from __future__ import annotations

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

revision = "0006_expand_ai_request_log_text"
down_revision = "0005_chat_session_summary"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.alter_column(
        "sys_ai_request_log",
        "prompt",
        existing_type=sa.Text(),
        type_=mysql.MEDIUMTEXT(),
        existing_nullable=True,
    )
    op.alter_column(
        "sys_ai_request_log",
        "retrieved_chunks",
        existing_type=sa.Text(),
        type_=mysql.MEDIUMTEXT(),
        existing_nullable=True,
    )


def downgrade() -> None:
    op.alter_column(
        "sys_ai_request_log",
        "retrieved_chunks",
        existing_type=mysql.MEDIUMTEXT(),
        type_=sa.Text(),
        existing_nullable=True,
    )
    op.alter_column(
        "sys_ai_request_log",
        "prompt",
        existing_type=mysql.MEDIUMTEXT(),
        type_=sa.Text(),
        existing_nullable=True,
    )
