aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'webmentions_ssg/migrations')
-rw-r--r--webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py39
-rw-r--r--webmentions_ssg/migrations/versions/b8179a2e46c3_merge_domain_rules_and_name_changes.py22
2 files changed, 61 insertions, 0 deletions
diff --git a/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py b/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py
new file mode 100644
index 0000000..04f5b8d
--- /dev/null
+++ b/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py
@@ -0,0 +1,39 @@
+# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+"""Add persistent source-domain block and allow lists.
+
+Revision ID: 3e8c87a96b2d
+Revises: e62b1a7c4d90
+"""
+
+import sqlalchemy as sa
+from alembic import op
+
+revision = "3e8c87a96b2d"
+down_revision = "e62b1a7c4d90"
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ op.create_table(
+ "blocked_sources",
+ sa.Column("id", sa.Integer(), nullable=False),
+ sa.Column("domain", sa.Text(), nullable=False),
+ sa.PrimaryKeyConstraint("id"),
+ sa.UniqueConstraint("domain"),
+ )
+ op.create_table(
+ "allowed_sources",
+ sa.Column("id", sa.Integer(), nullable=False),
+ sa.Column("domain", sa.Text(), nullable=False),
+ sa.PrimaryKeyConstraint("id"),
+ sa.UniqueConstraint("domain"),
+ )
+
+
+def downgrade():
+ op.drop_table("allowed_sources")
+ op.drop_table("blocked_sources")
diff --git a/webmentions_ssg/migrations/versions/b8179a2e46c3_merge_domain_rules_and_name_changes.py b/webmentions_ssg/migrations/versions/b8179a2e46c3_merge_domain_rules_and_name_changes.py
new file mode 100644
index 0000000..860e042
--- /dev/null
+++ b/webmentions_ssg/migrations/versions/b8179a2e46c3_merge_domain_rules_and_name_changes.py
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+"""Merge source-domain rules with Webmention lifecycle naming changes.
+
+Revision ID: b8179a2e46c3
+Revises: 3e8c87a96b2d, 9a4e0c8211d6
+"""
+
+revision = "b8179a2e46c3"
+down_revision = ("3e8c87a96b2d", "9a4e0c8211d6")
+branch_labels = None
+depends_on = None
+
+
+def upgrade() -> None:
+ """Both parent migrations have already applied their schema changes."""
+
+
+def downgrade() -> None:
+ """Downgrading past the merge leaves Alembic's two parent branches."""