Rename args for alembic 0.8.0
Version 0.8.0 of alembic has renamed some arguments in some of its methods. This generates warnings when running neutron's alembic migration scripts. Change-Id: I4f90a66c2465dd1d7f6631f297146754fd5e9cc4
This commit is contained in:
parent
4ca19658ed
commit
fab2f8eeca
|
@ -129,7 +129,7 @@ def create_table_if_not_exist_psql(table_name, values):
|
|||
def remove_foreign_keys(table, foreign_keys):
|
||||
for fk in foreign_keys:
|
||||
op.drop_constraint(
|
||||
name=fk['name'],
|
||||
constraint_name=fk['name'],
|
||||
table_name=table,
|
||||
type_='foreignkey'
|
||||
)
|
||||
|
@ -138,9 +138,9 @@ def remove_foreign_keys(table, foreign_keys):
|
|||
def create_foreign_keys(table, foreign_keys):
|
||||
for fk in foreign_keys:
|
||||
op.create_foreign_key(
|
||||
name=fk['name'],
|
||||
source=table,
|
||||
referent=fk['referred_table'],
|
||||
constraint_name=fk['name'],
|
||||
source_table=table,
|
||||
referent_table=fk['referred_table'],
|
||||
local_cols=fk['constrained_columns'],
|
||||
remote_cols=fk['referred_columns'],
|
||||
ondelete='CASCADE'
|
||||
|
|
|
@ -38,7 +38,7 @@ TABLE_NAME = 'extradhcpopts'
|
|||
def upgrade():
|
||||
with migration.remove_fks_from_table(TABLE_NAME):
|
||||
op.drop_constraint(
|
||||
name=CONSTRAINT_NAME_OLD,
|
||||
constraint_name=CONSTRAINT_NAME_OLD,
|
||||
table_name=TABLE_NAME,
|
||||
type_='unique'
|
||||
)
|
||||
|
@ -48,7 +48,7 @@ def upgrade():
|
|||
op.execute("UPDATE extradhcpopts SET ip_version = 4")
|
||||
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME_NEW,
|
||||
source='extradhcpopts',
|
||||
local_cols=['port_id', 'opt_name', 'ip_version']
|
||||
constraint_name=CONSTRAINT_NAME_NEW,
|
||||
table_name='extradhcpopts',
|
||||
columns=['port_id', 'opt_name', 'ip_version']
|
||||
)
|
||||
|
|
|
@ -33,7 +33,7 @@ CONSTRAINT_NAME = 'uniq_ports0network_id0mac_address'
|
|||
|
||||
def upgrade():
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME,
|
||||
source=TABLE_NAME,
|
||||
local_cols=['network_id', 'mac_address']
|
||||
constraint_name=CONSTRAINT_NAME,
|
||||
table_name=TABLE_NAME,
|
||||
columns=['network_id', 'mac_address']
|
||||
)
|
||||
|
|
|
@ -37,15 +37,15 @@ def upgrade():
|
|||
op.add_column('ml2_gre_endpoints',
|
||||
sa.Column('host', sa.String(length=255), nullable=True))
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME_GRE,
|
||||
source='ml2_gre_endpoints',
|
||||
local_cols=['host']
|
||||
constraint_name=CONSTRAINT_NAME_GRE,
|
||||
table_name='ml2_gre_endpoints',
|
||||
columns=['host']
|
||||
)
|
||||
|
||||
op.add_column('ml2_vxlan_endpoints',
|
||||
sa.Column('host', sa.String(length=255), nullable=True))
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME_VXLAN,
|
||||
source='ml2_vxlan_endpoints',
|
||||
local_cols=['host']
|
||||
constraint_name=CONSTRAINT_NAME_VXLAN,
|
||||
table_name='ml2_vxlan_endpoints',
|
||||
columns=['host']
|
||||
)
|
||||
|
|
|
@ -40,10 +40,10 @@ def upgrade():
|
|||
prev_pk_name = prev_pk_const.get('name')
|
||||
|
||||
with migration.remove_fks_from_table(TABLE_NAME):
|
||||
op.drop_constraint(name=prev_pk_name,
|
||||
op.drop_constraint(constraint_name=prev_pk_name,
|
||||
table_name=TABLE_NAME,
|
||||
type_='primary')
|
||||
|
||||
op.create_primary_key(name=None,
|
||||
op.create_primary_key(constraint_name=None,
|
||||
table_name=TABLE_NAME,
|
||||
cols=['router_id', 'l3_agent_id'])
|
||||
columns=['router_id', 'l3_agent_id'])
|
||||
|
|
|
@ -35,13 +35,13 @@ UC_2_NAME = 'uniq_ipavailabilityranges0last_ip0allocation_pool_id'
|
|||
|
||||
def upgrade():
|
||||
op.create_unique_constraint(
|
||||
name=UC_1_NAME,
|
||||
source=TABLE_NAME,
|
||||
local_cols=['first_ip', 'allocation_pool_id']
|
||||
constraint_name=UC_1_NAME,
|
||||
table_name=TABLE_NAME,
|
||||
columns=['first_ip', 'allocation_pool_id']
|
||||
)
|
||||
|
||||
op.create_unique_constraint(
|
||||
name=UC_2_NAME,
|
||||
source=TABLE_NAME,
|
||||
local_cols=['last_ip', 'allocation_pool_id']
|
||||
constraint_name=UC_2_NAME,
|
||||
table_name=TABLE_NAME,
|
||||
columns=['last_ip', 'allocation_pool_id']
|
||||
)
|
||||
|
|
|
@ -44,10 +44,10 @@ def upgrade():
|
|||
op.add_column('nuage_subnet_l2dom_mapping',
|
||||
sa.Column('nuage_managed_subnet', sa.Boolean(), nullable=True))
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME_NR,
|
||||
source='nuage_net_partition_router_mapping',
|
||||
local_cols=['nuage_router_id'])
|
||||
constraint_name=CONSTRAINT_NAME_NR,
|
||||
table_name='nuage_net_partition_router_mapping',
|
||||
columns=['nuage_router_id'])
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME_NS,
|
||||
source='nuage_subnet_l2dom_mapping',
|
||||
local_cols=['nuage_subnet_id'])
|
||||
constraint_name=CONSTRAINT_NAME_NS,
|
||||
table_name='nuage_subnet_l2dom_mapping',
|
||||
columns=['nuage_subnet_id'])
|
||||
|
|
|
@ -40,7 +40,7 @@ def _drop_constraint():
|
|||
def upgrade():
|
||||
_drop_constraint()
|
||||
op.create_foreign_key(
|
||||
name=None,
|
||||
source='floatingips', referent='ports',
|
||||
constraint_name=None,
|
||||
source_table='floatingips', referent_table='ports',
|
||||
local_cols=['floating_port_id'], remote_cols=['id'], ondelete='CASCADE'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue