diff --git a/docs/en_US/release_notes_6_3.rst b/docs/en_US/release_notes_6_3.rst index ec06d9635..5212ef8f7 100644 --- a/docs/en_US/release_notes_6_3.rst +++ b/docs/en_US/release_notes_6_3.rst @@ -31,5 +31,6 @@ Bug fixes | `Issue #7013 `_ - Fix an RPM build issue that could lead to a conflict with python3 at installation. | `Issue #7015 `_ - Fixed an issue where the error is thrown while creating a new server using Add New Server from the dashboard while tree item is not selected. | `Issue #7024 `_ - Fixed an issue where reverse engineering SQL is wrong for Aggregate. +| `Issue #7031 `_ - Fixed an issue where SQLite database definition is wrong because the USER_ID FK references the table user_old which is not available. | `Issue #7040 `_ - Add "section" to the Debian package control files. | `Issue #7044 `_ - Update the dropzone version to 5.9.3 and Flask-SQLAlchemy to 2.5.*. diff --git a/web/migrations/versions/35f29b1701bd_.py b/web/migrations/versions/35f29b1701bd_.py index 1180e7d89..653718e20 100644 --- a/web/migrations/versions/35f29b1701bd_.py +++ b/web/migrations/versions/35f29b1701bd_.py @@ -21,7 +21,10 @@ depends_on = None def upgrade(): - db.engine.execute("ALTER TABLE user RENAME TO user_old") + + db.engine.execute("create table user_old as select * from user") + + db.engine.execute("DROP TABLE user") db.engine.execute(""" CREATE TABLE user ( @@ -46,6 +49,12 @@ def upgrade(): db.engine.execute("DROP TABLE user_old") + # db.engine.execute("PRAGMA foreign_keys=ON") + + # db.session.commit() + + # db.engine.execute("PRAGMA foreign_keys=ON") + def downgrade(): # pgAdmin only upgrades, downgrade not implemented. diff --git a/web/migrations/versions/3ce25f562f3b_.py b/web/migrations/versions/3ce25f562f3b_.py new file mode 100644 index 000000000..bf4f266d8 --- /dev/null +++ b/web/migrations/versions/3ce25f562f3b_.py @@ -0,0 +1,36 @@ +########################################################################## +# +# pgAdmin 4 - PostgreSQL Tools +# +# Copyright (C) 2013 - 2021, The pgAdmin Development Team +# This software is released under the PostgreSQL Licence +# +########################################################################## + +"""empty message + +Revision ID: 3ce25f562f3b +Revises: 6650c52670c2 +Create Date: 2021-12-01 11:52:09.037749 + +""" +from pgadmin.model import db + +# revision identifiers, used by Alembic. +revision = '3ce25f562f3b' +down_revision = '6650c52670c2' +branch_labels = None +depends_on = None + + +def upgrade(): + db.engine.execute("create table user_old as select * from user") + + db.engine.execute("DROP TABLE user") + + db.engine.execute("ALTER TABLE user_old RENAME TO user") + + +def downgrade(): + # pgAdmin only upgrades, downgrade not implemented. + pass diff --git a/web/migrations/versions/7fedf8531802_.py b/web/migrations/versions/7fedf8531802_.py index 4d055c829..222f59d8e 100644 --- a/web/migrations/versions/7fedf8531802_.py +++ b/web/migrations/versions/7fedf8531802_.py @@ -19,7 +19,9 @@ depends_on = None def upgrade(): - db.engine.execute("ALTER TABLE user RENAME TO user_old") + db.engine.execute("create table user_old as select * from user") + + db.engine.execute("DROP TABLE user") db.engine.execute(""" CREATE TABLE user ( diff --git a/web/migrations/versions/c465fee44968_.py b/web/migrations/versions/c465fee44968_.py index c2abe767a..de5b763d2 100644 --- a/web/migrations/versions/c465fee44968_.py +++ b/web/migrations/versions/c465fee44968_.py @@ -19,7 +19,10 @@ depends_on = None def upgrade(): - db.engine.execute("ALTER TABLE user RENAME TO user_old") + + db.engine.execute("create table user_old as select * from user") + + db.engine.execute("DROP TABLE user") db.engine.execute(""" CREATE TABLE user ( @@ -48,7 +51,6 @@ def upgrade(): confirmed_at, masterpass_check, auth_source, fs_uniquifier) VALUES(:id, :username, :email, :password, :active, :confirmed_at, :masterpass_check, :auth_source, :fs_uniquifier)""") - db.engine.execute(statement, [ { **row, @@ -58,7 +60,6 @@ def upgrade(): db.engine.execute("DROP TABLE user_old") - def downgrade(): # pgAdmin only upgrades, downgrade not implemented. pass diff --git a/web/pgadmin/model/__init__.py b/web/pgadmin/model/__init__.py index aea32c1e1..58c309bbd 100644 --- a/web/pgadmin/model/__init__.py +++ b/web/pgadmin/model/__init__.py @@ -30,7 +30,7 @@ import uuid # ########################################################################## -SCHEMA_VERSION = 31 +SCHEMA_VERSION = 32 ########################################################################## #