53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
"""Parsed uploader outcomes (US05-03).
|
|
|
|
Revision ID: 0009_upload_report_outcomes
|
|
Revises: 0008_upload_batches
|
|
Create Date: 2026-08-16
|
|
|
|
Per-item outcomes parsed from the immich-go report plus the parser evidence that
|
|
produced them, so "what did Immich do with this file?" survives a restart.
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0009_upload_report_outcomes"
|
|
down_revision = "0008_upload_batches"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# NULL parser = the uploader version has no pinned grammar; the batch is then
|
|
# requires_verification however the process exited.
|
|
op.add_column("upload_batches", sa.Column("parser", sa.String(), nullable=True))
|
|
op.add_column("upload_batches", sa.Column("parser_version", sa.Integer(), nullable=True))
|
|
op.add_column(
|
|
"upload_batches", sa.Column("parsed_at", sa.DateTime(timezone=True), nullable=True)
|
|
)
|
|
# verified | requires_verification
|
|
op.add_column("upload_batches", sa.Column("outcome_state", sa.String(), nullable=True))
|
|
op.add_column("upload_batches", sa.Column("outcome_counts", sa.String(), nullable=True))
|
|
op.add_column("upload_batches", sa.Column("report_counts", sa.String(), nullable=True))
|
|
|
|
# uploaded | upgraded | duplicate | skipped | failed | unknown
|
|
op.add_column("upload_items", sa.Column("outcome", sa.String(), nullable=True))
|
|
op.add_column("upload_items", sa.Column("evidence", sa.String(), nullable=True))
|
|
op.add_column(
|
|
"upload_items", sa.Column("outcome_at", sa.DateTime(timezone=True), nullable=True)
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
for column in ("outcome_at", "evidence", "outcome"):
|
|
op.drop_column("upload_items", column)
|
|
for column in (
|
|
"report_counts",
|
|
"outcome_counts",
|
|
"outcome_state",
|
|
"parsed_at",
|
|
"parser_version",
|
|
"parser",
|
|
):
|
|
op.drop_column("upload_batches", column)
|