🏡 index : ~doyle/dave.git

author Jordan Doyle <jordan@doyle.wf> 2017-07-30 13:00:05.0 +01:00:00
committer Jordan Doyle <jordan@doyle.wf> 2017-07-30 13:00:05.0 +01:00:00
commit
2c8ecc4ef2d5a465802d3367ca07fa50aa9cf126 [patch]
tree
e0325744ddc7cd8a217315ce83e9eafb83d567ff
parent
85c434df22c2b65fbc72c9c31f74356c6dcac5ba
download
2c8ecc4ef2d5a465802d3367ca07fa50aa9cf126.tar.gz

Make alembic use our db connection instead of their own



Diff

 alembic.ini       |  2 --
 migrations/env.py |  9 +++++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/alembic.ini b/alembic.ini
index 1efc2f6..aeba60c 100644
--- a/alembic.ini
+++ a/alembic.ini
@@ -29,8 +29,6 @@
# are written from script.py.mako

# output_encoding = utf-8


sqlalchemy.url = postgresql://dave:dave@127.0.0.1/dave

# Logging configuration

[loggers]
keys = root,sqlalchemy,alembic
diff --git a/migrations/env.py b/migrations/env.py
index 724c1df..ebe8a83 100644
--- a/migrations/env.py
+++ a/migrations/env.py
@@ -1,6 +1,6 @@
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from sqlalchemy import pool
from logging.config import fileConfig
import os
import sys
@@ -9,7 +9,7 @@
parent_dir = os.path.abspath(os.path.join(basepath, ".."))
sys.path.append(parent_dir)

from dave.config import config as dave_config
from dave.config import db, config as dave_config

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@@ -58,10 +58,7 @@
    and associate a connection with the context.

    """
    connectable = engine_from_config(
        config.get_section(config.config_ini_section),
        prefix='sqlalchemy.',
        poolclass=pool.NullPool)
    connectable = db

    with connectable.connect() as connection:
        context.configure(