Infrastructure to build the worker docker and run it.

This commit is contained in:
2020-10-14 08:19:42 +05:30
parent 99f5f09c17
commit fc6eebed19
10 changed files with 267 additions and 88 deletions

View File

@ -1,10 +1,9 @@
import logging
from sqlalchemy import create_engine
from sqlalchemy import pool
from alembic import context
from barker.core.config import settings
from sqlalchemy import create_engine, pool
logging.basicConfig()
logging.getLogger("sqlalchemy.engine").setLevel(settings.ALEMBIC_LOG_LEVEL)
@ -15,6 +14,7 @@ logging.getLogger("alembic").setLevel(settings.ALEMBIC_LOG_LEVEL)
from barker.models.auth import User # noqa
target_metadata = User.metadata
# other values from the config, defined by the needs of env.py,
@ -55,10 +55,15 @@ def run_migrations_online():
and associate a connection with the context.
"""
connectable = create_engine(settings.SQLALCHEMY_DATABASE_URI, poolclass=pool.NullPool,)
connectable = create_engine(
settings.SQLALCHEMY_DATABASE_URI,
poolclass=pool.NullPool,
)
with connectable.connect() as connection:
context.configure(connection=connection, target_metadata=target_metadata, compare_type=True)
context.configure(
connection=connection, target_metadata=target_metadata, compare_type=True
)
with context.begin_transaction():
context.run_migrations()