Revert "Update SQLAlchemy, Flask, Flask-SQLAlchemy, and other packages to current versions. #5901"

This reverts commit 31818bb67a.
This commit is contained in:
Akshay Joshi
2023-03-09 16:53:43 +05:30
parent c63442732b
commit 3c56c0e4b7
21 changed files with 202 additions and 175 deletions

View File

@@ -123,9 +123,9 @@ def upgrade():
if version < 11:
# get metadata from current connection
meta = sa.MetaData()
meta = sa.MetaData(bind=op.get_bind())
# define table representation
meta.reflect(op.get_bind(), only=('role',))
meta.reflect(only=('role',))
role_table = sa.Table('role', meta)
op.execute(
@@ -166,9 +166,9 @@ def upgrade():
'value': security_password_salt}])
# get metadata from current connection
meta = sa.MetaData()
meta = sa.MetaData(bind=op.get_bind())
# define table representation
meta.reflect(op.get_bind(), only=('version',))
meta.reflect(only=('version',))
version_table = sa.Table('version', meta)
op.execute(

View File

@@ -35,9 +35,9 @@ def upgrade():
['username', 'auth_source'])
# For internal email is a user name, so update the existing records.
meta = sa.MetaData()
meta = sa.MetaData(bind=op.get_bind())
# define table representation
meta.reflect(op.get_bind(), only=('user',))
meta.reflect(only=('user',))
user_table = sa.Table('user', meta)
op.execute(

View File

@@ -27,9 +27,9 @@ depends_on = None
def upgrade():
# get metadata from current connection
meta = sa.MetaData()
meta = sa.MetaData(bind=op.get_bind())
# define table representation
meta.reflect(op.get_bind(), only=('server',))
meta.reflect(only=('server',))
server_table = sa.Table('server', meta)
op.execute(
server_table.update().where(server_table.c.connect_timeout == 0 or

View File

@@ -29,9 +29,9 @@ def upgrade():
op.add_column('user', sa.Column('fs_uniquifier', sa.String(),
nullable=True))
meta = sa.MetaData()
meta = sa.MetaData(bind=op.get_bind())
# define table representation
meta.reflect(op.get_bind(), only=('user',))
meta.reflect(only=('user',))
user_table = sa.Table('user', meta)
op.execute(

View File

@@ -30,9 +30,9 @@ def upgrade():
# If password is already exists for any existing server then change the
# save_password column to 1 (True) else set 0
# get metadata from current connection
meta = sa.MetaData()
meta = sa.MetaData(bind=op.get_bind())
# define table representation
meta.reflect(op.get_bind(), only=('server',))
meta.reflect(only=('server',))
server_table = sa.Table('server', meta)
op.execute(

View File

@@ -50,18 +50,18 @@ def migrate_connection_params(table_name):
pass
# define table representation
meta = sa.MetaData()
meta.reflect(op.get_bind(), only=(table_name,))
meta = sa.MetaData(bind=op.get_bind())
meta.reflect(only=(table_name,))
server_table = sa.Table(table_name, meta)
# Create a select statement
stmt = sa.select(
stmt = sa.select([
server_table.columns.id, server_table.columns.ssl_mode,
server_table.columns.sslcert, server_table.columns.sslkey,
server_table.columns.sslrootcert, server_table.columns.sslcrl,
server_table.columns.sslcompression, server_table.columns.hostaddr,
server_table.columns.passfile, server_table.columns.connect_timeout
)
])
# Fetch the data from the server table
results = op.get_bind().execute(stmt).fetchall()

View File

@@ -114,8 +114,7 @@ def upgrade():
current_app.config['SECURITY_PASSWORD_SALT'] = current_salt
current_app.config['SECRET_KEY'] = secret_key
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
Security(current_app.app_context().app, user_datastore,
register_blueprint=False)
Security(current_app, user_datastore, register_blueprint=False)
else:
current_app.config['SECURITY_PASSWORD_SALT'] = current_salt
current_app.config['SECRET_KEY'] = secret_key