30 lines
887 B
Python
30 lines
887 B
Python
|
|
"""initial accounts schema (from the ORM models)
|
||
|
|
|
||
|
|
Adopts Alembic on the existing create_all-managed schema: this baseline builds the
|
||
|
|
full current schema straight from ``Base.metadata`` (so it never drifts from
|
||
|
|
models.py), and subsequent revisions are produced with ``alembic revision
|
||
|
|
--autogenerate``. It subsumes the two hand-written deploy/migrations/*.sql
|
||
|
|
column-adds, which were SQLite-specific and are moot on a fresh Postgres database.
|
||
|
|
|
||
|
|
Revision ID: 0001_initial_schema
|
||
|
|
Revises:
|
||
|
|
Create Date: 2026-07-19
|
||
|
|
"""
|
||
|
|
from alembic import op
|
||
|
|
|
||
|
|
from accounts.db import Base
|
||
|
|
from accounts import models # noqa: F401 (registers tables on Base.metadata)
|
||
|
|
|
||
|
|
revision = "0001_initial_schema"
|
||
|
|
down_revision = None
|
||
|
|
branch_labels = None
|
||
|
|
depends_on = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade() -> None:
|
||
|
|
Base.metadata.create_all(bind=op.get_bind())
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade() -> None:
|
||
|
|
Base.metadata.drop_all(bind=op.get_bind())
|