feat: route bounded hierarchy postbox copies
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
"""v0.1.1 durable hierarchy routes
|
||||
|
||||
Revision ID: e4b7c9d2a6f1
|
||||
Revises: c7d2e5f8a1b4
|
||||
Create Date: 2026-07-30 04:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "e4b7c9d2a6f1"
|
||||
down_revision = "c7d2e5f8a1b4"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("postbox_routes") as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
"execute_after",
|
||||
sa.DateTime(timezone=True),
|
||||
nullable=True,
|
||||
)
|
||||
)
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
"processed_at",
|
||||
sa.DateTime(timezone=True),
|
||||
nullable=True,
|
||||
)
|
||||
)
|
||||
batch_op.create_unique_constraint(
|
||||
"uq_postbox_routes_delivery_target_kind_depth",
|
||||
("delivery_id", "target_postbox_id", "route_kind", "depth"),
|
||||
)
|
||||
batch_op.create_index(
|
||||
"ix_postbox_routes_due",
|
||||
("status", "execute_after"),
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("postbox_routes") as batch_op:
|
||||
batch_op.drop_index("ix_postbox_routes_due")
|
||||
batch_op.drop_constraint(
|
||||
"uq_postbox_routes_delivery_target_kind_depth",
|
||||
type_="unique",
|
||||
)
|
||||
batch_op.drop_column("processed_at")
|
||||
batch_op.drop_column("execute_after")
|
||||
Reference in New Issue
Block a user