mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Update _grist_ACLResources.tableId when migration summary table IDs
Summary: https://grist.slack.com/archives/C0234CPPXPA/p1658146315294109 Test Plan: Updated test Reviewers: dsagal, paulfitz Reviewed By: dsagal, paulfitz Differential Revision: https://phab.getgrist.com/D3535
This commit is contained in:
parent
257dafe423
commit
d221aeed24
@ -1022,6 +1022,7 @@ def migration30(tdset):
|
||||
def migration31(tdset):
|
||||
columns = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables_column']))
|
||||
tables = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables']))
|
||||
acl_resources = list(actions.transpose_bulk_action(tdset.all_tables['_grist_ACLResources']))
|
||||
|
||||
tables_by_ref = {t.id: t for t in tables}
|
||||
columns_by_table_ref = defaultdict(list)
|
||||
@ -1072,4 +1073,11 @@ def migration31(tdset):
|
||||
formula = re.sub(r'\b%s\b' % table.tableId, new_name, formula)
|
||||
doc_actions.append(actions.UpdateRecord('_grist_Tables_column', col.id, {'formula': formula}))
|
||||
|
||||
table_renames_dict = {t.tableId: new for t, new in table_renames}
|
||||
for resource in acl_resources:
|
||||
new_name = table_renames_dict.get(resource.tableId)
|
||||
if new_name:
|
||||
doc_actions.append(
|
||||
actions.UpdateRecord('_grist_ACLResources', resource.id, {'tableId': new_name})
|
||||
)
|
||||
return tdset.apply_doc_actions(doc_actions)
|
||||
|
Loading…
Reference in New Issue
Block a user