"""increase-char-counts

Revision ID: a95609631ed3
Revises: 44bd2fd2d4c0
Create Date: 2025-03-17 06:13:49.060163+00:00

"""

from typing import Sequence, Union

import sqlalchemy as sa
import sqlmodel.sql.sqltypes
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "a95609631ed3"
down_revision: Union[str, None] = "44bd2fd2d4c0"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("datasets", schema=None) as batch_op:
        batch_op.alter_column(
            "description",
            existing_type=sa.VARCHAR(length=4096),
            type_=sqlmodel.sql.sqltypes.AutoString(length=16384),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "description_html",
            existing_type=sa.VARCHAR(length=8192),
            type_=sqlmodel.sql.sqltypes.AutoString(length=32768),
            existing_nullable=True,
        )

    with op.batch_alter_table("uploads", schema=None) as batch_op:
        batch_op.alter_column(
            "method",
            existing_type=sa.VARCHAR(length=2048),
            type_=sqlmodel.sql.sqltypes.AutoString(length=8192),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "method_html",
            existing_type=sa.VARCHAR(length=4096),
            type_=sqlmodel.sql.sqltypes.AutoString(length=16384),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "description",
            existing_type=sa.VARCHAR(length=4096),
            type_=sqlmodel.sql.sqltypes.AutoString(length=8192),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "description_html",
            existing_type=sa.VARCHAR(length=8192),
            type_=sqlmodel.sql.sqltypes.AutoString(length=16384),
            existing_nullable=True,
        )

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("uploads", schema=None) as batch_op:
        batch_op.alter_column(
            "description_html",
            existing_type=sqlmodel.sql.sqltypes.AutoString(length=16384),
            type_=sa.VARCHAR(length=8192),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "description",
            existing_type=sqlmodel.sql.sqltypes.AutoString(length=8192),
            type_=sa.VARCHAR(length=4096),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "method_html",
            existing_type=sqlmodel.sql.sqltypes.AutoString(length=16384),
            type_=sa.VARCHAR(length=4096),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "method",
            existing_type=sqlmodel.sql.sqltypes.AutoString(length=8192),
            type_=sa.VARCHAR(length=2048),
            existing_nullable=True,
        )

    with op.batch_alter_table("datasets", schema=None) as batch_op:
        batch_op.alter_column(
            "description_html",
            existing_type=sqlmodel.sql.sqltypes.AutoString(length=32768),
            type_=sa.VARCHAR(length=8192),
            existing_nullable=True,
        )
        batch_op.alter_column(
            "description",
            existing_type=sqlmodel.sql.sqltypes.AutoString(length=16384),
            type_=sa.VARCHAR(length=4096),
            existing_nullable=True,
        )

    # ### end Alembic commands ###
