Added support for storing configurations of pgAdmin in an external database. #1832

This commit is contained in:
Akshay Joshi
2022-10-20 16:18:41 +05:30
committed by GitHub
parent d50e9f7fc2
commit e17c50d304
52 changed files with 963 additions and 1062 deletions

View File

@@ -24,8 +24,9 @@ logger = logging.getLogger('alembic.env')
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
from flask import current_app
config.set_main_option('sqlalchemy.url',
current_app.config.get('SQLALCHEMY_DATABASE_URI'))
db_url_escaped = \
current_app.config.get('SQLALCHEMY_DATABASE_URI').replace('%', '%%')
config.set_main_option('sqlalchemy.url', db_url_escaped)
target_metadata = current_app.extensions['migrate'].db.metadata
# other values from the config, defined by the needs of env.py,
@@ -87,6 +88,7 @@ def run_migrations_online():
finally:
connection.close()
if context.is_offline_mode():
run_migrations_offline()
else: