Merge "Fixes force to set ondelete=CASCADE in create_foreign_keys()"
This commit is contained in:
commit
2644c12155
@ -165,7 +165,7 @@ def create_foreign_keys(table, foreign_keys):
|
|||||||
referent_table=fk['referred_table'],
|
referent_table=fk['referred_table'],
|
||||||
local_cols=fk['constrained_columns'],
|
local_cols=fk['constrained_columns'],
|
||||||
remote_cols=fk['referred_columns'],
|
remote_cols=fk['referred_columns'],
|
||||||
ondelete='CASCADE'
|
ondelete=fk['options'].get('ondelete')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,5 +37,8 @@ TABLE_NAME = 'flavorserviceprofilebindings'
|
|||||||
def upgrade():
|
def upgrade():
|
||||||
inspector = reflection.Inspector.from_engine(op.get_bind())
|
inspector = reflection.Inspector.from_engine(op.get_bind())
|
||||||
fk_constraints = inspector.get_foreign_keys(TABLE_NAME)
|
fk_constraints = inspector.get_foreign_keys(TABLE_NAME)
|
||||||
|
for fk in fk_constraints:
|
||||||
|
fk['options']['ondelete'] = 'CASCADE'
|
||||||
|
|
||||||
migration.remove_foreign_keys(TABLE_NAME, fk_constraints)
|
migration.remove_foreign_keys(TABLE_NAME, fk_constraints)
|
||||||
migration.create_foreign_keys(TABLE_NAME, fk_constraints)
|
migration.create_foreign_keys(TABLE_NAME, fk_constraints)
|
||||||
|
Loading…
Reference in New Issue
Block a user