"""Max length on varchar's

Revision ID: 0009
Revises: 0008
Create Date: 2022-06-17 07:44:33.849746

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "0009"
down_revision = "0008"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "boefje_meta", "boefje_id", existing_type=sa.String(), type_=sa.String(length=32), existing_nullable=False
    )
    op.alter_column(
        "boefje_meta", "boefje_version", existing_type=sa.String(), type_=sa.String(length=16), existing_nullable=True
    )
    op.alter_column(
        "boefje_meta", "organization", existing_type=sa.String(), type_=sa.String(length=4), existing_nullable=False
    )
    op.alter_column(
        "boefje_meta", "input_ooi", existing_type=sa.String(), type_=sa.String(length=128), existing_nullable=False
    )

    op.alter_column(
        "raw_file", "secure_hash", existing_type=sa.String(), type_=sa.String(length=256), existing_nullable=True
    )
    op.alter_column(
        "raw_file",
        "hash_retrieval_link",
        existing_type=sa.String(),
        type_=sa.String(length=128),
        existing_nullable=True,
    )
    op.alter_column(
        "raw_file",
        "mime_types",
        existing_type=sa.ARRAY(sa.String()),
        type_=sa.ARRAY(sa.String(length=64)),
        existing_nullable=False,
    )

    op.alter_column(
        "normalizer_meta",
        "normalizer_name",
        existing_type=sa.String(),
        type_=sa.String(length=32),
        existing_nullable=False,
    )
    op.alter_column(
        "normalizer_meta",
        "normalizer_version",
        existing_type=sa.String(),
        type_=sa.String(length=16),
        existing_nullable=True,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "boefje_meta", "boefje_id", existing_type=sa.String(length=32), type_=sa.String(), existing_nullable=False
    )
    op.alter_column(
        "boefje_meta", "boefje_version", existing_type=sa.String(length=16), type_=sa.String(), existing_nullable=True
    )
    op.alter_column(
        "boefje_meta", "organization", existing_type=sa.String(length=4), type_=sa.String(), existing_nullable=False
    )
    op.alter_column(
        "boefje_meta", "input_ooi", existing_type=sa.String(length=128), type_=sa.String(), existing_nullable=False
    )

    op.alter_column(
        "raw_file", "secure_hash", existing_type=sa.String(length=256), type_=sa.String(), existing_nullable=True
    )
    op.alter_column(
        "raw_file",
        "hash_retrieval_link",
        existing_type=sa.String(length=128),
        type_=sa.String(),
        existing_nullable=True,
    )
    op.alter_column(
        "raw_file",
        "mime_types",
        existing_type=sa.ARRAY(sa.String(length=64)),
        type_=sa.ARRAY(sa.String()),
        existing_nullable=False,
    )

    op.alter_column(
        "normalizer_meta",
        "normalizer_name",
        existing_type=sa.String(length=32),
        type_=sa.String(),
        existing_nullable=False,
    )
    op.alter_column(
        "normalizer_meta",
        "normalizer_version",
        existing_type=sa.String(length=16),
        type_=sa.String(),
        existing_nullable=True,
    )
    # ### end Alembic commands ###
