"""add cached raw Forgejo payload on issues

Revision ID: d3f4a5b6c7d8
Revises: a7aa29cf8a20
Create Date: 2026-05-22 00:00:00.000000

"""

from __future__ import annotations

import sqlalchemy as sa
from alembic import op

revision = "d3f4a5b6c7d8"
down_revision = "a7aa29cf8a20"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "forgejo_issues",
        sa.Column("forgejo_payload", sa.JSON(), nullable=True),
    )
    op.add_column(
        "forgejo_issues",
        sa.Column("forgejo_comments_payload", sa.JSON(), nullable=False, server_default="[]"),
    )
    op.add_column(
        "forgejo_issues",
        sa.Column("forgejo_timeline_payload", sa.JSON(), nullable=False, server_default="[]"),
    )
    op.add_column(
        "forgejo_issues",
        sa.Column("forgejo_reactions_payload", sa.JSON(), nullable=False, server_default="[]"),
    )


def downgrade() -> None:
    op.drop_column("forgejo_issues", "forgejo_reactions_payload")
    op.drop_column("forgejo_issues", "forgejo_timeline_payload")
    op.drop_column("forgejo_issues", "forgejo_comments_payload")
    op.drop_column("forgejo_issues", "forgejo_payload")
