Files
computer/cptr/migrations/env.py
T
2026-06-04 08:21:34 -07:00

25 lines
698 B
Python

from alembic import context
from sqlalchemy import engine_from_config, pool
from cptr.models import Base
target_metadata = Base.metadata
def run_migrations_online():
connectable = context.config.attributes.get("connection", None)
if connectable is None:
connectable = engine_from_config(
context.config.get_section(context.config.config_ini_section),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
with connectable.connect() as connection:
context.configure(connection=connection, target_metadata=target_metadata)
with context.begin_transaction():
context.run_migrations()
run_migrations_online()