"""workflow_add_activity

Revision ID: 3a4ffcdea1f6
Revises: 0617d0af5c50
Create Date: 2022-05-27 08:29:39.476875

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3a4ffcdea1f6'
down_revision = '0617d0af5c50'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('cmf_chat_group', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_chat_topic', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_company', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_deal', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_document', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_invoice', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_lead', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_list', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_mail', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_payment', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_pipeline', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_project', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_purchase_order', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_purchase_order_items', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_roadmap', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_stock_move', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_stock_move_items', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_task', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.alter_column('cmf_u_work_post', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=(True,))
    op.add_column('cmf_workflow', sa.Column('activity_id', sa.String(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_workflow_activity_id'), 'cmf_workflow', ['activity_id'], unique=False)
    op.create_foreign_key(None, 'cmf_workflow', 'cmf_activity', ['activity_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'cmf_workflow', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_workflow_activity_id'), table_name='cmf_workflow')
    op.drop_column('cmf_workflow', 'activity_id')
    op.alter_column('cmf_u_work_post', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_task', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_stock_move_items', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_stock_move', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_roadmap', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_purchase_order_items', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_purchase_order', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_project', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_pipeline', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_payment', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_mail', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_list', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_lead', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_invoice', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_document', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_deal', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_company', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_chat_topic', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cmf_chat_group', 'workflow_id',
               existing_type=sa.VARCHAR(length=64),
               nullable=True)
    # ### end Alembic commands ###
