"""capture_process_data

Revision ID: f1599a5bd658
Revises: 95387de7067e
Create Date: 2024-04-26 12:30:03.513372

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

# revision identifiers, used by Alembic.
revision = 'f1599a5bd658'
down_revision = '95387de7067e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('process',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('process_type', postgresql.ENUM('BPMN', 'LOWCODE', 'DMN', name='ProcessType'), nullable=False),
    sa.Column('process_data', sa.String(), nullable=False),
    sa.Column('status', postgresql.ENUM('DRAFT', 'PUBLISHED', name='ProcessStatus'), nullable=False),
    sa.Column('form_process_mapper_id', sa.Integer(), nullable=True),
    sa.Column('tenant', sa.String(length=100), nullable=True),
    sa.Column('created', sa.DateTime(), nullable=False),
    sa.Column('modified', sa.DateTime(), nullable=True),
    sa.Column('created_by', sa.String(), nullable=False),
    sa.Column('modified_by', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['form_process_mapper_id'], ['form_process_mapper.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_process_process_type'), 'process', ['process_type'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_process_process_type'), table_name='process')
    op.drop_table('process')
    sa.Enum(name='ProcessType').drop(op.get_bind(), checkfirst=False)
    sa.Enum(name='ProcessStatus').drop(op.get_bind(), checkfirst=False)
    # ### end Alembic commands ###
