Use different name for the same constraint
In DB2, a constraint-name must not identify a constraint that was already specified within the same CREATE TABLE statement. The current CREATE TABLE statement uses the same constraint name 'ipv6_modes' for both ipv6_ra_mode and ipv6_address_mode column. This change tries to use different names. Change-Id: Id4d82fb7e0e570a843e28856e531e25578a4351a Closes-Bug: #1294568
This commit is contained in:
parent
86334a0549
commit
fd49e7243c
@ -47,14 +47,16 @@ def upgrade(active_plugins=None, options=None):
|
||||
# https://bitbucket.org/zzzeek/alembic/issue/89
|
||||
context = op.get_context()
|
||||
if context.bind.dialect.name == 'postgresql':
|
||||
op.execute("CREATE TYPE ipv6_modes AS ENUM ('%s', '%s', '%s')"
|
||||
op.execute("CREATE TYPE ipv6_ra_modes AS ENUM ('%s', '%s', '%s')"
|
||||
% ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))
|
||||
op.execute("CREATE TYPE ipv6_address_modes AS ENUM ('%s', '%s', '%s')"
|
||||
% ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))
|
||||
op.add_column('subnets',
|
||||
sa.Column('ipv6_ra_mode',
|
||||
sa.Enum('slaac',
|
||||
'dhcpv6-stateful',
|
||||
'dhcpv6-stateless',
|
||||
name='ipv6_modes'),
|
||||
name='ipv6_ra_modes'),
|
||||
nullable=True)
|
||||
)
|
||||
op.add_column('subnets',
|
||||
@ -62,7 +64,7 @@ def upgrade(active_plugins=None, options=None):
|
||||
sa.Enum('slaac',
|
||||
'dhcpv6-stateful',
|
||||
'dhcpv6-stateless',
|
||||
name='ipv6_modes'),
|
||||
name='ipv6_address_modes'),
|
||||
nullable=True)
|
||||
)
|
||||
|
||||
@ -75,4 +77,5 @@ def downgrade(active_plugins=None, options=None):
|
||||
op.drop_column('subnets', 'ipv6_address_mode')
|
||||
context = op.get_context()
|
||||
if context.bind.dialect.name == 'postgresql':
|
||||
op.execute('DROP TYPE ipv6_modes')
|
||||
op.execute('DROP TYPE ipv6_ra_modes')
|
||||
op.execute('DROP TYPE ipv6_address_modes')
|
||||
|
@ -187,11 +187,11 @@ class Subnet(model_base.BASEV2, HasId, HasTenant):
|
||||
ipv6_ra_mode = sa.Column(sa.Enum(constants.IPV6_SLAAC,
|
||||
constants.DHCPV6_STATEFUL,
|
||||
constants.DHCPV6_STATELESS,
|
||||
name='ipv6_modes'), nullable=True)
|
||||
name='ipv6_ra_modes'), nullable=True)
|
||||
ipv6_address_mode = sa.Column(sa.Enum(constants.IPV6_SLAAC,
|
||||
constants.DHCPV6_STATEFUL,
|
||||
constants.DHCPV6_STATELESS,
|
||||
name='ipv6_modes'), nullable=True)
|
||||
name='ipv6_address_modes'), nullable=True)
|
||||
|
||||
|
||||
class Network(model_base.BASEV2, HasId, HasTenant):
|
||||
|
Loading…
x
Reference in New Issue
Block a user