From 23c43ee027ee2ae852c810139ae3ffc69f7cfe19 Mon Sep 17 00:00:00 2001 From: Quentin Smith Date: Wed, 17 Feb 2010 01:30:59 -0500 Subject: [PATCH] Enforce a unique constraint on the machine name column. svn path=/trunk/packages/invirt-database/; revision=2991 --- debian/changelog | 6 ++++++ python/database/models.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 9e53ebb..3265f8f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-database (0.2.5) unstable; urgency=low + + * Enforce a unique constraint on the machine name column. + + -- Quentin Smith Wed, 17 Feb 2010 01:30:17 -0500 + invirt-database (0.2.4) unstable; urgency=low * Generate a new /etc/postgresql/8.3/main/postgresql.conf with diff --git a/python/database/models.py b/python/database/models.py index 60cc025..77f4109 100644 --- a/python/database/models.py +++ b/python/database/models.py @@ -42,7 +42,7 @@ session = orm.scoped_session(orm.sessionmaker(transactional=False, autoflush=Fal machine_table = Table('machines', meta, Column('machine_id', Integer, primary_key=True, nullable=False), - Column('name', String, nullable=False), + Column('name', String, nullable=False, unique=True), Column('description', String, nullable=False), Column('memory', Integer, nullable=False), Column('owner', String, nullable=False), -- 1.7.9.5