state-hub/migrations/versions/a0b1c2d3e4f5_memo_notification_receipts.py
tegwick 49eeddbfed
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 27s
Add a dev memo-forwarding fixture and deduplicated intake notifications.
Pose, replay, and conflict stay on an injected transport with local retry
evidence. Notification receipts keep only memo id, question, class, and
submitter, and a resolve conflict stays readable.

Assistant: grok
Assistant-Session: 01a10329-31cb-78d3-b7a3-789e1fb83139
2026-10-03 21:25:46 +02:00

53 lines
1.6 KiB
Python

"""memo notification receipts
Revision ID: a0b1c2d3e4f5
Revises: f9a0b1c2d3e4
Create Date: 2026-10-03
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import UUID
revision = "a0b1c2d3e4f5"
down_revision = "f9a0b1c2d3e4"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
"memo_notification_receipts",
sa.Column("delivery_id", sa.String(length=128), primary_key=True),
sa.Column("body_digest", sa.String(length=64), nullable=False),
sa.Column("memo_id", sa.String(length=63), nullable=False),
sa.Column("question", sa.String(length=400), nullable=False),
sa.Column("memo_class", sa.String(length=63), nullable=False),
sa.Column("submitter", sa.String(length=63), nullable=False),
sa.Column(
"message_id",
UUID(as_uuid=True),
sa.ForeignKey("agent_messages.id", ondelete="RESTRICT"),
nullable=False,
),
sa.Column("authoritative_review", sa.String(length=40), nullable=False),
sa.Column(
"created_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
)
op.create_index(
"ix_memo_notification_receipts_message_id",
"memo_notification_receipts",
["message_id"],
)
def downgrade() -> None:
op.drop_index(
"ix_memo_notification_receipts_message_id",
table_name="memo_notification_receipts",
)
op.drop_table("memo_notification_receipts")