From 749138791a763fde7941887a029b8d14d0ee1642 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 16 Nov 2022 14:01:55 +0530 Subject: [PATCH] 1) Fixed an issue where the 'save_password' column threw an error for the shared server when using an external database. #5535 2) Fixed integrity error while removing server when using an external database. 3) Remove the length of the password column of the server and the shared server table. --- docs/en_US/release_notes_6_16.rst | 4 +++- web/migrations/versions/09d53fca90c7_.py | 10 ++++++---- web/migrations/versions/15c88f765bc8_.py | 2 +- web/migrations/versions/398697dc9550_.py | 4 ++-- web/migrations/versions/84700139beb0_.py | 2 +- web/migrations/versions/a091c9611d20_.py | 8 ++++---- web/migrations/versions/ec1cac3399c9_.py | 4 ++-- web/migrations/versions/fdc58d9bd449_.py | 12 ++++++------ 8 files changed, 25 insertions(+), 21 deletions(-) diff --git a/docs/en_US/release_notes_6_16.rst b/docs/en_US/release_notes_6_16.rst index 3eaeae50d..0902ca4de 100644 --- a/docs/en_US/release_notes_6_16.rst +++ b/docs/en_US/release_notes_6_16.rst @@ -2,7 +2,7 @@ Version 6.16 ************ -Release date: 2022-11-17 +Release date: 2022-11-18 This release contains a number of bug fixes and new features since the release of pgAdmin 4 v6.15. @@ -47,3 +47,5 @@ Bug fixes | `Issue #5507 `_ - Fixed an issue where pgadmin does not respect reverse proxy any more. | `Issue #5521 `_ - Fixed SocketIO calls when pgAdmin 4 server is running from a sub directory. | `Issue #5522 `_ - Ensure that the load file paths are children of the storage directory. + | `Issue #5533 `_ - Use the shared server username when opening query tool. + | `Issue #5535 `_ - Fixed an issue where the 'save_password' column threw an error for the shared server when using an external database. diff --git a/web/migrations/versions/09d53fca90c7_.py b/web/migrations/versions/09d53fca90c7_.py index fefaed4ec..113d02f4c 100644 --- a/web/migrations/versions/09d53fca90c7_.py +++ b/web/migrations/versions/09d53fca90c7_.py @@ -39,7 +39,7 @@ def upgrade(): if version < 3: op.add_column('server', sa.Column('comment', sa.String(length=1024))) if version < 4: - op.add_column('server', sa.Column('password', sa.String(length=64))) + op.add_column('server', sa.Column('password', sa.String())) if version < 5: op.add_column('server', sa.Column('role', sa.String(length=64))) if version < 6: @@ -82,8 +82,9 @@ def upgrade(): sa.Column('pid', sa.Integer(), nullable=False), sa.Column('uid', sa.Integer(), nullable=False), sa.Column('value', sa.String(length=1024), nullable=False), - sa.ForeignKeyConstraint(['pid'], ['preferences.id'], ), - sa.ForeignKeyConstraint(['uid'], ['user.id'], ), + sa.ForeignKeyConstraint(['pid'], ['preferences.id'], + ondelete='CASCADE'), + sa.ForeignKeyConstraint(['uid'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('pid', 'uid')) if version < 9: @@ -116,7 +117,8 @@ def upgrade(): sa.Column('logdir', sa.String()), sa.Column('exit_code', sa.Integer()), sa.Column('acknowledge', sa.String()), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], + ondelete='CASCADE'), sa.PrimaryKeyConstraint('pid')) if version < 11: diff --git a/web/migrations/versions/15c88f765bc8_.py b/web/migrations/versions/15c88f765bc8_.py index c4158dfed..c19030325 100644 --- a/web/migrations/versions/15c88f765bc8_.py +++ b/web/migrations/versions/15c88f765bc8_.py @@ -31,7 +31,7 @@ def upgrade(): 'user_mfa', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('mfa_auth', sa.String(length=256), nullable=False), sa.Column('options', sa.String()), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('user_id', 'mfa_auth')) # ### end Alembic commands ### diff --git a/web/migrations/versions/398697dc9550_.py b/web/migrations/versions/398697dc9550_.py index 09a4cec74..0655952ad 100644 --- a/web/migrations/versions/398697dc9550_.py +++ b/web/migrations/versions/398697dc9550_.py @@ -39,8 +39,8 @@ def upgrade(): sa.Column('uid', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=1024), nullable=False), sa.Column('sql', sa.String()), - sa.ForeignKeyConstraint(['mid'], ['macros.id']), - sa.ForeignKeyConstraint(['uid'], ['user.id']), + sa.ForeignKeyConstraint(['mid'], ['macros.id'], ondelete='CASCADE'), + sa.ForeignKeyConstraint(['uid'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('mid', 'uid')) op.bulk_insert(macro_table, [ diff --git a/web/migrations/versions/84700139beb0_.py b/web/migrations/versions/84700139beb0_.py index ead238425..396d54703 100644 --- a/web/migrations/versions/84700139beb0_.py +++ b/web/migrations/versions/84700139beb0_.py @@ -29,7 +29,7 @@ def upgrade(): sa.Column('id', sa.Integer(), nullable=False), sa.Column('schema_res', sa.String()), sa.Column('server', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['server'], ['server.id'], ), + sa.ForeignKeyConstraint(['server'], ['server.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', 'server')) diff --git a/web/migrations/versions/a091c9611d20_.py b/web/migrations/versions/a091c9611d20_.py index 749935316..7f9b0a69b 100644 --- a/web/migrations/versions/a091c9611d20_.py +++ b/web/migrations/versions/a091c9611d20_.py @@ -36,7 +36,7 @@ def upgrade(): sa.Column('port', sa.Integer(), nullable=False), sa.Column('maintenance_db', sa.String(length=64)), sa.Column('username', sa.String(length=64)), - sa.Column('password', sa.String(length=64)), + sa.Column('password', sa.String()), sa.Column('role', sa.String(length=64)), sa.Column('ssl_mode', sa.String(length=16), nullable=False), sa.Column('comment', sa.String(length=1024)), @@ -59,13 +59,13 @@ def upgrade(): sa.Column('tunnel_authentication', sa.Integer(), server_default='0'), sa.Column('tunnel_identity_file', sa.String()), sa.Column('shared', sa.Boolean(), nullable=False), - sa.Column('save_password', sa.Boolean(), nullable=False), - sa.Column('tunnel_password', sa.String(length=64)), + sa.Column('save_password', sa.Integer(), server_default='0'), + sa.Column('tunnel_password', sa.String()), sa.Column('connect_timeout', sa.Integer()), sa.CheckConstraint("ssl_mode IN ('allow', 'prefer', 'require', \ 'disable', 'verify-ca', 'verify-full')"), sa.ForeignKeyConstraint(['servergroup_id'], ['servergroup.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) # Named constraint diff --git a/web/migrations/versions/ec1cac3399c9_.py b/web/migrations/versions/ec1cac3399c9_.py index 5454dbc90..fc7312229 100644 --- a/web/migrations/versions/ec1cac3399c9_.py +++ b/web/migrations/versions/ec1cac3399c9_.py @@ -33,8 +33,8 @@ def upgrade(): sa.Column('dbname', sa.String(), nullable=False), sa.Column('query_info', sa.String(), nullable=False), sa.Column('last_updated_flag', sa.String(), nullable=False), - sa.ForeignKeyConstraint(['sid'], ['server.id']), - sa.ForeignKeyConstraint(['uid'], ['user.id']), + sa.ForeignKeyConstraint(['sid'], ['server.id'], ondelete='CASCADE'), + sa.ForeignKeyConstraint(['uid'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('srno', 'uid', 'sid', 'dbname')) diff --git a/web/migrations/versions/fdc58d9bd449_.py b/web/migrations/versions/fdc58d9bd449_.py index 5d8df463c..a1cfb6570 100644 --- a/web/migrations/versions/fdc58d9bd449_.py +++ b/web/migrations/versions/fdc58d9bd449_.py @@ -46,7 +46,7 @@ def upgrade(): 'user', sa.Column('id', sa.Integer(), nullable=False, autoincrement=True), sa.Column('email', sa.String(length=256), nullable=False), - sa.Column('password', sa.String(length=256), nullable=True), + sa.Column('password', sa.String(), nullable=True), sa.Column('active', sa.Boolean(), nullable=False), sa.Column('confirmed_at', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id')) @@ -66,21 +66,21 @@ def upgrade(): 'setting', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('setting', sa.String(length=256), nullable=False), sa.Column('value', sa.String(length=1024), nullable=True), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('user_id', 'setting')) roles_users_table = op.create_table( 'roles_users', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['role_id'], ['role.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], )) + sa.ForeignKeyConstraint(['role_id'], ['role.id'], ondelete='CASCADE'), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE')) server_group_table = op.create_table( 'servergroup', sa.Column('id', sa.Integer(), nullable=False, autoincrement=True), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('user_id', 'name')) @@ -96,7 +96,7 @@ def upgrade(): sa.Column('username', sa.String(length=64), nullable=False), sa.Column('ssl_mode', sa.String(length=16), nullable=False), sa.ForeignKeyConstraint(['servergroup_id'], ['servergroup.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) current_salt = getattr(