aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/migrations/versions/408fc2eca9ce_track_webmention_digest_notifications.py
blob: 5547e45f544e7382b5a69bb8e7c39a09ed8b3180 (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

"""Track webmention digest notifications.

Revision ID: 408fc2eca9ce
Revises: be6e229d6a3d
Create Date: 2026-10-29 20:24:42.008723
"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "408fc2eca9ce"
down_revision = "be6e229d6a3d"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("received_webmentions", schema=None) as batch_op:
        batch_op.add_column(
            sa.Column("notification_sent_at", sa.DateTime(timezone=True), nullable=True)
        )
    op.execute(
        "UPDATE received_webmentions SET notification_sent_at = CURRENT_TIMESTAMP"
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("received_webmentions", schema=None) as batch_op:
        batch_op.drop_column("notification_sent_at")

    # ### end Alembic commands ###