33 lines
745 B
Python
33 lines
745 B
Python
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "a7b12026a003"
|
|
down_revision = "a6b12026a002"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.add_column(
|
|
"attachment_jobs",
|
|
sa.Column("failed_published_at", sa.DateTime(timezone=True)),
|
|
)
|
|
|
|
op.create_index(
|
|
"ix_attachment_jobs_failed_unpublished",
|
|
"attachment_jobs",
|
|
["created_at"],
|
|
postgresql_where=sa.text(
|
|
"status = 'failed' AND failed_published_at IS NULL"
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index(
|
|
"ix_attachment_jobs_failed_unpublished",
|
|
table_name="attachment_jobs",
|
|
)
|
|
|
|
op.drop_column("attachment_jobs", "failed_published_at") |