Fix Enum usage in 589f9237ca0e_cisco_n1kv_ml2_driver_tables
PostgreSQL is more sensitive with types than MySQL, it creates a separate type when a Enum is created. In migration 589f9237ca0e type profile_type is trying to be created, but the type with such name was already created in havana_initial migration. The solution for this is not to create type in 589f9237ca0e migration when dialect is PostgreSQL and use already created. Closes-bug: #1463301 Change-Id: I66e74d50cc70673de8635616076779cc20cde113
This commit is contained in:
parent
692da2b7c7
commit
1552f31153
|
@ -31,7 +31,6 @@ import sqlalchemy as sa
|
|||
|
||||
network_profile_type = sa.Enum('vlan', 'vxlan',
|
||||
name='network_profile_type')
|
||||
profile_type = sa.Enum('network', 'policy', name='profile_type')
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
@ -103,7 +102,15 @@ def upgrade():
|
|||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('physical_network', 'vlan_id')
|
||||
)
|
||||
|
||||
# Bugfix for 1463301: PostgreSQL creates type when Enum assigned to column,
|
||||
# but type profile_type was already created in cisco_init_opts, so it needs
|
||||
# to be reused. MySQL do not create type for Enums.
|
||||
if op.get_context().dialect.name == 'postgresql':
|
||||
profile_type = sa.dialects.postgresql.ENUM('network', 'policy',
|
||||
name='profile_type',
|
||||
create_type=False)
|
||||
else:
|
||||
profile_type = sa.Enum('network', 'policy', name='profile_type')
|
||||
op.create_table(
|
||||
'cisco_ml2_n1kv_profile_bindings',
|
||||
sa.Column('profile_type', profile_type, nullable=True),
|
||||
|
|
Loading…
Reference in New Issue