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.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""import_batch.refreshed counter for deep-scan sidecar re-application
|
|
|
|
Revision ID: 0019
|
|
Revises: 0018
|
|
Create Date: 2026-05-25
|
|
|
|
Adds a `refreshed` counter to `import_batch`, mirroring the existing
|
|
`imported`/`skipped`/`failed`/`attachments` columns. Deep scan now
|
|
re-applies sidecar metadata to already-imported files (the IR feature
|
|
that didn't make the FC port the first time); a "refreshed" outcome
|
|
increments this counter so the UI can surface "X new, Y refreshed"
|
|
instead of the misleading "Scan complete — no new files" message.
|
|
|
|
server_default=0 backfills existing rows in place — no UPDATE needed.
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0019"
|
|
down_revision: Union[str, None] = "0018"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"import_batch",
|
|
sa.Column(
|
|
"refreshed", sa.Integer(),
|
|
nullable=False, server_default=sa.text("0"),
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("import_batch", "refreshed")
|