"""Add psa_ticket_id and psa_connection_id to sessions.

Revision ID: 059
Revises: 058
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

revision = "059"
down_revision = "058"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column("sessions", sa.Column("psa_ticket_id", sa.String(100), nullable=True))
    op.add_column(
        "sessions",
        sa.Column(
            "psa_connection_id",
            postgresql.UUID(as_uuid=True),
            sa.ForeignKey("psa_connections.id", ondelete="SET NULL"),
            nullable=True,
        ),
    )


def downgrade() -> None:
    op.drop_column("sessions", "psa_connection_id")
    op.drop_column("sessions", "psa_ticket_id")
