2020-04-10 06:33:04 -05:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2024-12-31 23:56:42 -06:00
|
|
|
# Copyright (C) 2013 - 2025, The pgAdmin Development Team
|
2020-04-10 06:33:04 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
"""Add a column to save password option which will be useful when Trust mode
|
|
|
|
|
|
|
|
Revision ID: d39482714a2e
|
|
|
|
Revises: 7fedf8531802
|
|
|
|
Create Date: 2020-04-09 13:20:13.939775
|
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = 'd39482714a2e'
|
|
|
|
down_revision = '7fedf8531802'
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2022-10-20 05:48:41 -05:00
|
|
|
op.add_column('server', sa.Column('save_password', sa.Integer(),
|
|
|
|
server_default='0'))
|
2020-04-10 06:33:04 -05:00
|
|
|
# If password is already exists for any existing server then change the
|
|
|
|
# save_password column to 1 (True) else set 0
|
2022-10-20 05:48:41 -05:00
|
|
|
# get metadata from current connection
|
Update SQLAlchemy, Flask, Flask-SQLAlchemy, and other packages to current versions. #5901
- Update Flask, Flask-SQLAlchemy, Flask-Babel, Flask-Security-Too, Flask-SocketIO, pytz, psutil, SQLAlchemy, bcrypt, cryptography, eventlet, Authlib, requests python packages
- Remove pinned dnspython, Werkzeug packages from requirements.txt
2023-03-15 01:27:16 -05:00
|
|
|
meta = sa.MetaData()
|
2022-10-20 05:48:41 -05:00
|
|
|
# define table representation
|
Update SQLAlchemy, Flask, Flask-SQLAlchemy, and other packages to current versions. #5901
- Update Flask, Flask-SQLAlchemy, Flask-Babel, Flask-Security-Too, Flask-SocketIO, pytz, psutil, SQLAlchemy, bcrypt, cryptography, eventlet, Authlib, requests python packages
- Remove pinned dnspython, Werkzeug packages from requirements.txt
2023-03-15 01:27:16 -05:00
|
|
|
meta.reflect(op.get_bind(), only=('server',))
|
2022-10-20 05:48:41 -05:00
|
|
|
server_table = sa.Table('server', meta)
|
|
|
|
|
|
|
|
op.execute(
|
|
|
|
server_table.update().values(save_password=sa.case(
|
|
|
|
(server_table.c.password != 'NULL' and
|
|
|
|
server_table.c.password != '', 1), else_=0)
|
|
|
|
))
|
2020-04-10 06:33:04 -05:00
|
|
|
|
2020-07-24 01:16:30 -05:00
|
|
|
|
2020-04-10 06:33:04 -05:00
|
|
|
def downgrade():
|
2020-07-24 01:16:30 -05:00
|
|
|
# pgAdmin only upgrades, downgrade not implemented.
|
2020-04-10 06:33:04 -05:00
|
|
|
pass
|