mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-08 15:13:10 -06:00
6b613fdf36
references the table user_old which is not available. Fixes #7031
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
|
|
"""empty message
|
|
|
|
Revision ID: 7fedf8531802
|
|
Revises: aff1436e3c8c
|
|
Create Date: 2020-02-26 11:24:54.353288
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from pgadmin.model import db
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '7fedf8531802'
|
|
down_revision = 'aff1436e3c8c'
|
|
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("""
|
|
CREATE TABLE user (
|
|
id INTEGER NOT NULL,
|
|
username VARCHAR(256) NOT NULL,
|
|
email VARCHAR(256),
|
|
password VARCHAR(256),
|
|
active BOOLEAN NOT NULL,
|
|
confirmed_at DATETIME,
|
|
masterpass_check VARCHAR(256),
|
|
auth_source VARCHAR(256) NOT NULL DEFAULT 'internal',
|
|
PRIMARY KEY (id),
|
|
UNIQUE (username, auth_source),
|
|
CHECK (active IN (0, 1))
|
|
);
|
|
""")
|
|
|
|
db.engine.execute("""
|
|
INSERT INTO user (
|
|
id, username, email, password, active, confirmed_at, masterpass_check
|
|
) SELECT
|
|
id, email, email, password, active, confirmed_at, masterpass_check
|
|
FROM user_old""")
|
|
|
|
db.engine.execute("DROP TABLE user_old")
|
|
|
|
|
|
def downgrade():
|
|
# pgAdmin only upgrades, downgrade not implemented.
|
|
pass
|