Merge pull request #1279 from wrouesnel/wrouesnel/fix_env_migrations

Fix handling of passwords with % in the SQLALCHEMY_DATABASE_URI
This commit is contained in:
Matt Scott
2022-12-08 21:51:38 -05:00
committed by GitHub

View File

@ -19,7 +19,7 @@ logger = logging.getLogger('alembic.env')
# target_metadata = mymodel.Base.metadata
from flask import current_app
config.set_main_option('sqlalchemy.url',
current_app.config.get('SQLALCHEMY_DATABASE_URI'))
current_app.config.get('SQLALCHEMY_DATABASE_URI').replace("%","%%"))
target_metadata = current_app.extensions['migrate'].db.metadata
# other values from the config, defined by the needs of env.py,