Merge "Fixes force to set ondelete=CASCADE in create_foreign_keys()"

This commit is contained in:
Jenkins 2016-03-17 15:07:54 +00:00 committed by Gerrit Code Review
commit 2644c12155
2 changed files with 4 additions and 1 deletions

View File

@ -165,7 +165,7 @@ def create_foreign_keys(table, foreign_keys):
referent_table=fk['referred_table'],
local_cols=fk['constrained_columns'],
remote_cols=fk['referred_columns'],
ondelete='CASCADE'
ondelete=fk['options'].get('ondelete')
)

View File

@ -37,5 +37,8 @@ TABLE_NAME = 'flavorserviceprofilebindings'
def upgrade():
inspector = reflection.Inspector.from_engine(op.get_bind())
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.create_foreign_keys(TABLE_NAME, fk_constraints)