"""external_link.started_at: when a fetch claimed the link. A worker killed mid-fetch (the Celery hard limit, an OOM, a restart) never reaches the code that moves its link out of 'downloading'. The external-link sweep returns such a link to the retry path once it has been 'downloading' longer than the task's hard limit, which needs the claim time. A row in 'downloading' with no claim time is treated as stale: no worker survives the deploy that adds this column. Revision ID: 0117 Revises: 0116 Create Date: 2026-11-05 """ import sqlalchemy as sa from alembic import op revision = "0117" down_revision = "0116" branch_labels = None depends_on = None def upgrade() -> None: op.add_column( "external_link", sa.Column("started_at", sa.DateTime(timezone=True), nullable=True), ) def downgrade() -> None: op.drop_column("external_link", "started_at")