Fixed an issue where foreign key is not removed even if the referred table is removed in ERD. Fixes #7238

This commit is contained in:
Aditya Toshniwal
2022-03-17 17:01:07 +05:30
committed by Akshay Joshi
parent 08880ebd2e
commit 3299b0c1b0
5 changed files with 43 additions and 11 deletions

View File

@@ -547,8 +547,10 @@ def translate_foreign_keys(tab_fks, tab_data, all_nodes):
for tab_fk in tab_fks:
if 'columns' not in tab_fk:
continue
print(tab_data)
remote_table = all_nodes[tab_fk['columns'][0]['references']]
try:
remote_table = all_nodes[tab_fk['columns'][0]['references']]
except KeyError:
continue
tab_fk['schema'] = tab_data['schema']
tab_fk['table'] = tab_data['name']
tab_fk['remote_schema'] = remote_table['schema']