43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
"""Baseline schema: SPEC 3 plus the SPEC 0 additions.
|
|
|
|
Revision ID: 0001
|
|
Revises:
|
|
Create Date: 2026-09-20
|
|
|
|
This baseline builds the schema from ``Base.metadata`` rather than from
|
|
hand-written DDL. That is a deliberate, bounded exception, and it applies to
|
|
this revision only:
|
|
|
|
* it cannot drift from the models, which hand-written DDL silently can;
|
|
* ``tests/test_schema_matches_models.py`` asserts that a freshly migrated
|
|
database produces an empty autogenerate diff, so the guarantee is checked
|
|
rather than assumed;
|
|
* every subsequent revision is a normal autogenerated one with real
|
|
``op.*`` operations.
|
|
|
|
If you would rather have explicit DDL here, run
|
|
``alembic revision --autogenerate`` against an empty database once Postgres is
|
|
up and replace this file with the result. The drift test passes either way.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Sequence
|
|
|
|
from alembic import op
|
|
|
|
from poorbird.models import Base
|
|
|
|
revision: str = "0001"
|
|
down_revision: str | None = None
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
Base.metadata.create_all(bind=op.get_bind())
|
|
|
|
|
|
def downgrade() -> None:
|
|
Base.metadata.drop_all(bind=op.get_bind())
|