]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Replace nullable from primary keys in tz_network_bindings with default
authorJakub Libosvar <libosvar@redhat.com>
Tue, 22 Jul 2014 13:22:24 +0000 (15:22 +0200)
committerJakub Libosvar <libosvar@redhat.com>
Wed, 30 Jul 2014 12:39:58 +0000 (14:39 +0200)
Columns vlan_id and phy_uuid were both nullable and primary keys.
Primary keys cannot be nulls. This situation caused problems in
autogenerating scripts creating always migration that set these columns
to nullable.

Instead of having primary keys nullable this patch creates a default
values.

Change-Id: I04642f6d6ad232997a593bff8ca44f9a7a803ffd
Closes-bug: #1346900

neutron/plugins/vmware/dbexts/models.py

index 53bf24f204903eaa7f23996d8f138b323296a10f..47d735c3ed2e9434bf376273fcba1dbbc5214ccf 100644 (file)
@@ -40,9 +40,8 @@ class TzNetworkBinding(model_base.BASEV2):
     binding_type = Column(Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
                                name='tz_network_bindings_binding_type'),
                           nullable=False, primary_key=True)
-    phy_uuid = Column(String(36), primary_key=True, nullable=True)
-    vlan_id = Column(Integer, primary_key=True, nullable=True,
-                     autoincrement=False)
+    phy_uuid = Column(String(36), primary_key=True, default='')
+    vlan_id = Column(Integer, primary_key=True, autoincrement=False, default=0)
 
     def __init__(self, network_id, binding_type, phy_uuid, vlan_id):
         self.network_id = network_id