From: Quentin Smith Date: Wed, 17 Feb 2010 06:30:59 +0000 (-0500) Subject: Enforce a unique constraint on the machine name column. X-Git-Tag: 0.2.5^0 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-database.git/commitdiff_plain/23c43ee027ee2ae852c810139ae3ffc69f7cfe19?hp=65edc75e8f6d8d0c725bdd0078753accca31e71d Enforce a unique constraint on the machine name column. svn path=/trunk/packages/invirt-database/; revision=2991 --- 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),