20 lines
506 B
Python
20 lines
506 B
Python
from logging.config import fileConfig
|
|||
|
|
|
||
|
|
from alembic import context
|
||
|
|
|
||
|
|
from app import models # noqa: F401
|
||
|
|
from app.db import Base, engine
|
||
|
|
|
||
|
|
if context.config.config_file_name:
|
||
|
|
fileConfig(context.config.config_file_name)
|
||
|
|
|
||
|
|
|
||
|
|
def run_migrations_online() -> None:
|
||
|
|
with engine.connect() as connection:
|
||
|
|
context.configure(connection=connection, target_metadata=Base.metadata, compare_type=True)
|
||
|
|
with context.begin_transaction():
|
||
|
|
context.run_migrations()
|
||
|
|
|
||
|
|
|
||
|
|
run_migrations_online()
|