aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db/migrations')
-rw-r--r--mediagoblin/db/migrations/alembic.ini56
-rw-r--r--mediagoblin/db/migrations/env.py3
2 files changed, 57 insertions, 2 deletions
diff --git a/mediagoblin/db/migrations/alembic.ini b/mediagoblin/db/migrations/alembic.ini
new file mode 100644
index 00000000..4f7fc115
--- /dev/null
+++ b/mediagoblin/db/migrations/alembic.ini
@@ -0,0 +1,56 @@
+# A generic, single database configuration.
+
+[alembic]
+# path to migration scripts
+script_location = %(here)s
+
+# template used to generate migration files
+# file_template = %%(rev)s_%%(slug)s
+
+# max length of characters to apply to the
+# "slug" field
+#truncate_slug_length = 40
+
+# set to 'true' to run the environment during
+# the 'revision' command, regardless of autogenerate
+# revision_environment = false
+
+# set to 'true' to allow .pyc and .pyo files without
+# a source .py file to be detected as revisions in the
+# versions/ directory
+# sourceless = false
+
+# Logging configuration
+[loggers]
+keys = root,sqlalchemy,alembic
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+qualname =
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+
+[logger_alembic]
+level = INFO
+handlers =
+qualname = alembic
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
diff --git a/mediagoblin/db/migrations/env.py b/mediagoblin/db/migrations/env.py
index 43b7b247..a6d05cd1 100644
--- a/mediagoblin/db/migrations/env.py
+++ b/mediagoblin/db/migrations/env.py
@@ -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()
-