"""Add SAML request data table for distributed cache

Revision ID: 71c8649f752f
Revises: fc82d8b66c20
Create Date: 2025-06-04 19:41:20.895344

"""

from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "71c8649f752f"
down_revision: str | None = "fc82d8b66c20"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "saml_request_data",
        sa.Column("id", sa.String(), nullable=False),
        sa.Column("relay_state", sa.String(), nullable=False),
        sa.Column("expires_at", sa.TIMESTAMP(timezone=True), nullable=False),
        sa.Column(
            "created_at",
            sa.TIMESTAMP(timezone=True),
            server_default=sa.text("now()"),
            nullable=False,
        ),
        sa.PrimaryKeyConstraint("id", name="saml_request_data_pkey"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("saml_request_data")
    # ### end Alembic commands ###
