"""cmf_text_search3

Revision ID: bf2258be5664
Revises: b1fb2bc34014
Create Date: 2023-09-28 01:47:35.692239

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

# revision identifiers, used by Alembic.
revision = 'bf2258be5664'
down_revision = 'b1fb2bc34014'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_text_search', sa.Column('obj_result_text', sa.TEXT(), nullable=True))
    op.add_column('cmf_text_search', sa.Column('result_text_tsvector', postgresql.TSVECTOR(), nullable=True))
    op.drop_index('ix_cmf_text_search_obj_result_gin_trgm', table_name='cmf_text_search')
    op.drop_index('ix_cmf_text_search_result_tsvector_gin', table_name='cmf_text_search')
    op.create_index('ix_cmf_text_search_obj_result_text_gin_trgm', 'cmf_text_search', ['obj_result_text'], unique=False, postgresql_using='gin', postgresql_ops={'obj_result_text': 'gin_trgm_ops'})
    op.create_index('ix_cmf_text_search_result_text_tsvector_gin', 'cmf_text_search', ['result_text_tsvector'], unique=False, postgresql_using='gin')
    op.drop_column('cmf_text_search', 'obj_result')
    op.drop_column('cmf_text_search', 'result_tsvector')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_text_search', sa.Column('result_tsvector', postgresql.TSVECTOR(), autoincrement=False, nullable=True))
    op.add_column('cmf_text_search', sa.Column('obj_result', sa.TEXT(), autoincrement=False, nullable=True))
    op.drop_index('ix_cmf_text_search_result_text_tsvector_gin', table_name='cmf_text_search', postgresql_using='gin')
    op.drop_index('ix_cmf_text_search_obj_result_text_gin_trgm', table_name='cmf_text_search', postgresql_using='gin', postgresql_ops={'obj_result_text': 'gin_trgm_ops'})
    op.create_index('ix_cmf_text_search_result_tsvector_gin', 'cmf_text_search', ['result_tsvector'], unique=False)
    op.create_index('ix_cmf_text_search_obj_result_gin_trgm', 'cmf_text_search', ['obj_result'], unique=False)
    op.drop_column('cmf_text_search', 'result_text_tsvector')
    op.drop_column('cmf_text_search', 'obj_result_text')
    # ### end Alembic commands ###
