diff options
| author | Dennis Fink | 2026-11-19 19:42:41 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-19 20:59:24 +0100 |
| commit | 88f54d9a7699944b7d56f978e724b1c0b54dde98 (patch) | |
| tree | 88ecc527903a91a6f6622ca288b278e5875aff3d /webmentions_ssg/migrations/versions | |
| parent | 8ec35babe87ff8139ec23cc10b858b7481f132db (diff) | |
| download | webmentions-ssg-88f54d9a7699944b7d56f978e724b1c0b54dde98.tar.gz webmentions-ssg-88f54d9a7699944b7d56f978e724b1c0b54dde98.zip | |
feat(sender): add bulk resend and delivery history
Allow admins to resend all failed Webmentions globally or requeue every
delivery for a source using the shared confirmation workflow.
Record outgoing status history, expand sent source details, and provide
human-readable guidance for current and historical delivery failures.
Diffstat (limited to 'webmentions_ssg/migrations/versions')
| -rw-r--r-- | webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py b/webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py new file mode 100644 index 0000000..454367d --- /dev/null +++ b/webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> +# +# SPDX-License-Identifier: BSD-3-Clause + +"""Record outgoing Webmention delivery history. + +Revision ID: c8fa49e1a203 +Revises: 2b4c6e8a0d12 +""" + +import sqlalchemy as sa +from alembic import op + +revision = "c8fa49e1a203" +down_revision = "2b4c6e8a0d12" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "sent_webmention_status_events", + sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), + sa.Column("webmention_uuid", sa.Uuid(), nullable=False), + sa.Column( + "status", + sa.Enum( + "sent", + "no_endpoint", + "failed", + name="sent_webmention_status", + native_enum=False, + ), + nullable=True, + ), + sa.Column("action", sa.String(length=80), nullable=False), + sa.Column("revision", sa.Integer(), nullable=False), + sa.Column("attempt_count", sa.Integer(), nullable=False), + sa.Column("failure_reason", sa.Text(), nullable=True), + sa.Column("endpoint_response_status", sa.Integer(), nullable=True), + sa.Column("occurred_at", sa.DateTime(timezone=True), nullable=False), + sa.ForeignKeyConstraint( + ["webmention_uuid"], ["sent_webmentions.uuid"], ondelete="CASCADE" + ), + ) + op.create_index( + "ix_sent_webmention_status_events_webmention_id", + "sent_webmention_status_events", + ["webmention_uuid", "id"], + ) + # A pre-upgrade delivery has only its current result available. + op.execute( + sa.text( + """INSERT INTO sent_webmention_status_events + (webmention_uuid, status, action, revision, attempt_count, + failure_reason, endpoint_response_status, occurred_at) + SELECT uuid, status, 'Existing status at upgrade', + desired_revision, attempt_count, failure_reason, + endpoint_response_status, + COALESCE(last_attempted_at, last_sent_at, CURRENT_TIMESTAMP) + FROM sent_webmentions""" + ) + ) + + +def downgrade(): + op.drop_index( + "ix_sent_webmention_status_events_webmention_id", + table_name="sent_webmention_status_events", + ) + op.drop_table("sent_webmention_status_events") |
