"""search add ml_text

Revision ID: 1d613083ac89
Revises: 447d65d1f3eb
Create Date: 2025-09-22 11:04:25.256934

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

# revision identifiers, used by Alembic.
revision = '1d613083ac89'
down_revision = '447d65d1f3eb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_full_search', sa.Column('obj_ml_text', sa.TEXT(), nullable=True))
    op.add_column('cmf_full_search', sa.Column('ml_text_tsvector', postgresql.TSVECTOR(), nullable=True))
    op.create_index('ix_cmf_full_search_ml_text_tsvector_gin', 'cmf_full_search', ['ml_text_tsvector'], unique=False, postgresql_using='gin')
    op.create_index('ix_cmf_full_search_obj_ml_text_gin_trgm', 'cmf_full_search', ['obj_ml_text'], unique=False, postgresql_using='gin', postgresql_ops={'obj_ml_text': 'gin_trgm_ops'})
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_cmf_full_search_obj_ml_text_gin_trgm', table_name='cmf_full_search', postgresql_using='gin', postgresql_ops={'obj_ml_text': 'gin_trgm_ops'})
    op.drop_index('ix_cmf_full_search_ml_text_tsvector_gin', table_name='cmf_full_search', postgresql_using='gin')
    op.drop_column('cmf_full_search', 'ml_text_tsvector')
    op.drop_column('cmf_full_search', 'obj_ml_text')
    # ### end Alembic commands ###
