"""Remove obsolete fields from tenants due to Catalog introduction

Revision ID: 741bb5dac7f3
Revises: a678c84d5633
Create Date: 2024-10-16 11:34:59.194992

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '741bb5dac7f3'
down_revision = 'a678c84d5633'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('tenant', schema=None) as batch_op:
        batch_op.drop_column('rag_tuning')
        batch_op.drop_column('html_excluded_classes')
        batch_op.drop_column('html_tags')
        batch_op.drop_column('chat_RAG_temperature')
        batch_op.drop_column('html_excluded_elements')
        batch_op.drop_column('embed_tuning')
        batch_op.drop_column('es_similarity_threshold')
        batch_op.drop_column('chat_no_RAG_temperature')
        batch_op.drop_column('html_end_tags')
        batch_op.drop_column('html_included_elements')
        batch_op.drop_column('max_chunk_size')
        batch_op.drop_column('min_chunk_size')
        batch_op.drop_column('es_k')

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('tenant', schema=None) as batch_op:
        batch_op.add_column(sa.Column('es_k', sa.INTEGER(), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('min_chunk_size', sa.INTEGER(), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('max_chunk_size', sa.INTEGER(), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('html_included_elements', postgresql.ARRAY(sa.VARCHAR(length=50)), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('html_end_tags', postgresql.ARRAY(sa.VARCHAR(length=10)), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('chat_no_RAG_temperature', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('es_similarity_threshold', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('embed_tuning', sa.BOOLEAN(), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('html_excluded_elements', postgresql.ARRAY(sa.VARCHAR(length=50)), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('chat_RAG_temperature', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('html_tags', postgresql.ARRAY(sa.VARCHAR(length=10)), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('html_excluded_classes', postgresql.ARRAY(sa.VARCHAR(length=200)), autoincrement=False, nullable=True))
        batch_op.add_column(sa.Column('rag_tuning', sa.BOOLEAN(), autoincrement=False, nullable=True))

    # ### end Alembic commands ###
