aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2016-01-18 09:39:34 +0000
committerJessica Tallon <tsyesika@tsyesika.se>2016-01-18 09:39:34 +0000
commit2ddebb97bfbb281bcb48e699d5b0c493cd9932c0 (patch)
treef0d1db5a22e436b13326868798c3bc0e49bec841
parentbeb5a4a150baba1f7219749ee47f96b01f3fdb0f (diff)
downloadmediagoblin-2ddebb97bfbb281bcb48e699d5b0c493cd9932c0.tar.lz
mediagoblin-2ddebb97bfbb281bcb48e699d5b0c493cd9932c0.tar.xz
mediagoblin-2ddebb97bfbb281bcb48e699d5b0c493cd9932c0.zip
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.
-rw-r--r--alembic.ini3
-rw-r--r--mediagoblin/db/migration_tools.py1
2 files changed, 1 insertions, 3 deletions
diff --git a/alembic.ini b/alembic.ini
index 2fa08099..7ae94f9f 100644
--- a/alembic.ini
+++ b/alembic.ini
@@ -20,9 +20,6 @@ script_location = %(here)s/mediagoblin/db/migrations
# versions/ directory
# sourceless = false
-sqlalchemy.url = sqlite:///mediagoblin.db
-
-
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
diff --git a/mediagoblin/db/migration_tools.py b/mediagoblin/db/migration_tools.py
index 756c1093..e34685f5 100644
--- a/mediagoblin/db/migration_tools.py
+++ b/mediagoblin/db/migration_tools.py
@@ -42,6 +42,7 @@ class AlembicMigrationManager(object):
os.path.dirname(__file__))))
alembic_cfg_path = os.path.join(root_dir, 'alembic.ini')
self.alembic_cfg = Config(alembic_cfg_path)
+ self.alembic_cfg.set_main_option("sqlalchemy.url", str(session.get_bind().url))
self.session = session
def get_current_revision(self):