лаба на 4
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "a6b12026a002"
|
||||
down_revision = "e5a12026a001"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column(
|
||||
"attachment_jobs",
|
||||
sa.Column("next_attempt_at", sa.DateTime(timezone=True)),
|
||||
)
|
||||
|
||||
op.add_column(
|
||||
"attachment_jobs",
|
||||
sa.Column("last_error_code", sa.String(64)),
|
||||
)
|
||||
|
||||
op.add_column(
|
||||
"attachment_jobs",
|
||||
sa.Column("finished_at", sa.DateTime(timezone=True)),
|
||||
)
|
||||
|
||||
op.create_index(
|
||||
"ix_attachment_jobs_retry_schedule",
|
||||
"attachment_jobs",
|
||||
["status", "next_attempt_at"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index(
|
||||
"ix_attachment_jobs_retry_schedule",
|
||||
table_name="attachment_jobs",
|
||||
)
|
||||
|
||||
op.drop_column("attachment_jobs", "finished_at")
|
||||
op.drop_column("attachment_jobs", "last_error_code")
|
||||
op.drop_column("attachment_jobs", "next_attempt_at")
|
||||
@@ -0,0 +1,33 @@
|
||||
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")
|
||||
@@ -0,0 +1,24 @@
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "b8b12026a004"
|
||||
down_revision = "a7b12026a003"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column(
|
||||
"attachment_jobs",
|
||||
sa.Column(
|
||||
"generation",
|
||||
sa.Integer(),
|
||||
nullable=False,
|
||||
server_default="1",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column("attachment_jobs", "generation")
|
||||
Reference in New Issue
Block a user