summaryrefslogtreecommitdiff
path: root/src/mailman/database/factory.py
diff options
context:
space:
mode:
authorAurélien Bompard2014-10-06 15:58:58 +0200
committerAurélien Bompard2014-10-06 15:58:58 +0200
commit506b0fff2b4b1f068223d6e9cdfb254fd53bcdac (patch)
treed5c4e598fccf67c133179c4d1156252a61c4b8dc /src/mailman/database/factory.py
parentcbbac03083357ca928d104d386d9e3008c937581 (diff)
parent061799ef5031977bd343bbe54a6ad809138bdb45 (diff)
downloadmailman-506b0fff2b4b1f068223d6e9cdfb254fd53bcdac.tar.gz
mailman-506b0fff2b4b1f068223d6e9cdfb254fd53bcdac.tar.zst
mailman-506b0fff2b4b1f068223d6e9cdfb254fd53bcdac.zip
Diffstat (limited to 'src/mailman/database/factory.py')
-rw-r--r--src/mailman/database/factory.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mailman/database/factory.py b/src/mailman/database/factory.py
index fedfb816f..7d5c2cc73 100644
--- a/src/mailman/database/factory.py
+++ b/src/mailman/database/factory.py
@@ -30,7 +30,6 @@ import os
import types
from alembic import command
-from alembic.config import Config as AlembicConfig
from alembic.migration import MigrationContext
from alembic.script import ScriptDirectory
from flufl.lock import Lock
@@ -40,8 +39,9 @@ from zope.interface.verify import verifyObject
from mailman.config import config
from mailman.database.model import Model
+from mailman.database.alembic import alembic_cfg
from mailman.interfaces.database import IDatabase, IDatabaseFactory
-from mailman.utilities.modules import call_name
+from mailman.utilities.modules import call_name, expand_path
@@ -70,10 +70,7 @@ class SchemaManager:
def __init__(self, database):
self.database = database
- self.alembic_cfg = AlembicConfig()
- self.alembic_cfg.set_main_option(
- "script_location", config.alembic['script_location'])
- self.script = ScriptDirectory.from_config(self.alembic_cfg)
+ self.script = ScriptDirectory.from_config(alembic_cfg)
def get_storm_schema_version(self):
md = MetaData()
@@ -89,10 +86,10 @@ class SchemaManager:
def _create(self):
# initial DB creation
Model.metadata.create_all(self.database.engine)
- command.stamp(self.alembic_cfg, "head")
+ command.stamp(alembic_cfg, "head")
def _upgrade(self):
- command.upgrade(self.alembic_cfg, "head")
+ command.upgrade(alembic_cfg, "head")
def setup_db(self):
context = MigrationContext.configure(self.database.store.connection())