Replace nullable from primary keys in tz_network_bindings with default

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
This commit is contained in:
Jakub Libosvar 2014-07-22 15:22:24 +02:00
parent 984132d848
commit e416a5420f
1 changed files with 2 additions and 3 deletions

View 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