86 lines
4.2 KiB
Python
86 lines
4.2 KiB
Python
"""empty message
|
|
|
|
Revision ID: 317dd5155137
|
|
Revises: 8930711a75a4
|
|
Create Date: 2023-03-02 17:16:15.687837
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '317dd5155137'
|
|
down_revision = '8930711a75a4'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('bpmn_process',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('parent_process_id', sa.Integer(), nullable=True),
|
|
sa.Column('properties_json', sa.JSON(), nullable=False),
|
|
sa.Column('json_data_hash', sa.String(length=255), nullable=False),
|
|
sa.Column('process_type', sa.String(length=30), nullable=False),
|
|
sa.ForeignKeyConstraint(['parent_process_id'], ['bpmn_process.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_bpmn_process_json_data_hash'), 'bpmn_process', ['json_data_hash'], unique=False)
|
|
op.create_table('bpmn_process_definition',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('hash', sa.String(length=255), nullable=False),
|
|
sa.Column('bpmn_identifier', sa.String(length=255), nullable=False),
|
|
sa.Column('properties_json', sa.JSON(), nullable=False),
|
|
sa.Column('type', sa.String(length=32), nullable=False),
|
|
sa.Column('bpmn_version_control_type', sa.String(length=50), nullable=True),
|
|
sa.Column('bpmn_version_control_identifier', sa.String(length=255), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_bpmn_process_definition_bpmn_identifier'), 'bpmn_process_definition', ['bpmn_identifier'], unique=False)
|
|
op.create_index(op.f('ix_bpmn_process_definition_hash'), 'bpmn_process_definition', ['hash'], unique=True)
|
|
op.create_index(op.f('ix_bpmn_process_definition_type'), 'bpmn_process_definition', ['type'], unique=False)
|
|
op.create_table('task_definition',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('bpmn_process_definition_id', sa.Integer(), nullable=False),
|
|
sa.Column('bpmn_identifier', sa.String(length=255), nullable=False),
|
|
sa.Column('properties_json', sa.JSON(), nullable=False),
|
|
sa.Column('typename', sa.String(length=255), nullable=False),
|
|
sa.ForeignKeyConstraint(['bpmn_process_definition_id'], ['bpmn_process_definition.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('bpmn_process_definition_id', 'bpmn_identifier', name='task_definition_unique')
|
|
)
|
|
op.create_index(op.f('ix_task_definition_bpmn_identifier'), 'task_definition', ['bpmn_identifier'], unique=False)
|
|
op.create_table('task',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('guid', sa.String(length=36), nullable=False),
|
|
sa.Column('bpmn_process_id', sa.Integer(), nullable=False),
|
|
sa.Column('task_definition_id', sa.Integer(), nullable=False),
|
|
sa.Column('state', sa.String(length=10), nullable=False),
|
|
sa.Column('properties_json', sa.JSON(), nullable=False),
|
|
sa.Column('json_data_hash', sa.String(length=255), nullable=False),
|
|
sa.ForeignKeyConstraint(['bpmn_process_id'], ['bpmn_process.id'], ),
|
|
sa.ForeignKeyConstraint(['task_definition_id'], ['task_definition.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_task_guid'), 'task', ['guid'], unique=True)
|
|
op.create_index(op.f('ix_task_json_data_hash'), 'task', ['json_data_hash'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_task_json_data_hash'), table_name='task')
|
|
op.drop_index(op.f('ix_task_guid'), table_name='task')
|
|
op.drop_table('task')
|
|
op.drop_index(op.f('ix_task_definition_bpmn_identifier'), table_name='task_definition')
|
|
op.drop_table('task_definition')
|
|
op.drop_index(op.f('ix_bpmn_process_definition_type'), table_name='bpmn_process_definition')
|
|
op.drop_index(op.f('ix_bpmn_process_definition_hash'), table_name='bpmn_process_definition')
|
|
op.drop_index(op.f('ix_bpmn_process_definition_bpmn_identifier'), table_name='bpmn_process_definition')
|
|
op.drop_table('bpmn_process_definition')
|
|
op.drop_index(op.f('ix_bpmn_process_json_data_hash'), table_name='bpmn_process')
|
|
op.drop_table('bpmn_process')
|
|
# ### end Alembic commands ###
|