"""empty message

Revision ID: 3b642a300c52
Revises: dc4fd60e0465
Create Date: 2020-12-21 14:39:38.984801

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3b642a300c52'
down_revision = 'dc4fd60e0465'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(op.f('ix_cmf_chat_group_activity_id'), 'cmf_chat_group', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_alarm_date'), 'cmf_chat_group', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cache_last_topic_code'), 'cmf_chat_group', ['cache_last_topic_code'], unique=True)
    op.create_index(op.f('ix_cmf_chat_group_cache_last_topic_name'), 'cmf_chat_group', ['cache_last_topic_name'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cache_status_type'), 'cmf_chat_group', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_author_id'), 'cmf_chat_group', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_created_at'), 'cmf_chat_group', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_deleted'), 'cmf_chat_group', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_locked_at'), 'cmf_chat_group', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_locked_by_id'), 'cmf_chat_group', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_modified_at'), 'cmf_chat_group', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_modified_by_id'), 'cmf_chat_group', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_owner_id'), 'cmf_chat_group', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_version'), 'cmf_chat_group', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_cmf_viewed_at'), 'cmf_chat_group', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_code'), 'cmf_chat_group', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_chat_group_company_id'), 'cmf_chat_group', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_last_comment_id'), 'cmf_chat_group', ['last_comment_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_last_topic_id'), 'cmf_chat_group', ['last_topic_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_name'), 'cmf_chat_group', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_orderno'), 'cmf_chat_group', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_parent_task_id'), 'cmf_chat_group', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_period_clone_from_id'), 'cmf_chat_group', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_project_id'), 'cmf_chat_group', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_responsible_id'), 'cmf_chat_group', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_status_id'), 'cmf_chat_group', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_tree_parent_id'), 'cmf_chat_group', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_waiting_for_id'), 'cmf_chat_group', ['waiting_for_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_group_activity_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_alarm_date', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cache_last_topic_code', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cache_last_topic_name', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cache_status_type', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_author_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_created_at', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_deleted', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_locked_at', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_locked_by_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_modified_at', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_modified_by_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_owner_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_version', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_cmf_viewed_at', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_code', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_company_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_last_comment_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_last_topic_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_name', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_orderno', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_parent_task_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_period_clone_from_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_project_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_responsible_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_status_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_tree_parent_id', table_name='cmf_chat_group')
    op.drop_index('ix_cmf_u_work_chat_group_waiting_for_id', table_name='cmf_chat_group')
    op.create_index(op.f('ix_cmf_chat_group_executors_left_id'), 'cmf_chat_group_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_executors_parent_id'), 'cmf_chat_group_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_executors_right_id'), 'cmf_chat_group_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_executors_root_id'), 'cmf_chat_group_executors', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_group_executors_left_id', table_name='cmf_chat_group_executors')
    op.drop_index('ix_cmf_u_work_chat_group_executors_parent_id', table_name='cmf_chat_group_executors')
    op.drop_index('ix_cmf_u_work_chat_group_executors_right_id', table_name='cmf_chat_group_executors')
    op.drop_index('ix_cmf_u_work_chat_group_executors_root_id', table_name='cmf_chat_group_executors')
    op.create_index(op.f('ix_cmf_chat_group_related_objects_left_id'), 'cmf_chat_group_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_related_objects_parent_id'), 'cmf_chat_group_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_related_objects_right_id'), 'cmf_chat_group_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_related_objects_root_id'), 'cmf_chat_group_related_objects', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_group_related_objects_left_id', table_name='cmf_chat_group_related_objects')
    op.drop_index('ix_cmf_u_work_chat_group_related_objects_parent_id', table_name='cmf_chat_group_related_objects')
    op.drop_index('ix_cmf_u_work_chat_group_related_objects_right_id', table_name='cmf_chat_group_related_objects')
    op.drop_index('ix_cmf_u_work_chat_group_related_objects_root_id', table_name='cmf_chat_group_related_objects')
    op.create_index(op.f('ix_cmf_chat_group_spectators_left_id'), 'cmf_chat_group_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_spectators_parent_id'), 'cmf_chat_group_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_spectators_right_id'), 'cmf_chat_group_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_group_spectators_root_id'), 'cmf_chat_group_spectators', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_group_spectators_left_id', table_name='cmf_chat_group_spectators')
    op.drop_index('ix_cmf_u_work_chat_group_spectators_parent_id', table_name='cmf_chat_group_spectators')
    op.drop_index('ix_cmf_u_work_chat_group_spectators_right_id', table_name='cmf_chat_group_spectators')
    op.drop_index('ix_cmf_u_work_chat_group_spectators_root_id', table_name='cmf_chat_group_spectators')
    op.create_index(op.f('ix_cmf_chat_topic_activity_id'), 'cmf_chat_topic', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_alarm_date'), 'cmf_chat_topic', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cache_status_type'), 'cmf_chat_topic', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_author_id'), 'cmf_chat_topic', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_created_at'), 'cmf_chat_topic', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_deleted'), 'cmf_chat_topic', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_locked_at'), 'cmf_chat_topic', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_locked_by_id'), 'cmf_chat_topic', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_modified_at'), 'cmf_chat_topic', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_modified_by_id'), 'cmf_chat_topic', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_owner_id'), 'cmf_chat_topic', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_version'), 'cmf_chat_topic', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_cmf_viewed_at'), 'cmf_chat_topic', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_code'), 'cmf_chat_topic', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_chat_topic_company_id'), 'cmf_chat_topic', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_group_id'), 'cmf_chat_topic', ['group_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_last_comment_id'), 'cmf_chat_topic', ['last_comment_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_name'), 'cmf_chat_topic', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_orderno'), 'cmf_chat_topic', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_parent_task_id'), 'cmf_chat_topic', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_period_clone_from_id'), 'cmf_chat_topic', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_project_id'), 'cmf_chat_topic', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_responsible_id'), 'cmf_chat_topic', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_status_id'), 'cmf_chat_topic', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_tree_parent_id'), 'cmf_chat_topic', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_waiting_for_id'), 'cmf_chat_topic', ['waiting_for_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_topic_activity_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_alarm_date', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cache_status_type', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_author_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_created_at', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_deleted', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_locked_at', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_locked_by_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_modified_at', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_modified_by_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_owner_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_version', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_cmf_viewed_at', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_code', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_company_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_group_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_last_comment_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_name', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_orderno', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_parent_task_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_period_clone_from_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_project_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_responsible_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_status_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_tree_parent_id', table_name='cmf_chat_topic')
    op.drop_index('ix_cmf_u_work_chat_topic_waiting_for_id', table_name='cmf_chat_topic')
    op.create_foreign_key(None, 'cmf_chat_topic', 'cmf_chat_group', ['group_id'], ['id'])
    op.create_index(op.f('ix_cmf_chat_topic_executors_left_id'), 'cmf_chat_topic_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_executors_parent_id'), 'cmf_chat_topic_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_executors_right_id'), 'cmf_chat_topic_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_executors_root_id'), 'cmf_chat_topic_executors', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_topic_executors_left_id', table_name='cmf_chat_topic_executors')
    op.drop_index('ix_cmf_u_work_chat_topic_executors_parent_id', table_name='cmf_chat_topic_executors')
    op.drop_index('ix_cmf_u_work_chat_topic_executors_right_id', table_name='cmf_chat_topic_executors')
    op.drop_index('ix_cmf_u_work_chat_topic_executors_root_id', table_name='cmf_chat_topic_executors')
    op.create_index(op.f('ix_cmf_chat_topic_related_objects_left_id'), 'cmf_chat_topic_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_related_objects_parent_id'), 'cmf_chat_topic_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_related_objects_right_id'), 'cmf_chat_topic_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_related_objects_root_id'), 'cmf_chat_topic_related_objects', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_topic_related_objects_left_id', table_name='cmf_chat_topic_related_objects')
    op.drop_index('ix_cmf_u_work_chat_topic_related_objects_parent_id', table_name='cmf_chat_topic_related_objects')
    op.drop_index('ix_cmf_u_work_chat_topic_related_objects_right_id', table_name='cmf_chat_topic_related_objects')
    op.drop_index('ix_cmf_u_work_chat_topic_related_objects_root_id', table_name='cmf_chat_topic_related_objects')
    op.create_index(op.f('ix_cmf_chat_topic_spectators_left_id'), 'cmf_chat_topic_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_spectators_parent_id'), 'cmf_chat_topic_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_spectators_right_id'), 'cmf_chat_topic_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_chat_topic_spectators_root_id'), 'cmf_chat_topic_spectators', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_chat_topic_spectators_left_id', table_name='cmf_chat_topic_spectators')
    op.drop_index('ix_cmf_u_work_chat_topic_spectators_parent_id', table_name='cmf_chat_topic_spectators')
    op.drop_index('ix_cmf_u_work_chat_topic_spectators_right_id', table_name='cmf_chat_topic_spectators')
    op.drop_index('ix_cmf_u_work_chat_topic_spectators_root_id', table_name='cmf_chat_topic_spectators')
    op.alter_column('cmf_deal', 'activity_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'company_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'currency_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_deal', 'parent_task_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'period_clone_from_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'pipeline_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'project_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'responsible_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'status_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'tree_parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'waiting_for_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_company', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_deal_cmf_company', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_company', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_person', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_deal_cmf_person', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_person', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_deal_executors', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_deal_related_objects', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_deal_spectators', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'activity_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'company_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'currency_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'customer_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'deal_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_invoice', 'parent_task_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'period_clone_from_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'print_tmpl_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'project_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'responsible_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'status_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'tree_parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'waiting_for_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_invoice_executors', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'deal_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_invoice_items', 'product_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_invoice_related_objects', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_invoice_spectators', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'activity_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'company_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_lead', 'parent_task_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'period_clone_from_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'project_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'responsible_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'status_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'tree_parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'waiting_for_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_lead_executors', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_lead_related_objects', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_lead_spectators', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.create_index(op.f('ix_cmf_list_activity_id'), 'cmf_list', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_alarm_date'), 'cmf_list', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_list_cache_status_type'), 'cmf_list', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_author_id'), 'cmf_list', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_created_at'), 'cmf_list', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_deleted'), 'cmf_list', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_locked_at'), 'cmf_list', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_locked_by_id'), 'cmf_list', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_modified_at'), 'cmf_list', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_modified_by_id'), 'cmf_list', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_owner_id'), 'cmf_list', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_version'), 'cmf_list', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_list_cmf_viewed_at'), 'cmf_list', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_list_code'), 'cmf_list', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_list_company_id'), 'cmf_list', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_name'), 'cmf_list', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_list_orderno'), 'cmf_list', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_list_parent_task_id'), 'cmf_list', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_period_clone_from_id'), 'cmf_list', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_project_id'), 'cmf_list', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_responsible_id'), 'cmf_list', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_status_id'), 'cmf_list', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_tree_parent_id'), 'cmf_list', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_waiting_for_id'), 'cmf_list', ['waiting_for_id'], unique=False)
    op.drop_index('ix_cmf_u_work_list_activity_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_alarm_date', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cache_status_type', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_author_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_created_at', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_deleted', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_locked_at', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_locked_by_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_modified_at', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_modified_by_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_owner_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_version', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_cmf_viewed_at', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_code', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_company_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_name', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_orderno', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_parent_task_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_period_clone_from_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_project_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_responsible_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_status_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_tree_parent_id', table_name='cmf_list')
    op.drop_index('ix_cmf_u_work_list_waiting_for_id', table_name='cmf_list')
    op.create_index(op.f('ix_cmf_list_executors_left_id'), 'cmf_list_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_executors_parent_id'), 'cmf_list_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_executors_right_id'), 'cmf_list_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_executors_root_id'), 'cmf_list_executors', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_list_executors_left_id', table_name='cmf_list_executors')
    op.drop_index('ix_cmf_u_work_list_executors_parent_id', table_name='cmf_list_executors')
    op.drop_index('ix_cmf_u_work_list_executors_right_id', table_name='cmf_list_executors')
    op.drop_index('ix_cmf_u_work_list_executors_root_id', table_name='cmf_list_executors')
    op.create_index(op.f('ix_cmf_list_members_left_id'), 'cmf_list_members', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_members_parent_id'), 'cmf_list_members', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_members_right_id'), 'cmf_list_members', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_members_root_id'), 'cmf_list_members', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_list_members_left_id', table_name='cmf_list_members')
    op.drop_index('ix_cmf_u_work_list_members_parent_id', table_name='cmf_list_members')
    op.drop_index('ix_cmf_u_work_list_members_right_id', table_name='cmf_list_members')
    op.drop_index('ix_cmf_u_work_list_members_root_id', table_name='cmf_list_members')
    op.create_index(op.f('ix_cmf_list_related_objects_left_id'), 'cmf_list_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_related_objects_parent_id'), 'cmf_list_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_related_objects_right_id'), 'cmf_list_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_related_objects_root_id'), 'cmf_list_related_objects', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_list_related_objects_left_id', table_name='cmf_list_related_objects')
    op.drop_index('ix_cmf_u_work_list_related_objects_parent_id', table_name='cmf_list_related_objects')
    op.drop_index('ix_cmf_u_work_list_related_objects_right_id', table_name='cmf_list_related_objects')
    op.drop_index('ix_cmf_u_work_list_related_objects_root_id', table_name='cmf_list_related_objects')
    op.create_index(op.f('ix_cmf_list_spectators_left_id'), 'cmf_list_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_spectators_parent_id'), 'cmf_list_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_spectators_right_id'), 'cmf_list_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_list_spectators_root_id'), 'cmf_list_spectators', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_list_spectators_left_id', table_name='cmf_list_spectators')
    op.drop_index('ix_cmf_u_work_list_spectators_parent_id', table_name='cmf_list_spectators')
    op.drop_index('ix_cmf_u_work_list_spectators_right_id', table_name='cmf_list_spectators')
    op.drop_index('ix_cmf_u_work_list_spectators_root_id', table_name='cmf_list_spectators')
    op.alter_column('cmf_payment', 'activity_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'company_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'currency_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'customer_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'deal_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_payment', 'parent_task_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'period_clone_from_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'print_tmpl_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'project_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'responsible_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'status_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'tree_parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'waiting_for_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_payment_executors', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_payment_related_objects', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_payment_spectators', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'activity_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'company_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_pipeline', 'parent_task_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'period_clone_from_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'project_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'responsible_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'status_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'tree_parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'waiting_for_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_pipeline_executors', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_pipeline_related_objects', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_pipeline_spectators', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_price', 'currency_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_price', 'product_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_price', 'unit_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'activity_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'company_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'currency_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'customer_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'deal_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_sales_order', 'parent_task_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'period_clone_from_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'print_tmpl_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'project_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'responsible_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'status_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'tree_parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'waiting_for_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_sales_order_executors', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_author_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_locked_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_modified_by_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_owner_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'deal_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_sales_order_items', 'product_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_sales_order_related_objects', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64))
    op.alter_column('cmf_sales_order_spectators', 'left_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'parent_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'right_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'root_id',
               existing_type=sa.CHAR(length=64),
               type_=sa.String(length=64),
               existing_nullable=True)
    op.create_index(op.f('ix_cmf_task_activity_id'), 'cmf_task', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_alarm_date'), 'cmf_task', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_task_cache_status_type'), 'cmf_task', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_author_id'), 'cmf_task', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_created_at'), 'cmf_task', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_deleted'), 'cmf_task', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_locked_at'), 'cmf_task', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_locked_by_id'), 'cmf_task', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_modified_at'), 'cmf_task', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_modified_by_id'), 'cmf_task', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_owner_id'), 'cmf_task', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_version'), 'cmf_task', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_task_cmf_viewed_at'), 'cmf_task', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_task_code'), 'cmf_task', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_task_company_id'), 'cmf_task', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_name'), 'cmf_task', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_task_orderno'), 'cmf_task', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_task_parent_task_id'), 'cmf_task', ['parent_task_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_period_clone_from_id'), 'cmf_task', ['period_clone_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_project_id'), 'cmf_task', ['project_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_responsible_id'), 'cmf_task', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_status_id'), 'cmf_task', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_tree_parent_id'), 'cmf_task', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_uwork_type_id'), 'cmf_task', ['uwork_type_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_waiting_for_id'), 'cmf_task', ['waiting_for_id'], unique=False)
    op.drop_index('ix_cmf_u_work_task_activity_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_alarm_date', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cache_status_type', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_author_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_created_at', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_deleted', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_locked_at', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_locked_by_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_modified_at', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_modified_by_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_owner_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_version', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_cmf_viewed_at', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_code', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_company_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_name', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_orderno', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_parent_task_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_period_clone_from_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_project_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_responsible_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_status_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_tree_parent_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_uwork_type_id', table_name='cmf_task')
    op.drop_index('ix_cmf_u_work_task_waiting_for_id', table_name='cmf_task')
    op.create_index(op.f('ix_cmf_task_executors_left_id'), 'cmf_task_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_executors_parent_id'), 'cmf_task_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_executors_right_id'), 'cmf_task_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_executors_root_id'), 'cmf_task_executors', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_task_executors_left_id', table_name='cmf_task_executors')
    op.drop_index('ix_cmf_u_work_task_executors_parent_id', table_name='cmf_task_executors')
    op.drop_index('ix_cmf_u_work_task_executors_right_id', table_name='cmf_task_executors')
    op.drop_index('ix_cmf_u_work_task_executors_root_id', table_name='cmf_task_executors')
    op.create_index(op.f('ix_cmf_task_related_objects_left_id'), 'cmf_task_related_objects', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_related_objects_parent_id'), 'cmf_task_related_objects', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_related_objects_right_id'), 'cmf_task_related_objects', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_related_objects_root_id'), 'cmf_task_related_objects', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_task_related_objects_left_id', table_name='cmf_task_related_objects')
    op.drop_index('ix_cmf_u_work_task_related_objects_parent_id', table_name='cmf_task_related_objects')
    op.drop_index('ix_cmf_u_work_task_related_objects_right_id', table_name='cmf_task_related_objects')
    op.drop_index('ix_cmf_u_work_task_related_objects_root_id', table_name='cmf_task_related_objects')
    op.create_index(op.f('ix_cmf_task_spectators_left_id'), 'cmf_task_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_spectators_parent_id'), 'cmf_task_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_spectators_right_id'), 'cmf_task_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_task_spectators_root_id'), 'cmf_task_spectators', ['root_id'], unique=False)
    op.drop_index('ix_cmf_u_work_task_spectators_left_id', table_name='cmf_task_spectators')
    op.drop_index('ix_cmf_u_work_task_spectators_parent_id', table_name='cmf_task_spectators')
    op.drop_index('ix_cmf_u_work_task_spectators_right_id', table_name='cmf_task_spectators')
    op.drop_index('ix_cmf_u_work_task_spectators_root_id', table_name='cmf_task_spectators')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index('ix_cmf_u_work_task_spectators_root_id', 'cmf_task_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_spectators_right_id', 'cmf_task_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_spectators_parent_id', 'cmf_task_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_spectators_left_id', 'cmf_task_spectators', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_task_spectators_root_id'), table_name='cmf_task_spectators')
    op.drop_index(op.f('ix_cmf_task_spectators_right_id'), table_name='cmf_task_spectators')
    op.drop_index(op.f('ix_cmf_task_spectators_parent_id'), table_name='cmf_task_spectators')
    op.drop_index(op.f('ix_cmf_task_spectators_left_id'), table_name='cmf_task_spectators')
    op.create_index('ix_cmf_u_work_task_related_objects_root_id', 'cmf_task_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_related_objects_right_id', 'cmf_task_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_related_objects_parent_id', 'cmf_task_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_related_objects_left_id', 'cmf_task_related_objects', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_task_related_objects_root_id'), table_name='cmf_task_related_objects')
    op.drop_index(op.f('ix_cmf_task_related_objects_right_id'), table_name='cmf_task_related_objects')
    op.drop_index(op.f('ix_cmf_task_related_objects_parent_id'), table_name='cmf_task_related_objects')
    op.drop_index(op.f('ix_cmf_task_related_objects_left_id'), table_name='cmf_task_related_objects')
    op.create_index('ix_cmf_u_work_task_executors_root_id', 'cmf_task_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_executors_right_id', 'cmf_task_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_executors_parent_id', 'cmf_task_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_executors_left_id', 'cmf_task_executors', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_task_executors_root_id'), table_name='cmf_task_executors')
    op.drop_index(op.f('ix_cmf_task_executors_right_id'), table_name='cmf_task_executors')
    op.drop_index(op.f('ix_cmf_task_executors_parent_id'), table_name='cmf_task_executors')
    op.drop_index(op.f('ix_cmf_task_executors_left_id'), table_name='cmf_task_executors')
    op.create_index('ix_cmf_u_work_task_waiting_for_id', 'cmf_task', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_uwork_type_id', 'cmf_task', ['uwork_type_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_tree_parent_id', 'cmf_task', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_status_id', 'cmf_task', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_responsible_id', 'cmf_task', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_project_id', 'cmf_task', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_period_clone_from_id', 'cmf_task', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_parent_task_id', 'cmf_task', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_orderno', 'cmf_task', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_task_name', 'cmf_task', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_task_company_id', 'cmf_task', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_code', 'cmf_task', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_task_cmf_viewed_at', 'cmf_task', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_version', 'cmf_task', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_owner_id', 'cmf_task', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_modified_by_id', 'cmf_task', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_modified_at', 'cmf_task', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_locked_by_id', 'cmf_task', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_locked_at', 'cmf_task', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_deleted', 'cmf_task', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_created_at', 'cmf_task', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_task_cmf_author_id', 'cmf_task', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_task_cache_status_type', 'cmf_task', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_task_alarm_date', 'cmf_task', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_task_activity_id', 'cmf_task', ['activity_id'], unique=False)
    op.drop_index(op.f('ix_cmf_task_waiting_for_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_uwork_type_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_tree_parent_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_status_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_responsible_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_project_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_period_clone_from_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_parent_task_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_orderno'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_name'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_company_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_code'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_viewed_at'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_version'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_owner_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_modified_by_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_modified_at'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_locked_by_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_locked_at'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_deleted'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_created_at'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cmf_author_id'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_cache_status_type'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_alarm_date'), table_name='cmf_task')
    op.drop_index(op.f('ix_cmf_task_activity_id'), table_name='cmf_task')
    op.alter_column('cmf_sales_order_spectators', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_spectators', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_sales_order_related_objects', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_related_objects', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_sales_order_items', 'product_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_sales_order_items', 'deal_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_items', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order_executors', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_sales_order', 'waiting_for_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'tree_parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'status_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'responsible_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'project_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'print_tmpl_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'period_clone_from_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'parent_task_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_sales_order', 'deal_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'customer_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'currency_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'company_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_sales_order', 'activity_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_price', 'unit_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_price', 'product_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_price', 'currency_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_spectators', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_pipeline_related_objects', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_related_objects', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_pipeline_executors', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline_executors', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_pipeline', 'waiting_for_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'tree_parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'status_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'responsible_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'project_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'period_clone_from_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'parent_task_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_pipeline', 'company_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_pipeline', 'activity_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_spectators', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_payment_related_objects', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_related_objects', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_payment_executors', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment_executors', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_payment', 'waiting_for_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'tree_parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'status_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'responsible_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'project_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'print_tmpl_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'period_clone_from_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'parent_task_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_payment', 'deal_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'customer_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'currency_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'company_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_payment', 'activity_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.create_index('ix_cmf_u_work_list_spectators_root_id', 'cmf_list_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_spectators_right_id', 'cmf_list_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_spectators_parent_id', 'cmf_list_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_spectators_left_id', 'cmf_list_spectators', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_list_spectators_root_id'), table_name='cmf_list_spectators')
    op.drop_index(op.f('ix_cmf_list_spectators_right_id'), table_name='cmf_list_spectators')
    op.drop_index(op.f('ix_cmf_list_spectators_parent_id'), table_name='cmf_list_spectators')
    op.drop_index(op.f('ix_cmf_list_spectators_left_id'), table_name='cmf_list_spectators')
    op.create_index('ix_cmf_u_work_list_related_objects_root_id', 'cmf_list_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_related_objects_right_id', 'cmf_list_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_related_objects_parent_id', 'cmf_list_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_related_objects_left_id', 'cmf_list_related_objects', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_list_related_objects_root_id'), table_name='cmf_list_related_objects')
    op.drop_index(op.f('ix_cmf_list_related_objects_right_id'), table_name='cmf_list_related_objects')
    op.drop_index(op.f('ix_cmf_list_related_objects_parent_id'), table_name='cmf_list_related_objects')
    op.drop_index(op.f('ix_cmf_list_related_objects_left_id'), table_name='cmf_list_related_objects')
    op.create_index('ix_cmf_u_work_list_members_root_id', 'cmf_list_members', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_members_right_id', 'cmf_list_members', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_members_parent_id', 'cmf_list_members', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_members_left_id', 'cmf_list_members', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_list_members_root_id'), table_name='cmf_list_members')
    op.drop_index(op.f('ix_cmf_list_members_right_id'), table_name='cmf_list_members')
    op.drop_index(op.f('ix_cmf_list_members_parent_id'), table_name='cmf_list_members')
    op.drop_index(op.f('ix_cmf_list_members_left_id'), table_name='cmf_list_members')
    op.create_index('ix_cmf_u_work_list_executors_root_id', 'cmf_list_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_executors_right_id', 'cmf_list_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_executors_parent_id', 'cmf_list_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_executors_left_id', 'cmf_list_executors', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_list_executors_root_id'), table_name='cmf_list_executors')
    op.drop_index(op.f('ix_cmf_list_executors_right_id'), table_name='cmf_list_executors')
    op.drop_index(op.f('ix_cmf_list_executors_parent_id'), table_name='cmf_list_executors')
    op.drop_index(op.f('ix_cmf_list_executors_left_id'), table_name='cmf_list_executors')
    op.create_index('ix_cmf_u_work_list_waiting_for_id', 'cmf_list', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_tree_parent_id', 'cmf_list', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_status_id', 'cmf_list', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_responsible_id', 'cmf_list', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_project_id', 'cmf_list', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_period_clone_from_id', 'cmf_list', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_parent_task_id', 'cmf_list', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_orderno', 'cmf_list', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_list_name', 'cmf_list', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_list_company_id', 'cmf_list', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_code', 'cmf_list', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_list_cmf_viewed_at', 'cmf_list', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_version', 'cmf_list', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_owner_id', 'cmf_list', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_modified_by_id', 'cmf_list', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_modified_at', 'cmf_list', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_locked_by_id', 'cmf_list', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_locked_at', 'cmf_list', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_deleted', 'cmf_list', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_created_at', 'cmf_list', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_list_cmf_author_id', 'cmf_list', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_list_cache_status_type', 'cmf_list', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_list_alarm_date', 'cmf_list', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_list_activity_id', 'cmf_list', ['activity_id'], unique=False)
    op.drop_index(op.f('ix_cmf_list_waiting_for_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_tree_parent_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_status_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_responsible_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_project_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_period_clone_from_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_parent_task_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_orderno'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_name'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_company_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_code'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_viewed_at'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_version'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_owner_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_modified_by_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_modified_at'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_locked_by_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_locked_at'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_deleted'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_created_at'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cmf_author_id'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_cache_status_type'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_alarm_date'), table_name='cmf_list')
    op.drop_index(op.f('ix_cmf_list_activity_id'), table_name='cmf_list')
    op.alter_column('cmf_lead_spectators', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_spectators', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_lead_related_objects', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_related_objects', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_lead_executors', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead_executors', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_lead', 'waiting_for_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'tree_parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'status_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'responsible_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'project_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'period_clone_from_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'parent_task_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_lead', 'company_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_lead', 'activity_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_spectators', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_invoice_related_objects', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_related_objects', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_invoice_items', 'product_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_invoice_items', 'deal_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_items', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice_executors', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_invoice', 'waiting_for_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'tree_parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'status_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'responsible_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'project_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'print_tmpl_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'period_clone_from_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'parent_task_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_invoice', 'deal_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'customer_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'currency_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'company_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_invoice', 'activity_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_spectators', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_deal_related_objects', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_related_objects', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_deal_executors', 'root_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_executors', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_deal_cmf_person', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_person', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_person', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_deal_cmf_company', 'right_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_company', 'left_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal_cmf_company', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_deal', 'waiting_for_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'tree_parent_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'status_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'responsible_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'project_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'pipeline_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'period_clone_from_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'parent_task_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64))
    op.alter_column('cmf_deal', 'currency_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'company_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_owner_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_modified_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_locked_by_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'cmf_author_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.alter_column('cmf_deal', 'activity_id',
               existing_type=sa.String(length=64),
               type_=sa.CHAR(length=64),
               existing_nullable=True)
    op.create_index('ix_cmf_u_work_chat_topic_spectators_root_id', 'cmf_chat_topic_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_spectators_right_id', 'cmf_chat_topic_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_spectators_parent_id', 'cmf_chat_topic_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_spectators_left_id', 'cmf_chat_topic_spectators', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_topic_spectators_root_id'), table_name='cmf_chat_topic_spectators')
    op.drop_index(op.f('ix_cmf_chat_topic_spectators_right_id'), table_name='cmf_chat_topic_spectators')
    op.drop_index(op.f('ix_cmf_chat_topic_spectators_parent_id'), table_name='cmf_chat_topic_spectators')
    op.drop_index(op.f('ix_cmf_chat_topic_spectators_left_id'), table_name='cmf_chat_topic_spectators')
    op.create_index('ix_cmf_u_work_chat_topic_related_objects_root_id', 'cmf_chat_topic_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_related_objects_right_id', 'cmf_chat_topic_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_related_objects_parent_id', 'cmf_chat_topic_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_related_objects_left_id', 'cmf_chat_topic_related_objects', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_topic_related_objects_root_id'), table_name='cmf_chat_topic_related_objects')
    op.drop_index(op.f('ix_cmf_chat_topic_related_objects_right_id'), table_name='cmf_chat_topic_related_objects')
    op.drop_index(op.f('ix_cmf_chat_topic_related_objects_parent_id'), table_name='cmf_chat_topic_related_objects')
    op.drop_index(op.f('ix_cmf_chat_topic_related_objects_left_id'), table_name='cmf_chat_topic_related_objects')
    op.create_index('ix_cmf_u_work_chat_topic_executors_root_id', 'cmf_chat_topic_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_executors_right_id', 'cmf_chat_topic_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_executors_parent_id', 'cmf_chat_topic_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_executors_left_id', 'cmf_chat_topic_executors', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_topic_executors_root_id'), table_name='cmf_chat_topic_executors')
    op.drop_index(op.f('ix_cmf_chat_topic_executors_right_id'), table_name='cmf_chat_topic_executors')
    op.drop_index(op.f('ix_cmf_chat_topic_executors_parent_id'), table_name='cmf_chat_topic_executors')
    op.drop_index(op.f('ix_cmf_chat_topic_executors_left_id'), table_name='cmf_chat_topic_executors')
    op.drop_constraint(None, 'cmf_chat_topic', type_='foreignkey')
    op.create_index('ix_cmf_u_work_chat_topic_waiting_for_id', 'cmf_chat_topic', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_tree_parent_id', 'cmf_chat_topic', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_status_id', 'cmf_chat_topic', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_responsible_id', 'cmf_chat_topic', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_project_id', 'cmf_chat_topic', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_period_clone_from_id', 'cmf_chat_topic', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_parent_task_id', 'cmf_chat_topic', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_orderno', 'cmf_chat_topic', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_name', 'cmf_chat_topic', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_last_comment_id', 'cmf_chat_topic', ['last_comment_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_group_id', 'cmf_chat_topic', ['group_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_company_id', 'cmf_chat_topic', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_code', 'cmf_chat_topic', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_viewed_at', 'cmf_chat_topic', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_version', 'cmf_chat_topic', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_owner_id', 'cmf_chat_topic', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_modified_by_id', 'cmf_chat_topic', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_modified_at', 'cmf_chat_topic', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_locked_by_id', 'cmf_chat_topic', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_locked_at', 'cmf_chat_topic', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_deleted', 'cmf_chat_topic', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_created_at', 'cmf_chat_topic', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cmf_author_id', 'cmf_chat_topic', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_cache_status_type', 'cmf_chat_topic', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_alarm_date', 'cmf_chat_topic', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_chat_topic_activity_id', 'cmf_chat_topic', ['activity_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_topic_waiting_for_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_tree_parent_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_status_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_responsible_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_project_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_period_clone_from_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_parent_task_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_orderno'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_name'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_last_comment_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_group_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_company_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_code'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_viewed_at'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_version'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_owner_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_modified_by_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_modified_at'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_locked_by_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_locked_at'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_deleted'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_created_at'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cmf_author_id'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_cache_status_type'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_alarm_date'), table_name='cmf_chat_topic')
    op.drop_index(op.f('ix_cmf_chat_topic_activity_id'), table_name='cmf_chat_topic')
    op.create_index('ix_cmf_u_work_chat_group_spectators_root_id', 'cmf_chat_group_spectators', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_spectators_right_id', 'cmf_chat_group_spectators', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_spectators_parent_id', 'cmf_chat_group_spectators', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_spectators_left_id', 'cmf_chat_group_spectators', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_group_spectators_root_id'), table_name='cmf_chat_group_spectators')
    op.drop_index(op.f('ix_cmf_chat_group_spectators_right_id'), table_name='cmf_chat_group_spectators')
    op.drop_index(op.f('ix_cmf_chat_group_spectators_parent_id'), table_name='cmf_chat_group_spectators')
    op.drop_index(op.f('ix_cmf_chat_group_spectators_left_id'), table_name='cmf_chat_group_spectators')
    op.create_index('ix_cmf_u_work_chat_group_related_objects_root_id', 'cmf_chat_group_related_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_related_objects_right_id', 'cmf_chat_group_related_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_related_objects_parent_id', 'cmf_chat_group_related_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_related_objects_left_id', 'cmf_chat_group_related_objects', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_group_related_objects_root_id'), table_name='cmf_chat_group_related_objects')
    op.drop_index(op.f('ix_cmf_chat_group_related_objects_right_id'), table_name='cmf_chat_group_related_objects')
    op.drop_index(op.f('ix_cmf_chat_group_related_objects_parent_id'), table_name='cmf_chat_group_related_objects')
    op.drop_index(op.f('ix_cmf_chat_group_related_objects_left_id'), table_name='cmf_chat_group_related_objects')
    op.create_index('ix_cmf_u_work_chat_group_executors_root_id', 'cmf_chat_group_executors', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_executors_right_id', 'cmf_chat_group_executors', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_executors_parent_id', 'cmf_chat_group_executors', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_executors_left_id', 'cmf_chat_group_executors', ['left_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_group_executors_root_id'), table_name='cmf_chat_group_executors')
    op.drop_index(op.f('ix_cmf_chat_group_executors_right_id'), table_name='cmf_chat_group_executors')
    op.drop_index(op.f('ix_cmf_chat_group_executors_parent_id'), table_name='cmf_chat_group_executors')
    op.drop_index(op.f('ix_cmf_chat_group_executors_left_id'), table_name='cmf_chat_group_executors')
    op.create_index('ix_cmf_u_work_chat_group_waiting_for_id', 'cmf_chat_group', ['waiting_for_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_tree_parent_id', 'cmf_chat_group', ['tree_parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_status_id', 'cmf_chat_group', ['status_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_responsible_id', 'cmf_chat_group', ['responsible_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_project_id', 'cmf_chat_group', ['project_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_period_clone_from_id', 'cmf_chat_group', ['period_clone_from_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_parent_task_id', 'cmf_chat_group', ['parent_task_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_orderno', 'cmf_chat_group', ['orderno'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_name', 'cmf_chat_group', ['name'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_last_topic_id', 'cmf_chat_group', ['last_topic_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_last_comment_id', 'cmf_chat_group', ['last_comment_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_company_id', 'cmf_chat_group', ['company_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_code', 'cmf_chat_group', ['code'], unique=True)
    op.create_index('ix_cmf_u_work_chat_group_cmf_viewed_at', 'cmf_chat_group', ['cmf_viewed_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_version', 'cmf_chat_group', ['cmf_version'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_owner_id', 'cmf_chat_group', ['cmf_owner_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_modified_by_id', 'cmf_chat_group', ['cmf_modified_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_modified_at', 'cmf_chat_group', ['cmf_modified_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_locked_by_id', 'cmf_chat_group', ['cmf_locked_by_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_locked_at', 'cmf_chat_group', ['cmf_locked_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_deleted', 'cmf_chat_group', ['cmf_deleted'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_created_at', 'cmf_chat_group', ['cmf_created_at'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cmf_author_id', 'cmf_chat_group', ['cmf_author_id'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cache_status_type', 'cmf_chat_group', ['cache_status_type'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cache_last_topic_name', 'cmf_chat_group', ['cache_last_topic_name'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_cache_last_topic_code', 'cmf_chat_group', ['cache_last_topic_code'], unique=True)
    op.create_index('ix_cmf_u_work_chat_group_alarm_date', 'cmf_chat_group', ['alarm_date'], unique=False)
    op.create_index('ix_cmf_u_work_chat_group_activity_id', 'cmf_chat_group', ['activity_id'], unique=False)
    op.drop_index(op.f('ix_cmf_chat_group_waiting_for_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_tree_parent_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_status_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_responsible_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_project_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_period_clone_from_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_parent_task_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_orderno'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_name'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_last_topic_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_last_comment_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_company_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_code'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_viewed_at'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_version'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_owner_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_modified_by_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_modified_at'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_locked_by_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_locked_at'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_deleted'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_created_at'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cmf_author_id'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cache_status_type'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cache_last_topic_name'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_cache_last_topic_code'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_alarm_date'), table_name='cmf_chat_group')
    op.drop_index(op.f('ix_cmf_chat_group_activity_id'), table_name='cmf_chat_group')
    # ### end Alembic commands ###
