Ensure that the schema diff tool should pick up the change in the column grants. #5269

This commit is contained in:
Akshay Joshi
2023-02-13 17:54:38 +05:30
parent 0fd1e0963e
commit f623d563b1
2 changed files with 15 additions and 0 deletions

View File

@@ -176,6 +176,20 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
source['attnum'] = tmp['attnum']
if tmp and source != tmp:
# check column level grants
acl_dict = dict()
if 'attacl' in source and 'attacl' in tmp and \
source['attacl'] != tmp['attacl']:
if len(source['attacl']) > 0 and len(tmp['attacl']) < 1:
acl_dict['added'] = source['attacl'].copy()
source['attacl'] = acl_dict
elif len(source['attacl']) < 1 and len(tmp['attacl']) > 0:
acl_dict['deleted'] = tmp['attacl'].copy()
source['attacl'] = acl_dict
else:
acl_dict['changed'] = source['attacl'].copy()
source['attacl'] = acl_dict
updated.append(source)
target_cols.remove(tmp)
elif tmp and source == tmp: