86 lines
4.1 KiB
Python
86 lines
4.1 KiB
Python
"""empty message
|
|
|
|
Revision ID: 43afc70a7016
|
|
Revises: d4b900e71852
|
|
Create Date: 2024-06-10 11:17:19.060779
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '43afc70a7016'
|
|
down_revision = 'd4b900e71852'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('message',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('identifier', sa.String(length=255), nullable=False),
|
|
sa.Column('location', sa.String(length=255), nullable=False),
|
|
sa.Column('schema', sa.JSON(), nullable=False),
|
|
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=False),
|
|
sa.Column('created_at_in_seconds', sa.Integer(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('identifier', 'location', name='message_identifier_location_unique')
|
|
)
|
|
with op.batch_alter_table('message', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_message_identifier'), ['identifier'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_message_location'), ['location'], unique=False)
|
|
|
|
op.create_table('message_correlation_property',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('message_id', sa.Integer(), nullable=False),
|
|
sa.Column('identifier', sa.String(length=255), nullable=False),
|
|
sa.Column('retrieval_expression', sa.String(length=255), nullable=False),
|
|
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=False),
|
|
sa.Column('created_at_in_seconds', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['message_id'], ['message.id'], name='message_correlation_property_message_id_fk'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('message_id', 'identifier', name='message_correlation_property_unique')
|
|
)
|
|
with op.batch_alter_table('message_correlation_property', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_message_correlation_property_identifier'), ['identifier'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_message_correlation_property_message_id'), ['message_id'], unique=False)
|
|
|
|
with op.batch_alter_table('correlation_property_cache', schema=None) as batch_op:
|
|
batch_op.drop_index('ix_correlation_property_cache_message_name')
|
|
batch_op.drop_index('ix_correlation_property_cache_name')
|
|
|
|
op.drop_table('correlation_property_cache')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('correlation_property_cache',
|
|
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column('name', mysql.VARCHAR(collation='utf8mb4_0900_as_cs', length=50), nullable=False),
|
|
sa.Column('message_name', mysql.VARCHAR(collation='utf8mb4_0900_as_cs', length=50), nullable=False),
|
|
sa.Column('process_model_id', mysql.VARCHAR(collation='utf8mb4_0900_as_cs', length=255), nullable=False),
|
|
sa.Column('retrieval_expression', mysql.VARCHAR(collation='utf8mb4_0900_as_cs', length=255), nullable=True),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
mysql_collate='utf8mb4_0900_as_cs',
|
|
mysql_default_charset='utf8mb4',
|
|
mysql_engine='InnoDB'
|
|
)
|
|
with op.batch_alter_table('correlation_property_cache', schema=None) as batch_op:
|
|
batch_op.create_index('ix_correlation_property_cache_name', ['name'], unique=False)
|
|
batch_op.create_index('ix_correlation_property_cache_message_name', ['message_name'], unique=False)
|
|
|
|
with op.batch_alter_table('message_correlation_property', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_message_correlation_property_message_id'))
|
|
batch_op.drop_index(batch_op.f('ix_message_correlation_property_identifier'))
|
|
|
|
op.drop_table('message_correlation_property')
|
|
with op.batch_alter_table('message', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_message_location'))
|
|
batch_op.drop_index(batch_op.f('ix_message_identifier'))
|
|
|
|
op.drop_table('message')
|
|
# ### end Alembic commands ###
|