"""extend complexity fields to text

Revision ID: 11f3a598b82d
Revises: 001
Create Date: 2025-04-12 20:44:46.031680

"""

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "11f3a598b82d"
down_revision: str | None = "001"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    op.alter_column(
        "explanations",
        "time_complexity",
        existing_type=sa.VARCHAR(length=50),
        type_=sa.Text(),
        existing_nullable=False,
    )
    op.alter_column(
        "explanations",
        "space_complexity",
        existing_type=sa.VARCHAR(length=50),
        type_=sa.Text(),
        existing_nullable=False,
    )


def downgrade() -> None:
    op.alter_column(
        "explanations",
        "space_complexity",
        existing_type=sa.Text(),
        type_=sa.VARCHAR(length=50),
        existing_nullable=False,
    )
    op.alter_column(
        "explanations",
        "time_complexity",
        existing_type=sa.Text(),
        type_=sa.VARCHAR(length=50),
        existing_nullable=False,
    )
