20260731_14_bootstrap_empty_database.py 855 B

12345678910111213141516171819202122232425262728293031
  1. """bootstrap the complete application schema for an empty database
  2. Revision ID: 20260731_14
  3. Revises: 20260731_13
  4. Create Date: 2026-07-31
  5. """
  6. from __future__ import annotations
  7. from collections.abc import Sequence
  8. from alembic import op
  9. from supply_infra.db.base import Base
  10. import supply_infra.db.models # noqa: F401
  11. revision: str = "20260731_14"
  12. down_revision: str | None = "20260731_13"
  13. branch_labels: str | Sequence[str] | None = None
  14. depends_on: str | Sequence[str] | None = None
  15. def upgrade() -> None:
  16. """Create model-owned tables that historical deployments supplied manually."""
  17. Base.metadata.create_all(bind=op.get_bind(), checkfirst=True)
  18. def downgrade() -> None:
  19. # This is an adoption migration. Some tables may predate Alembic, so a
  20. # downgrade must not guess ownership and delete existing application data.
  21. pass