"""cmf_import become ActiveEntity

Revision ID: b9d54b62ac5a
Revises: 6433ba2e0bdd
Create Date: 2022-06-09 17:55:45.336484

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b9d54b62ac5a'
down_revision = '6433ba2e0bdd'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_import_executors',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_import_executors_left_id'), 'cmf_import_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_executors_parent_id'), 'cmf_import_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_executors_right_id'), 'cmf_import_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_executors_root_id'), 'cmf_import_executors', ['root_id'], unique=False)
    op.create_table('cmf_import_spectators',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_import_spectators_left_id'), 'cmf_import_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_spectators_parent_id'), 'cmf_import_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_spectators_right_id'), 'cmf_import_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_spectators_root_id'), 'cmf_import_spectators', ['root_id'], unique=False)
    op.add_column('cmf_import', sa.Column('is_public', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('is_public_editable', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('is_public_comments', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('status_in_progress_start', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('status_in_progress_end', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('status_review_at', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('status_closed_at', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('no_control', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('priority_old', sa.String(length=32), nullable=False, server_default='0'))
    op.add_column('cmf_import', sa.Column('priority', sa.Integer(), nullable=False, server_default='0'))
    op.add_column('cmf_import', sa.Column('mark', sa.String(length=32), nullable=True))
    op.add_column('cmf_import', sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('time_estimate', sa.Integer(), nullable=True))
    op.add_column('cmf_import', sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_import', sa.Column('period_interval', sa.String(length=32), nullable=True))
    op.add_column('cmf_import', sa.Column('is_template', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('is_penalty', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('cache_status_type', sa.String(length=32), nullable=True))
    op.add_column('cmf_import', sa.Column('cache_fields', sa.TEXT(), nullable=True))
    op.add_column('cmf_import', sa.Column('approved', sa.Boolean(), nullable=False, server_default='false'))
    op.add_column('cmf_import', sa.Column('perm_readonly', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('perm_private', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('perm_encrypt', sa.Boolean(), nullable=True))
    op.add_column('cmf_import', sa.Column('workflow_type', sa.String(), nullable=True))
    op.add_column('cmf_import', sa.Column('workflow_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('default_task_workflow_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('company_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('responsible_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('waiting_for_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('cloned_from_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('activity_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_import', sa.Column('cache_status_opt_id', sa.String(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_import_activity_id'), 'cmf_import', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_alarm_date'), 'cmf_import', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_import_approved'), 'cmf_import', ['approved'], unique=False)
    op.create_index(op.f('ix_cmf_import_cache_status_opt_id'), 'cmf_import', ['cache_status_opt_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_cache_status_type'), 'cmf_import', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_import_cloned_from_id'), 'cmf_import', ['cloned_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_company_id'), 'cmf_import', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_default_task_workflow_id'), 'cmf_import', ['default_task_workflow_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_is_template'), 'cmf_import', ['is_template'], unique=False)
    op.create_index(op.f('ix_cmf_import_responsible_id'), 'cmf_import', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_waiting_for_id'), 'cmf_import', ['waiting_for_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_workflow_id'), 'cmf_import', ['workflow_id'], unique=False)
    op.create_index(op.f('ix_cmf_import_workflow_type'), 'cmf_import', ['workflow_type'], unique=False)
    op.create_foreign_key(None, 'cmf_import', 'cmf_company', ['company_id'], ['id'])
    op.create_foreign_key(None, 'cmf_import', 'cmf_status_opt', ['cache_status_opt_id'], ['id'])
    op.create_foreign_key(None, 'cmf_import', 'cmf_activity', ['activity_id'], ['id'])
    op.create_foreign_key(None, 'cmf_import', 'cmf_workflow', ['workflow_id'], ['id'])
    op.create_foreign_key(None, 'cmf_import', 'cmf_workflow', ['default_task_workflow_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'cmf_import', type_='foreignkey')
    op.drop_constraint(None, 'cmf_import', type_='foreignkey')
    op.drop_constraint(None, 'cmf_import', type_='foreignkey')
    op.drop_constraint(None, 'cmf_import', type_='foreignkey')
    op.drop_constraint(None, 'cmf_import', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_import_workflow_type'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_workflow_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_waiting_for_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_responsible_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_is_template'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_default_task_workflow_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_company_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_cloned_from_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_cache_status_type'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_cache_status_opt_id'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_approved'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_alarm_date'), table_name='cmf_import')
    op.drop_index(op.f('ix_cmf_import_activity_id'), table_name='cmf_import')
    op.drop_column('cmf_import', 'cache_status_opt_id')
    op.drop_column('cmf_import', 'activity_id')
    op.drop_column('cmf_import', 'cloned_from_id')
    op.drop_column('cmf_import', 'waiting_for_id')
    op.drop_column('cmf_import', 'responsible_id')
    op.drop_column('cmf_import', 'company_id')
    op.drop_column('cmf_import', 'default_task_workflow_id')
    op.drop_column('cmf_import', 'workflow_id')
    op.drop_column('cmf_import', 'workflow_type')
    op.drop_column('cmf_import', 'perm_encrypt')
    op.drop_column('cmf_import', 'perm_private')
    op.drop_column('cmf_import', 'perm_readonly')
    op.drop_column('cmf_import', 'approved')
    op.drop_column('cmf_import', 'cache_fields')
    op.drop_column('cmf_import', 'cache_status_type')
    op.drop_column('cmf_import', 'is_penalty')
    op.drop_column('cmf_import', 'is_template')
    op.drop_column('cmf_import', 'period_interval')
    op.drop_column('cmf_import', 'period_next_date')
    op.drop_column('cmf_import', 'plan_end_date')
    op.drop_column('cmf_import', 'plan_start_date')
    op.drop_column('cmf_import', 'time_estimate')
    op.drop_column('cmf_import', 'deadline')
    op.drop_column('cmf_import', 'alarm_date')
    op.drop_column('cmf_import', 'mark')
    op.drop_column('cmf_import', 'priority')
    op.drop_column('cmf_import', 'priority_old')
    op.drop_column('cmf_import', 'no_control')
    op.drop_column('cmf_import', 'status_closed_at')
    op.drop_column('cmf_import', 'status_review_at')
    op.drop_column('cmf_import', 'status_in_progress_end')
    op.drop_column('cmf_import', 'status_in_progress_start')
    op.drop_column('cmf_import', 'status_modified_at')
    op.drop_column('cmf_import', 'is_public_comments')
    op.drop_column('cmf_import', 'is_public_editable')
    op.drop_column('cmf_import', 'is_public')
    op.drop_index(op.f('ix_cmf_import_spectators_root_id'), table_name='cmf_import_spectators')
    op.drop_index(op.f('ix_cmf_import_spectators_right_id'), table_name='cmf_import_spectators')
    op.drop_index(op.f('ix_cmf_import_spectators_parent_id'), table_name='cmf_import_spectators')
    op.drop_index(op.f('ix_cmf_import_spectators_left_id'), table_name='cmf_import_spectators')
    op.drop_table('cmf_import_spectators')
    op.drop_index(op.f('ix_cmf_import_executors_root_id'), table_name='cmf_import_executors')
    op.drop_index(op.f('ix_cmf_import_executors_right_id'), table_name='cmf_import_executors')
    op.drop_index(op.f('ix_cmf_import_executors_parent_id'), table_name='cmf_import_executors')
    op.drop_index(op.f('ix_cmf_import_executors_left_id'), table_name='cmf_import_executors')
    op.drop_table('cmf_import_executors')
    # ### end Alembic commands ###
