aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/migrations/versions
diff options
context:
space:
mode:
authorDennis Fink2026-11-21 14:49:28 +0100
committerDennis Fink2026-11-21 14:49:28 +0100
commitef90dc381322122ecfb9af039cf790de92807514 (patch)
tree9b81d9726b05fbd22e738bbc29ab6ec66536c11f /webmentions_ssg/migrations/versions
parenteb11fb64e9cad6fbda2065362189653416d98577 (diff)
downloadwebmentions-ssg-ef90dc381322122ecfb9af039cf790de92807514.tar.gz
webmentions-ssg-ef90dc381322122ecfb9af039cf790de92807514.zip
feat(sender): split source and delivery history
Add per-Webmention detail pages so delivery state, failure guidance, status URLs, and delivery history no longer crowd the source overview. Track source lifecycle events separately for discovery, revision, deletion, and restoration, and add a source-level action to resend only failed Webmentions.
Diffstat (limited to 'webmentions_ssg/migrations/versions')
-rw-r--r--webmentions_ssg/migrations/versions/4e6fbc9d207a_source_document_events.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/webmentions_ssg/migrations/versions/4e6fbc9d207a_source_document_events.py b/webmentions_ssg/migrations/versions/4e6fbc9d207a_source_document_events.py
new file mode 100644
index 0000000..eb162dd
--- /dev/null
+++ b/webmentions_ssg/migrations/versions/4e6fbc9d207a_source_document_events.py
@@ -0,0 +1,53 @@
+# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+"""Record source-document lifecycle history separately from deliveries.
+
+Revision ID: 4e6fbc9d207a
+Revises: c8fa49e1a203
+"""
+
+import sqlalchemy as sa
+from alembic import op
+
+revision = "4e6fbc9d207a"
+down_revision = "c8fa49e1a203"
+branch_labels = None
+depends_on = None
+
+
+def upgrade() -> None:
+ op.create_table(
+ "source_document_events",
+ sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
+ sa.Column("source_uuid", sa.Uuid(), nullable=False),
+ sa.Column("action", sa.String(length=80), nullable=False),
+ sa.Column("revision", sa.Integer(), nullable=False),
+ sa.Column("occurred_at", sa.DateTime(timezone=True), nullable=False),
+ sa.ForeignKeyConstraint(
+ ["source_uuid"], ["source_documents.uuid"], ondelete="CASCADE"
+ ),
+ )
+ op.create_index(
+ "ix_source_document_events_source_id",
+ "source_document_events",
+ ["source_uuid", "id"],
+ )
+ # The old schema did not retain lifecycle transitions. Seed one honest
+ # baseline snapshot per existing source; do not fabricate earlier events.
+ op.execute(
+ sa.text(
+ """INSERT INTO source_document_events
+ (source_uuid, action, revision, occurred_at)
+ SELECT uuid, 'Existing source at upgrade', revision, CURRENT_TIMESTAMP
+ FROM source_documents"""
+ )
+ )
+
+
+def downgrade() -> None:
+ op.drop_index(
+ "ix_source_document_events_source_id", table_name="source_document_events"
+ )
+ op.drop_table("source_document_events")