mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-27 18:24:58 +00:00
108 lines
5.6 KiB
Python
108 lines
5.6 KiB
Python
"""empty message
|
|
|
|
Revision ID: d6fd61fd64d7
|
|
Revises: 8930711a75a4
|
|
Create Date: 2023-03-03 12:06:39.987943
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'd6fd61fd64d7'
|
|
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.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=True),
|
|
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_table('json_data',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('hash', sa.String(length=255), nullable=False),
|
|
sa.Column('data', sa.JSON(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_json_data_hash'), 'json_data', ['hash'], unique=True)
|
|
op.create_table('bpmn_process_definition_relationship',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('bpmn_process_definition_parent_id', sa.Integer(), nullable=False),
|
|
sa.Column('bpmn_process_definition_child_id', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['bpmn_process_definition_child_id'], ['bpmn_process_definition.id'], ),
|
|
sa.ForeignKeyConstraint(['bpmn_process_definition_parent_id'], ['bpmn_process_definition.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('bpmn_process_definition_parent_id', 'bpmn_process_definition_child_id', name='bpmn_process_definition_relationship_unique')
|
|
)
|
|
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)
|
|
op.add_column('process_instance', sa.Column('bpmn_process_definition_id', sa.Integer(), nullable=True))
|
|
op.add_column('process_instance', sa.Column('spiff_serializer_version', sa.String(length=50), nullable=True))
|
|
op.create_foreign_key(None, 'process_instance', 'bpmn_process_definition', ['bpmn_process_definition_id'], ['id'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint(None, 'process_instance', type_='foreignkey')
|
|
op.drop_column('process_instance', 'spiff_serializer_version')
|
|
op.drop_column('process_instance', 'bpmn_process_definition_id')
|
|
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_table('bpmn_process_definition_relationship')
|
|
op.drop_index(op.f('ix_json_data_hash'), table_name='json_data')
|
|
op.drop_table('json_data')
|
|
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 ###
|