mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-11-02 20:30:17 -06:00
Fixed an issue where columns with sequences get altered unnecessarily with a schema diff tool. Fixes #6564
This commit is contained in:
1 parent
d59063d79f
commit
7798584e1c
3 files changed
+29
-12
No files matched your search
@@ -18,4 +18,5 @@ Housekeeping
|
|||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #6564 <https://redmine.postgresql.org/issues/6564>`_ - Fixed an issue where columns with sequences get altered unnecessarily with a schema diff tool.
|
||||||
| `Issue #6572 <https://redmine.postgresql.org/issues/6572>`_ - Partially fixes the data output panel display issue.
|
| `Issue #6572 <https://redmine.postgresql.org/issues/6572>`_ - Partially fixes the data output panel display issue.
|
||||||
@@ -79,16 +79,21 @@ def login():
|
|||||||
user.login_attempts += 1
|
user.login_attempts += 1
|
||||||
left_attempts = \
|
left_attempts = \
|
||||||
config.MAX_LOGIN_ATTEMPTS - user.login_attempts
|
config.MAX_LOGIN_ATTEMPTS - user.login_attempts
|
||||||
flash_login_attempt_error = \
|
if left_attempts > 1:
|
||||||
gettext('You are left with {0} more attempts.'.
|
flash_login_attempt_error = \
|
||||||
format(left_attempts))
|
gettext('{0} more attempts remaining.'.
|
||||||
|
format(left_attempts))
|
||||||
|
else:
|
||||||
|
flash_login_attempt_error = \
|
||||||
|
gettext('{0} more attempt remaining.'.
|
||||||
|
format(left_attempts))
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
for error in form.errors[field]:
|
for error in form.errors[field]:
|
||||||
|
if flash_login_attempt_error:
|
||||||
|
error = error + flash_login_attempt_error
|
||||||
|
flash_login_attempt_error = None
|
||||||
flash(error, 'warning')
|
flash(error, 'warning')
|
||||||
|
|
||||||
if flash_login_attempt_error:
|
|
||||||
flash(flash_login_attempt_error, 'warning')
|
|
||||||
|
|
||||||
return redirect(get_post_logout_redirect())
|
return redirect(get_post_logout_redirect())
|
||||||
|
|
||||||
# Authenticate the user
|
# Authenticate the user
|
||||||
|
|||||||
+17
-6
@@ -19,11 +19,13 @@ from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
|
|||||||
|
|
||||||
|
|
||||||
class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
||||||
table_keys_to_ignore = ['oid', 'schema', 'edit_types', 'attnum',
|
table_keys_to_ignore = ['oid', 'schema', 'edit_types',
|
||||||
'col_type', 'references', 'reltuples', 'oid-2',
|
'col_type', 'references', 'reltuples', 'oid-2',
|
||||||
'rows_cnt', 'seqrelid', 'atttypid', 'elemoid',
|
'rows_cnt', 'hastoasttable', 'relhassubclass',
|
||||||
'hastoasttable', 'relhassubclass', 'relacl_str',
|
'relacl_str', 'setting']
|
||||||
'setting']
|
|
||||||
|
column_keys_to_ignore = ['attnum', 'atttypid', 'edit_types', 'elemoid',
|
||||||
|
'seqrelid']
|
||||||
|
|
||||||
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
|
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
|
||||||
'attrelid', 'adrelid', 'fknsp', 'confrelid',
|
'attrelid', 'adrelid', 'fknsp', 'confrelid',
|
||||||
@@ -34,8 +36,9 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
|||||||
'tgqual', 'tgconstraint']
|
'tgqual', 'tgconstraint']
|
||||||
index_keys_to_ignore = ['indrelid', 'indclass']
|
index_keys_to_ignore = ['indrelid', 'indclass']
|
||||||
|
|
||||||
keys_to_ignore = table_keys_to_ignore + constraint_keys_to_ignore \
|
keys_to_ignore = table_keys_to_ignore + column_keys_to_ignore + \
|
||||||
+ trigger_keys_to_ignore + index_keys_to_ignore
|
constraint_keys_to_ignore + trigger_keys_to_ignore + \
|
||||||
|
index_keys_to_ignore
|
||||||
|
|
||||||
def compare(self, **kwargs):
|
def compare(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
@@ -156,8 +159,16 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
|||||||
"""
|
"""
|
||||||
tmp = None
|
tmp = None
|
||||||
for item in target_cols:
|
for item in target_cols:
|
||||||
|
# ignore keys from the columns list
|
||||||
|
for ig_key in SchemaDiffTableCompare.column_keys_to_ignore:
|
||||||
|
if ig_key in source:
|
||||||
|
del source[ig_key]
|
||||||
|
if ig_key in item:
|
||||||
|
del item[ig_key]
|
||||||
|
|
||||||
if item['name'] == source['name']:
|
if item['name'] == source['name']:
|
||||||
tmp = copy.deepcopy(item)
|
tmp = copy.deepcopy(item)
|
||||||
|
|
||||||
if tmp and source != tmp:
|
if tmp and source != tmp:
|
||||||
tmp_updated = copy.deepcopy(source)
|
tmp_updated = copy.deepcopy(source)
|
||||||
# Preserve the column number
|
# Preserve the column number
|
||||||
|
|||||||
Reference in new issue
Block a user