This reverts 2529b51. Not a retreat — a reordering, on the operator's
call, and the better sequence.
The squash's acceptance test (run 4971) found ~130 places where the ORM
models do not describe the deployed schema (#3275), including a
unique=True the database never had and two UNIQUE indexes that exist
only in migrations. Collapsing now would have baked all of that into the
one file a public installer starts from.
So: fix the drift first as ordinary migrations on the intact chain, let
the operator deploy so their database moves to the corrected head, and
only then collapse. The baseline is then generated from reconciled
models and reproduces a schema worth reproducing.
Nothing is lost by reverting. The baseline was never deployed, and
regenerating it after the fixes is strictly better than patching this
copy — it will come out of autogenerate correct rather than needing the
same hand-finishing twice.
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""fc3b: rename credential.kind -> credential_type, drop status, add last_verified
|
|
|
|
Revision ID: 0011
|
|
Revises: 0010
|
|
Create Date: 2026-05-20
|
|
|
|
Aligns the credential table with the GallerySubscriber wire-field names
|
|
so the existing browser extension can POST to FC unmodified. Greenfield —
|
|
no rows exist in production yet, so no data preservation logic is
|
|
needed; the rename uses ALTER COLUMN rather than copy-then-drop.
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0011"
|
|
down_revision: Union[str, None] = "0010"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.alter_column("credential", "kind", new_column_name="credential_type")
|
|
op.drop_column("credential", "status")
|
|
op.add_column(
|
|
"credential",
|
|
sa.Column("last_verified", sa.DateTime(timezone=True), nullable=True),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("credential", "last_verified")
|
|
op.add_column(
|
|
"credential",
|
|
sa.Column(
|
|
"status", sa.String(length=32), nullable=False,
|
|
server_default="active",
|
|
),
|
|
)
|
|
op.alter_column("credential", "credential_type", new_column_name="kind")
|