"""Fixed video_streams table

Revision ID: 298430e7849d
Revises: f107b45529ba
Create Date: 2024-10-28 19:14:27.017319

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "298430e7849d"
down_revision = "f107b45529ba"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    with op.batch_alter_table("video_streams", schema=None) as batch_op:
        batch_op.alter_column(
            "xml", existing_type=sa.VARCHAR(length=255), type_=sa.TEXT(), existing_nullable=True
        )
        batch_op.alter_column(
            "mediamtx_settings",
            existing_type=sa.VARCHAR(length=255),
            type_=sa.TEXT(),
            existing_nullable=False,
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("video_streams", schema=None) as batch_op:
        batch_op.alter_column(
            "mediamtx_settings",
            existing_type=sa.TEXT(),
            type_=sa.VARCHAR(length=255),
            existing_nullable=False,
        )
        batch_op.alter_column(
            "xml", existing_type=sa.TEXT(), type_=sa.VARCHAR(length=255), existing_nullable=True
        )

    # ### end Alembic commands ###
