]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
set allocation_pool_id nullable=False
authorMark McClain <mark.mcclain@dreamhost.com>
Tue, 22 Jan 2013 22:48:09 +0000 (17:48 -0500)
committerMark McClain <mark.mcclain@dreamhost.com>
Tue, 22 Jan 2013 23:28:07 +0000 (18:28 -0500)
fixes bug 1103216

SQL Primary Keys cannot be null, so this patch fixes an
inconsistency between the models and SQL.  The databases were
correcting this automatically, so a migration is not required.

Change-Id: I724294580de9b86a2edfd4fdc6907e9469b6c552

quantum/db/migration/alembic_migrations/versions/folsom_initial.py
quantum/db/models_v2.py

index 6eb7ceab68f7095a6ac8e4bfe911573d54af5adb..ee85e2f114aa60b8a54ffd8813fb203f0be4b4bc 100644 (file)
@@ -176,7 +176,7 @@ def upgrade_base():
 
     op.create_table(
         'ipavailabilityranges',
-        sa.Column('allocation_pool_id', sa.String(length=36), nullable=True),
+        sa.Column('allocation_pool_id', sa.String(length=36), nullable=False),
         sa.Column('first_ip', sa.String(length=64), nullable=False),
         sa.Column('last_ip', sa.String(length=64), nullable=False),
         sa.ForeignKeyConstraint(['allocation_pool_id'],
index 760355beb3459edc5d56ff7ef418e632a84ff8b1..def066d99aa87a6bda8c10907b77dc6d97cedfb7 100644 (file)
@@ -50,7 +50,7 @@ class IPAvailabilityRange(model_base.BASEV2):
     allocation_pool_id = sa.Column(sa.String(36),
                                    sa.ForeignKey('ipallocationpools.id',
                                                  ondelete="CASCADE"),
-                                   nullable=True,
+                                   nullable=False,
                                    primary_key=True)
     first_ip = sa.Column(sa.String(64), nullable=False, primary_key=True)
     last_ip = sa.Column(sa.String(64), nullable=False, primary_key=True)