"""rte history

Revision ID: a7359c7fdc02
Revises: 1d3c82255b39
Create Date: 2023-10-02 16:29:33.538555

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a7359c7fdc02'
down_revision = '1d3c82255b39'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_list_history_r_t_e',
    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('spent_sum', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('estimate_value', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('remaining_value', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('spent_value', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('rem_inc', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('rem_dec', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('spent_inc', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('spent_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.Column('timetracker_history_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['task_id'], ['cmf_task.id'], ),
    sa.ForeignKeyConstraint(['task_list_id'], ['cmf_list.id'], ),
    sa.ForeignKeyConstraint(['timetracker_history_id'], ['cmf_time_tracker_history.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_author_id'), 'cmf_list_history_r_t_e', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_created_at'), 'cmf_list_history_r_t_e', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_deleted'), 'cmf_list_history_r_t_e', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_locked_at'), 'cmf_list_history_r_t_e', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_locked_by_id'), 'cmf_list_history_r_t_e', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_modified_at'), 'cmf_list_history_r_t_e', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_modified_by_id'), 'cmf_list_history_r_t_e', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_owner_id'), 'cmf_list_history_r_t_e', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_version'), 'cmf_list_history_r_t_e', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_cmf_viewed_at'), 'cmf_list_history_r_t_e', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_parent_id'), 'cmf_list_history_r_t_e', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_task_id'), 'cmf_list_history_r_t_e', ['task_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_task_list_id'), 'cmf_list_history_r_t_e', ['task_list_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_history_r_t_e_timetracker_history_id'), 'cmf_list_history_r_t_e', ['timetracker_history_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_timetracker_history_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_task_list_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_task_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_parent_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_viewed_at'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_version'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_owner_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_modified_by_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_modified_at'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_locked_by_id'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_locked_at'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_deleted'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_created_at'), table_name='cmf_list_history_r_t_e')
    op.drop_index(op.f('ix_cmf_list_history_r_t_e_cmf_author_id'), table_name='cmf_list_history_r_t_e')
    op.drop_table('cmf_list_history_r_t_e')
    # ### end Alembic commands ###
