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")
|