"""empty message

Revision ID: 66dc0ae05abe
Revises: fede06177f16
Create Date: 2021-01-15 10:36:39.408528

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '66dc0ae05abe'
down_revision = 'fede06177f16'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_company_executors',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_company_executors_left_id'), 'cmf_company_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_executors_parent_id'), 'cmf_company_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_executors_right_id'), 'cmf_company_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_executors_root_id'), 'cmf_company_executors', ['root_id'], unique=False)
    op.create_table('cmf_company_related_objects',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_company_related_objects_left_id'), 'cmf_company_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_related_objects_parent_id'), 'cmf_company_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_related_objects_right_id'), 'cmf_company_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_related_objects_root_id'), 'cmf_company_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_company_spectators',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_company_spectators_left_id'), 'cmf_company_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_spectators_parent_id'), 'cmf_company_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_spectators_right_id'), 'cmf_company_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_spectators_root_id'), 'cmf_company_spectators', ['root_id'], unique=False)
    op.alter_column('cmf_chat_group', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_chat_topic', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.add_column('cmf_company', sa.Column('activity_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_company', sa.Column('cache_status_type', sa.String(length=32), nullable=True))
    op.add_column('cmf_company', sa.Column('company_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_company', sa.Column('is_penalty', sa.Boolean(), nullable=True))
    op.add_column('cmf_company', sa.Column('mark', sa.String(length=32), nullable=True))
    op.add_column('cmf_company', sa.Column('no_control', sa.Boolean(), nullable=True))
    op.add_column('cmf_company', sa.Column('orderno', sa.Integer(), nullable=True))
    op.add_column('cmf_company', sa.Column('parent_task_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('period_clone_from_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('period_interval', sa.String(length=32), nullable=True))
    op.add_column('cmf_company', sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_company', sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_company', sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_company', sa.Column('priority', sa.String(length=32), nullable=True))
    op.add_column('cmf_company', sa.Column('project_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('responsible_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('status_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True))
    op.add_column('cmf_company', sa.Column('tags', sa.TEXT(), nullable=True))
    op.add_column('cmf_company', sa.Column('time_estimate', sa.Integer(), nullable=True))
    op.add_column('cmf_company', sa.Column('tree_parent_id', sa.String(length=64), nullable=True))
    op.add_column('cmf_company', sa.Column('waiting_for_id', sa.String(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_company_activity_id'), 'cmf_company', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_alarm_date'), 'cmf_company', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_company_cache_status_type'), 'cmf_company', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_company_company_id'), 'cmf_company', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_orderno'), 'cmf_company', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_company_parent_task_id'), 'cmf_company', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_period_clone_from_id'), 'cmf_company', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_project_id'), 'cmf_company', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_responsible_id'), 'cmf_company', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_status_id'), 'cmf_company', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_tree_parent_id'), 'cmf_company', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_company_waiting_for_id'), 'cmf_company', ['waiting_for_id'], unique=False)
    op.create_foreign_key(None, 'cmf_company', 'cmf_project', ['project_id'], ['id'])
    op.create_foreign_key(None, 'cmf_company', 'cmf_company', ['company_id'], ['id'])
    op.create_foreign_key(None, 'cmf_company', 'cmf_activity', ['activity_id'], ['id'])
    op.create_foreign_key(None, 'cmf_company', 'cmf_status', ['status_id'], ['id'])
    op.alter_column('cmf_deal', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_document', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_invoice', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_lead', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_list', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_payment', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_pipeline', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_purchase_order', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_purchase_order_items', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_sales_order', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_stock_move', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_stock_move_items', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_task', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_u_work_post', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('cmf_u_work_post', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_task', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_stock_move_items', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_stock_move', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_sales_order', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_purchase_order_items', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_purchase_order', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_pipeline', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_payment', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_list', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_lead', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_invoice', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_document', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_deal', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.drop_constraint(None, 'cmf_company', type_='foreignkey')
    op.drop_constraint(None, 'cmf_company', type_='foreignkey')
    op.drop_constraint(None, 'cmf_company', type_='foreignkey')
    op.drop_constraint(None, 'cmf_company', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_company_waiting_for_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_tree_parent_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_status_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_responsible_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_project_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_period_clone_from_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_parent_task_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_orderno'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_company_id'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_cache_status_type'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_alarm_date'), table_name='cmf_company')
    op.drop_index(op.f('ix_cmf_company_activity_id'), table_name='cmf_company')
    op.drop_column('cmf_company', 'waiting_for_id')
    op.drop_column('cmf_company', 'tree_parent_id')
    op.drop_column('cmf_company', 'time_estimate')
    op.drop_column('cmf_company', 'tags')
    op.drop_column('cmf_company', 'status_modified_at')
    op.drop_column('cmf_company', 'status_id')
    op.drop_column('cmf_company', 'responsible_id')
    op.drop_column('cmf_company', 'project_id')
    op.drop_column('cmf_company', 'priority')
    op.drop_column('cmf_company', 'plan_start_date')
    op.drop_column('cmf_company', 'plan_end_date')
    op.drop_column('cmf_company', 'period_next_date')
    op.drop_column('cmf_company', 'period_interval')
    op.drop_column('cmf_company', 'period_clone_from_id')
    op.drop_column('cmf_company', 'parent_task_id')
    op.drop_column('cmf_company', 'orderno')
    op.drop_column('cmf_company', 'no_control')
    op.drop_column('cmf_company', 'mark')
    op.drop_column('cmf_company', 'is_penalty')
    op.drop_column('cmf_company', 'deadline')
    op.drop_column('cmf_company', 'company_id')
    op.drop_column('cmf_company', 'cache_status_type')
    op.drop_column('cmf_company', 'alarm_date')
    op.drop_column('cmf_company', 'activity_id')
    op.alter_column('cmf_chat_topic', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.alter_column('cmf_chat_group', 'priority',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.drop_index(op.f('ix_cmf_company_spectators_root_id'), table_name='cmf_company_spectators')
    op.drop_index(op.f('ix_cmf_company_spectators_right_id'), table_name='cmf_company_spectators')
    op.drop_index(op.f('ix_cmf_company_spectators_parent_id'), table_name='cmf_company_spectators')
    op.drop_index(op.f('ix_cmf_company_spectators_left_id'), table_name='cmf_company_spectators')
    op.drop_table('cmf_company_spectators')
    op.drop_index(op.f('ix_cmf_company_related_objects_root_id'), table_name='cmf_company_related_objects')
    op.drop_index(op.f('ix_cmf_company_related_objects_right_id'), table_name='cmf_company_related_objects')
    op.drop_index(op.f('ix_cmf_company_related_objects_parent_id'), table_name='cmf_company_related_objects')
    op.drop_index(op.f('ix_cmf_company_related_objects_left_id'), table_name='cmf_company_related_objects')
    op.drop_table('cmf_company_related_objects')
    op.drop_index(op.f('ix_cmf_company_executors_root_id'), table_name='cmf_company_executors')
    op.drop_index(op.f('ix_cmf_company_executors_right_id'), table_name='cmf_company_executors')
    op.drop_index(op.f('ix_cmf_company_executors_parent_id'), table_name='cmf_company_executors')
    op.drop_index(op.f('ix_cmf_company_executors_left_id'), table_name='cmf_company_executors')
    op.drop_table('cmf_company_executors')
    # ### end Alembic commands ###
