Fix #5391 - Alembic migrations would only work for SQLite
The database connection was being set in a alembic.ini config file, if the user had specified postgres the "sqlite" connection URL in alembic.ini would override that. We probably should look into this more so i've opened #5395.
This commit is contained in:
parent
beb5a4a150
commit
2ddebb97bf
@ -20,9 +20,6 @@ script_location = %(here)s/mediagoblin/db/migrations
|
|||||||
# versions/ directory
|
# versions/ directory
|
||||||
# sourceless = false
|
# sourceless = false
|
||||||
|
|
||||||
sqlalchemy.url = sqlite:///mediagoblin.db
|
|
||||||
|
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
[loggers]
|
[loggers]
|
||||||
keys = root,sqlalchemy,alembic
|
keys = root,sqlalchemy,alembic
|
||||||
|
@ -42,6 +42,7 @@ class AlembicMigrationManager(object):
|
|||||||
os.path.dirname(__file__))))
|
os.path.dirname(__file__))))
|
||||||
alembic_cfg_path = os.path.join(root_dir, 'alembic.ini')
|
alembic_cfg_path = os.path.join(root_dir, 'alembic.ini')
|
||||||
self.alembic_cfg = Config(alembic_cfg_path)
|
self.alembic_cfg = Config(alembic_cfg_path)
|
||||||
|
self.alembic_cfg.set_main_option("sqlalchemy.url", str(session.get_bind().url))
|
||||||
self.session = session
|
self.session = session
|
||||||
|
|
||||||
def get_current_revision(self):
|
def get_current_revision(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user