"""Бюджет повторов и аудит операторского replay.""" from alembic import op import sqlalchemy as sa revision = "f9183d27a640" down_revision = "e7048b6da913" branch_labels = None depends_on = None def upgrade() -> None: op.add_column( "attachment_jobs", sa.Column( "cycle_start_attempt", sa.Integer(), nullable=False, server_default="0" ), ) op.add_column( "attachment_jobs", sa.Column("attempt_limit", sa.Integer(), nullable=True) ) op.add_column( "attachment_jobs", sa.Column("last_error_permanent", sa.Boolean(), nullable=True), ) op.create_table( "job_replays", sa.Column("id", sa.Uuid(), primary_key=True), sa.Column( "job_id", sa.Uuid(), sa.ForeignKey("attachment_jobs.id"), nullable=False ), sa.Column("actor", sa.String(64), nullable=False), sa.Column("reason", sa.String(32), nullable=False), sa.Column("previous_attempt", sa.Integer(), nullable=False), sa.Column("attempt_limit", sa.Integer(), nullable=False), sa.Column("previous_error_code", sa.String(64), nullable=True), sa.Column( "created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.clock_timestamp(), ), ) op.create_index("ix_job_replays_job_id", "job_replays", ["job_id"]) def downgrade() -> None: op.drop_table("job_replays") op.drop_column("attachment_jobs", "last_error_permanent") op.drop_column("attachment_jobs", "attempt_limit") op.drop_column("attachment_jobs", "cycle_start_attempt")