Fixed an issue where SQLite database definition is wrong because the USER_ID FK

references the table user_old which is not available.

Fixes #7031
pull/63/head
Pradip Parkale 2021-12-01 17:21:28 +05:30 committed by Akshay Joshi
parent 9d804d2857
commit 6b613fdf36
6 changed files with 55 additions and 6 deletions

View File

@ -31,5 +31,6 @@ Bug fixes
| `Issue #7013 <https://redmine.postgresql.org/issues/7013>`_ - Fix an RPM build issue that could lead to a conflict with python3 at installation.
| `Issue #7015 <https://redmine.postgresql.org/issues/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 <https://redmine.postgresql.org/issues/7024>`_ - Fixed an issue where reverse engineering SQL is wrong for Aggregate.
| `Issue #7031 <https://redmine.postgresql.org/issues/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 <https://redmine.postgresql.org/issues/7040>`_ - Add "section" to the Debian package control files.
| `Issue #7044 <https://redmine.postgresql.org/issues/7044>`_ - Update the dropzone version to 5.9.3 and Flask-SQLAlchemy to 2.5.*.

View File

@ -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.

View File

@ -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

View File

@ -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 (

View File

@ -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

View File

@ -30,7 +30,7 @@ import uuid
#
##########################################################################
SCHEMA_VERSION = 31
SCHEMA_VERSION = 32
##########################################################################
#