"""empty message

Revision ID: f0b5bf93cfe6
Revises: 5da0a12f74d1
Create Date: 2020-12-18 10:19:31.091984

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

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_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_deal_executors_left_id'), 'cmf_deal_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_executors_parent_id'), 'cmf_deal_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_executors_right_id'), 'cmf_deal_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_executors_root_id'), 'cmf_deal_executors', ['root_id'], unique=False)
    op.create_table('cmf_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_deal_related_objects_left_id'), 'cmf_deal_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_related_objects_parent_id'), 'cmf_deal_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_related_objects_right_id'), 'cmf_deal_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_related_objects_root_id'), 'cmf_deal_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_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_deal_spectators_left_id'), 'cmf_deal_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_spectators_parent_id'), 'cmf_deal_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_spectators_right_id'), 'cmf_deal_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_spectators_root_id'), 'cmf_deal_spectators', ['root_id'], unique=False)
    op.create_table('cmf_invoice_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_invoice_executors_left_id'), 'cmf_invoice_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_executors_parent_id'), 'cmf_invoice_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_executors_right_id'), 'cmf_invoice_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_executors_root_id'), 'cmf_invoice_executors', ['root_id'], unique=False)
    op.create_table('cmf_invoice_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_invoice_related_objects_left_id'), 'cmf_invoice_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_related_objects_parent_id'), 'cmf_invoice_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_related_objects_right_id'), 'cmf_invoice_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_related_objects_root_id'), 'cmf_invoice_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_invoice_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_invoice_spectators_left_id'), 'cmf_invoice_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_spectators_parent_id'), 'cmf_invoice_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_spectators_right_id'), 'cmf_invoice_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_spectators_root_id'), 'cmf_invoice_spectators', ['root_id'], unique=False)
    op.create_table('cmf_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_lead_executors_left_id'), 'cmf_lead_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_executors_parent_id'), 'cmf_lead_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_executors_right_id'), 'cmf_lead_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_executors_root_id'), 'cmf_lead_executors', ['root_id'], unique=False)
    op.create_table('cmf_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_lead_related_objects_left_id'), 'cmf_lead_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_related_objects_parent_id'), 'cmf_lead_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_related_objects_right_id'), 'cmf_lead_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_related_objects_root_id'), 'cmf_lead_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_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_lead_spectators_left_id'), 'cmf_lead_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_spectators_parent_id'), 'cmf_lead_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_spectators_right_id'), 'cmf_lead_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_spectators_root_id'), 'cmf_lead_spectators', ['root_id'], unique=False)
    op.create_table('cmf_payment_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_payment_executors_left_id'), 'cmf_payment_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_executors_parent_id'), 'cmf_payment_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_executors_right_id'), 'cmf_payment_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_executors_root_id'), 'cmf_payment_executors', ['root_id'], unique=False)
    op.create_table('cmf_payment_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_payment_related_objects_left_id'), 'cmf_payment_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_related_objects_parent_id'), 'cmf_payment_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_related_objects_right_id'), 'cmf_payment_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_related_objects_root_id'), 'cmf_payment_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_payment_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_payment_spectators_left_id'), 'cmf_payment_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_spectators_parent_id'), 'cmf_payment_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_spectators_right_id'), 'cmf_payment_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_spectators_root_id'), 'cmf_payment_spectators', ['root_id'], unique=False)
    op.create_table('cmf_pipeline_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_pipeline_executors_left_id'), 'cmf_pipeline_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_executors_parent_id'), 'cmf_pipeline_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_executors_right_id'), 'cmf_pipeline_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_executors_root_id'), 'cmf_pipeline_executors', ['root_id'], unique=False)
    op.create_table('cmf_pipeline_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_pipeline_related_objects_left_id'), 'cmf_pipeline_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_related_objects_parent_id'), 'cmf_pipeline_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_related_objects_right_id'), 'cmf_pipeline_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_related_objects_root_id'), 'cmf_pipeline_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_pipeline_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_pipeline_spectators_left_id'), 'cmf_pipeline_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_spectators_parent_id'), 'cmf_pipeline_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_spectators_right_id'), 'cmf_pipeline_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_spectators_root_id'), 'cmf_pipeline_spectators', ['root_id'], unique=False)
    op.create_table('cmf_sales_order_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_sales_order_executors_left_id'), 'cmf_sales_order_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_executors_parent_id'), 'cmf_sales_order_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_executors_right_id'), 'cmf_sales_order_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_executors_root_id'), 'cmf_sales_order_executors', ['root_id'], unique=False)
    op.create_table('cmf_sales_order_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_sales_order_related_objects_left_id'), 'cmf_sales_order_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_related_objects_parent_id'), 'cmf_sales_order_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_related_objects_right_id'), 'cmf_sales_order_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_related_objects_root_id'), 'cmf_sales_order_related_objects', ['root_id'], unique=False)
    op.create_table('cmf_sales_order_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_sales_order_spectators_left_id'), 'cmf_sales_order_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_spectators_parent_id'), 'cmf_sales_order_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_spectators_right_id'), 'cmf_sales_order_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_spectators_root_id'), 'cmf_sales_order_spectators', ['root_id'], unique=False)
    op.create_table('cmf_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('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(['project_id'], ['cmf_project.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_lead_activity_id'), 'cmf_lead', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_alarm_date'), 'cmf_lead', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cache_status_type'), 'cmf_lead', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_author_id'), 'cmf_lead', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_created_at'), 'cmf_lead', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_deleted'), 'cmf_lead', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_locked_at'), 'cmf_lead', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_locked_by_id'), 'cmf_lead', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_modified_at'), 'cmf_lead', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_modified_by_id'), 'cmf_lead', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_owner_id'), 'cmf_lead', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_version'), 'cmf_lead', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_lead_cmf_viewed_at'), 'cmf_lead', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_lead_code'), 'cmf_lead', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_lead_company_id'), 'cmf_lead', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_name'), 'cmf_lead', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_lead_orderno'), 'cmf_lead', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_lead_parent_task_id'), 'cmf_lead', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_period_clone_from_id'), 'cmf_lead', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_project_id'), 'cmf_lead', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_responsible_id'), 'cmf_lead', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_status_id'), 'cmf_lead', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_tree_parent_id'), 'cmf_lead', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_lead_waiting_for_id'), 'cmf_lead', ['waiting_for_id'], unique=False)
    op.create_table('cmf_pipeline',
    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_pipeline_activity_id'), 'cmf_pipeline', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_alarm_date'), 'cmf_pipeline', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cache_status_type'), 'cmf_pipeline', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_author_id'), 'cmf_pipeline', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_created_at'), 'cmf_pipeline', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_deleted'), 'cmf_pipeline', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_locked_at'), 'cmf_pipeline', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_locked_by_id'), 'cmf_pipeline', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_modified_at'), 'cmf_pipeline', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_modified_by_id'), 'cmf_pipeline', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_owner_id'), 'cmf_pipeline', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_version'), 'cmf_pipeline', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_cmf_viewed_at'), 'cmf_pipeline', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_code'), 'cmf_pipeline', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_pipeline_company_id'), 'cmf_pipeline', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_name'), 'cmf_pipeline', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_orderno'), 'cmf_pipeline', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_parent_task_id'), 'cmf_pipeline', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_period_clone_from_id'), 'cmf_pipeline', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_project_id'), 'cmf_pipeline', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_responsible_id'), 'cmf_pipeline', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_status_id'), 'cmf_pipeline', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_tree_parent_id'), 'cmf_pipeline', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_pipeline_waiting_for_id'), 'cmf_pipeline', ['waiting_for_id'], unique=False)
    op.create_table('cmf_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('pipeline_id', sa.CHAR(length=64), 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('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(['pipeline_id'], ['cmf_pipeline.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_deal_activity_id'), 'cmf_deal', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_alarm_date'), 'cmf_deal', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cache_status_type'), 'cmf_deal', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_author_id'), 'cmf_deal', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_created_at'), 'cmf_deal', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_deleted'), 'cmf_deal', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_locked_at'), 'cmf_deal', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_locked_by_id'), 'cmf_deal', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_modified_at'), 'cmf_deal', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_modified_by_id'), 'cmf_deal', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_owner_id'), 'cmf_deal', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_version'), 'cmf_deal', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_viewed_at'), 'cmf_deal', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_deal_code'), 'cmf_deal', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_deal_company_id'), 'cmf_deal', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_currency_id'), 'cmf_deal', ['currency_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_name'), 'cmf_deal', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_deal_orderno'), 'cmf_deal', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_deal_parent_task_id'), 'cmf_deal', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_period_clone_from_id'), 'cmf_deal', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_pipeline_id'), 'cmf_deal', ['pipeline_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_project_id'), 'cmf_deal', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_responsible_id'), 'cmf_deal', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_status_id'), 'cmf_deal', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_tree_parent_id'), 'cmf_deal', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_waiting_for_id'), 'cmf_deal', ['waiting_for_id'], unique=False)
    op.create_table('cmf_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_deal.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_company.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_deal_cmf_company_left_id'), 'cmf_deal_cmf_company', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_company_right_id'), 'cmf_deal_cmf_company', ['right_id'], unique=False)
    op.create_table('cmf_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_deal.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_person.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_deal_cmf_person_left_id'), 'cmf_deal_cmf_person', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_deal_cmf_person_right_id'), 'cmf_deal_cmf_person', ['right_id'], unique=False)
    op.create_table('cmf_invoice',
    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_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_invoice_activity_id'), 'cmf_invoice', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_alarm_date'), 'cmf_invoice', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cache_status_type'), 'cmf_invoice', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_author_id'), 'cmf_invoice', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_created_at'), 'cmf_invoice', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_deleted'), 'cmf_invoice', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_locked_at'), 'cmf_invoice', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_locked_by_id'), 'cmf_invoice', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_modified_at'), 'cmf_invoice', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_modified_by_id'), 'cmf_invoice', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_owner_id'), 'cmf_invoice', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_version'), 'cmf_invoice', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_cmf_viewed_at'), 'cmf_invoice', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_code'), 'cmf_invoice', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_invoice_company_id'), 'cmf_invoice', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_currency_id'), 'cmf_invoice', ['currency_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_customer_id'), 'cmf_invoice', ['customer_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_deal_id'), 'cmf_invoice', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_name'), 'cmf_invoice', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_orderno'), 'cmf_invoice', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_parent_task_id'), 'cmf_invoice', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_period_clone_from_id'), 'cmf_invoice', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_print_tmpl_id'), 'cmf_invoice', ['print_tmpl_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_project_id'), 'cmf_invoice', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_responsible_id'), 'cmf_invoice', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_status_id'), 'cmf_invoice', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_tree_parent_id'), 'cmf_invoice', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_waiting_for_id'), 'cmf_invoice', ['waiting_for_id'], unique=False)
    op.create_table('cmf_invoice_items',
    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_deal.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_invoice_items_cmf_author_id'), 'cmf_invoice_items', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_created_at'), 'cmf_invoice_items', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_deleted'), 'cmf_invoice_items', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_locked_at'), 'cmf_invoice_items', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_locked_by_id'), 'cmf_invoice_items', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_modified_at'), 'cmf_invoice_items', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_modified_by_id'), 'cmf_invoice_items', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_owner_id'), 'cmf_invoice_items', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_version'), 'cmf_invoice_items', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_cmf_viewed_at'), 'cmf_invoice_items', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_code'), 'cmf_invoice_items', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_invoice_items_deal_id'), 'cmf_invoice_items', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_invoice_items_product_id'), 'cmf_invoice_items', ['product_id'], unique=False)
    op.create_table('cmf_payment',
    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('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_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_payment_activity_id'), 'cmf_payment', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_alarm_date'), 'cmf_payment', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cache_status_type'), 'cmf_payment', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_author_id'), 'cmf_payment', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_created_at'), 'cmf_payment', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_deleted'), 'cmf_payment', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_locked_at'), 'cmf_payment', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_locked_by_id'), 'cmf_payment', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_modified_at'), 'cmf_payment', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_modified_by_id'), 'cmf_payment', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_owner_id'), 'cmf_payment', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_version'), 'cmf_payment', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_payment_cmf_viewed_at'), 'cmf_payment', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_payment_code'), 'cmf_payment', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_payment_company_id'), 'cmf_payment', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_currency_id'), 'cmf_payment', ['currency_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_customer_id'), 'cmf_payment', ['customer_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_deal_id'), 'cmf_payment', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_name'), 'cmf_payment', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_payment_orderno'), 'cmf_payment', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_payment_parent_task_id'), 'cmf_payment', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_period_clone_from_id'), 'cmf_payment', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_print_tmpl_id'), 'cmf_payment', ['print_tmpl_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_project_id'), 'cmf_payment', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_responsible_id'), 'cmf_payment', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_status_id'), 'cmf_payment', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_tree_parent_id'), 'cmf_payment', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_payment_waiting_for_id'), 'cmf_payment', ['waiting_for_id'], unique=False)
    op.create_table('cmf_sales_order',
    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_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_sales_order_activity_id'), 'cmf_sales_order', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_alarm_date'), 'cmf_sales_order', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cache_status_type'), 'cmf_sales_order', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_author_id'), 'cmf_sales_order', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_created_at'), 'cmf_sales_order', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_deleted'), 'cmf_sales_order', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_locked_at'), 'cmf_sales_order', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_locked_by_id'), 'cmf_sales_order', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_modified_at'), 'cmf_sales_order', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_modified_by_id'), 'cmf_sales_order', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_owner_id'), 'cmf_sales_order', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_version'), 'cmf_sales_order', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_cmf_viewed_at'), 'cmf_sales_order', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_code'), 'cmf_sales_order', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_sales_order_company_id'), 'cmf_sales_order', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_currency_id'), 'cmf_sales_order', ['currency_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_customer_id'), 'cmf_sales_order', ['customer_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_deal_id'), 'cmf_sales_order', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_name'), 'cmf_sales_order', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_orderno'), 'cmf_sales_order', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_parent_task_id'), 'cmf_sales_order', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_period_clone_from_id'), 'cmf_sales_order', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_print_tmpl_id'), 'cmf_sales_order', ['print_tmpl_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_project_id'), 'cmf_sales_order', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_responsible_id'), 'cmf_sales_order', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_status_id'), 'cmf_sales_order', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_tree_parent_id'), 'cmf_sales_order', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_waiting_for_id'), 'cmf_sales_order', ['waiting_for_id'], unique=False)
    op.create_table('cmf_sales_order_items',
    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_deal.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_author_id'), 'cmf_sales_order_items', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_created_at'), 'cmf_sales_order_items', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_deleted'), 'cmf_sales_order_items', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_locked_at'), 'cmf_sales_order_items', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_locked_by_id'), 'cmf_sales_order_items', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_modified_at'), 'cmf_sales_order_items', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_modified_by_id'), 'cmf_sales_order_items', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_owner_id'), 'cmf_sales_order_items', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_version'), 'cmf_sales_order_items', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_cmf_viewed_at'), 'cmf_sales_order_items', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_code'), 'cmf_sales_order_items', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_sales_order_items_deal_id'), 'cmf_sales_order_items', ['deal_id'], unique=False)
    op.create_index(op.f('ix_cmf_sales_order_items_product_id'), 'cmf_sales_order_items', ['product_id'], unique=False)
    # op.drop_index('ix_cmf_u_work_deal_related_objects_left_id', table_name='cmf_u_work_deal_related_objects')
    # op.drop_index('ix_cmf_u_work_deal_related_objects_parent_id', table_name='cmf_u_work_deal_related_objects')
    # op.drop_index('ix_cmf_u_work_deal_related_objects_right_id', table_name='cmf_u_work_deal_related_objects')
    # op.drop_index('ix_cmf_u_work_deal_related_objects_root_id', table_name='cmf_u_work_deal_related_objects')
    op.drop_table('cmf_u_work_deal_related_objects')
    op.drop_table('cmf_u_work_bill')
    # op.drop_index('ix_cmf_deal_product_cmf_author_id', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_created_at', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_deleted', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_locked_at', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_locked_by_id', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_modified_at', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_modified_by_id', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_owner_id', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_version', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_cmf_viewed_at', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_code', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_deal_id', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_name', table_name='cmf_deal_product')
    # op.drop_index('ix_cmf_deal_product_product_id', table_name='cmf_deal_product')
    op.drop_table('cmf_deal_product')
    # op.drop_index('ix_cmf_u_work_sales_list_executors_left_id', table_name='cmf_u_work_sales_list_executors')
    # op.drop_index('ix_cmf_u_work_sales_list_executors_parent_id', table_name='cmf_u_work_sales_list_executors')
    # op.drop_index('ix_cmf_u_work_sales_list_executors_right_id', table_name='cmf_u_work_sales_list_executors')
    # op.drop_index('ix_cmf_u_work_sales_list_executors_root_id', table_name='cmf_u_work_sales_list_executors')
    op.drop_table('cmf_u_work_sales_list_executors')
    # op.drop_index('ix_cmf_u_work_deal_cmf_person_left_id', table_name='cmf_u_work_deal_cmf_person')
    # op.drop_index('ix_cmf_u_work_deal_cmf_person_right_id', table_name='cmf_u_work_deal_cmf_person')
    op.drop_table('cmf_u_work_deal_cmf_person')
    # op.drop_index('ix_cmf_u_work_bill_executors_left_id', table_name='cmf_u_work_bill_executors')
    # op.drop_index('ix_cmf_u_work_bill_executors_parent_id', table_name='cmf_u_work_bill_executors')
    # op.drop_index('ix_cmf_u_work_bill_executors_right_id', table_name='cmf_u_work_bill_executors')
    # op.drop_index('ix_cmf_u_work_bill_executors_root_id', table_name='cmf_u_work_bill_executors')
    op.drop_table('cmf_u_work_bill_executors')
    # op.drop_index('ix_cmf_u_work_lead_spectators_left_id', table_name='cmf_u_work_lead_spectators')
    # op.drop_index('ix_cmf_u_work_lead_spectators_parent_id', table_name='cmf_u_work_lead_spectators')
    # op.drop_index('ix_cmf_u_work_lead_spectators_right_id', table_name='cmf_u_work_lead_spectators')
    # op.drop_index('ix_cmf_u_work_lead_spectators_root_id', table_name='cmf_u_work_lead_spectators')
    op.drop_table('cmf_u_work_lead_spectators')
    # op.drop_index('ix_cmf_u_work_deal_activity_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_alarm_date', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cache_status_type', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_author_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_created_at', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_deleted', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_locked_at', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_locked_by_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_modified_at', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_modified_by_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_owner_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_version', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_cmf_viewed_at', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_code', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_company_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_currency_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_name', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_orderno', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_parent_task_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_period_clone_from_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_project_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_responsible_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_status_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_tree_parent_id', table_name='cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_deal_waiting_for_id', table_name='cmf_u_work_deal')
    op.drop_table('cmf_u_work_deal_cmf_company')
    op.drop_table('cmf_u_work_deal')
    # op.drop_index('ix_cmf_u_work_sales_list_related_objects_left_id', table_name='cmf_u_work_sales_list_related_objects')
    # op.drop_index('ix_cmf_u_work_sales_list_related_objects_parent_id', table_name='cmf_u_work_sales_list_related_objects')
    # op.drop_index('ix_cmf_u_work_sales_list_related_objects_right_id', table_name='cmf_u_work_sales_list_related_objects')
    # op.drop_index('ix_cmf_u_work_sales_list_related_objects_root_id', table_name='cmf_u_work_sales_list_related_objects')
    op.drop_table('cmf_u_work_sales_list_related_objects')
    # op.drop_index('ix_cmf_u_work_deal_cmf_company_left_id', table_name='cmf_u_work_deal_cmf_company')
    # op.drop_index('ix_cmf_u_work_deal_cmf_company_right_id', table_name='cmf_u_work_deal_cmf_company')

    # op.drop_index('ix_cmf_u_work_sales_list_activity_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_alarm_date', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cache_status_type', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_author_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_created_at', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_deleted', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_locked_at', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_locked_by_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_modified_at', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_modified_by_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_owner_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_version', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_cmf_viewed_at', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_code', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_company_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_name', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_orderno', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_parent_task_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_period_clone_from_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_project_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_responsible_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_status_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_tree_parent_id', table_name='cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_waiting_for_id', table_name='cmf_u_work_sales_list')
    op.drop_table('cmf_kanban_sales_status')
    op.drop_table('cmf_u_work_sales_list')
    # op.drop_index('ix_cmf_u_work_sales_list_spectators_left_id', table_name='cmf_u_work_sales_list_spectators')
    # op.drop_index('ix_cmf_u_work_sales_list_spectators_parent_id', table_name='cmf_u_work_sales_list_spectators')
    # op.drop_index('ix_cmf_u_work_sales_list_spectators_right_id', table_name='cmf_u_work_sales_list_spectators')
    # op.drop_index('ix_cmf_u_work_sales_list_spectators_root_id', table_name='cmf_u_work_sales_list_spectators')
    op.drop_table('cmf_u_work_sales_list_spectators')
    # op.drop_index('ix_cmf_u_work_lead_activity_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_alarm_date', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cache_status_type', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_author_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_created_at', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_deleted', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_locked_at', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_locked_by_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_modified_at', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_modified_by_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_owner_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_version', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_cmf_viewed_at', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_code', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_company_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_name', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_orderno', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_parent_task_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_period_clone_from_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_project_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_responsible_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_status_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_tree_parent_id', table_name='cmf_u_work_lead')
    # op.drop_index('ix_cmf_u_work_lead_waiting_for_id', table_name='cmf_u_work_lead')
    op.drop_table('cmf_u_work_lead')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_author_id', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_created_at', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_deleted', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_locked_at', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_locked_by_id', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_modified_at', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_modified_by_id', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_owner_id', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_version', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_cmf_viewed_at', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_code', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_name', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_orderno', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_project_id', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_sales_list_id', table_name='cmf_kanban_sales_status')
    # op.drop_index('ix_cmf_kanban_sales_status_status_id', table_name='cmf_kanban_sales_status')

    # op.drop_index('ix_cmf_u_work_bill_related_objects_left_id', table_name='cmf_u_work_bill_related_objects')
    # op.drop_index('ix_cmf_u_work_bill_related_objects_parent_id', table_name='cmf_u_work_bill_related_objects')
    # op.drop_index('ix_cmf_u_work_bill_related_objects_right_id', table_name='cmf_u_work_bill_related_objects')
    # op.drop_index('ix_cmf_u_work_bill_related_objects_root_id', table_name='cmf_u_work_bill_related_objects')
    op.drop_table('cmf_u_work_bill_related_objects')
    # op.drop_index('ix_cmf_u_work_lead_related_objects_left_id', table_name='cmf_u_work_lead_related_objects')
    # op.drop_index('ix_cmf_u_work_lead_related_objects_parent_id', table_name='cmf_u_work_lead_related_objects')
    # op.drop_index('ix_cmf_u_work_lead_related_objects_right_id', table_name='cmf_u_work_lead_related_objects')
    # op.drop_index('ix_cmf_u_work_lead_related_objects_root_id', table_name='cmf_u_work_lead_related_objects')
    op.drop_table('cmf_u_work_lead_related_objects')
    # op.drop_index('ix_cmf_u_work_sales_list_members_left_id', table_name='cmf_u_work_sales_list_members')
    # op.drop_index('ix_cmf_u_work_sales_list_members_parent_id', table_name='cmf_u_work_sales_list_members')
    # op.drop_index('ix_cmf_u_work_sales_list_members_right_id', table_name='cmf_u_work_sales_list_members')
    # op.drop_index('ix_cmf_u_work_sales_list_members_root_id', table_name='cmf_u_work_sales_list_members')
    op.drop_table('cmf_u_work_sales_list_members')
    # op.drop_index('ix_cmf_u_work_lead_executors_left_id', table_name='cmf_u_work_lead_executors')
    # op.drop_index('ix_cmf_u_work_lead_executors_parent_id', table_name='cmf_u_work_lead_executors')
    # op.drop_index('ix_cmf_u_work_lead_executors_right_id', table_name='cmf_u_work_lead_executors')
    # op.drop_index('ix_cmf_u_work_lead_executors_root_id', table_name='cmf_u_work_lead_executors')
    op.drop_table('cmf_u_work_lead_executors')
    # op.drop_index('ix_cmf_u_work_deal_executors_left_id', table_name='cmf_u_work_deal_executors')
    # op.drop_index('ix_cmf_u_work_deal_executors_parent_id', table_name='cmf_u_work_deal_executors')
    # op.drop_index('ix_cmf_u_work_deal_executors_right_id', table_name='cmf_u_work_deal_executors')
    # op.drop_index('ix_cmf_u_work_deal_executors_root_id', table_name='cmf_u_work_deal_executors')
    op.drop_table('cmf_u_work_deal_executors')
    # op.drop_index('ix_cmf_u_work_deal_spectators_left_id', table_name='cmf_u_work_deal_spectators')
    # op.drop_index('ix_cmf_u_work_deal_spectators_parent_id', table_name='cmf_u_work_deal_spectators')
    # op.drop_index('ix_cmf_u_work_deal_spectators_right_id', table_name='cmf_u_work_deal_spectators')
    # op.drop_index('ix_cmf_u_work_deal_spectators_root_id', table_name='cmf_u_work_deal_spectators')
    op.drop_table('cmf_u_work_deal_spectators')
    # op.drop_index('ix_cmf_u_work_bill_activity_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_alarm_date', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cache_status_type', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_author_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_created_at', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_deleted', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_locked_at', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_locked_by_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_modified_at', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_modified_by_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_owner_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_version', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_cmf_viewed_at', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_code', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_company_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_currency_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_customer_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_deal_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_name', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_orderno', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_parent_task_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_period_clone_from_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_print_tmpl_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_project_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_responsible_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_status_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_tree_parent_id', table_name='cmf_u_work_bill')
    # op.drop_index('ix_cmf_u_work_bill_waiting_for_id', table_name='cmf_u_work_bill')

    # op.drop_index('ix_cmf_kanban_sales_status_objects_left_id', table_name='cmf_kanban_sales_status_objects')
    # op.drop_index('ix_cmf_kanban_sales_status_objects_parent_id', table_name='cmf_kanban_sales_status_objects')
    # op.drop_index('ix_cmf_kanban_sales_status_objects_right_id', table_name='cmf_kanban_sales_status_objects')
    # op.drop_index('ix_cmf_kanban_sales_status_objects_root_id', table_name='cmf_kanban_sales_status_objects')
    op.drop_table('cmf_kanban_sales_status_objects')
    # op.drop_index('ix_cmf_u_work_bill_spectators_left_id', table_name='cmf_u_work_bill_spectators')
    # op.drop_index('ix_cmf_u_work_bill_spectators_parent_id', table_name='cmf_u_work_bill_spectators')
    # op.drop_index('ix_cmf_u_work_bill_spectators_right_id', table_name='cmf_u_work_bill_spectators')
    # op.drop_index('ix_cmf_u_work_bill_spectators_root_id', table_name='cmf_u_work_bill_spectators')
    op.drop_table('cmf_u_work_bill_spectators')
    # op.drop_constraint('cmf_kanban_status_ibfk_2', 'cmf_kanban_status', type_='foreignkey')
    op.add_column('cmf_price', sa.Column('currency_id', sa.CHAR(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_price_currency_id'), 'cmf_price', ['currency_id'], unique=False)
    op.create_foreign_key(None, 'cmf_price', 'cmf_currency', ['currency_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'cmf_price', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_price_currency_id'), table_name='cmf_price')
    op.drop_column('cmf_price', 'currency_id')
    op.create_foreign_key('cmf_kanban_status_ibfk_2', 'cmf_kanban_status', 'cmf_u_work_list', ['work_list_id'], ['id'])
    op.create_table('cmf_u_work_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_u_work_bill_spectators_root_id', 'cmf_u_work_bill_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_spectators_right_id', 'cmf_u_work_bill_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_spectators_parent_id', 'cmf_u_work_bill_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_spectators_left_id', 'cmf_u_work_bill_spectators', ['left_id'], unique=False)
    op.create_table('cmf_kanban_sales_status_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_kanban_sales_status_objects_root_id', 'cmf_kanban_sales_status_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_objects_right_id', 'cmf_kanban_sales_status_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_objects_parent_id', 'cmf_kanban_sales_status_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_objects_left_id', 'cmf_kanban_sales_status_objects', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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('currency_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('customer_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('deadline', mysql.TIMESTAMP(), nullable=True),
    sa.Column('deal_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('discount', mysql.DECIMAL(precision=14, scale=2), 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('print_tmpl_id', mysql.CHAR(length=64), 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.CheckConstraint('(`cmf_deleted` in (0,1))', name='cmf_u_work_bill_chk_1'),
    sa.CheckConstraint('(`is_penalty` in (0,1))', name='cmf_u_work_bill_chk_2'),
    sa.CheckConstraint('(`no_control` in (0,1))', name='cmf_u_work_bill_chk_3'),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_u_work_bill_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_u_work_bill_ibfk_2'),
    sa.ForeignKeyConstraint(['currency_id'], ['cmf_currency.id'], name='cmf_u_work_bill_ibfk_3'),
    sa.ForeignKeyConstraint(['deal_id'], ['cmf_u_work_deal.id'], name='cmf_u_work_bill_ibfk_4'),
    sa.ForeignKeyConstraint(['print_tmpl_id'], ['cmf_print_tmpl.id'], name='cmf_u_work_bill_ibfk_5'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_u_work_bill_ibfk_6'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_u_work_bill_ibfk_7'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_u_work_bill_waiting_for_id', 'cmf_u_work_bill', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_tree_parent_id', 'cmf_u_work_bill', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_status_id', 'cmf_u_work_bill', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_responsible_id', 'cmf_u_work_bill', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_project_id', 'cmf_u_work_bill', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_print_tmpl_id', 'cmf_u_work_bill', ['print_tmpl_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_period_clone_from_id', 'cmf_u_work_bill', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_parent_task_id', 'cmf_u_work_bill', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_orderno', 'cmf_u_work_bill', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_bill_name', 'cmf_u_work_bill', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_bill_deal_id', 'cmf_u_work_bill', ['deal_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_customer_id', 'cmf_u_work_bill', ['customer_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_currency_id', 'cmf_u_work_bill', ['currency_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_company_id', 'cmf_u_work_bill', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_code', 'cmf_u_work_bill', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_bill_cmf_viewed_at', 'cmf_u_work_bill', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_version', 'cmf_u_work_bill', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_owner_id', 'cmf_u_work_bill', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_modified_by_id', 'cmf_u_work_bill', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_modified_at', 'cmf_u_work_bill', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_locked_by_id', 'cmf_u_work_bill', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_locked_at', 'cmf_u_work_bill', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_deleted', 'cmf_u_work_bill', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_created_at', 'cmf_u_work_bill', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cmf_author_id', 'cmf_u_work_bill', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_cache_status_type', 'cmf_u_work_bill', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_bill_alarm_date', 'cmf_u_work_bill', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_bill_activity_id', 'cmf_u_work_bill', ['activity_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_deal_spectators_root_id', 'cmf_u_work_deal_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_spectators_right_id', 'cmf_u_work_deal_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_spectators_parent_id', 'cmf_u_work_deal_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_spectators_left_id', 'cmf_u_work_deal_spectators', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_deal_executors_root_id', 'cmf_u_work_deal_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_executors_right_id', 'cmf_u_work_deal_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_executors_parent_id', 'cmf_u_work_deal_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_executors_left_id', 'cmf_u_work_deal_executors', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_lead_executors_root_id', 'cmf_u_work_lead_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_executors_right_id', 'cmf_u_work_lead_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_executors_parent_id', 'cmf_u_work_lead_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_executors_left_id', 'cmf_u_work_lead_executors', ['left_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_members',
    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_u_work_sales_list_members_root_id', 'cmf_u_work_sales_list_members', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_members_right_id', 'cmf_u_work_sales_list_members', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_members_parent_id', 'cmf_u_work_sales_list_members', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_members_left_id', 'cmf_u_work_sales_list_members', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_lead_related_objects_root_id', 'cmf_u_work_lead_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_related_objects_right_id', 'cmf_u_work_lead_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_related_objects_parent_id', 'cmf_u_work_lead_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_related_objects_left_id', 'cmf_u_work_lead_related_objects', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_bill_related_objects_root_id', 'cmf_u_work_bill_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_related_objects_right_id', 'cmf_u_work_bill_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_related_objects_parent_id', 'cmf_u_work_bill_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_related_objects_left_id', 'cmf_u_work_bill_related_objects', ['left_id'], unique=False)
    op.create_table('cmf_kanban_sales_status',
    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('color', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('orderno', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('project_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('sales_list_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('status_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('text', mysql.TEXT(), nullable=True),
    sa.CheckConstraint('(`cmf_deleted` in (0,1))', name='cmf_kanban_sales_status_chk_1'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_kanban_sales_status_ibfk_1'),
    sa.ForeignKeyConstraint(['sales_list_id'], ['cmf_u_work_sales_list.id'], name='cmf_kanban_sales_status_ibfk_2'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_kanban_sales_status_ibfk_3'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_kanban_sales_status_status_id', 'cmf_kanban_sales_status', ['status_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_sales_list_id', 'cmf_kanban_sales_status', ['sales_list_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_project_id', 'cmf_kanban_sales_status', ['project_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_orderno', 'cmf_kanban_sales_status', ['orderno'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_name', 'cmf_kanban_sales_status', ['name'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_code', 'cmf_kanban_sales_status', ['code'], unique=True)
    op.create_index('ix_cmf_kanban_sales_status_cmf_viewed_at', 'cmf_kanban_sales_status', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_version', 'cmf_kanban_sales_status', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_owner_id', 'cmf_kanban_sales_status', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_modified_by_id', 'cmf_kanban_sales_status', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_modified_at', 'cmf_kanban_sales_status', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_locked_by_id', 'cmf_kanban_sales_status', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_locked_at', 'cmf_kanban_sales_status', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_deleted', 'cmf_kanban_sales_status', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_created_at', 'cmf_kanban_sales_status', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_kanban_sales_status_cmf_author_id', 'cmf_kanban_sales_status', ['cmf_author_id'], unique=False)
    op.create_table('cmf_u_work_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.CheckConstraint('(`cmf_deleted` in (0,1))', name='cmf_u_work_lead_chk_1'),
    sa.CheckConstraint('(`is_penalty` in (0,1))', name='cmf_u_work_lead_chk_2'),
    sa.CheckConstraint('(`no_control` in (0,1))', name='cmf_u_work_lead_chk_3'),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_u_work_lead_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_u_work_lead_ibfk_2'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_u_work_lead_ibfk_3'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_u_work_lead_ibfk_4'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_u_work_lead_waiting_for_id', 'cmf_u_work_lead', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_tree_parent_id', 'cmf_u_work_lead', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_status_id', 'cmf_u_work_lead', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_responsible_id', 'cmf_u_work_lead', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_project_id', 'cmf_u_work_lead', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_period_clone_from_id', 'cmf_u_work_lead', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_parent_task_id', 'cmf_u_work_lead', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_orderno', 'cmf_u_work_lead', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_lead_name', 'cmf_u_work_lead', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_lead_company_id', 'cmf_u_work_lead', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_code', 'cmf_u_work_lead', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_lead_cmf_viewed_at', 'cmf_u_work_lead', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_version', 'cmf_u_work_lead', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_owner_id', 'cmf_u_work_lead', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_modified_by_id', 'cmf_u_work_lead', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_modified_at', 'cmf_u_work_lead', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_locked_by_id', 'cmf_u_work_lead', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_locked_at', 'cmf_u_work_lead', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_deleted', 'cmf_u_work_lead', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_created_at', 'cmf_u_work_lead', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cmf_author_id', 'cmf_u_work_lead', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_cache_status_type', 'cmf_u_work_lead', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_lead_alarm_date', 'cmf_u_work_lead', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_lead_activity_id', 'cmf_u_work_lead', ['activity_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_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_u_work_sales_list_spectators_root_id', 'cmf_u_work_sales_list_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_spectators_right_id', 'cmf_u_work_sales_list_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_spectators_parent_id', 'cmf_u_work_sales_list_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_spectators_left_id', 'cmf_u_work_sales_list_spectators', ['left_id'], unique=False)
    op.create_table('cmf_u_work_sales_list',
    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('list_type', mysql.VARCHAR(length=32), nullable=False),
    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.CheckConstraint('(`cmf_deleted` in (0,1))', name='cmf_u_work_sales_list_chk_1'),
    sa.CheckConstraint('(`is_penalty` in (0,1))', name='cmf_u_work_sales_list_chk_2'),
    sa.CheckConstraint('(`no_control` in (0,1))', name='cmf_u_work_sales_list_chk_3'),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_u_work_sales_list_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_u_work_sales_list_ibfk_2'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_u_work_sales_list_ibfk_3'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_u_work_sales_list_ibfk_4'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_u_work_sales_list_waiting_for_id', 'cmf_u_work_sales_list', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_tree_parent_id', 'cmf_u_work_sales_list', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_status_id', 'cmf_u_work_sales_list', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_responsible_id', 'cmf_u_work_sales_list', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_project_id', 'cmf_u_work_sales_list', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_period_clone_from_id', 'cmf_u_work_sales_list', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_parent_task_id', 'cmf_u_work_sales_list', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_orderno', 'cmf_u_work_sales_list', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_name', 'cmf_u_work_sales_list', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_company_id', 'cmf_u_work_sales_list', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_code', 'cmf_u_work_sales_list', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_sales_list_cmf_viewed_at', 'cmf_u_work_sales_list', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_version', 'cmf_u_work_sales_list', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_owner_id', 'cmf_u_work_sales_list', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_modified_by_id', 'cmf_u_work_sales_list', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_modified_at', 'cmf_u_work_sales_list', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_locked_by_id', 'cmf_u_work_sales_list', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_locked_at', 'cmf_u_work_sales_list', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_deleted', 'cmf_u_work_sales_list', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_created_at', 'cmf_u_work_sales_list', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cmf_author_id', 'cmf_u_work_sales_list', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_cache_status_type', 'cmf_u_work_sales_list', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_alarm_date', 'cmf_u_work_sales_list', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_activity_id', 'cmf_u_work_sales_list', ['activity_id'], unique=False)
    op.create_table('cmf_u_work_deal_cmf_company',
    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('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_u_work_deal.id'], name='cmf_u_work_deal_cmf_company_ibfk_1'),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_company.id'], name='cmf_u_work_deal_cmf_company_ibfk_2'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_u_work_deal_cmf_company_right_id', 'cmf_u_work_deal_cmf_company', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_company_left_id', 'cmf_u_work_deal_cmf_company', ['left_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_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_u_work_sales_list_related_objects_root_id', 'cmf_u_work_sales_list_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_related_objects_right_id', 'cmf_u_work_sales_list_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_related_objects_parent_id', 'cmf_u_work_sales_list_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_related_objects_left_id', 'cmf_u_work_sales_list_related_objects', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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('currency_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('summa', mysql.DECIMAL(precision=14, scale=2), 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('utm_mark', mysql.TEXT(), nullable=True),
    sa.Column('waiting_for_id', mysql.CHAR(length=64), nullable=True),
    sa.CheckConstraint('(`cmf_deleted` in (0,1))', name='cmf_u_work_deal_chk_1'),
    sa.CheckConstraint('(`is_penalty` in (0,1))', name='cmf_u_work_deal_chk_2'),
    sa.CheckConstraint('(`no_control` in (0,1))', name='cmf_u_work_deal_chk_3'),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], name='cmf_u_work_deal_ibfk_1'),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], name='cmf_u_work_deal_ibfk_2'),
    sa.ForeignKeyConstraint(['currency_id'], ['cmf_currency.id'], name='cmf_u_work_deal_ibfk_3'),
    sa.ForeignKeyConstraint(['project_id'], ['cmf_project.id'], name='cmf_u_work_deal_ibfk_4'),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], name='cmf_u_work_deal_ibfk_5'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_u_work_deal_waiting_for_id', 'cmf_u_work_deal', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_tree_parent_id', 'cmf_u_work_deal', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_status_id', 'cmf_u_work_deal', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_responsible_id', 'cmf_u_work_deal', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_project_id', 'cmf_u_work_deal', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_period_clone_from_id', 'cmf_u_work_deal', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_parent_task_id', 'cmf_u_work_deal', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_orderno', 'cmf_u_work_deal', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_deal_name', 'cmf_u_work_deal', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_deal_currency_id', 'cmf_u_work_deal', ['currency_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_company_id', 'cmf_u_work_deal', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_code', 'cmf_u_work_deal', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_deal_cmf_viewed_at', 'cmf_u_work_deal', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_version', 'cmf_u_work_deal', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_owner_id', 'cmf_u_work_deal', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_modified_by_id', 'cmf_u_work_deal', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_modified_at', 'cmf_u_work_deal', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_locked_by_id', 'cmf_u_work_deal', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_locked_at', 'cmf_u_work_deal', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_deleted', 'cmf_u_work_deal', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_created_at', 'cmf_u_work_deal', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_author_id', 'cmf_u_work_deal', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cache_status_type', 'cmf_u_work_deal', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_deal_alarm_date', 'cmf_u_work_deal', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_deal_activity_id', 'cmf_u_work_deal', ['activity_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_lead_spectators_root_id', 'cmf_u_work_lead_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_spectators_right_id', 'cmf_u_work_lead_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_spectators_parent_id', 'cmf_u_work_lead_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_lead_spectators_left_id', 'cmf_u_work_lead_spectators', ['left_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_bill_executors_root_id', 'cmf_u_work_bill_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_executors_right_id', 'cmf_u_work_bill_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_executors_parent_id', 'cmf_u_work_bill_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_bill_executors_left_id', 'cmf_u_work_bill_executors', ['left_id'], unique=False)
    op.create_table('cmf_u_work_deal_cmf_person',
    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('right_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('right_name_cache', mysql.VARCHAR(length=256), nullable=True),
    sa.ForeignKeyConstraint(['left_id'], ['cmf_u_work_deal.id'], name='cmf_u_work_deal_cmf_person_ibfk_1'),
    sa.ForeignKeyConstraint(['right_id'], ['cmf_person.id'], name='cmf_u_work_deal_cmf_person_ibfk_2'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_u_work_deal_cmf_person_right_id', 'cmf_u_work_deal_cmf_person', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_cmf_person_left_id', 'cmf_u_work_deal_cmf_person', ['left_id'], unique=False)
    op.create_table('cmf_u_work_sales_list_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_u_work_sales_list_executors_root_id', 'cmf_u_work_sales_list_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_executors_right_id', 'cmf_u_work_sales_list_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_executors_parent_id', 'cmf_u_work_sales_list_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_sales_list_executors_left_id', 'cmf_u_work_sales_list_executors', ['left_id'], unique=False)
    op.create_table('cmf_deal_product',
    sa.Column('cache_product_name', mysql.VARCHAR(length=256), 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('count', mysql.DECIMAL(precision=14, scale=2), nullable=True),
    sa.Column('deal_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('id', mysql.CHAR(length=64), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=256), nullable=True),
    sa.Column('price', mysql.DECIMAL(precision=14, scale=2), nullable=True),
    sa.Column('product_id', mysql.CHAR(length=64), nullable=True),
    sa.Column('text', mysql.TEXT(), nullable=True),
    sa.CheckConstraint('(`cmf_deleted` in (0,1))', name='cmf_deal_product_chk_1'),
    sa.ForeignKeyConstraint(['deal_id'], ['cmf_u_work_deal.id'], name='cmf_deal_product_ibfk_1'),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], name='cmf_deal_product_ibfk_2'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_cmf_deal_product_product_id', 'cmf_deal_product', ['product_id'], unique=False)
    op.create_index('ix_cmf_deal_product_name', 'cmf_deal_product', ['name'], unique=False)
    op.create_index('ix_cmf_deal_product_deal_id', 'cmf_deal_product', ['deal_id'], unique=False)
    op.create_index('ix_cmf_deal_product_code', 'cmf_deal_product', ['code'], unique=True)
    op.create_index('ix_cmf_deal_product_cmf_viewed_at', 'cmf_deal_product', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_version', 'cmf_deal_product', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_owner_id', 'cmf_deal_product', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_modified_by_id', 'cmf_deal_product', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_modified_at', 'cmf_deal_product', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_locked_by_id', 'cmf_deal_product', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_locked_at', 'cmf_deal_product', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_deleted', 'cmf_deal_product', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_created_at', 'cmf_deal_product', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_deal_product_cmf_author_id', 'cmf_deal_product', ['cmf_author_id'], unique=False)
    op.create_table('cmf_u_work_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_u_work_deal_related_objects_root_id', 'cmf_u_work_deal_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_related_objects_right_id', 'cmf_u_work_deal_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_related_objects_parent_id', 'cmf_u_work_deal_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_deal_related_objects_left_id', 'cmf_u_work_deal_related_objects', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_sales_order_items_product_id'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_deal_id'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_code'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_viewed_at'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_version'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_owner_id'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_modified_by_id'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_modified_at'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_locked_by_id'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_locked_at'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_deleted'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_created_at'), table_name='cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_items_cmf_author_id'), table_name='cmf_sales_order_items')
    op.drop_table('cmf_sales_order_items')
    op.drop_index(op.f('ix_cmf_sales_order_waiting_for_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_tree_parent_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_status_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_responsible_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_project_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_print_tmpl_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_period_clone_from_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_parent_task_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_orderno'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_name'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_deal_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_customer_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_currency_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_company_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_code'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_viewed_at'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_version'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_owner_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_modified_by_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_modified_at'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_locked_by_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_locked_at'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_deleted'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_created_at'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cmf_author_id'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_cache_status_type'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_alarm_date'), table_name='cmf_sales_order')
    op.drop_index(op.f('ix_cmf_sales_order_activity_id'), table_name='cmf_sales_order')
    op.drop_table('cmf_sales_order')
    op.drop_index(op.f('ix_cmf_payment_waiting_for_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_tree_parent_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_status_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_responsible_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_project_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_print_tmpl_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_period_clone_from_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_parent_task_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_orderno'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_name'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_deal_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_customer_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_currency_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_company_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_code'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_viewed_at'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_version'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_owner_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_modified_by_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_modified_at'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_locked_by_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_locked_at'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_deleted'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_created_at'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cmf_author_id'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_cache_status_type'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_alarm_date'), table_name='cmf_payment')
    op.drop_index(op.f('ix_cmf_payment_activity_id'), table_name='cmf_payment')
    op.drop_table('cmf_payment')
    op.drop_index(op.f('ix_cmf_invoice_items_product_id'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_deal_id'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_code'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_viewed_at'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_version'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_owner_id'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_modified_by_id'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_modified_at'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_locked_by_id'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_locked_at'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_deleted'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_created_at'), table_name='cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_items_cmf_author_id'), table_name='cmf_invoice_items')
    op.drop_table('cmf_invoice_items')
    op.drop_index(op.f('ix_cmf_invoice_waiting_for_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_tree_parent_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_status_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_responsible_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_project_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_print_tmpl_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_period_clone_from_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_parent_task_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_orderno'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_name'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_deal_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_customer_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_currency_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_company_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_code'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_viewed_at'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_version'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_owner_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_modified_by_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_modified_at'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_locked_by_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_locked_at'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_deleted'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_created_at'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cmf_author_id'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_cache_status_type'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_alarm_date'), table_name='cmf_invoice')
    op.drop_index(op.f('ix_cmf_invoice_activity_id'), table_name='cmf_invoice')
    op.drop_table('cmf_invoice')
    op.drop_index(op.f('ix_cmf_deal_cmf_person_right_id'), table_name='cmf_deal_cmf_person')
    op.drop_index(op.f('ix_cmf_deal_cmf_person_left_id'), table_name='cmf_deal_cmf_person')
    op.drop_table('cmf_deal_cmf_person')
    op.drop_index(op.f('ix_cmf_deal_cmf_company_right_id'), table_name='cmf_deal_cmf_company')
    op.drop_index(op.f('ix_cmf_deal_cmf_company_left_id'), table_name='cmf_deal_cmf_company')
    op.drop_table('cmf_deal_cmf_company')
    op.drop_index(op.f('ix_cmf_deal_waiting_for_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_tree_parent_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_status_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_responsible_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_project_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_pipeline_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_period_clone_from_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_parent_task_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_orderno'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_name'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_currency_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_company_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_code'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_viewed_at'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_version'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_owner_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_modified_by_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_modified_at'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_locked_by_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_locked_at'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_deleted'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_created_at'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cmf_author_id'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_cache_status_type'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_alarm_date'), table_name='cmf_deal')
    op.drop_index(op.f('ix_cmf_deal_activity_id'), table_name='cmf_deal')
    op.drop_table('cmf_deal')
    op.drop_index(op.f('ix_cmf_pipeline_waiting_for_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_tree_parent_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_status_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_responsible_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_project_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_period_clone_from_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_parent_task_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_orderno'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_name'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_company_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_code'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_viewed_at'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_version'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_owner_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_modified_by_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_modified_at'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_locked_by_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_locked_at'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_deleted'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_created_at'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cmf_author_id'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_cache_status_type'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_alarm_date'), table_name='cmf_pipeline')
    op.drop_index(op.f('ix_cmf_pipeline_activity_id'), table_name='cmf_pipeline')
    op.drop_table('cmf_pipeline')
    op.drop_index(op.f('ix_cmf_lead_waiting_for_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_tree_parent_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_status_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_responsible_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_project_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_period_clone_from_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_parent_task_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_orderno'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_name'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_company_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_code'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_viewed_at'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_version'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_owner_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_modified_by_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_modified_at'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_locked_by_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_locked_at'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_deleted'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_created_at'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cmf_author_id'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_cache_status_type'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_alarm_date'), table_name='cmf_lead')
    op.drop_index(op.f('ix_cmf_lead_activity_id'), table_name='cmf_lead')
    op.drop_table('cmf_lead')
    op.drop_index(op.f('ix_cmf_sales_order_spectators_root_id'), table_name='cmf_sales_order_spectators')
    op.drop_index(op.f('ix_cmf_sales_order_spectators_right_id'), table_name='cmf_sales_order_spectators')
    op.drop_index(op.f('ix_cmf_sales_order_spectators_parent_id'), table_name='cmf_sales_order_spectators')
    op.drop_index(op.f('ix_cmf_sales_order_spectators_left_id'), table_name='cmf_sales_order_spectators')
    op.drop_table('cmf_sales_order_spectators')
    op.drop_index(op.f('ix_cmf_sales_order_related_objects_root_id'), table_name='cmf_sales_order_related_objects')
    op.drop_index(op.f('ix_cmf_sales_order_related_objects_right_id'), table_name='cmf_sales_order_related_objects')
    op.drop_index(op.f('ix_cmf_sales_order_related_objects_parent_id'), table_name='cmf_sales_order_related_objects')
    op.drop_index(op.f('ix_cmf_sales_order_related_objects_left_id'), table_name='cmf_sales_order_related_objects')
    op.drop_table('cmf_sales_order_related_objects')
    op.drop_index(op.f('ix_cmf_sales_order_executors_root_id'), table_name='cmf_sales_order_executors')
    op.drop_index(op.f('ix_cmf_sales_order_executors_right_id'), table_name='cmf_sales_order_executors')
    op.drop_index(op.f('ix_cmf_sales_order_executors_parent_id'), table_name='cmf_sales_order_executors')
    op.drop_index(op.f('ix_cmf_sales_order_executors_left_id'), table_name='cmf_sales_order_executors')
    op.drop_table('cmf_sales_order_executors')
    op.drop_index(op.f('ix_cmf_pipeline_spectators_root_id'), table_name='cmf_pipeline_spectators')
    op.drop_index(op.f('ix_cmf_pipeline_spectators_right_id'), table_name='cmf_pipeline_spectators')
    op.drop_index(op.f('ix_cmf_pipeline_spectators_parent_id'), table_name='cmf_pipeline_spectators')
    op.drop_index(op.f('ix_cmf_pipeline_spectators_left_id'), table_name='cmf_pipeline_spectators')
    op.drop_table('cmf_pipeline_spectators')
    op.drop_index(op.f('ix_cmf_pipeline_related_objects_root_id'), table_name='cmf_pipeline_related_objects')
    op.drop_index(op.f('ix_cmf_pipeline_related_objects_right_id'), table_name='cmf_pipeline_related_objects')
    op.drop_index(op.f('ix_cmf_pipeline_related_objects_parent_id'), table_name='cmf_pipeline_related_objects')
    op.drop_index(op.f('ix_cmf_pipeline_related_objects_left_id'), table_name='cmf_pipeline_related_objects')
    op.drop_table('cmf_pipeline_related_objects')
    op.drop_index(op.f('ix_cmf_pipeline_executors_root_id'), table_name='cmf_pipeline_executors')
    op.drop_index(op.f('ix_cmf_pipeline_executors_right_id'), table_name='cmf_pipeline_executors')
    op.drop_index(op.f('ix_cmf_pipeline_executors_parent_id'), table_name='cmf_pipeline_executors')
    op.drop_index(op.f('ix_cmf_pipeline_executors_left_id'), table_name='cmf_pipeline_executors')
    op.drop_table('cmf_pipeline_executors')
    op.drop_index(op.f('ix_cmf_payment_spectators_root_id'), table_name='cmf_payment_spectators')
    op.drop_index(op.f('ix_cmf_payment_spectators_right_id'), table_name='cmf_payment_spectators')
    op.drop_index(op.f('ix_cmf_payment_spectators_parent_id'), table_name='cmf_payment_spectators')
    op.drop_index(op.f('ix_cmf_payment_spectators_left_id'), table_name='cmf_payment_spectators')
    op.drop_table('cmf_payment_spectators')
    op.drop_index(op.f('ix_cmf_payment_related_objects_root_id'), table_name='cmf_payment_related_objects')
    op.drop_index(op.f('ix_cmf_payment_related_objects_right_id'), table_name='cmf_payment_related_objects')
    op.drop_index(op.f('ix_cmf_payment_related_objects_parent_id'), table_name='cmf_payment_related_objects')
    op.drop_index(op.f('ix_cmf_payment_related_objects_left_id'), table_name='cmf_payment_related_objects')
    op.drop_table('cmf_payment_related_objects')
    op.drop_index(op.f('ix_cmf_payment_executors_root_id'), table_name='cmf_payment_executors')
    op.drop_index(op.f('ix_cmf_payment_executors_right_id'), table_name='cmf_payment_executors')
    op.drop_index(op.f('ix_cmf_payment_executors_parent_id'), table_name='cmf_payment_executors')
    op.drop_index(op.f('ix_cmf_payment_executors_left_id'), table_name='cmf_payment_executors')
    op.drop_table('cmf_payment_executors')
    op.drop_index(op.f('ix_cmf_lead_spectators_root_id'), table_name='cmf_lead_spectators')
    op.drop_index(op.f('ix_cmf_lead_spectators_right_id'), table_name='cmf_lead_spectators')
    op.drop_index(op.f('ix_cmf_lead_spectators_parent_id'), table_name='cmf_lead_spectators')
    op.drop_index(op.f('ix_cmf_lead_spectators_left_id'), table_name='cmf_lead_spectators')
    op.drop_table('cmf_lead_spectators')
    op.drop_index(op.f('ix_cmf_lead_related_objects_root_id'), table_name='cmf_lead_related_objects')
    op.drop_index(op.f('ix_cmf_lead_related_objects_right_id'), table_name='cmf_lead_related_objects')
    op.drop_index(op.f('ix_cmf_lead_related_objects_parent_id'), table_name='cmf_lead_related_objects')
    op.drop_index(op.f('ix_cmf_lead_related_objects_left_id'), table_name='cmf_lead_related_objects')
    op.drop_table('cmf_lead_related_objects')
    op.drop_index(op.f('ix_cmf_lead_executors_root_id'), table_name='cmf_lead_executors')
    op.drop_index(op.f('ix_cmf_lead_executors_right_id'), table_name='cmf_lead_executors')
    op.drop_index(op.f('ix_cmf_lead_executors_parent_id'), table_name='cmf_lead_executors')
    op.drop_index(op.f('ix_cmf_lead_executors_left_id'), table_name='cmf_lead_executors')
    op.drop_table('cmf_lead_executors')
    op.drop_index(op.f('ix_cmf_invoice_spectators_root_id'), table_name='cmf_invoice_spectators')
    op.drop_index(op.f('ix_cmf_invoice_spectators_right_id'), table_name='cmf_invoice_spectators')
    op.drop_index(op.f('ix_cmf_invoice_spectators_parent_id'), table_name='cmf_invoice_spectators')
    op.drop_index(op.f('ix_cmf_invoice_spectators_left_id'), table_name='cmf_invoice_spectators')
    op.drop_table('cmf_invoice_spectators')
    op.drop_index(op.f('ix_cmf_invoice_related_objects_root_id'), table_name='cmf_invoice_related_objects')
    op.drop_index(op.f('ix_cmf_invoice_related_objects_right_id'), table_name='cmf_invoice_related_objects')
    op.drop_index(op.f('ix_cmf_invoice_related_objects_parent_id'), table_name='cmf_invoice_related_objects')
    op.drop_index(op.f('ix_cmf_invoice_related_objects_left_id'), table_name='cmf_invoice_related_objects')
    op.drop_table('cmf_invoice_related_objects')
    op.drop_index(op.f('ix_cmf_invoice_executors_root_id'), table_name='cmf_invoice_executors')
    op.drop_index(op.f('ix_cmf_invoice_executors_right_id'), table_name='cmf_invoice_executors')
    op.drop_index(op.f('ix_cmf_invoice_executors_parent_id'), table_name='cmf_invoice_executors')
    op.drop_index(op.f('ix_cmf_invoice_executors_left_id'), table_name='cmf_invoice_executors')
    op.drop_table('cmf_invoice_executors')
    op.drop_index(op.f('ix_cmf_deal_spectators_root_id'), table_name='cmf_deal_spectators')
    op.drop_index(op.f('ix_cmf_deal_spectators_right_id'), table_name='cmf_deal_spectators')
    op.drop_index(op.f('ix_cmf_deal_spectators_parent_id'), table_name='cmf_deal_spectators')
    op.drop_index(op.f('ix_cmf_deal_spectators_left_id'), table_name='cmf_deal_spectators')
    op.drop_table('cmf_deal_spectators')
    op.drop_index(op.f('ix_cmf_deal_related_objects_root_id'), table_name='cmf_deal_related_objects')
    op.drop_index(op.f('ix_cmf_deal_related_objects_right_id'), table_name='cmf_deal_related_objects')
    op.drop_index(op.f('ix_cmf_deal_related_objects_parent_id'), table_name='cmf_deal_related_objects')
    op.drop_index(op.f('ix_cmf_deal_related_objects_left_id'), table_name='cmf_deal_related_objects')
    op.drop_table('cmf_deal_related_objects')
    op.drop_index(op.f('ix_cmf_deal_executors_root_id'), table_name='cmf_deal_executors')
    op.drop_index(op.f('ix_cmf_deal_executors_right_id'), table_name='cmf_deal_executors')
    op.drop_index(op.f('ix_cmf_deal_executors_parent_id'), table_name='cmf_deal_executors')
    op.drop_index(op.f('ix_cmf_deal_executors_left_id'), table_name='cmf_deal_executors')
    op.drop_table('cmf_deal_executors')
    # ### end Alembic commands ###
