diff --git a/alembic/versions/0014_fc3d_scheduling.py b/alembic/versions/0014_fc3d_scheduling.py new file mode 100644 index 0000000..955e956 --- /dev/null +++ b/alembic/versions/0014_fc3d_scheduling.py @@ -0,0 +1,58 @@ +"""fc3d: scheduling + source health columns + +Revision ID: 0014 +Revises: 0013 +Create Date: 2026-05-21 + +Additive only. source.consecutive_failures (default 0, DownloadService +finalize hook owns the writes). import_settings gains the three +scheduling knobs (global default interval, event retention, failure +warning threshold). +""" +from typing import Sequence, Union + +import sqlalchemy as sa +from alembic import op + +revision: str = "0014" +down_revision: Union[str, None] = "0013" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.add_column( + "source", + sa.Column( + "consecutive_failures", sa.Integer(), + nullable=False, server_default="0", + ), + ) + op.add_column( + "import_settings", + sa.Column( + "download_schedule_default_seconds", sa.Integer(), + nullable=False, server_default="28800", + ), + ) + op.add_column( + "import_settings", + sa.Column( + "download_event_retention_days", sa.Integer(), + nullable=False, server_default="90", + ), + ) + op.add_column( + "import_settings", + sa.Column( + "download_failure_warning_threshold", sa.Integer(), + nullable=False, server_default="5", + ), + ) + + +def downgrade() -> None: + op.drop_column("import_settings", "download_failure_warning_threshold") + op.drop_column("import_settings", "download_event_retention_days") + op.drop_column("import_settings", "download_schedule_default_seconds") + op.drop_column("source", "consecutive_failures")