Add app_domain to APDeliveryLog so the same activity can be delivered to the same inbox under different actor identities (blog + federation).
34 lines
952 B
Python
34 lines
952 B
Python
"""Add app_domain to ap_delivery_log for per-domain idempotency
|
|
|
|
Revision ID: u1s9o5p7q8
|
|
Revises: t0r8n4o6p7
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "u1s9o5p7q8"
|
|
down_revision = "t0r8n4o6p7"
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"ap_delivery_log",
|
|
sa.Column("app_domain", sa.String(128), nullable=False, server_default="federation"),
|
|
)
|
|
op.drop_constraint("uq_delivery_activity_inbox", "ap_delivery_log", type_="unique")
|
|
op.create_unique_constraint(
|
|
"uq_delivery_activity_inbox_domain",
|
|
"ap_delivery_log",
|
|
["activity_id", "inbox_url", "app_domain"],
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_constraint("uq_delivery_activity_inbox_domain", "ap_delivery_log", type_="unique")
|
|
op.drop_column("ap_delivery_log", "app_domain")
|
|
op.create_unique_constraint(
|
|
"uq_delivery_activity_inbox",
|
|
"ap_delivery_log",
|
|
["activity_id", "inbox_url"],
|
|
)
|