pryscraper/alembic/script.py.mako
cryptorugmunch 0fc69d2650 feat(db): add Alembic migrations for versioned schema changes
- Add alembic to dev deps and requirements.txt.
- Initialize alembic/ config with SQLite + Postgres support.
- Create 0001_initial_schema migration covering all 26 models.
- Add db.run_migrations() helper and  CLI command.
- Add docker-entrypoint.sh to run migrations before app start.
- Keep Base.metadata.create_all() for backward compatibility.
- Add tests verifying alembic current and upgrade head work.
2026-07-03 02:04:21 +02:00

27 lines
630 B
Mako

"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from __future__ import annotations
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
revision: str = ${repr(up_revision)}
down_revision: Union[str, None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
${upgrades if upgrades else "pass"}
def downgrade() -> None:
${downgrades if downgrades else "pass"}