Pass connection to EnvironmentContext.configure
authorBoris Bobrov <breton@cynicmansion.ru>
Sat, 4 Mar 2017 07:58:48 +0000 (10:58 +0300)
committerBoris Bobrov <breton@cynicmansion.ru>
Sat, 4 Mar 2017 08:05:32 +0000 (11:05 +0300)
In https://bitbucket.org/zzzeek/alembic/issues/419/ we were suggested
use connection instead of engine. This should fix an issue reported
via ml.

(cherry picked from commit 3bad5310f683f2512e5d184555aa0108fbd3ff4b)

mediagoblin/db/migrations/env.py

index 43b7b24765aebda18ce1721f4fb25d2b62f8f938..a6d05cd1fd13683c77f2ba91c471d76175115c87 100644 (file)
@@ -48,7 +48,7 @@ def run_migrations_online():
     and associate a connection with the context.
 
     """
-    connection = config.attributes["session"].get_bind()
+    connection = config.attributes["session"].connection()
     context.configure(
                 connection=connection,
                 target_metadata=target_metadata
@@ -61,4 +61,3 @@ if context.is_offline_mode():
     run_migrations_offline()
 else:
     run_migrations_online()
-