"""orm column history

Revision ID: e41efa684636
Revises: 38002b76b029
Create Date: 2025-07-08 13:41:57.225026

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'e41efa684636'
down_revision = '38002b76b029'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_orm_column_history',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('obj_code', sa.String(length=64), nullable=True),
    sa.Column('cmf_model_name', sa.String(length=256), nullable=True),
    sa.Column('field_name', sa.String(length=256), nullable=True),
    sa.Column('from_value', sa.String(), nullable=True),
    sa.Column('to_value', sa.String(), nullable=True),
    sa.Column('from_value_name', sa.String(length=256), nullable=True),
    sa.Column('to_value_name', sa.String(length=256), nullable=True),
    sa.Column('from_value_code', sa.String(length=64), nullable=True),
    sa.Column('to_value_code', sa.String(length=64), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('obj_id', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_orm_column_history_cmf_author_id'), 'cmf_orm_column_history', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_orm_column_history_cmf_created_at'), 'cmf_orm_column_history', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_orm_column_history_from_value_code'), 'cmf_orm_column_history', ['from_value_code'], unique=True)
    op.create_index('ix_cmf_orm_column_history_from_value_code_gin_trgm', 'cmf_orm_column_history', ['from_value_code'], unique=False, postgresql_using='gin', postgresql_ops={'from_value_code': 'gin_trgm_ops'})
    op.create_index(op.f('ix_cmf_orm_column_history_from_value_name'), 'cmf_orm_column_history', ['from_value_name'], unique=False)
    op.create_index('ix_cmf_orm_column_history_from_value_name_gin_trgm', 'cmf_orm_column_history', ['from_value_name'], unique=False, postgresql_using='gin', postgresql_ops={'from_value_name': 'gin_trgm_ops'})
    op.create_index(op.f('ix_cmf_orm_column_history_obj_code'), 'cmf_orm_column_history', ['obj_code'], unique=True)
    op.create_index('ix_cmf_orm_column_history_obj_code_gin_trgm', 'cmf_orm_column_history', ['obj_code'], unique=False, postgresql_using='gin', postgresql_ops={'obj_code': 'gin_trgm_ops'})
    op.create_index(op.f('ix_cmf_orm_column_history_obj_id'), 'cmf_orm_column_history', ['obj_id'], unique=False)
    op.create_index(op.f('ix_cmf_orm_column_history_to_value_code'), 'cmf_orm_column_history', ['to_value_code'], unique=True)
    op.create_index('ix_cmf_orm_column_history_to_value_code_gin_trgm', 'cmf_orm_column_history', ['to_value_code'], unique=False, postgresql_using='gin', postgresql_ops={'to_value_code': 'gin_trgm_ops'})
    op.create_index(op.f('ix_cmf_orm_column_history_to_value_name'), 'cmf_orm_column_history', ['to_value_name'], unique=False)
    op.create_index('ix_cmf_orm_column_history_to_value_name_gin_trgm', 'cmf_orm_column_history', ['to_value_name'], unique=False, postgresql_using='gin', postgresql_ops={'to_value_name': 'gin_trgm_ops'})
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_cmf_orm_column_history_to_value_name_gin_trgm', table_name='cmf_orm_column_history', postgresql_using='gin', postgresql_ops={'to_value_name': 'gin_trgm_ops'})
    op.drop_index(op.f('ix_cmf_orm_column_history_to_value_name'), table_name='cmf_orm_column_history')
    op.drop_index('ix_cmf_orm_column_history_to_value_code_gin_trgm', table_name='cmf_orm_column_history', postgresql_using='gin', postgresql_ops={'to_value_code': 'gin_trgm_ops'})
    op.drop_index(op.f('ix_cmf_orm_column_history_to_value_code'), table_name='cmf_orm_column_history')
    op.drop_index(op.f('ix_cmf_orm_column_history_obj_id'), table_name='cmf_orm_column_history')
    op.drop_index('ix_cmf_orm_column_history_obj_code_gin_trgm', table_name='cmf_orm_column_history', postgresql_using='gin', postgresql_ops={'obj_code': 'gin_trgm_ops'})
    op.drop_index(op.f('ix_cmf_orm_column_history_obj_code'), table_name='cmf_orm_column_history')
    op.drop_index('ix_cmf_orm_column_history_from_value_name_gin_trgm', table_name='cmf_orm_column_history', postgresql_using='gin', postgresql_ops={'from_value_name': 'gin_trgm_ops'})
    op.drop_index(op.f('ix_cmf_orm_column_history_from_value_name'), table_name='cmf_orm_column_history')
    op.drop_index('ix_cmf_orm_column_history_from_value_code_gin_trgm', table_name='cmf_orm_column_history', postgresql_using='gin', postgresql_ops={'from_value_code': 'gin_trgm_ops'})
    op.drop_index(op.f('ix_cmf_orm_column_history_from_value_code'), table_name='cmf_orm_column_history')
    op.drop_index(op.f('ix_cmf_orm_column_history_cmf_created_at'), table_name='cmf_orm_column_history')
    op.drop_index(op.f('ix_cmf_orm_column_history_cmf_author_id'), table_name='cmf_orm_column_history')
    op.drop_table('cmf_orm_column_history')
    # ### end Alembic commands ###
