mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where schema diff is not working when providing the options to Foreign Data Wrapper, Foreign Server, and User Mapping. Fixes #5754
This commit is contained in:
parent
b53de0c31d
commit
52d0241a17
@ -14,8 +14,9 @@ New features
|
|||||||
Housekeeping
|
Housekeeping
|
||||||
************
|
************
|
||||||
|
|
||||||
| `Issue #5344 <https://redmine.postgresql.org/issues/5344>`_ - Improve code coverage and API test cases for Grant Wizard.
|
| `Issue #5344 <https://redmine.postgresql.org/issues/5344>`_ - Improve code coverage and API test cases for Grant Wizard.
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #5754 <https://redmine.postgresql.org/issues/5754>`_ - Fixed an issue where schema diff is not working when providing the options to Foreign Data Wrapper, Foreign Server, and User Mapping.
|
||||||
|
@ -682,13 +682,16 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
"""
|
"""
|
||||||
is_valid_added_options = is_valid_changed_options = False
|
is_valid_added_options = is_valid_changed_options = False
|
||||||
|
|
||||||
if 'fdwoptions' in data and 'added' in data['fdwoptions']:
|
if 'fdwoptions' in data and data['fdwoptions'] is not None and\
|
||||||
|
'added' in data['fdwoptions']:
|
||||||
is_valid_added_options, data['fdwoptions']['added'] = \
|
is_valid_added_options, data['fdwoptions']['added'] = \
|
||||||
validate_options(
|
validate_options(
|
||||||
data['fdwoptions']['added'],
|
data['fdwoptions']['added'],
|
||||||
'fdwoption',
|
'fdwoption',
|
||||||
'fdwvalue')
|
'fdwvalue')
|
||||||
if 'fdwoptions' in data and 'changed' in data['fdwoptions']:
|
|
||||||
|
if 'fdwoptions' in data and data['fdwoptions'] is not None and\
|
||||||
|
'changed' in data['fdwoptions']:
|
||||||
is_valid_changed_options, data['fdwoptions']['changed'] = \
|
is_valid_changed_options, data['fdwoptions']['changed'] = \
|
||||||
validate_options(
|
validate_options(
|
||||||
data['fdwoptions']['changed'],
|
data['fdwoptions']['changed'],
|
||||||
@ -960,6 +963,10 @@ class ForeignDataWrapperView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
for row in rset['rows']:
|
for row in rset['rows']:
|
||||||
status, data = self._fetch_properties(row['oid'])
|
status, data = self._fetch_properties(row['oid'])
|
||||||
if status:
|
if status:
|
||||||
|
# For schema diff if fdwoptions is None then convert it to
|
||||||
|
# the empty list.
|
||||||
|
if 'fdwoptions' in data and data['fdwoptions'] is None:
|
||||||
|
data['fdwoptions'] = []
|
||||||
res[row['name']] = data
|
res[row['name']] = data
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -641,14 +641,16 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
data[arg] = old_data[arg]
|
data[arg] = old_data[arg]
|
||||||
|
|
||||||
is_valid_added_options = is_valid_changed_options = False
|
is_valid_added_options = is_valid_changed_options = False
|
||||||
if 'fsrvoptions' in data and 'added' in data['fsrvoptions']:
|
if 'fsrvoptions' in data and data['fsrvoptions'] is not None and\
|
||||||
|
'added' in data['fsrvoptions']:
|
||||||
is_valid_added_options, data['fsrvoptions']['added'] = \
|
is_valid_added_options, data['fsrvoptions']['added'] = \
|
||||||
validate_options(
|
validate_options(
|
||||||
data['fsrvoptions']['added'],
|
data['fsrvoptions']['added'],
|
||||||
'fsrvoption',
|
'fsrvoption',
|
||||||
'fsrvvalue')
|
'fsrvvalue')
|
||||||
|
|
||||||
if 'fsrvoptions' in data and 'changed' in data['fsrvoptions']:
|
if 'fsrvoptions' in data and data['fsrvoptions'] is not None and\
|
||||||
|
'changed' in data['fsrvoptions']:
|
||||||
is_valid_changed_options, data['fsrvoptions']['changed'] = \
|
is_valid_changed_options, data['fsrvoptions']['changed'] = \
|
||||||
validate_options(
|
validate_options(
|
||||||
data['fsrvoptions']['changed'],
|
data['fsrvoptions']['changed'],
|
||||||
@ -921,6 +923,10 @@ class ForeignServerView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
for row in rset['rows']:
|
for row in rset['rows']:
|
||||||
status, data = self._fetch_properties(row['oid'])
|
status, data = self._fetch_properties(row['oid'])
|
||||||
if status:
|
if status:
|
||||||
|
# For schema diff if fsrvoptions is None then convert it to
|
||||||
|
# the empty list.
|
||||||
|
if 'fsrvoptions' in data and data['fsrvoptions'] is None:
|
||||||
|
data['fsrvoptions'] = []
|
||||||
res[row['name']] = data
|
res[row['name']] = data
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -696,13 +696,15 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
# Allow user to set the blank value in fdwvalue
|
# Allow user to set the blank value in fdwvalue
|
||||||
# field in option model
|
# field in option model
|
||||||
is_valid_added_options = is_valid_changed_options = False
|
is_valid_added_options = is_valid_changed_options = False
|
||||||
if 'umoptions' in data and 'added' in data['umoptions']:
|
if 'umoptions' in data and data['umoptions'] is not None and\
|
||||||
|
'added' in data['umoptions']:
|
||||||
is_valid_added_options, data['umoptions']['added'] =\
|
is_valid_added_options, data['umoptions']['added'] =\
|
||||||
validate_options(
|
validate_options(
|
||||||
data['umoptions']['added'],
|
data['umoptions']['added'],
|
||||||
'umoption',
|
'umoption',
|
||||||
'umvalue')
|
'umvalue')
|
||||||
if 'umoptions' in data and 'changed' in data['umoptions']:
|
if 'umoptions' in data and data['umoptions'] is not None and\
|
||||||
|
'changed' in data['umoptions']:
|
||||||
is_valid_changed_options, data['umoptions']['changed'] =\
|
is_valid_changed_options, data['umoptions']['changed'] =\
|
||||||
validate_options(
|
validate_options(
|
||||||
data['umoptions']['changed'],
|
data['umoptions']['changed'],
|
||||||
@ -873,6 +875,10 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
for row in rset['rows']:
|
for row in rset['rows']:
|
||||||
status, data = self._fetch_properties(row['oid'])
|
status, data = self._fetch_properties(row['oid'])
|
||||||
if status:
|
if status:
|
||||||
|
# For schema diff if umoptions is None then convert it to
|
||||||
|
# the empty list.
|
||||||
|
if 'umoptions' in data and data['umoptions'] is None:
|
||||||
|
data['umoptions'] = []
|
||||||
res[row['name']] = data
|
res[row['name']] = data
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -33,6 +33,7 @@ def _get_source_list(added, source_dict, node, source_params, view_object,
|
|||||||
:param group_name: group name
|
:param group_name: group name
|
||||||
:return: list of source dict.
|
:return: list of source dict.
|
||||||
"""
|
"""
|
||||||
|
global count
|
||||||
source_only = []
|
source_only = []
|
||||||
for item in added:
|
for item in added:
|
||||||
source_object_id = None
|
source_object_id = None
|
||||||
@ -109,6 +110,7 @@ def _get_target_list(removed, target_dict, node, target_params, view_object,
|
|||||||
:param group_name: group name.
|
:param group_name: group name.
|
||||||
:return: list of target dict.
|
:return: list of target dict.
|
||||||
"""
|
"""
|
||||||
|
global count
|
||||||
target_only = []
|
target_only = []
|
||||||
for item in removed:
|
for item in removed:
|
||||||
target_object_id = None
|
target_object_id = None
|
||||||
@ -207,6 +209,7 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict,
|
|||||||
:param other_param:
|
:param other_param:
|
||||||
:return: return list of identical and different dict.
|
:return: return list of identical and different dict.
|
||||||
"""
|
"""
|
||||||
|
global count
|
||||||
identical = []
|
identical = []
|
||||||
different = []
|
different = []
|
||||||
dict1 = kwargs['dict1']
|
dict1 = kwargs['dict1']
|
||||||
@ -349,7 +352,6 @@ def compare_dictionaries(**kwargs):
|
|||||||
# Keys that are available in source and missing in target.
|
# Keys that are available in source and missing in target.
|
||||||
|
|
||||||
added = dict1_keys - dict2_keys
|
added = dict1_keys - dict2_keys
|
||||||
global count
|
|
||||||
source_only = _get_source_list(added, source_dict, node, source_params,
|
source_only = _get_source_list(added, source_dict, node, source_params,
|
||||||
view_object, node_label, group_name)
|
view_object, node_label, group_name)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user