aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py
blob: 04f5b8dbef90d7e1b82510f590d0fef517a6b792 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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")