"""Raise OAuth2Grant/OAuth2Token.client_id length limit

Revision ID: 6a6e872cbea5
Revises: 7cb32fb2fc26
Create Date: 2025-01-02 15:58:59.376742

"""

import sqlalchemy as sa
from alembic import op

# Polar Custom Imports

# revision identifiers, used by Alembic.
revision = "6a6e872cbea5"
down_revision = "7cb32fb2fc26"
branch_labels: tuple[str] | None = None
depends_on: tuple[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "oauth2_grants",
        "client_id",
        existing_type=sa.VARCHAR(length=48),
        type_=sa.String(length=52),
        existing_nullable=False,
    )
    op.alter_column(
        "oauth2_tokens",
        "client_id",
        existing_type=sa.VARCHAR(length=48),
        type_=sa.String(length=52),
        nullable=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "oauth2_tokens",
        "client_id",
        existing_type=sa.String(length=52),
        type_=sa.VARCHAR(length=48),
        nullable=True,
    )
    op.alter_column(
        "oauth2_grants",
        "client_id",
        existing_type=sa.String(length=52),
        type_=sa.VARCHAR(length=48),
        existing_nullable=False,
    )
    # ### end Alembic commands ###
