"""refactor parent_objects

Revision ID: 9277b83d3263
Revises: 4716c577aaf2
Create Date: 2021-03-25 11:10:17.587833

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9277b83d3263'
down_revision = '4716c577aaf2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_cmf_pipeline_parent_objects_left_id', table_name='cmf_pipeline_parent_objects')
    op.drop_index('ix_cmf_pipeline_parent_objects_parent_id', table_name='cmf_pipeline_parent_objects')
    op.drop_index('ix_cmf_pipeline_parent_objects_right_id', table_name='cmf_pipeline_parent_objects')
    op.drop_index('ix_cmf_pipeline_parent_objects_root_id', table_name='cmf_pipeline_parent_objects')
    op.drop_table('cmf_pipeline_parent_objects')
    op.drop_index('ix_cmf_company_parent_objects_left_id', table_name='cmf_company_parent_objects')
    op.drop_index('ix_cmf_company_parent_objects_parent_id', table_name='cmf_company_parent_objects')
    op.drop_index('ix_cmf_company_parent_objects_right_id', table_name='cmf_company_parent_objects')
    op.drop_index('ix_cmf_company_parent_objects_root_id', table_name='cmf_company_parent_objects')
    op.drop_table('cmf_company_parent_objects')
    op.drop_index('ix_cmf_invoice_parent_objects_left_id', table_name='cmf_invoice_parent_objects')
    op.drop_index('ix_cmf_invoice_parent_objects_parent_id', table_name='cmf_invoice_parent_objects')
    op.drop_index('ix_cmf_invoice_parent_objects_right_id', table_name='cmf_invoice_parent_objects')
    op.drop_index('ix_cmf_invoice_parent_objects_root_id', table_name='cmf_invoice_parent_objects')
    op.drop_table('cmf_invoice_parent_objects')
    op.drop_index('ix_cmf_lead_parent_objects_left_id', table_name='cmf_lead_parent_objects')
    op.drop_index('ix_cmf_lead_parent_objects_parent_id', table_name='cmf_lead_parent_objects')
    op.drop_index('ix_cmf_lead_parent_objects_right_id', table_name='cmf_lead_parent_objects')
    op.drop_index('ix_cmf_lead_parent_objects_root_id', table_name='cmf_lead_parent_objects')
    op.drop_table('cmf_lead_parent_objects')
    op.drop_index('ix_cmf_purchase_order_items_parent_objects_left_id', table_name='cmf_purchase_order_items_parent_objects')
    op.drop_index('ix_cmf_purchase_order_items_parent_objects_parent_id', table_name='cmf_purchase_order_items_parent_objects')
    op.drop_index('ix_cmf_purchase_order_items_parent_objects_right_id', table_name='cmf_purchase_order_items_parent_objects')
    op.drop_index('ix_cmf_purchase_order_items_parent_objects_root_id', table_name='cmf_purchase_order_items_parent_objects')
    op.drop_table('cmf_purchase_order_items_parent_objects')
    op.drop_index('ix_cmf_mail_parent_objects_left_id', table_name='cmf_mail_parent_objects')
    op.drop_index('ix_cmf_mail_parent_objects_parent_id', table_name='cmf_mail_parent_objects')
    op.drop_index('ix_cmf_mail_parent_objects_right_id', table_name='cmf_mail_parent_objects')
    op.drop_index('ix_cmf_mail_parent_objects_root_id', table_name='cmf_mail_parent_objects')
    op.drop_table('cmf_mail_parent_objects')
    op.drop_index('ix_cmf_sales_order_parent_objects_left_id', table_name='cmf_sales_order_parent_objects')
    op.drop_index('ix_cmf_sales_order_parent_objects_parent_id', table_name='cmf_sales_order_parent_objects')
    op.drop_index('ix_cmf_sales_order_parent_objects_right_id', table_name='cmf_sales_order_parent_objects')
    op.drop_index('ix_cmf_sales_order_parent_objects_root_id', table_name='cmf_sales_order_parent_objects')
    op.drop_table('cmf_sales_order_parent_objects')
    op.drop_index('ix_cmf_u_work_post_parent_objects_left_id', table_name='cmf_u_work_post_parent_objects')
    op.drop_index('ix_cmf_u_work_post_parent_objects_parent_id', table_name='cmf_u_work_post_parent_objects')
    op.drop_index('ix_cmf_u_work_post_parent_objects_right_id', table_name='cmf_u_work_post_parent_objects')
    op.drop_index('ix_cmf_u_work_post_parent_objects_root_id', table_name='cmf_u_work_post_parent_objects')
    op.drop_table('cmf_u_work_post_parent_objects')
    op.drop_index('ix_cmf_chat_group_parent_objects_left_id', table_name='cmf_chat_group_parent_objects')
    op.drop_index('ix_cmf_chat_group_parent_objects_parent_id', table_name='cmf_chat_group_parent_objects')
    op.drop_index('ix_cmf_chat_group_parent_objects_right_id', table_name='cmf_chat_group_parent_objects')
    op.drop_index('ix_cmf_chat_group_parent_objects_root_id', table_name='cmf_chat_group_parent_objects')
    op.drop_table('cmf_chat_group_parent_objects')
    op.drop_index('ix_cmf_document_parent_objects_left_id', table_name='cmf_document_parent_objects')
    op.drop_index('ix_cmf_document_parent_objects_parent_id', table_name='cmf_document_parent_objects')
    op.drop_index('ix_cmf_document_parent_objects_right_id', table_name='cmf_document_parent_objects')
    op.drop_index('ix_cmf_document_parent_objects_root_id', table_name='cmf_document_parent_objects')
    op.drop_table('cmf_document_parent_objects')
    op.drop_index('ix_cmf_list_parent_objects_left_id', table_name='cmf_list_parent_objects')
    op.drop_index('ix_cmf_list_parent_objects_parent_id', table_name='cmf_list_parent_objects')
    op.drop_index('ix_cmf_list_parent_objects_right_id', table_name='cmf_list_parent_objects')
    op.drop_index('ix_cmf_list_parent_objects_root_id', table_name='cmf_list_parent_objects')
    op.drop_table('cmf_list_parent_objects')
    op.drop_index('ix_cmf_stock_move_parent_objects_left_id', table_name='cmf_stock_move_parent_objects')
    op.drop_index('ix_cmf_stock_move_parent_objects_parent_id', table_name='cmf_stock_move_parent_objects')
    op.drop_index('ix_cmf_stock_move_parent_objects_right_id', table_name='cmf_stock_move_parent_objects')
    op.drop_index('ix_cmf_stock_move_parent_objects_root_id', table_name='cmf_stock_move_parent_objects')
    op.drop_table('cmf_stock_move_parent_objects')
    op.drop_index('ix_cmf_deal_parent_objects_left_id', table_name='cmf_deal_parent_objects')
    op.drop_index('ix_cmf_deal_parent_objects_parent_id', table_name='cmf_deal_parent_objects')
    op.drop_index('ix_cmf_deal_parent_objects_right_id', table_name='cmf_deal_parent_objects')
    op.drop_index('ix_cmf_deal_parent_objects_root_id', table_name='cmf_deal_parent_objects')
    op.drop_table('cmf_deal_parent_objects')
    op.drop_index('ix_cmf_purchase_order_parent_objects_left_id', table_name='cmf_purchase_order_parent_objects')
    op.drop_index('ix_cmf_purchase_order_parent_objects_parent_id', table_name='cmf_purchase_order_parent_objects')
    op.drop_index('ix_cmf_purchase_order_parent_objects_right_id', table_name='cmf_purchase_order_parent_objects')
    op.drop_index('ix_cmf_purchase_order_parent_objects_root_id', table_name='cmf_purchase_order_parent_objects')
    op.drop_table('cmf_purchase_order_parent_objects')
    op.drop_index('ix_cmf_chat_topic_parent_objects_left_id', table_name='cmf_chat_topic_parent_objects')
    op.drop_index('ix_cmf_chat_topic_parent_objects_parent_id', table_name='cmf_chat_topic_parent_objects')
    op.drop_index('ix_cmf_chat_topic_parent_objects_right_id', table_name='cmf_chat_topic_parent_objects')
    op.drop_index('ix_cmf_chat_topic_parent_objects_root_id', table_name='cmf_chat_topic_parent_objects')
    op.drop_table('cmf_chat_topic_parent_objects')
    op.drop_index('ix_cmf_task_parent_objects_left_id', table_name='cmf_task_parent_objects')
    op.drop_index('ix_cmf_task_parent_objects_parent_id', table_name='cmf_task_parent_objects')
    op.drop_index('ix_cmf_task_parent_objects_right_id', table_name='cmf_task_parent_objects')
    op.drop_index('ix_cmf_task_parent_objects_root_id', table_name='cmf_task_parent_objects')
    op.drop_table('cmf_task_parent_objects')
    op.drop_index('ix_cmf_payment_parent_objects_left_id', table_name='cmf_payment_parent_objects')
    op.drop_index('ix_cmf_payment_parent_objects_parent_id', table_name='cmf_payment_parent_objects')
    op.drop_index('ix_cmf_payment_parent_objects_right_id', table_name='cmf_payment_parent_objects')
    op.drop_index('ix_cmf_payment_parent_objects_root_id', table_name='cmf_payment_parent_objects')
    op.drop_table('cmf_payment_parent_objects')
    op.drop_index('ix_cmf_stock_move_items_parent_objects_left_id', table_name='cmf_stock_move_items_parent_objects')
    op.drop_index('ix_cmf_stock_move_items_parent_objects_parent_id', table_name='cmf_stock_move_items_parent_objects')
    op.drop_index('ix_cmf_stock_move_items_parent_objects_right_id', table_name='cmf_stock_move_items_parent_objects')
    op.drop_index('ix_cmf_stock_move_items_parent_objects_root_id', table_name='cmf_stock_move_items_parent_objects')
    op.drop_table('cmf_stock_move_items_parent_objects')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_stock_move_items_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_stock_move_items_parent_objects_pkey')
    )
    op.create_index('ix_cmf_stock_move_items_parent_objects_root_id', 'cmf_stock_move_items_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_stock_move_items_parent_objects_right_id', 'cmf_stock_move_items_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_stock_move_items_parent_objects_parent_id', 'cmf_stock_move_items_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_stock_move_items_parent_objects_left_id', 'cmf_stock_move_items_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_payment_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_payment_parent_objects_pkey')
    )
    op.create_index('ix_cmf_payment_parent_objects_root_id', 'cmf_payment_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_payment_parent_objects_right_id', 'cmf_payment_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_payment_parent_objects_parent_id', 'cmf_payment_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_payment_parent_objects_left_id', 'cmf_payment_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_task_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_task_parent_objects_pkey')
    )
    op.create_index('ix_cmf_task_parent_objects_root_id', 'cmf_task_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_task_parent_objects_right_id', 'cmf_task_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_task_parent_objects_parent_id', 'cmf_task_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_task_parent_objects_left_id', 'cmf_task_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_chat_topic_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_chat_topic_parent_objects_pkey')
    )
    op.create_index('ix_cmf_chat_topic_parent_objects_root_id', 'cmf_chat_topic_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_chat_topic_parent_objects_right_id', 'cmf_chat_topic_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_chat_topic_parent_objects_parent_id', 'cmf_chat_topic_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_chat_topic_parent_objects_left_id', 'cmf_chat_topic_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_purchase_order_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_purchase_order_parent_objects_pkey')
    )
    op.create_index('ix_cmf_purchase_order_parent_objects_root_id', 'cmf_purchase_order_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_purchase_order_parent_objects_right_id', 'cmf_purchase_order_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_purchase_order_parent_objects_parent_id', 'cmf_purchase_order_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_purchase_order_parent_objects_left_id', 'cmf_purchase_order_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_deal_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_deal_parent_objects_pkey')
    )
    op.create_index('ix_cmf_deal_parent_objects_root_id', 'cmf_deal_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_deal_parent_objects_right_id', 'cmf_deal_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_deal_parent_objects_parent_id', 'cmf_deal_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_deal_parent_objects_left_id', 'cmf_deal_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_stock_move_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_stock_move_parent_objects_pkey')
    )
    op.create_index('ix_cmf_stock_move_parent_objects_root_id', 'cmf_stock_move_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_stock_move_parent_objects_right_id', 'cmf_stock_move_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_stock_move_parent_objects_parent_id', 'cmf_stock_move_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_stock_move_parent_objects_left_id', 'cmf_stock_move_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_list_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_list_parent_objects_pkey')
    )
    op.create_index('ix_cmf_list_parent_objects_root_id', 'cmf_list_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_list_parent_objects_right_id', 'cmf_list_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_list_parent_objects_parent_id', 'cmf_list_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_list_parent_objects_left_id', 'cmf_list_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_document_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_document_parent_objects_pkey')
    )
    op.create_index('ix_cmf_document_parent_objects_root_id', 'cmf_document_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_document_parent_objects_right_id', 'cmf_document_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_document_parent_objects_parent_id', 'cmf_document_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_document_parent_objects_left_id', 'cmf_document_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_chat_group_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_chat_group_parent_objects_pkey')
    )
    op.create_index('ix_cmf_chat_group_parent_objects_root_id', 'cmf_chat_group_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_chat_group_parent_objects_right_id', 'cmf_chat_group_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_chat_group_parent_objects_parent_id', 'cmf_chat_group_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_chat_group_parent_objects_left_id', 'cmf_chat_group_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_u_work_post_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_u_work_post_parent_objects_pkey')
    )
    op.create_index('ix_cmf_u_work_post_parent_objects_root_id', 'cmf_u_work_post_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_u_work_post_parent_objects_right_id', 'cmf_u_work_post_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_u_work_post_parent_objects_parent_id', 'cmf_u_work_post_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_u_work_post_parent_objects_left_id', 'cmf_u_work_post_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_sales_order_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_sales_order_parent_objects_pkey')
    )
    op.create_index('ix_cmf_sales_order_parent_objects_root_id', 'cmf_sales_order_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_sales_order_parent_objects_right_id', 'cmf_sales_order_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_sales_order_parent_objects_parent_id', 'cmf_sales_order_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_sales_order_parent_objects_left_id', 'cmf_sales_order_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_mail_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_mail_parent_objects_pkey')
    )
    op.create_index('ix_cmf_mail_parent_objects_root_id', 'cmf_mail_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_mail_parent_objects_right_id', 'cmf_mail_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_mail_parent_objects_parent_id', 'cmf_mail_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_mail_parent_objects_left_id', 'cmf_mail_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_purchase_order_items_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_purchase_order_items_parent_objects_pkey')
    )
    op.create_index('ix_cmf_purchase_order_items_parent_objects_root_id', 'cmf_purchase_order_items_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_purchase_order_items_parent_objects_right_id', 'cmf_purchase_order_items_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_purchase_order_items_parent_objects_parent_id', 'cmf_purchase_order_items_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_purchase_order_items_parent_objects_left_id', 'cmf_purchase_order_items_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_lead_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_lead_parent_objects_pkey')
    )
    op.create_index('ix_cmf_lead_parent_objects_root_id', 'cmf_lead_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_lead_parent_objects_right_id', 'cmf_lead_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_lead_parent_objects_parent_id', 'cmf_lead_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_lead_parent_objects_left_id', 'cmf_lead_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_invoice_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_invoice_parent_objects_pkey')
    )
    op.create_index('ix_cmf_invoice_parent_objects_root_id', 'cmf_invoice_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_invoice_parent_objects_right_id', 'cmf_invoice_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_invoice_parent_objects_parent_id', 'cmf_invoice_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_invoice_parent_objects_left_id', 'cmf_invoice_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_company_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_company_parent_objects_pkey')
    )
    op.create_index('ix_cmf_company_parent_objects_root_id', 'cmf_company_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_company_parent_objects_right_id', 'cmf_company_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_company_parent_objects_parent_id', 'cmf_company_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_company_parent_objects_left_id', 'cmf_company_parent_objects', ['left_id'], unique=False)
    op.create_table('cmf_pipeline_parent_objects',
    sa.Column('description', sa.VARCHAR(length=4096), autoincrement=False, nullable=True),
    sa.Column('id', sa.VARCHAR(length=64), autoincrement=False, nullable=False),
    sa.Column('left_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('left_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('parent_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.Column('right_name_cache', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.Column('root_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='cmf_pipeline_parent_objects_pkey')
    )
    op.create_index('ix_cmf_pipeline_parent_objects_root_id', 'cmf_pipeline_parent_objects', ['root_id'], unique=False)
    op.create_index('ix_cmf_pipeline_parent_objects_right_id', 'cmf_pipeline_parent_objects', ['right_id'], unique=False)
    op.create_index('ix_cmf_pipeline_parent_objects_parent_id', 'cmf_pipeline_parent_objects', ['parent_id'], unique=False)
    op.create_index('ix_cmf_pipeline_parent_objects_left_id', 'cmf_pipeline_parent_objects', ['left_id'], unique=False)
    # ### end Alembic commands ###
