generated from coulomb/repo-seed
Add Inter-Hub migration bundle importer
This commit is contained in:
39
migrations/versions/20260627_0002_add_migration_runs.py
Normal file
39
migrations/versions/20260627_0002_add_migration_runs.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""add migration run ledger
|
||||
|
||||
Revision ID: 20260627_0002
|
||||
Revises: 20260627_0001
|
||||
Create Date: 2026-06-27
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "20260627_0002"
|
||||
down_revision: str | None = "20260627_0001"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"migration_runs",
|
||||
sa.Column("id", sa.String(length=36), primary_key=True),
|
||||
sa.Column("source", sa.String(length=120), nullable=False),
|
||||
sa.Column("schema_version", sa.String(length=80), nullable=False),
|
||||
sa.Column("bundle_sha256", sa.String(length=64), nullable=False),
|
||||
sa.Column("dry_run", sa.Boolean(), nullable=False),
|
||||
sa.Column("status", sa.String(length=40), nullable=False),
|
||||
sa.Column("counts_json", sa.Text(), nullable=False),
|
||||
sa.Column("diagnostics_json", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||
)
|
||||
op.create_index("ix_migration_runs_source", "migration_runs", ["source"])
|
||||
op.create_index("ix_migration_runs_bundle_sha256", "migration_runs", ["bundle_sha256"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("ix_migration_runs_bundle_sha256", table_name="migration_runs")
|
||||
op.drop_index("ix_migration_runs_source", table_name="migration_runs")
|
||||
op.drop_table("migration_runs")
|
||||
Reference in New Issue
Block a user