"""otr history

Revision ID: 6304e8ac8f8e
Revises: 3165d82f8c84
Create Date: 2023-09-29 07:53:43.819385

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '6304e8ac8f8e'
down_revision = '3165d82f8c84'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_list_history_o_t_r',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('task_list_operate', sa.String(length=32), nullable=True),
    sa.Column('task_operate', sa.String(length=32), nullable=True),
    sa.Column('date', sa.DATE(), nullable=True),
    sa.Column('counter_type', sa.String(length=32), nullable=False),
    sa.Column('remaining_sum', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('estimate_sum', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('value', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('rem_inс', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('rem_dec', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('current', sa.Boolean(), nullable=False),
    sa.Column('show_chart', sa.Boolean(), nullable=False),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('task_id', sa.String(length=64), nullable=True),
    sa.Column('task_list_id', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['task_id'], ['cmf_task.id'], ),
    sa.ForeignKeyConstraint(['task_list_id'], ['cmf_list.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_author_id'), 'cmf_list_history_o_t_r', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_created_at'), 'cmf_list_history_o_t_r', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_deleted'), 'cmf_list_history_o_t_r', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_locked_at'), 'cmf_list_history_o_t_r', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_locked_by_id'), 'cmf_list_history_o_t_r', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_modified_at'), 'cmf_list_history_o_t_r', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_modified_by_id'), 'cmf_list_history_o_t_r', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_owner_id'), 'cmf_list_history_o_t_r', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_version'), 'cmf_list_history_o_t_r', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_cmf_viewed_at'), 'cmf_list_history_o_t_r', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_parent_id'), 'cmf_list_history_o_t_r', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_task_id'), 'cmf_list_history_o_t_r', ['task_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_o_t_r_task_list_id'), 'cmf_list_history_o_t_r', ['task_list_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_task_list_id'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_task_id'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_parent_id'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_viewed_at'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_version'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_owner_id'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_modified_by_id'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_modified_at'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_locked_by_id'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_locked_at'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_deleted'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_created_at'), table_name='cmf_list_history_o_t_r')
    op.drop_index(op.f('ix_cmf_list_history_o_t_r_cmf_author_id'), table_name='cmf_list_history_o_t_r')
    op.drop_table('cmf_list_history_o_t_r')
    # ### end Alembic commands ###
