"""add_new_stock_documents

Revision ID: 73e1d50a5428
Revises: ed06e9e325c2
Create Date: 2022-06-06 07:53:37.578347

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

# revision identifiers, used by Alembic.
revision = '73e1d50a5428'
down_revision = 'ed06e9e325c2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cmf_stock_initial',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('is_public', sa.Boolean(), nullable=True),
    sa.Column('is_public_editable', sa.Boolean(), nullable=True),
    sa.Column('is_public_comments', sa.Boolean(), nullable=True),
    sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_in_progress_start', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_in_progress_end', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_review_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_closed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('no_control', sa.Boolean(), nullable=True),
    sa.Column('priority_old', sa.String(length=32), nullable=False),
    sa.Column('priority', sa.Integer(), nullable=False),
    sa.Column('mark', sa.String(length=32), nullable=True),
    sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('time_estimate', sa.Integer(), nullable=True),
    sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('period_interval', sa.String(length=32), nullable=True),
    sa.Column('is_template', sa.Boolean(), nullable=True),
    sa.Column('is_penalty', sa.Boolean(), nullable=True),
    sa.Column('cache_status_type', sa.String(length=32), nullable=True),
    sa.Column('cache_fields', sa.TEXT(), nullable=True),
    sa.Column('approved', sa.Boolean(), nullable=False),
    sa.Column('perm_readonly', sa.Boolean(), nullable=True),
    sa.Column('perm_private', sa.Boolean(), nullable=True),
    sa.Column('perm_encrypt', sa.Boolean(), nullable=True),
    sa.Column('workflow_type', sa.String(), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('workflow_id', sa.String(length=64), nullable=True),
    sa.Column('default_task_workflow_id', sa.String(length=64), nullable=True),
    sa.Column('status_id', sa.String(length=64), nullable=True),
    sa.Column('company_id', sa.String(length=64), nullable=True),
    sa.Column('responsible_id', sa.String(length=64), nullable=True),
    sa.Column('waiting_for_id', sa.String(length=64), nullable=True),
    sa.Column('cloned_from_id', sa.String(length=64), nullable=True),
    sa.Column('activity_id', sa.String(length=64), nullable=True),
    sa.Column('cache_status_opt_id', sa.String(length=64), nullable=True),
    sa.Column('stock_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], ),
    sa.ForeignKeyConstraint(['cache_status_opt_id'], ['cmf_status_opt.id'], ),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], ),
    sa.ForeignKeyConstraint(['default_task_workflow_id'], ['cmf_workflow.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.ForeignKeyConstraint(['stock_id'], ['cmf_stock.id'], ),
    sa.ForeignKeyConstraint(['workflow_id'], ['cmf_workflow.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_initial_activity_id'), 'cmf_stock_initial', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_alarm_date'), 'cmf_stock_initial', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_approved'), 'cmf_stock_initial', ['approved'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cache_status_opt_id'), 'cmf_stock_initial', ['cache_status_opt_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cache_status_type'), 'cmf_stock_initial', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cloned_from_id'), 'cmf_stock_initial', ['cloned_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_author_id'), 'cmf_stock_initial', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_created_at'), 'cmf_stock_initial', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_deleted'), 'cmf_stock_initial', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_import_id'), 'cmf_stock_initial', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_locked_at'), 'cmf_stock_initial', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_locked_by_id'), 'cmf_stock_initial', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_modified_at'), 'cmf_stock_initial', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_modified_by_id'), 'cmf_stock_initial', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_owner_assistant_id'), 'cmf_stock_initial', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_owner_id'), 'cmf_stock_initial', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_version'), 'cmf_stock_initial', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_cmf_viewed_at'), 'cmf_stock_initial', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_code'), 'cmf_stock_initial', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_initial_company_id'), 'cmf_stock_initial', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_default_task_workflow_id'), 'cmf_stock_initial', ['default_task_workflow_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_is_template'), 'cmf_stock_initial', ['is_template'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_name'), 'cmf_stock_initial', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_orderno'), 'cmf_stock_initial', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_parent_id'), 'cmf_stock_initial', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_responsible_id'), 'cmf_stock_initial', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_status_id'), 'cmf_stock_initial', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_stock_id'), 'cmf_stock_initial', ['stock_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_tree_parent_id'), 'cmf_stock_initial', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_waiting_for_id'), 'cmf_stock_initial', ['waiting_for_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_workflow_id'), 'cmf_stock_initial', ['workflow_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_workflow_type'), 'cmf_stock_initial', ['workflow_type'], unique=False)
    op.create_table('cmf_stock_initial_executors',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_initial_executors_left_id'), 'cmf_stock_initial_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_executors_parent_id'), 'cmf_stock_initial_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_executors_right_id'), 'cmf_stock_initial_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_executors_root_id'), 'cmf_stock_initial_executors', ['root_id'], unique=False)
    op.create_table('cmf_stock_initial_item',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('item_count', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('batch', sa.String(length=64), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('product_id', sa.String(length=64), nullable=True),
    sa.Column('stock_initial_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.ForeignKeyConstraint(['stock_initial_id'], ['cmf_stock_initial.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_author_id'), 'cmf_stock_initial_item', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_created_at'), 'cmf_stock_initial_item', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_deleted'), 'cmf_stock_initial_item', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_import_id'), 'cmf_stock_initial_item', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_locked_at'), 'cmf_stock_initial_item', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_locked_by_id'), 'cmf_stock_initial_item', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_modified_at'), 'cmf_stock_initial_item', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_modified_by_id'), 'cmf_stock_initial_item', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_owner_assistant_id'), 'cmf_stock_initial_item', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_owner_id'), 'cmf_stock_initial_item', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_version'), 'cmf_stock_initial_item', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_cmf_viewed_at'), 'cmf_stock_initial_item', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_code'), 'cmf_stock_initial_item', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_initial_item_name'), 'cmf_stock_initial_item', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_orderno'), 'cmf_stock_initial_item', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_parent_id'), 'cmf_stock_initial_item', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_product_id'), 'cmf_stock_initial_item', ['product_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_stock_initial_id'), 'cmf_stock_initial_item', ['stock_initial_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_item_tree_parent_id'), 'cmf_stock_initial_item', ['tree_parent_id'], unique=False)
    op.create_table('cmf_stock_initial_spectators',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_initial_spectators_left_id'), 'cmf_stock_initial_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_spectators_parent_id'), 'cmf_stock_initial_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_spectators_right_id'), 'cmf_stock_initial_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_initial_spectators_root_id'), 'cmf_stock_initial_spectators', ['root_id'], unique=False)
    op.create_table('cmf_stock_inventory',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('is_public', sa.Boolean(), nullable=True),
    sa.Column('is_public_editable', sa.Boolean(), nullable=True),
    sa.Column('is_public_comments', sa.Boolean(), nullable=True),
    sa.Column('status_modified_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_in_progress_start', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_in_progress_end', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_review_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('status_closed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('no_control', sa.Boolean(), nullable=True),
    sa.Column('priority_old', sa.String(length=32), nullable=False),
    sa.Column('priority', sa.Integer(), nullable=False),
    sa.Column('mark', sa.String(length=32), nullable=True),
    sa.Column('alarm_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('deadline', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('time_estimate', sa.Integer(), nullable=True),
    sa.Column('plan_start_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('plan_end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('period_next_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('period_interval', sa.String(length=32), nullable=True),
    sa.Column('is_template', sa.Boolean(), nullable=True),
    sa.Column('is_penalty', sa.Boolean(), nullable=True),
    sa.Column('cache_status_type', sa.String(length=32), nullable=True),
    sa.Column('cache_fields', sa.TEXT(), nullable=True),
    sa.Column('approved', sa.Boolean(), nullable=False),
    sa.Column('perm_readonly', sa.Boolean(), nullable=True),
    sa.Column('perm_private', sa.Boolean(), nullable=True),
    sa.Column('perm_encrypt', sa.Boolean(), nullable=True),
    sa.Column('workflow_type', sa.String(), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('workflow_id', sa.String(length=64), nullable=True),
    sa.Column('default_task_workflow_id', sa.String(length=64), nullable=True),
    sa.Column('status_id', sa.String(length=64), nullable=True),
    sa.Column('company_id', sa.String(length=64), nullable=True),
    sa.Column('responsible_id', sa.String(length=64), nullable=True),
    sa.Column('waiting_for_id', sa.String(length=64), nullable=True),
    sa.Column('cloned_from_id', sa.String(length=64), nullable=True),
    sa.Column('activity_id', sa.String(length=64), nullable=True),
    sa.Column('cache_status_opt_id', sa.String(length=64), nullable=True),
    sa.Column('stock_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['activity_id'], ['cmf_activity.id'], ),
    sa.ForeignKeyConstraint(['cache_status_opt_id'], ['cmf_status_opt.id'], ),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['company_id'], ['cmf_company.id'], ),
    sa.ForeignKeyConstraint(['default_task_workflow_id'], ['cmf_workflow.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['cmf_status.id'], ),
    sa.ForeignKeyConstraint(['stock_id'], ['cmf_stock.id'], ),
    sa.ForeignKeyConstraint(['workflow_id'], ['cmf_workflow.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_inventory_activity_id'), 'cmf_stock_inventory', ['activity_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_alarm_date'), 'cmf_stock_inventory', ['alarm_date'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_approved'), 'cmf_stock_inventory', ['approved'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cache_status_opt_id'), 'cmf_stock_inventory', ['cache_status_opt_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cache_status_type'), 'cmf_stock_inventory', ['cache_status_type'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cloned_from_id'), 'cmf_stock_inventory', ['cloned_from_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_author_id'), 'cmf_stock_inventory', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_created_at'), 'cmf_stock_inventory', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_deleted'), 'cmf_stock_inventory', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_import_id'), 'cmf_stock_inventory', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_locked_at'), 'cmf_stock_inventory', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_locked_by_id'), 'cmf_stock_inventory', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_modified_at'), 'cmf_stock_inventory', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_modified_by_id'), 'cmf_stock_inventory', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_owner_assistant_id'), 'cmf_stock_inventory', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_owner_id'), 'cmf_stock_inventory', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_version'), 'cmf_stock_inventory', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_cmf_viewed_at'), 'cmf_stock_inventory', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_code'), 'cmf_stock_inventory', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_inventory_company_id'), 'cmf_stock_inventory', ['company_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_default_task_workflow_id'), 'cmf_stock_inventory', ['default_task_workflow_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_is_template'), 'cmf_stock_inventory', ['is_template'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_name'), 'cmf_stock_inventory', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_orderno'), 'cmf_stock_inventory', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_parent_id'), 'cmf_stock_inventory', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_responsible_id'), 'cmf_stock_inventory', ['responsible_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_status_id'), 'cmf_stock_inventory', ['status_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_stock_id'), 'cmf_stock_inventory', ['stock_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_tree_parent_id'), 'cmf_stock_inventory', ['tree_parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_waiting_for_id'), 'cmf_stock_inventory', ['waiting_for_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_workflow_id'), 'cmf_stock_inventory', ['workflow_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_workflow_type'), 'cmf_stock_inventory', ['workflow_type'], unique=False)
    op.create_table('cmf_stock_inventory_executors',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_inventory_executors_left_id'), 'cmf_stock_inventory_executors', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_executors_parent_id'), 'cmf_stock_inventory_executors', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_executors_right_id'), 'cmf_stock_inventory_executors', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_executors_root_id'), 'cmf_stock_inventory_executors', ['root_id'], unique=False)
    op.create_table('cmf_stock_inventory_item',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('count_fact', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('count_stock', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('count_diff', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('product_id', sa.String(length=64), nullable=True),
    sa.Column('stock_inventory_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.ForeignKeyConstraint(['stock_inventory_id'], ['cmf_stock_inventory.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_author_id'), 'cmf_stock_inventory_item', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_created_at'), 'cmf_stock_inventory_item', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_deleted'), 'cmf_stock_inventory_item', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_import_id'), 'cmf_stock_inventory_item', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_locked_at'), 'cmf_stock_inventory_item', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_locked_by_id'), 'cmf_stock_inventory_item', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_modified_at'), 'cmf_stock_inventory_item', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_modified_by_id'), 'cmf_stock_inventory_item', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_owner_assistant_id'), 'cmf_stock_inventory_item', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_owner_id'), 'cmf_stock_inventory_item', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_version'), 'cmf_stock_inventory_item', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_cmf_viewed_at'), 'cmf_stock_inventory_item', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_code'), 'cmf_stock_inventory_item', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_inventory_item_name'), 'cmf_stock_inventory_item', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_orderno'), 'cmf_stock_inventory_item', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_parent_id'), 'cmf_stock_inventory_item', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_product_id'), 'cmf_stock_inventory_item', ['product_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_stock_inventory_id'), 'cmf_stock_inventory_item', ['stock_inventory_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_item_tree_parent_id'), 'cmf_stock_inventory_item', ['tree_parent_id'], unique=False)
    op.create_table('cmf_stock_inventory_spectators',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('root_id', sa.String(length=64), nullable=True),
    sa.Column('description', sa.String(length=4096), nullable=True),
    sa.Column('left_id', sa.String(length=64), nullable=True),
    sa.Column('right_id', sa.String(length=64), nullable=True),
    sa.Column('left_name_cache', sa.String(length=256), nullable=True),
    sa.Column('right_name_cache', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_inventory_spectators_left_id'), 'cmf_stock_inventory_spectators', ['left_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_spectators_parent_id'), 'cmf_stock_inventory_spectators', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_spectators_right_id'), 'cmf_stock_inventory_spectators', ['right_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_inventory_spectators_root_id'), 'cmf_stock_inventory_spectators', ['root_id'], unique=False)
    op.create_table('cmf_stock_item',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('item_count', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('product_id', sa.String(length=64), nullable=True),
    sa.Column('stock_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.ForeignKeyConstraint(['stock_id'], ['cmf_stock.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_item_cmf_author_id'), 'cmf_stock_item', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_created_at'), 'cmf_stock_item', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_deleted'), 'cmf_stock_item', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_import_id'), 'cmf_stock_item', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_locked_at'), 'cmf_stock_item', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_locked_by_id'), 'cmf_stock_item', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_modified_at'), 'cmf_stock_item', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_modified_by_id'), 'cmf_stock_item', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_owner_assistant_id'), 'cmf_stock_item', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_owner_id'), 'cmf_stock_item', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_version'), 'cmf_stock_item', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_cmf_viewed_at'), 'cmf_stock_item', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_code'), 'cmf_stock_item', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_item_name'), 'cmf_stock_item', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_orderno'), 'cmf_stock_item', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_parent_id'), 'cmf_stock_item', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_product_id'), 'cmf_stock_item', ['product_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_stock_id'), 'cmf_stock_item', ['stock_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_item_tree_parent_id'), 'cmf_stock_item', ['tree_parent_id'], unique=False)
    op.create_table('cmf_stock_move_item',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('item_count', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('stock_move_id', sa.String(length=64), nullable=True),
    sa.Column('product_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.ForeignKeyConstraint(['stock_move_id'], ['cmf_stock_move.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_author_id'), 'cmf_stock_move_item', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_created_at'), 'cmf_stock_move_item', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_deleted'), 'cmf_stock_move_item', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_import_id'), 'cmf_stock_move_item', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_locked_at'), 'cmf_stock_move_item', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_locked_by_id'), 'cmf_stock_move_item', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_modified_at'), 'cmf_stock_move_item', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_modified_by_id'), 'cmf_stock_move_item', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_owner_assistant_id'), 'cmf_stock_move_item', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_owner_id'), 'cmf_stock_move_item', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_version'), 'cmf_stock_move_item', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_cmf_viewed_at'), 'cmf_stock_move_item', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_code'), 'cmf_stock_move_item', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_move_item_name'), 'cmf_stock_move_item', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_orderno'), 'cmf_stock_move_item', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_parent_id'), 'cmf_stock_move_item', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_product_id'), 'cmf_stock_move_item', ['product_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_stock_move_id'), 'cmf_stock_move_item', ['stock_move_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_move_item_tree_parent_id'), 'cmf_stock_move_item', ['tree_parent_id'], unique=False)
    op.create_table('cmf_stock_operation',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('document_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_operation_cmf_author_id'), 'cmf_stock_operation', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_created_at'), 'cmf_stock_operation', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_deleted'), 'cmf_stock_operation', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_import_id'), 'cmf_stock_operation', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_locked_at'), 'cmf_stock_operation', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_locked_by_id'), 'cmf_stock_operation', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_modified_at'), 'cmf_stock_operation', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_modified_by_id'), 'cmf_stock_operation', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_owner_assistant_id'), 'cmf_stock_operation', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_owner_id'), 'cmf_stock_operation', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_version'), 'cmf_stock_operation', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_cmf_viewed_at'), 'cmf_stock_operation', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_code'), 'cmf_stock_operation', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_operation_document_id'), 'cmf_stock_operation', ['document_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_name'), 'cmf_stock_operation', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_orderno'), 'cmf_stock_operation', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_parent_id'), 'cmf_stock_operation', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_tree_parent_id'), 'cmf_stock_operation', ['tree_parent_id'], unique=False)
    op.create_table('cmf_stock_operation_item',
    sa.Column('id', sa.String(length=64), nullable=False),
    sa.Column('cmf_locked_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_modified_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('cmf_viewed_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('cmf_deleted', sa.Boolean(), nullable=False),
    sa.Column('cmf_version', sa.BIGINT(), nullable=True),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=True),
    sa.Column('system', sa.Boolean(), nullable=False),
    sa.Column('text', sa.TEXT(), nullable=True),
    sa.Column('is_favorite', sa.Boolean(), nullable=True),
    sa.Column('has_tree_nodes', sa.Boolean(), nullable=True),
    sa.Column('tree_node_is_branch', sa.Boolean(), nullable=True),
    sa.Column('tree_hidden', sa.Boolean(), nullable=True),
    sa.Column('orderno', sa.Integer(), nullable=True),
    sa.Column('item_count', sa.Numeric(precision=14, scale=2), nullable=True),
    sa.Column('operation_type', sa.String(length=32), nullable=False),
    sa.Column('cmf_author_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_owner_assistant_id', sa.String(length=64), nullable=True),
    sa.Column('parent_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_modified_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_locked_by_id', sa.String(length=64), nullable=True),
    sa.Column('cmf_import_id', sa.String(length=64), nullable=True),
    sa.Column('tree_parent_id', sa.String(length=64), nullable=True),
    sa.Column('product_id', sa.String(length=64), nullable=True),
    sa.Column('stock_operation_id', sa.String(length=64), nullable=True),
    sa.Column('stock_id', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['cmf_import_id'], ['cmf_import.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['cmf_product.id'], ),
    sa.ForeignKeyConstraint(['stock_id'], ['cmf_stock.id'], ),
    sa.ForeignKeyConstraint(['stock_operation_id'], ['cmf_stock_operation.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_author_id'), 'cmf_stock_operation_item', ['cmf_author_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_created_at'), 'cmf_stock_operation_item', ['cmf_created_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_deleted'), 'cmf_stock_operation_item', ['cmf_deleted'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_import_id'), 'cmf_stock_operation_item', ['cmf_import_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_locked_at'), 'cmf_stock_operation_item', ['cmf_locked_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_locked_by_id'), 'cmf_stock_operation_item', ['cmf_locked_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_modified_at'), 'cmf_stock_operation_item', ['cmf_modified_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_modified_by_id'), 'cmf_stock_operation_item', ['cmf_modified_by_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_owner_assistant_id'), 'cmf_stock_operation_item', ['cmf_owner_assistant_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_owner_id'), 'cmf_stock_operation_item', ['cmf_owner_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_version'), 'cmf_stock_operation_item', ['cmf_version'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_cmf_viewed_at'), 'cmf_stock_operation_item', ['cmf_viewed_at'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_code'), 'cmf_stock_operation_item', ['code'], unique=True)
    op.create_index(op.f('ix_cmf_stock_operation_item_name'), 'cmf_stock_operation_item', ['name'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_operation_type'), 'cmf_stock_operation_item', ['operation_type'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_orderno'), 'cmf_stock_operation_item', ['orderno'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_parent_id'), 'cmf_stock_operation_item', ['parent_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_product_id'), 'cmf_stock_operation_item', ['product_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_stock_id'), 'cmf_stock_operation_item', ['stock_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_stock_operation_id'), 'cmf_stock_operation_item', ['stock_operation_id'], unique=False)
    op.create_index(op.f('ix_cmf_stock_operation_item_tree_parent_id'), 'cmf_stock_operation_item', ['tree_parent_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_stock_operation_item_tree_parent_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_stock_operation_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_stock_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_product_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_parent_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_orderno'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_operation_type'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_name'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_code'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_viewed_at'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_version'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_owner_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_owner_assistant_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_modified_by_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_modified_at'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_locked_by_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_locked_at'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_import_id'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_deleted'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_created_at'), table_name='cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_item_cmf_author_id'), table_name='cmf_stock_operation_item')
    op.drop_table('cmf_stock_operation_item')
    op.drop_index(op.f('ix_cmf_stock_operation_tree_parent_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_parent_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_orderno'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_name'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_document_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_code'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_viewed_at'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_version'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_owner_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_owner_assistant_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_modified_by_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_modified_at'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_locked_by_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_locked_at'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_import_id'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_deleted'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_created_at'), table_name='cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_operation_cmf_author_id'), table_name='cmf_stock_operation')
    op.drop_table('cmf_stock_operation')
    op.drop_index(op.f('ix_cmf_stock_move_item_tree_parent_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_stock_move_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_product_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_parent_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_orderno'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_name'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_code'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_viewed_at'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_version'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_owner_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_owner_assistant_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_modified_by_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_modified_at'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_locked_by_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_locked_at'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_import_id'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_deleted'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_created_at'), table_name='cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_move_item_cmf_author_id'), table_name='cmf_stock_move_item')
    op.drop_table('cmf_stock_move_item')
    op.drop_index(op.f('ix_cmf_stock_item_tree_parent_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_stock_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_product_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_parent_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_orderno'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_name'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_code'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_viewed_at'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_version'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_owner_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_owner_assistant_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_modified_by_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_modified_at'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_locked_by_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_locked_at'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_import_id'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_deleted'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_created_at'), table_name='cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_item_cmf_author_id'), table_name='cmf_stock_item')
    op.drop_table('cmf_stock_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_spectators_root_id'), table_name='cmf_stock_inventory_spectators')
    op.drop_index(op.f('ix_cmf_stock_inventory_spectators_right_id'), table_name='cmf_stock_inventory_spectators')
    op.drop_index(op.f('ix_cmf_stock_inventory_spectators_parent_id'), table_name='cmf_stock_inventory_spectators')
    op.drop_index(op.f('ix_cmf_stock_inventory_spectators_left_id'), table_name='cmf_stock_inventory_spectators')
    op.drop_table('cmf_stock_inventory_spectators')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_tree_parent_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_stock_inventory_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_product_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_parent_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_orderno'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_name'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_code'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_viewed_at'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_version'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_owner_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_owner_assistant_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_modified_by_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_modified_at'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_locked_by_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_locked_at'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_import_id'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_deleted'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_created_at'), table_name='cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_item_cmf_author_id'), table_name='cmf_stock_inventory_item')
    op.drop_table('cmf_stock_inventory_item')
    op.drop_index(op.f('ix_cmf_stock_inventory_executors_root_id'), table_name='cmf_stock_inventory_executors')
    op.drop_index(op.f('ix_cmf_stock_inventory_executors_right_id'), table_name='cmf_stock_inventory_executors')
    op.drop_index(op.f('ix_cmf_stock_inventory_executors_parent_id'), table_name='cmf_stock_inventory_executors')
    op.drop_index(op.f('ix_cmf_stock_inventory_executors_left_id'), table_name='cmf_stock_inventory_executors')
    op.drop_table('cmf_stock_inventory_executors')
    op.drop_index(op.f('ix_cmf_stock_inventory_workflow_type'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_workflow_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_waiting_for_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_tree_parent_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_stock_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_status_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_responsible_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_parent_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_orderno'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_name'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_is_template'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_default_task_workflow_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_company_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_code'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_viewed_at'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_version'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_owner_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_owner_assistant_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_modified_by_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_modified_at'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_locked_by_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_locked_at'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_import_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_deleted'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_created_at'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cmf_author_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cloned_from_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cache_status_type'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_cache_status_opt_id'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_approved'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_alarm_date'), table_name='cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_inventory_activity_id'), table_name='cmf_stock_inventory')
    op.drop_table('cmf_stock_inventory')
    op.drop_index(op.f('ix_cmf_stock_initial_spectators_root_id'), table_name='cmf_stock_initial_spectators')
    op.drop_index(op.f('ix_cmf_stock_initial_spectators_right_id'), table_name='cmf_stock_initial_spectators')
    op.drop_index(op.f('ix_cmf_stock_initial_spectators_parent_id'), table_name='cmf_stock_initial_spectators')
    op.drop_index(op.f('ix_cmf_stock_initial_spectators_left_id'), table_name='cmf_stock_initial_spectators')
    op.drop_table('cmf_stock_initial_spectators')
    op.drop_index(op.f('ix_cmf_stock_initial_item_tree_parent_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_stock_initial_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_product_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_parent_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_orderno'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_name'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_code'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_viewed_at'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_version'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_owner_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_owner_assistant_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_modified_by_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_modified_at'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_locked_by_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_locked_at'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_import_id'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_deleted'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_created_at'), table_name='cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_item_cmf_author_id'), table_name='cmf_stock_initial_item')
    op.drop_table('cmf_stock_initial_item')
    op.drop_index(op.f('ix_cmf_stock_initial_executors_root_id'), table_name='cmf_stock_initial_executors')
    op.drop_index(op.f('ix_cmf_stock_initial_executors_right_id'), table_name='cmf_stock_initial_executors')
    op.drop_index(op.f('ix_cmf_stock_initial_executors_parent_id'), table_name='cmf_stock_initial_executors')
    op.drop_index(op.f('ix_cmf_stock_initial_executors_left_id'), table_name='cmf_stock_initial_executors')
    op.drop_table('cmf_stock_initial_executors')
    op.drop_index(op.f('ix_cmf_stock_initial_workflow_type'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_workflow_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_waiting_for_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_tree_parent_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_stock_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_status_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_responsible_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_parent_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_orderno'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_name'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_is_template'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_default_task_workflow_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_company_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_code'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_viewed_at'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_version'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_owner_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_owner_assistant_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_modified_by_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_modified_at'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_locked_by_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_locked_at'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_import_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_deleted'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_created_at'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cmf_author_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cloned_from_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cache_status_type'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_cache_status_opt_id'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_approved'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_alarm_date'), table_name='cmf_stock_initial')
    op.drop_index(op.f('ix_cmf_stock_initial_activity_id'), table_name='cmf_stock_initial')
    op.drop_table('cmf_stock_initial')
    # ### end Alembic commands ###
