"""empty message

Revision ID: 5da0a12f74d1
Revises: 1843bb2d7b77
Create Date: 2020-12-16 18:28:49.780215

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '5da0a12f74d1'
down_revision = '3850a2b469ae'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_kanban_sales_status_objects',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_kanban_sales_status_objects_left_id'), 'cmf_kanban_sales_status_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_objects_parent_id'), 'cmf_kanban_sales_status_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_objects_right_id'), 'cmf_kanban_sales_status_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_objects_root_id'), 'cmf_kanban_sales_status_objects', ['root_id'], unique=False)
    op.create_table('cmf_u_work_bill_executors',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_bill_executors_left_id'), 'cmf_u_work_bill_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_executors_parent_id'), 'cmf_u_work_bill_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_executors_right_id'), 'cmf_u_work_bill_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_executors_root_id'), 'cmf_u_work_bill_executors', ['root_id'], unique=False)
    op.create_table('cmf_u_work_bill_related_objects',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_bill_related_objects_left_id'), 'cmf_u_work_bill_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_related_objects_parent_id'), 'cmf_u_work_bill_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_related_objects_right_id'), 'cmf_u_work_bill_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_related_objects_root_id'), 'cmf_u_work_bill_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_u_work_bill_spectators',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_bill_spectators_left_id'), 'cmf_u_work_bill_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_spectators_parent_id'), 'cmf_u_work_bill_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_spectators_right_id'), 'cmf_u_work_bill_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_spectators_root_id'), 'cmf_u_work_bill_spectators', ['root_id'], unique=False)
    op.create_table('cmf_u_work_deal_executors',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_deal_executors_left_id'), 'cmf_u_work_deal_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_executors_parent_id'), 'cmf_u_work_deal_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_executors_right_id'), 'cmf_u_work_deal_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_executors_root_id'), 'cmf_u_work_deal_executors', ['root_id'], unique=False)
    op.create_table('cmf_u_work_deal_related_objects',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_deal_related_objects_left_id'), 'cmf_u_work_deal_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_related_objects_parent_id'), 'cmf_u_work_deal_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_related_objects_right_id'), 'cmf_u_work_deal_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_related_objects_root_id'), 'cmf_u_work_deal_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_u_work_deal_spectators',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_deal_spectators_left_id'), 'cmf_u_work_deal_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_spectators_parent_id'), 'cmf_u_work_deal_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_spectators_right_id'), 'cmf_u_work_deal_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_spectators_root_id'), 'cmf_u_work_deal_spectators', ['root_id'], unique=False)
    op.create_table('cmf_u_work_lead_executors',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_lead_executors_left_id'), 'cmf_u_work_lead_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_executors_parent_id'), 'cmf_u_work_lead_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_executors_right_id'), 'cmf_u_work_lead_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_executors_root_id'), 'cmf_u_work_lead_executors', ['root_id'], unique=False)
    op.create_table('cmf_u_work_lead_related_objects',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_lead_related_objects_left_id'), 'cmf_u_work_lead_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_related_objects_parent_id'), 'cmf_u_work_lead_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_related_objects_right_id'), 'cmf_u_work_lead_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_related_objects_root_id'), 'cmf_u_work_lead_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_u_work_lead_spectators',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_lead_spectators_left_id'), 'cmf_u_work_lead_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_spectators_parent_id'), 'cmf_u_work_lead_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_spectators_right_id'), 'cmf_u_work_lead_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_spectators_root_id'), 'cmf_u_work_lead_spectators', ['root_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_executors',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_sales_list_executors_left_id'), 'cmf_u_work_sales_list_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_executors_parent_id'), 'cmf_u_work_sales_list_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_executors_right_id'), 'cmf_u_work_sales_list_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_executors_root_id'), 'cmf_u_work_sales_list_executors', ['root_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_members',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_sales_list_members_left_id'), 'cmf_u_work_sales_list_members', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_members_parent_id'), 'cmf_u_work_sales_list_members', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_members_right_id'), 'cmf_u_work_sales_list_members', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_members_root_id'), 'cmf_u_work_sales_list_members', ['root_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_related_objects',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_sales_list_related_objects_left_id'), 'cmf_u_work_sales_list_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_related_objects_parent_id'), 'cmf_u_work_sales_list_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_related_objects_right_id'), 'cmf_u_work_sales_list_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_related_objects_root_id'), 'cmf_u_work_sales_list_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_spectators',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.Column('root_id', sa.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_sales_list_spectators_left_id'), 'cmf_u_work_sales_list_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_spectators_parent_id'), 'cmf_u_work_sales_list_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_spectators_right_id'), 'cmf_u_work_sales_list_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_spectators_root_id'), 'cmf_u_work_sales_list_spectators', ['root_id'], unique=False)
    op.create_table('cmf_u_work_deal',
    sa.Column('activity_id', sa.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cache_status_type', sa.String(length=32), nullable=True),
    sa.Column('cmf_author_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_locked_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_modified_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', sa.Integer(), nullable=True),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('company_id', sa.CHAR(length=64), nullable=True),
    sa.Column('currency_id', sa.CHAR(length=64), nullable=True),
    sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', sa.Boolean(), nullable=True),
    sa.Column('mark', sa.String(length=32), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('no_control', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('parent_task_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_interval', sa.String(length=32), nullable=True),
    sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('priority', sa.String(length=32), nullable=False),
    sa.Column('project_id', sa.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('summa', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('tags', sa.TEXT(), nullable=True),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('time_estimate', sa.Integer(), nullable=True),
    sa.Column('tree_parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('utm_mark', sa.TEXT(), nullable=True),
    sa.Column('waiting_for_id', sa.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], ),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], ),
    sa.ForeignKeyConstraint(['currency_id'], ['cmf_currency.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_deal_activity_id'), 'cmf_u_work_deal', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_alarm_date'), 'cmf_u_work_deal', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cache_status_type'), 'cmf_u_work_deal', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_author_id'), 'cmf_u_work_deal', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_created_at'), 'cmf_u_work_deal', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_deleted'), 'cmf_u_work_deal', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_locked_at'), 'cmf_u_work_deal', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_locked_by_id'), 'cmf_u_work_deal', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_modified_at'), 'cmf_u_work_deal', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_modified_by_id'), 'cmf_u_work_deal', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_owner_id'), 'cmf_u_work_deal', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_version'), 'cmf_u_work_deal', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_viewed_at'), 'cmf_u_work_deal', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_code'), 'cmf_u_work_deal', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_u_work_deal_company_id'), 'cmf_u_work_deal', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_currency_id'), 'cmf_u_work_deal', ['currency_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_name'), 'cmf_u_work_deal', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_orderno'), 'cmf_u_work_deal', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_parent_task_id'), 'cmf_u_work_deal', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_period_clone_from_id'), 'cmf_u_work_deal', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_project_id'), 'cmf_u_work_deal', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_responsible_id'), 'cmf_u_work_deal', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_status_id'), 'cmf_u_work_deal', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_tree_parent_id'), 'cmf_u_work_deal', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_waiting_for_id'), 'cmf_u_work_deal', ['waiting_for_id'], unique=False)
    op.create_table('cmf_u_work_lead',
    sa.Column('activity_id', sa.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cache_status_type', sa.String(length=32), nullable=True),
    sa.Column('cmf_author_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_locked_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_modified_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', sa.Integer(), nullable=True),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('company_id', sa.CHAR(length=64), nullable=True),
    sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', sa.Boolean(), nullable=True),
    sa.Column('mark', sa.String(length=32), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('no_control', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('parent_task_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_interval', sa.String(length=32), nullable=True),
    sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('priority', sa.String(length=32), nullable=False),
    sa.Column('project_id', sa.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('tags', sa.TEXT(), nullable=True),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('time_estimate', sa.Integer(), nullable=True),
    sa.Column('tree_parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('waiting_for_id', sa.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], ),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_lead_activity_id'), 'cmf_u_work_lead', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_alarm_date'), 'cmf_u_work_lead', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cache_status_type'), 'cmf_u_work_lead', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_author_id'), 'cmf_u_work_lead', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_created_at'), 'cmf_u_work_lead', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_deleted'), 'cmf_u_work_lead', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_locked_at'), 'cmf_u_work_lead', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_locked_by_id'), 'cmf_u_work_lead', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_modified_at'), 'cmf_u_work_lead', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_modified_by_id'), 'cmf_u_work_lead', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_owner_id'), 'cmf_u_work_lead', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_version'), 'cmf_u_work_lead', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_cmf_viewed_at'), 'cmf_u_work_lead', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_code'), 'cmf_u_work_lead', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_u_work_lead_company_id'), 'cmf_u_work_lead', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_name'), 'cmf_u_work_lead', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_orderno'), 'cmf_u_work_lead', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_parent_task_id'), 'cmf_u_work_lead', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_period_clone_from_id'), 'cmf_u_work_lead', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_project_id'), 'cmf_u_work_lead', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_responsible_id'), 'cmf_u_work_lead', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_status_id'), 'cmf_u_work_lead', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_tree_parent_id'), 'cmf_u_work_lead', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_lead_waiting_for_id'), 'cmf_u_work_lead', ['waiting_for_id'], unique=False)
    op.create_table('cmf_u_work_sales_list',
    sa.Column('activity_id', sa.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cache_status_type', sa.String(length=32), nullable=True),
    sa.Column('cmf_author_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_locked_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_modified_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', sa.Integer(), nullable=True),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('company_id', sa.CHAR(length=64), nullable=True),
    sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', sa.Boolean(), nullable=True),
    sa.Column('list_type', sa.String(length=32), nullable=False),
    sa.Column('mark', sa.String(length=32), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('no_control', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('parent_task_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_interval', sa.String(length=32), nullable=True),
    sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('priority', sa.String(length=32), nullable=False),
    sa.Column('project_id', sa.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('tags', sa.TEXT(), nullable=True),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('time_estimate', sa.Integer(), nullable=True),
    sa.Column('tree_parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('waiting_for_id', sa.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], ),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_sales_list_activity_id'), 'cmf_u_work_sales_list', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_alarm_date'), 'cmf_u_work_sales_list', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cache_status_type'), 'cmf_u_work_sales_list', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_author_id'), 'cmf_u_work_sales_list', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_created_at'), 'cmf_u_work_sales_list', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_deleted'), 'cmf_u_work_sales_list', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_locked_at'), 'cmf_u_work_sales_list', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_locked_by_id'), 'cmf_u_work_sales_list', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_modified_at'), 'cmf_u_work_sales_list', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_modified_by_id'), 'cmf_u_work_sales_list', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_owner_id'), 'cmf_u_work_sales_list', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_version'), 'cmf_u_work_sales_list', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_cmf_viewed_at'), 'cmf_u_work_sales_list', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_code'), 'cmf_u_work_sales_list', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_u_work_sales_list_company_id'), 'cmf_u_work_sales_list', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_name'), 'cmf_u_work_sales_list', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_orderno'), 'cmf_u_work_sales_list', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_parent_task_id'), 'cmf_u_work_sales_list', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_period_clone_from_id'), 'cmf_u_work_sales_list', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_project_id'), 'cmf_u_work_sales_list', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_responsible_id'), 'cmf_u_work_sales_list', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_status_id'), 'cmf_u_work_sales_list', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_tree_parent_id'), 'cmf_u_work_sales_list', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_sales_list_waiting_for_id'), 'cmf_u_work_sales_list', ['waiting_for_id'], unique=False)
    op.create_table('cmf_deal_product',
    sa.Column('cache_product_name', sa.String(length=256), nullable=True),
    sa.Column('cmf_author_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_locked_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_modified_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', sa.Integer(), nullable=True),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('count', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('deal_id', sa.CHAR(length=64), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('price', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('product_id', sa.CHAR(length=64), nullable=True),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.ForeignKeyConstraint(['deal_id'], ['cmf_u_work_deal.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_deal_product_cmf_author_id'), 'cmf_deal_product', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_created_at'), 'cmf_deal_product', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_deleted'), 'cmf_deal_product', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_locked_at'), 'cmf_deal_product', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_locked_by_id'), 'cmf_deal_product', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_modified_at'), 'cmf_deal_product', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_modified_by_id'), 'cmf_deal_product', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_owner_id'), 'cmf_deal_product', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_version'), 'cmf_deal_product', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_cmf_viewed_at'), 'cmf_deal_product', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_code'), 'cmf_deal_product', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_deal_product_deal_id'), 'cmf_deal_product', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_name'), 'cmf_deal_product', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_deal_product_product_id'), 'cmf_deal_product', ['product_id'], unique=False)
    op.create_table('cmf_kanban_sales_status',
    sa.Column('cmf_author_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_locked_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_modified_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', sa.Integer(), nullable=True),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('color', sa.String(length=32), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('project_id', sa.CHAR(length=64), nullable=True),
    sa.Column('sales_list_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_id', sa.CHAR(length=64), nullable=True),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], ),
    sa.ForeignKeyConstraint(['sales_list_id'], ['cmf_u_work_sales_list.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_author_id'), 'cmf_kanban_sales_status', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_created_at'), 'cmf_kanban_sales_status', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_deleted'), 'cmf_kanban_sales_status', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_locked_at'), 'cmf_kanban_sales_status', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_locked_by_id'), 'cmf_kanban_sales_status', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_modified_at'), 'cmf_kanban_sales_status', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_modified_by_id'), 'cmf_kanban_sales_status', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_owner_id'), 'cmf_kanban_sales_status', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_version'), 'cmf_kanban_sales_status', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_cmf_viewed_at'), 'cmf_kanban_sales_status', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_code'), 'cmf_kanban_sales_status', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_kanban_sales_status_name'), 'cmf_kanban_sales_status', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_orderno'), 'cmf_kanban_sales_status', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_project_id'), 'cmf_kanban_sales_status', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_sales_list_id'), 'cmf_kanban_sales_status', ['sales_list_id'], unique=False)
    op.create_index(op.f('ix_cmf_kanban_sales_status_status_id'), 'cmf_kanban_sales_status', ['status_id'], unique=False)
    op.create_table('cmf_u_work_bill',
    sa.Column('activity_id', sa.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cache_status_type', sa.String(length=32), nullable=True),
    sa.Column('cmf_author_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_locked_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_modified_by_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', sa.Integer(), nullable=True),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('company_id', sa.CHAR(length=64), nullable=True),
    sa.Column('currency_id', sa.CHAR(length=64), nullable=True),
    sa.Column('customer_id', sa.CHAR(length=64), nullable=True),
    sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('deal_id', sa.CHAR(length=64), nullable=True),
    sa.Column('discount', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', sa.Boolean(), nullable=True),
    sa.Column('mark', sa.String(length=32), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('no_control', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('parent_task_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', sa.CHAR(length=64), nullable=True),
    sa.Column('period_interval', sa.String(length=32), nullable=True),
    sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('print_tmpl_id', sa.CHAR(length=64), nullable=True),
    sa.Column('priority', sa.String(length=32), nullable=False),
    sa.Column('project_id', sa.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_id', sa.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('tags', sa.TEXT(), nullable=True),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('time_estimate', sa.Integer(), nullable=True),
    sa.Column('tree_parent_id', sa.CHAR(length=64), nullable=True),
    sa.Column('waiting_for_id', sa.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], ),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], ),
    sa.ForeignKeyConstraint(['currency_id'], ['cmf_currency.id'], ),
    sa.ForeignKeyConstraint(['deal_id'], ['cmf_u_work_deal.id'], ),
    sa.ForeignKeyConstraint(['print_tmpl_id'], ['cmf_print_tmpl.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_bill_activity_id'), 'cmf_u_work_bill', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_alarm_date'), 'cmf_u_work_bill', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cache_status_type'), 'cmf_u_work_bill', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_author_id'), 'cmf_u_work_bill', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_created_at'), 'cmf_u_work_bill', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_deleted'), 'cmf_u_work_bill', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_locked_at'), 'cmf_u_work_bill', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_locked_by_id'), 'cmf_u_work_bill', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_modified_at'), 'cmf_u_work_bill', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_modified_by_id'), 'cmf_u_work_bill', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_owner_id'), 'cmf_u_work_bill', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_version'), 'cmf_u_work_bill', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_cmf_viewed_at'), 'cmf_u_work_bill', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_code'), 'cmf_u_work_bill', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_u_work_bill_company_id'), 'cmf_u_work_bill', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_currency_id'), 'cmf_u_work_bill', ['currency_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_customer_id'), 'cmf_u_work_bill', ['customer_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_deal_id'), 'cmf_u_work_bill', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_name'), 'cmf_u_work_bill', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_orderno'), 'cmf_u_work_bill', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_parent_task_id'), 'cmf_u_work_bill', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_period_clone_from_id'), 'cmf_u_work_bill', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_print_tmpl_id'), 'cmf_u_work_bill', ['print_tmpl_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_project_id'), 'cmf_u_work_bill', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_responsible_id'), 'cmf_u_work_bill', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_status_id'), 'cmf_u_work_bill', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_tree_parent_id'), 'cmf_u_work_bill', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_bill_waiting_for_id'), 'cmf_u_work_bill', ['waiting_for_id'], unique=False)
    op.create_table('cmf_u_work_deal_cmf_company',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_u_work_deal.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_company.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_company_left_id'), 'cmf_u_work_deal_cmf_company', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_company_right_id'), 'cmf_u_work_deal_cmf_company', ['right_id'], unique=False)
    op.create_table('cmf_u_work_deal_cmf_person',
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('id', sa.CHAR(length=64), nullable=False),
    sa.Column('left_id', sa.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_id', sa.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_u_work_deal.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_person.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_person_left_id'), 'cmf_u_work_deal_cmf_person', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_u_work_deal_cmf_person_right_id'), 'cmf_u_work_deal_cmf_person', ['right_id'], unique=False)
    # op.drop_index('ix_cmf_bill_activity_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_alarm_date', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cache_status_type', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_author_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_created_at', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_deleted', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_locked_at', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_locked_by_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_modified_at', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_modified_by_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_owner_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_version', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_cmf_viewed_at', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_code', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_company_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_name', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_orderno', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_parent_task_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_period_clone_from_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_project_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_responsible_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_status_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_tree_parent_id', table_name='cmf_bill')
    # op.drop_index('ix_cmf_bill_waiting_for_id', table_name='cmf_bill')
    op.drop_table('cmf_bill')
    # op.drop_index('ix_cmf_deal_activity_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_alarm_date', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cache_status_type', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_author_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_created_at', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_deleted', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_locked_at', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_locked_by_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_modified_at', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_modified_by_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_owner_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_version', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_cmf_viewed_at', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_code', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_company_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_name', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_orderno', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_parent_task_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_period_clone_from_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_project_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_responsible_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_status_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_tree_parent_id', table_name='cmf_deal')
    # op.drop_index('ix_cmf_deal_waiting_for_id', table_name='cmf_deal')
    op.drop_table('cmf_deal')
    op.drop_index('ix_cmf_bill_executors_left_id', table_name='cmf_bill_executors')
    op.drop_index('ix_cmf_bill_executors_parent_id', table_name='cmf_bill_executors')
    op.drop_index('ix_cmf_bill_executors_right_id', table_name='cmf_bill_executors')
    op.drop_index('ix_cmf_bill_executors_root_id', table_name='cmf_bill_executors')
    op.drop_table('cmf_bill_executors')
    op.drop_index('ix_cmf_deal_executors_left_id', table_name='cmf_deal_executors')
    op.drop_index('ix_cmf_deal_executors_parent_id', table_name='cmf_deal_executors')
    op.drop_index('ix_cmf_deal_executors_right_id', table_name='cmf_deal_executors')
    op.drop_index('ix_cmf_deal_executors_root_id', table_name='cmf_deal_executors')
    op.drop_table('cmf_deal_executors')
    op.drop_index('ix_cmf_bill_spectators_left_id', table_name='cmf_bill_spectators')
    op.drop_index('ix_cmf_bill_spectators_parent_id', table_name='cmf_bill_spectators')
    op.drop_index('ix_cmf_bill_spectators_right_id', table_name='cmf_bill_spectators')
    op.drop_index('ix_cmf_bill_spectators_root_id', table_name='cmf_bill_spectators')
    op.drop_table('cmf_bill_spectators')
    # op.drop_index('ix_cmf_lead_activity_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_alarm_date', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cache_status_type', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_author_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_created_at', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_deleted', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_locked_at', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_locked_by_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_modified_at', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_modified_by_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_owner_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_version', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_cmf_viewed_at', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_code', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_company_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_name', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_orderno', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_parent_task_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_period_clone_from_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_project_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_responsible_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_status_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_tree_parent_id', table_name='cmf_lead')
    # op.drop_index('ix_cmf_lead_waiting_for_id', table_name='cmf_lead')
    op.drop_table('cmf_lead')
    op.drop_index('ix_cmf_lead_related_objects_left_id', table_name='cmf_lead_related_objects')
    op.drop_index('ix_cmf_lead_related_objects_parent_id', table_name='cmf_lead_related_objects')
    op.drop_index('ix_cmf_lead_related_objects_right_id', table_name='cmf_lead_related_objects')
    op.drop_index('ix_cmf_lead_related_objects_root_id', table_name='cmf_lead_related_objects')
    op.drop_table('cmf_lead_related_objects')
    op.drop_index('ix_cmf_deal_spectators_left_id', table_name='cmf_deal_spectators')
    op.drop_index('ix_cmf_deal_spectators_parent_id', table_name='cmf_deal_spectators')
    op.drop_index('ix_cmf_deal_spectators_right_id', table_name='cmf_deal_spectators')
    op.drop_index('ix_cmf_deal_spectators_root_id', table_name='cmf_deal_spectators')
    op.drop_table('cmf_deal_spectators')
    op.drop_index('ix_cmf_bill_related_objects_left_id', table_name='cmf_bill_related_objects')
    op.drop_index('ix_cmf_bill_related_objects_parent_id', table_name='cmf_bill_related_objects')
    op.drop_index('ix_cmf_bill_related_objects_right_id', table_name='cmf_bill_related_objects')
    op.drop_index('ix_cmf_bill_related_objects_root_id', table_name='cmf_bill_related_objects')
    op.drop_table('cmf_bill_related_objects')
    op.drop_index('ix_cmf_lead_executors_left_id', table_name='cmf_lead_executors')
    op.drop_index('ix_cmf_lead_executors_parent_id', table_name='cmf_lead_executors')
    op.drop_index('ix_cmf_lead_executors_right_id', table_name='cmf_lead_executors')
    op.drop_index('ix_cmf_lead_executors_root_id', table_name='cmf_lead_executors')
    op.drop_table('cmf_lead_executors')
    op.drop_index('ix_cmf_lead_spectators_left_id', table_name='cmf_lead_spectators')
    op.drop_index('ix_cmf_lead_spectators_parent_id', table_name='cmf_lead_spectators')
    op.drop_index('ix_cmf_lead_spectators_right_id', table_name='cmf_lead_spectators')
    op.drop_index('ix_cmf_lead_spectators_root_id', table_name='cmf_lead_spectators')
    op.drop_table('cmf_lead_spectators')
    op.drop_index('ix_cmf_deal_related_objects_left_id', table_name='cmf_deal_related_objects')
    op.drop_index('ix_cmf_deal_related_objects_parent_id', table_name='cmf_deal_related_objects')
    op.drop_index('ix_cmf_deal_related_objects_right_id', table_name='cmf_deal_related_objects')
    op.drop_index('ix_cmf_deal_related_objects_root_id', table_name='cmf_deal_related_objects')
    op.drop_table('cmf_deal_related_objects')
    op.add_column('cmf_currency', sa.Column('main', sa.Boolean(), nullable=True))
    op.add_column('cmf_currency', sa.Column('rate', sa.Numeric(precision=14, scale=2), nullable=True))
    op.add_column('cmf_price', sa.Column('cost', sa.Numeric(precision=14, scale=2), nullable=True))
    op.add_column('cmf_price', sa.Column('direct_costs', sa.Numeric(precision=14, scale=2), nullable=True))
    op.add_column('cmf_price', sa.Column('price', sa.Numeric(precision=14, scale=2), nullable=True))
    op.add_column('cmf_price', sa.Column('product_id', sa.CHAR(length=64), nullable=True))
    op.add_column('cmf_price', sa.Column('unit_id', sa.CHAR(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_price_product_id'), 'cmf_price', ['product_id'], unique=False)
    op.create_index(op.f('ix_cmf_price_unit_id'), 'cmf_price', ['unit_id'], unique=False)
    op.create_foreign_key(None, 'cmf_price', 'cmf_product', ['product_id'], ['id'])
    op.create_foreign_key(None, 'cmf_price', 'cmf_unit', ['unit_id'], ['id'])
    # op.drop_index('ix_cmf_product_unit_id', table_name='cmf_product')
    # op.drop_constraint('cmf_product_ibfk_1', 'cmf_product', type_='foreignkey')
    op.drop_column('cmf_product', 'price')
    op.drop_column('cmf_product', 'unit_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_product', sa.Column('unit_id', mysql.CHAR(length=64), nullable=True))
    op.add_column('cmf_product', sa.Column('price', mysql.DECIMAL(precision=14, scale=2), nullable=True))
    op.create_foreign_key('cmf_product_ibfk_1', 'cmf_product', 'cmf_unit', ['unit_id'], ['id'])
    op.create_index('ix_cmf_product_unit_id', 'cmf_product', ['unit_id'], unique=False)
    op.drop_constraint(None, 'cmf_price', type_='foreignkey')
    op.drop_constraint(None, 'cmf_price', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_price_unit_id'), table_name='cmf_price')
    op.drop_index(op.f('ix_cmf_price_product_id'), table_name='cmf_price')
    op.drop_column('cmf_price', 'unit_id')
    op.drop_column('cmf_price', 'product_id')
    op.drop_column('cmf_price', 'price')
    op.drop_column('cmf_price', 'direct_costs')
    op.drop_column('cmf_price', 'cost')
    op.drop_column('cmf_currency', 'rate')
    op.drop_column('cmf_currency', 'main')
    op.create_table('cmf_deal_related_objects',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_deal_related_objects_root_id', 'cmf_deal_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_deal_related_objects_right_id', 'cmf_deal_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_deal_related_objects_parent_id', 'cmf_deal_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_deal_related_objects_left_id', 'cmf_deal_related_objects', ['left_id'], unique=False)
    op.create_table('cmf_lead_spectators',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_lead_spectators_root_id', 'cmf_lead_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_lead_spectators_right_id', 'cmf_lead_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_lead_spectators_parent_id', 'cmf_lead_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_lead_spectators_left_id', 'cmf_lead_spectators', ['left_id'], unique=False)
    op.create_table('cmf_lead_executors',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_lead_executors_root_id', 'cmf_lead_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_lead_executors_right_id', 'cmf_lead_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_lead_executors_parent_id', 'cmf_lead_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_lead_executors_left_id', 'cmf_lead_executors', ['left_id'], unique=False)
    op.create_table('cmf_bill_related_objects',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_bill_related_objects_root_id', 'cmf_bill_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_bill_related_objects_right_id', 'cmf_bill_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_bill_related_objects_parent_id', 'cmf_bill_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_bill_related_objects_left_id', 'cmf_bill_related_objects', ['left_id'], unique=False)
    op.create_table('cmf_deal_spectators',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_deal_spectators_root_id', 'cmf_deal_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_deal_spectators_right_id', 'cmf_deal_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_deal_spectators_parent_id', 'cmf_deal_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_deal_spectators_left_id', 'cmf_deal_spectators', ['left_id'], unique=False)
    op.create_table('cmf_lead_related_objects',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_lead_related_objects_root_id', 'cmf_lead_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_lead_related_objects_right_id', 'cmf_lead_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_lead_related_objects_parent_id', 'cmf_lead_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_lead_related_objects_left_id', 'cmf_lead_related_objects', ['left_id'], unique=False)
    op.create_table('cmf_lead',
    sa.Column('activity_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cache_status_type', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('cmf_author_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_deleted', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False),
    sa.Column('cmf_locked_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_locked_by_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_modified_by_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('cmf_viewed_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('code', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('company_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('deadline', mysql.TIMESTAMP(), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('mark', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('name', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('no_control', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('orderno', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('parent_task_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('period_interval', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('period_next_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('plan_end_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('plan_start_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('priority', mysql.VARCHAR(length=32), nullable=False),
    sa.Column('project_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('tags', mysql.TEXT(), nullable=True),
    sa.Column('text', mysql.TEXT(), nullable=True),
    sa.Column('time_estimate', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('tree_parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('waiting_for_id', mysql.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_lead_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_lead_ibfk_2'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_lead_ibfk_3'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_lead_ibfk_4'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_lead_waiting_for_id', 'cmf_lead', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_lead_tree_parent_id', 'cmf_lead', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_lead_status_id', 'cmf_lead', ['status_id'], unique=False)
    op.create_index('ix_cmf_lead_responsible_id', 'cmf_lead', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_lead_project_id', 'cmf_lead', ['project_id'], unique=False)
    op.create_index('ix_cmf_lead_period_clone_from_id', 'cmf_lead', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_lead_parent_task_id', 'cmf_lead', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_lead_orderno', 'cmf_lead', ['orderno'], unique=False)
    op.create_index('ix_cmf_lead_name', 'cmf_lead', ['name'], unique=False)
    op.create_index('ix_cmf_lead_company_id', 'cmf_lead', ['company_id'], unique=False)
    op.create_index('ix_cmf_lead_code', 'cmf_lead', ['code'], unique=True)
    op.create_index('ix_cmf_lead_cmf_viewed_at', 'cmf_lead', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_lead_cmf_version', 'cmf_lead', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_lead_cmf_owner_id', 'cmf_lead', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_lead_cmf_modified_by_id', 'cmf_lead', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_lead_cmf_modified_at', 'cmf_lead', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_lead_cmf_locked_by_id', 'cmf_lead', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_lead_cmf_locked_at', 'cmf_lead', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_lead_cmf_deleted', 'cmf_lead', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_lead_cmf_created_at', 'cmf_lead', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_lead_cmf_author_id', 'cmf_lead', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_lead_cache_status_type', 'cmf_lead', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_lead_alarm_date', 'cmf_lead', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_lead_activity_id', 'cmf_lead', ['activity_id'], unique=False)
    op.create_table('cmf_bill_spectators',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_bill_spectators_root_id', 'cmf_bill_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_bill_spectators_right_id', 'cmf_bill_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_bill_spectators_parent_id', 'cmf_bill_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_bill_spectators_left_id', 'cmf_bill_spectators', ['left_id'], unique=False)
    op.create_table('cmf_deal_executors',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_deal_executors_root_id', 'cmf_deal_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_deal_executors_right_id', 'cmf_deal_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_deal_executors_parent_id', 'cmf_deal_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_deal_executors_left_id', 'cmf_deal_executors', ['left_id'], unique=False)
    op.create_table('cmf_bill_executors',
    sa.Column('description', mysql.VARCHAR(length=4096), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('left_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('left_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('root_id', mysql.CHAR(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_bill_executors_root_id', 'cmf_bill_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_bill_executors_right_id', 'cmf_bill_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_bill_executors_parent_id', 'cmf_bill_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_bill_executors_left_id', 'cmf_bill_executors', ['left_id'], unique=False)
    op.create_table('cmf_deal',
    sa.Column('activity_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cache_status_type', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('cmf_author_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_deleted', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False),
    sa.Column('cmf_locked_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_locked_by_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_modified_by_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('cmf_viewed_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('code', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('company_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('deadline', mysql.TIMESTAMP(), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('mark', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('name', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('no_control', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('orderno', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('parent_task_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('period_interval', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('period_next_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('plan_end_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('plan_start_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('priority', mysql.VARCHAR(length=32), nullable=False),
    sa.Column('project_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('tags', mysql.TEXT(), nullable=True),
    sa.Column('text', mysql.TEXT(), nullable=True),
    sa.Column('time_estimate', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('tree_parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('waiting_for_id', mysql.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_deal_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_deal_ibfk_2'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_deal_ibfk_3'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_deal_ibfk_4'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_deal_waiting_for_id', 'cmf_deal', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_deal_tree_parent_id', 'cmf_deal', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_deal_status_id', 'cmf_deal', ['status_id'], unique=False)
    op.create_index('ix_cmf_deal_responsible_id', 'cmf_deal', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_deal_project_id', 'cmf_deal', ['project_id'], unique=False)
    op.create_index('ix_cmf_deal_period_clone_from_id', 'cmf_deal', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_deal_parent_task_id', 'cmf_deal', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_deal_orderno', 'cmf_deal', ['orderno'], unique=False)
    op.create_index('ix_cmf_deal_name', 'cmf_deal', ['name'], unique=False)
    op.create_index('ix_cmf_deal_company_id', 'cmf_deal', ['company_id'], unique=False)
    op.create_index('ix_cmf_deal_code', 'cmf_deal', ['code'], unique=True)
    op.create_index('ix_cmf_deal_cmf_viewed_at', 'cmf_deal', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_deal_cmf_version', 'cmf_deal', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_deal_cmf_owner_id', 'cmf_deal', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_deal_cmf_modified_by_id', 'cmf_deal', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_deal_cmf_modified_at', 'cmf_deal', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_deal_cmf_locked_by_id', 'cmf_deal', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_deal_cmf_locked_at', 'cmf_deal', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_deal_cmf_deleted', 'cmf_deal', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_deal_cmf_created_at', 'cmf_deal', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_deal_cmf_author_id', 'cmf_deal', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_deal_cache_status_type', 'cmf_deal', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_deal_alarm_date', 'cmf_deal', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_deal_activity_id', 'cmf_deal', ['activity_id'], unique=False)
    op.create_table('cmf_bill',
    sa.Column('activity_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('alarm_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cache_status_type', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('cmf_author_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_created_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_deleted', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False),
    sa.Column('cmf_locked_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_locked_by_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_modified_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('cmf_modified_by_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_owner_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('cmf_version', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('cmf_viewed_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('code', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('company_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('deadline', mysql.TIMESTAMP(), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('is_penalty', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('mark', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('name', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('no_control', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('orderno', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('parent_task_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('period_clone_from_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('period_interval', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('period_next_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('plan_end_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('plan_start_date', mysql.TIMESTAMP(), nullable=True),
    sa.Column('priority', mysql.VARCHAR(length=32), nullable=False),
    sa.Column('project_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('responsible_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_modified_at', mysql.TIMESTAMP(), nullable=True),
    sa.Column('tags', mysql.TEXT(), nullable=True),
    sa.Column('text', mysql.TEXT(), nullable=True),
    sa.Column('time_estimate', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('tree_parent_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('waiting_for_id', mysql.CHAR(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_bill_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_bill_ibfk_2'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_bill_ibfk_3'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_bill_ibfk_4'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_bill_waiting_for_id', 'cmf_bill', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_bill_tree_parent_id', 'cmf_bill', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_bill_status_id', 'cmf_bill', ['status_id'], unique=False)
    op.create_index('ix_cmf_bill_responsible_id', 'cmf_bill', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_bill_project_id', 'cmf_bill', ['project_id'], unique=False)
    op.create_index('ix_cmf_bill_period_clone_from_id', 'cmf_bill', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_bill_parent_task_id', 'cmf_bill', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_bill_orderno', 'cmf_bill', ['orderno'], unique=False)
    op.create_index('ix_cmf_bill_name', 'cmf_bill', ['name'], unique=False)
    op.create_index('ix_cmf_bill_company_id', 'cmf_bill', ['company_id'], unique=False)
    op.create_index('ix_cmf_bill_code', 'cmf_bill', ['code'], unique=True)
    op.create_index('ix_cmf_bill_cmf_viewed_at', 'cmf_bill', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_bill_cmf_version', 'cmf_bill', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_bill_cmf_owner_id', 'cmf_bill', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_bill_cmf_modified_by_id', 'cmf_bill', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_bill_cmf_modified_at', 'cmf_bill', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_bill_cmf_locked_by_id', 'cmf_bill', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_bill_cmf_locked_at', 'cmf_bill', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_bill_cmf_deleted', 'cmf_bill', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_bill_cmf_created_at', 'cmf_bill', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_bill_cmf_author_id', 'cmf_bill', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_bill_cache_status_type', 'cmf_bill', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_bill_alarm_date', 'cmf_bill', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_bill_activity_id', 'cmf_bill', ['activity_id'], unique=False)
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_person_right_id'), table_name='cmf_u_work_deal_cmf_person')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_person_left_id'), table_name='cmf_u_work_deal_cmf_person')
    op.drop_table('cmf_u_work_deal_cmf_person')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_company_right_id'), table_name='cmf_u_work_deal_cmf_company')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_company_left_id'), table_name='cmf_u_work_deal_cmf_company')
    op.drop_table('cmf_u_work_deal_cmf_company')
    op.drop_index(op.f('ix_cmf_u_work_bill_waiting_for_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_tree_parent_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_status_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_responsible_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_project_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_print_tmpl_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_period_clone_from_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_parent_task_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_orderno'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_name'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_deal_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_customer_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_currency_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_company_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_code'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_viewed_at'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_version'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_owner_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_modified_by_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_modified_at'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_locked_by_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_locked_at'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_deleted'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_created_at'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cmf_author_id'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_cache_status_type'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_alarm_date'), table_name='cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_u_work_bill_activity_id'), table_name='cmf_u_work_bill')
    op.drop_table('cmf_u_work_bill')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_status_id'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_sales_list_id'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_project_id'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_orderno'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_name'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_code'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_viewed_at'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_version'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_owner_id'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_modified_by_id'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_modified_at'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_locked_by_id'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_locked_at'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_deleted'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_created_at'), table_name='cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_cmf_author_id'), table_name='cmf_kanban_sales_status')
    op.drop_table('cmf_kanban_sales_status')
    op.drop_index(op.f('ix_cmf_deal_product_product_id'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_name'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_deal_id'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_code'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_viewed_at'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_version'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_owner_id'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_modified_by_id'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_modified_at'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_locked_by_id'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_locked_at'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_deleted'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_created_at'), table_name='cmf_deal_product')
    op.drop_index(op.f('ix_cmf_deal_product_cmf_author_id'), table_name='cmf_deal_product')
    op.drop_table('cmf_deal_product')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_waiting_for_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_tree_parent_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_status_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_responsible_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_project_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_period_clone_from_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_parent_task_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_orderno'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_name'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_company_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_code'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_viewed_at'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_version'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_owner_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_modified_by_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_modified_at'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_locked_by_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_locked_at'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_deleted'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_created_at'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cmf_author_id'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_cache_status_type'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_alarm_date'), table_name='cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_activity_id'), table_name='cmf_u_work_sales_list')
    op.drop_table('cmf_u_work_sales_list')
    op.drop_index(op.f('ix_cmf_u_work_lead_waiting_for_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_tree_parent_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_status_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_responsible_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_project_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_period_clone_from_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_parent_task_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_orderno'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_name'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_company_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_code'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_viewed_at'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_version'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_owner_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_modified_by_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_modified_at'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_locked_by_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_locked_at'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_deleted'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_created_at'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cmf_author_id'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_cache_status_type'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_alarm_date'), table_name='cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_lead_activity_id'), table_name='cmf_u_work_lead')
    op.drop_table('cmf_u_work_lead')
    op.drop_index(op.f('ix_cmf_u_work_deal_waiting_for_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_tree_parent_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_status_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_responsible_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_project_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_period_clone_from_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_parent_task_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_orderno'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_name'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_currency_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_company_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_code'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_viewed_at'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_version'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_owner_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_modified_by_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_modified_at'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_locked_by_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_locked_at'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_deleted'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_created_at'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cmf_author_id'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_cache_status_type'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_alarm_date'), table_name='cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_deal_activity_id'), table_name='cmf_u_work_deal')
    op.drop_table('cmf_u_work_deal')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_spectators_root_id'), table_name='cmf_u_work_sales_list_spectators')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_spectators_right_id'), table_name='cmf_u_work_sales_list_spectators')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_spectators_parent_id'), table_name='cmf_u_work_sales_list_spectators')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_spectators_left_id'), table_name='cmf_u_work_sales_list_spectators')
    op.drop_table('cmf_u_work_sales_list_spectators')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_related_objects_root_id'), table_name='cmf_u_work_sales_list_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_related_objects_right_id'), table_name='cmf_u_work_sales_list_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_related_objects_parent_id'), table_name='cmf_u_work_sales_list_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_related_objects_left_id'), table_name='cmf_u_work_sales_list_related_objects')
    op.drop_table('cmf_u_work_sales_list_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_members_root_id'), table_name='cmf_u_work_sales_list_members')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_members_right_id'), table_name='cmf_u_work_sales_list_members')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_members_parent_id'), table_name='cmf_u_work_sales_list_members')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_members_left_id'), table_name='cmf_u_work_sales_list_members')
    op.drop_table('cmf_u_work_sales_list_members')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_executors_root_id'), table_name='cmf_u_work_sales_list_executors')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_executors_right_id'), table_name='cmf_u_work_sales_list_executors')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_executors_parent_id'), table_name='cmf_u_work_sales_list_executors')
    op.drop_index(op.f('ix_cmf_u_work_sales_list_executors_left_id'), table_name='cmf_u_work_sales_list_executors')
    op.drop_table('cmf_u_work_sales_list_executors')
    op.drop_index(op.f('ix_cmf_u_work_lead_spectators_root_id'), table_name='cmf_u_work_lead_spectators')
    op.drop_index(op.f('ix_cmf_u_work_lead_spectators_right_id'), table_name='cmf_u_work_lead_spectators')
    op.drop_index(op.f('ix_cmf_u_work_lead_spectators_parent_id'), table_name='cmf_u_work_lead_spectators')
    op.drop_index(op.f('ix_cmf_u_work_lead_spectators_left_id'), table_name='cmf_u_work_lead_spectators')
    op.drop_table('cmf_u_work_lead_spectators')
    op.drop_index(op.f('ix_cmf_u_work_lead_related_objects_root_id'), table_name='cmf_u_work_lead_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_lead_related_objects_right_id'), table_name='cmf_u_work_lead_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_lead_related_objects_parent_id'), table_name='cmf_u_work_lead_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_lead_related_objects_left_id'), table_name='cmf_u_work_lead_related_objects')
    op.drop_table('cmf_u_work_lead_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_lead_executors_root_id'), table_name='cmf_u_work_lead_executors')
    op.drop_index(op.f('ix_cmf_u_work_lead_executors_right_id'), table_name='cmf_u_work_lead_executors')
    op.drop_index(op.f('ix_cmf_u_work_lead_executors_parent_id'), table_name='cmf_u_work_lead_executors')
    op.drop_index(op.f('ix_cmf_u_work_lead_executors_left_id'), table_name='cmf_u_work_lead_executors')
    op.drop_table('cmf_u_work_lead_executors')
    op.drop_index(op.f('ix_cmf_u_work_deal_spectators_root_id'), table_name='cmf_u_work_deal_spectators')
    op.drop_index(op.f('ix_cmf_u_work_deal_spectators_right_id'), table_name='cmf_u_work_deal_spectators')
    op.drop_index(op.f('ix_cmf_u_work_deal_spectators_parent_id'), table_name='cmf_u_work_deal_spectators')
    op.drop_index(op.f('ix_cmf_u_work_deal_spectators_left_id'), table_name='cmf_u_work_deal_spectators')
    op.drop_table('cmf_u_work_deal_spectators')
    op.drop_index(op.f('ix_cmf_u_work_deal_related_objects_root_id'), table_name='cmf_u_work_deal_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_deal_related_objects_right_id'), table_name='cmf_u_work_deal_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_deal_related_objects_parent_id'), table_name='cmf_u_work_deal_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_deal_related_objects_left_id'), table_name='cmf_u_work_deal_related_objects')
    op.drop_table('cmf_u_work_deal_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_deal_executors_root_id'), table_name='cmf_u_work_deal_executors')
    op.drop_index(op.f('ix_cmf_u_work_deal_executors_right_id'), table_name='cmf_u_work_deal_executors')
    op.drop_index(op.f('ix_cmf_u_work_deal_executors_parent_id'), table_name='cmf_u_work_deal_executors')
    op.drop_index(op.f('ix_cmf_u_work_deal_executors_left_id'), table_name='cmf_u_work_deal_executors')
    op.drop_table('cmf_u_work_deal_executors')
    op.drop_index(op.f('ix_cmf_u_work_bill_spectators_root_id'), table_name='cmf_u_work_bill_spectators')
    op.drop_index(op.f('ix_cmf_u_work_bill_spectators_right_id'), table_name='cmf_u_work_bill_spectators')
    op.drop_index(op.f('ix_cmf_u_work_bill_spectators_parent_id'), table_name='cmf_u_work_bill_spectators')
    op.drop_index(op.f('ix_cmf_u_work_bill_spectators_left_id'), table_name='cmf_u_work_bill_spectators')
    op.drop_table('cmf_u_work_bill_spectators')
    op.drop_index(op.f('ix_cmf_u_work_bill_related_objects_root_id'), table_name='cmf_u_work_bill_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_bill_related_objects_right_id'), table_name='cmf_u_work_bill_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_bill_related_objects_parent_id'), table_name='cmf_u_work_bill_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_bill_related_objects_left_id'), table_name='cmf_u_work_bill_related_objects')
    op.drop_table('cmf_u_work_bill_related_objects')
    op.drop_index(op.f('ix_cmf_u_work_bill_executors_root_id'), table_name='cmf_u_work_bill_executors')
    op.drop_index(op.f('ix_cmf_u_work_bill_executors_right_id'), table_name='cmf_u_work_bill_executors')
    op.drop_index(op.f('ix_cmf_u_work_bill_executors_parent_id'), table_name='cmf_u_work_bill_executors')
    op.drop_index(op.f('ix_cmf_u_work_bill_executors_left_id'), table_name='cmf_u_work_bill_executors')
    op.drop_table('cmf_u_work_bill_executors')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_objects_root_id'), table_name='cmf_kanban_sales_status_objects')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_objects_right_id'), table_name='cmf_kanban_sales_status_objects')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_objects_parent_id'), table_name='cmf_kanban_sales_status_objects')
    op.drop_index(op.f('ix_cmf_kanban_sales_status_objects_left_id'), table_name='cmf_kanban_sales_status_objects')
    op.drop_table('cmf_kanban_sales_status_objects')
    # ### end Alembic commands ###
