154 lines
10 KiB
Python
154 lines
10 KiB
Python
"""empty message
|
|
|
|
Revision ID: 9f0b1662a8af
|
|
Revises: 63fc8d693b9f
|
|
Create Date: 2023-02-24 14:30:05.970959
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '9f0b1662a8af'
|
|
down_revision = '63fc8d693b9f'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('correlation_property_cache',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=50), nullable=False),
|
|
sa.Column('message_name', sa.String(length=50), nullable=False),
|
|
sa.Column('process_model_id', sa.String(length=255), nullable=False),
|
|
sa.Column('retrieval_expression', sa.String(length=255), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('message_instance_correlation_rule',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('message_instance_id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=50), nullable=False),
|
|
sa.Column('retrieval_expression', sa.String(length=255), nullable=True),
|
|
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True),
|
|
sa.Column('created_at_in_seconds', sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(['message_instance_id'], ['message_instance.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('message_instance_id', 'name', name='message_instance_id_name_unique')
|
|
)
|
|
op.create_index(op.f('ix_message_instance_correlation_rule_message_instance_id'), 'message_instance_correlation_rule', ['message_instance_id'], unique=False)
|
|
op.drop_index('ix_message_model_identifier', table_name='message_model')
|
|
op.drop_index('ix_message_model_name', table_name='message_model')
|
|
op.drop_constraint('message_correlation_property_ibfk_1', 'message_correlation_property', type_='foreignkey')
|
|
op.drop_constraint('message_triggerable_process_model_ibfk_1', 'message_triggerable_process_model', type_='foreignkey')
|
|
op.drop_constraint('message_instance_ibfk_1', 'message_instance', type_='foreignkey')
|
|
op.drop_table('message_model')
|
|
op.drop_constraint('message_correlation_message_instance_ibfk_1', 'message_correlation_message_instance', type_='foreignkey')
|
|
op.drop_index('ix_message_correlation_name', table_name='message_correlation')
|
|
op.drop_index('ix_message_correlation_process_instance_id', table_name='message_correlation')
|
|
op.drop_index('ix_message_correlation_value', table_name='message_correlation')
|
|
# op.drop_index('message_instance_id_name_unique', table_name='message_correlation')
|
|
# op.drop_index('ix_message_correlation_message_correlation_property_id', table_name='message_correlation')
|
|
op.drop_table('message_correlation')
|
|
op.drop_index('ix_message_correlation_message_instance_message_correlation_id', table_name='message_correlation_message_instance')
|
|
op.drop_index('ix_message_correlation_message_instance_message_instance_id', table_name='message_correlation_message_instance')
|
|
# op.drop_index('message_correlation_message_instance_unique', table_name='message_correlation_message_instance')
|
|
op.drop_table('message_correlation_message_instance')
|
|
op.drop_index('ix_message_correlation_property_identifier', table_name='message_correlation_property')
|
|
op.drop_index('message_correlation_property_unique', table_name='message_correlation_property')
|
|
op.drop_table('message_correlation_property')
|
|
op.add_column('message_instance', sa.Column('name', sa.String(length=255), nullable=True))
|
|
op.add_column('message_instance', sa.Column('correlation_keys', sa.JSON(), nullable=True))
|
|
op.add_column('message_instance', sa.Column('user_id', sa.Integer(), nullable=False))
|
|
op.add_column('message_instance', sa.Column('counterpart_id', sa.Integer(), nullable=True))
|
|
op.alter_column('message_instance', 'process_instance_id',
|
|
existing_type=mysql.INTEGER(),
|
|
nullable=True)
|
|
op.create_foreign_key(None, 'message_instance', 'user', ['user_id'], ['id'])
|
|
op.drop_column('message_instance', 'message_model_id')
|
|
op.add_column('message_triggerable_process_model', sa.Column('message_name', sa.String(length=255), nullable=True))
|
|
op.drop_index('message_model_id', table_name='message_triggerable_process_model')
|
|
op.drop_column('message_triggerable_process_model', 'message_model_id')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('message_triggerable_process_model', sa.Column('message_model_id', mysql.INTEGER(), autoincrement=False, nullable=False))
|
|
op.create_index('message_model_id', 'message_triggerable_process_model', ['message_model_id'], unique=False)
|
|
op.drop_column('message_triggerable_process_model', 'message_name')
|
|
op.add_column('message_instance', sa.Column('message_model_id', mysql.INTEGER(), autoincrement=False, nullable=False))
|
|
op.drop_constraint(None, 'message_instance', type_='foreignkey')
|
|
op.create_foreign_key('message_instance_ibfk_1', 'message_instance', 'message_model', ['message_model_id'], ['id'])
|
|
op.alter_column('message_instance', 'process_instance_id',
|
|
existing_type=mysql.INTEGER(),
|
|
nullable=False)
|
|
op.drop_column('message_instance', 'counterpart_id')
|
|
op.drop_column('message_instance', 'user_id')
|
|
op.drop_column('message_instance', 'correlation_keys')
|
|
op.drop_column('message_instance', 'name')
|
|
op.create_table('message_correlation_property',
|
|
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column('identifier', mysql.VARCHAR(length=50), nullable=True),
|
|
sa.Column('message_model_id', mysql.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('updated_at_in_seconds', mysql.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.Column('created_at_in_seconds', mysql.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.ForeignKeyConstraint(['message_model_id'], ['message_model.id'], name='message_correlation_property_ibfk_1'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
mysql_collate='utf8mb4_0900_ai_ci',
|
|
mysql_default_charset='utf8mb4',
|
|
mysql_engine='InnoDB'
|
|
)
|
|
op.create_index('message_correlation_property_unique', 'message_correlation_property', ['identifier', 'message_model_id'], unique=False)
|
|
op.create_index('ix_message_correlation_property_identifier', 'message_correlation_property', ['identifier'], unique=False)
|
|
op.create_table('message_correlation_message_instance',
|
|
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column('message_instance_id', mysql.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('message_correlation_id', mysql.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.ForeignKeyConstraint(['message_correlation_id'], ['message_correlation.id'], name='message_correlation_message_instance_ibfk_1'),
|
|
sa.ForeignKeyConstraint(['message_instance_id'], ['message_instance.id'], name='message_correlation_message_instance_ibfk_2'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
mysql_collate='utf8mb4_0900_ai_ci',
|
|
mysql_default_charset='utf8mb4',
|
|
mysql_engine='InnoDB'
|
|
)
|
|
op.create_index('message_correlation_message_instance_unique', 'message_correlation_message_instance', ['message_instance_id', 'message_correlation_id'], unique=False)
|
|
op.create_index('ix_message_correlation_message_instance_message_instance_id', 'message_correlation_message_instance', ['message_instance_id'], unique=False)
|
|
op.create_index('ix_message_correlation_message_instance_message_correlation_id', 'message_correlation_message_instance', ['message_correlation_id'], unique=False)
|
|
op.create_table('message_correlation',
|
|
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column('process_instance_id', mysql.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('message_correlation_property_id', mysql.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('name', mysql.VARCHAR(length=255), nullable=False),
|
|
sa.Column('value', mysql.VARCHAR(length=255), nullable=False),
|
|
sa.Column('updated_at_in_seconds', mysql.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.Column('created_at_in_seconds', mysql.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.ForeignKeyConstraint(['message_correlation_property_id'], ['message_correlation_property.id'], name='message_correlation_ibfk_1'),
|
|
sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], name='message_correlation_ibfk_2'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
mysql_collate='utf8mb4_0900_ai_ci',
|
|
mysql_default_charset='utf8mb4',
|
|
mysql_engine='InnoDB'
|
|
)
|
|
op.create_index('message_instance_id_name_unique', 'message_correlation', ['process_instance_id', 'message_correlation_property_id', 'name'], unique=False)
|
|
op.create_index('ix_message_correlation_value', 'message_correlation', ['value'], unique=False)
|
|
op.create_index('ix_message_correlation_process_instance_id', 'message_correlation', ['process_instance_id'], unique=False)
|
|
op.create_index('ix_message_correlation_name', 'message_correlation', ['name'], unique=False)
|
|
op.create_index('ix_message_correlation_message_correlation_property_id', 'message_correlation', ['message_correlation_property_id'], unique=False)
|
|
op.create_table('message_model',
|
|
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column('identifier', mysql.VARCHAR(length=50), nullable=True),
|
|
sa.Column('name', mysql.VARCHAR(length=50), nullable=True),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
mysql_collate='utf8mb4_0900_ai_ci',
|
|
mysql_default_charset='utf8mb4',
|
|
mysql_engine='InnoDB'
|
|
)
|
|
op.create_index('ix_message_model_name', 'message_model', ['name'], unique=False)
|
|
op.create_index('ix_message_model_identifier', 'message_model', ['identifier'], unique=False)
|
|
op.drop_index(op.f('ix_message_instance_correlation_rule_message_instance_id'), table_name='message_instance_correlation_rule')
|
|
op.drop_table('message_instance_correlation_rule')
|
|
op.drop_table('correlation_property_cache')
|
|
# ### end Alembic commands ###
|