"""agent_model_optional

Revision ID: bfc6f44f5bc9
Revises: 2958416fbe75
Create Date: 2024-07-09 14:50:40.193842

"""
from alembic import op
import sqlalchemy as sa
import mindsdb.interfaces.storage.db  # noqa

# revision identifiers, used by Alembic.
revision = 'bfc6f44f5bc9'
down_revision = 'cbedc4968d5d'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('agents', schema=None) as batch_op:
        batch_op.alter_column(
            'model_name',
            existing_type=sa.VARCHAR(),
            nullable=True
        )

    with op.batch_alter_table('chat_bots', schema=None) as batch_op:
        batch_op.alter_column(
            'model_name',
            existing_type=sa.VARCHAR(),
            nullable=True
        )


def downgrade():

    with op.batch_alter_table('chat_bots', schema=None) as batch_op:
        batch_op.alter_column(
            'model_name',
            existing_type=sa.VARCHAR(),
            nullable=False
        )

    with op.batch_alter_table('agents', schema=None) as batch_op:
        batch_op.alter_column(
            'model_name',
            existing_type=sa.VARCHAR(),
            nullable=False
        )
