Add migration (#931)

This commit is contained in:
jbirddog 2024-01-31 11:31:14 -05:00 committed by GitHub
parent 711da2b048
commit a214a6aedd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,57 @@
"""empty message
Revision ID: 343b406f723d
Revises: a872f8f2e909
Create Date: 2024-01-31 10:40:53.320103
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '343b406f723d'
down_revision = 'a872f8f2e909'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
# with op.batch_alter_table('spec_reference_cache', schema=None) as batch_op:
# batch_op.drop_index('_identifier_type_unique')
# batch_op.drop_index('ix_spec_reference_cache_display_name')
# batch_op.drop_index('ix_spec_reference_cache_identifier')
# batch_op.drop_index('ix_spec_reference_cache_process_model_id')
# batch_op.drop_index('ix_spec_reference_cache_type')
op.drop_table('spec_reference_cache')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('spec_reference_cache',
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
sa.Column('identifier', mysql.VARCHAR(length=255), nullable=True),
sa.Column('display_name', mysql.VARCHAR(length=255), nullable=True),
sa.Column('process_model_id', mysql.VARCHAR(length=255), nullable=True),
sa.Column('type', mysql.VARCHAR(length=255), nullable=True),
sa.Column('file_name', mysql.VARCHAR(length=255), nullable=True),
sa.Column('relative_path', mysql.VARCHAR(length=255), nullable=True),
sa.Column('has_lanes', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
sa.Column('is_executable', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
sa.Column('is_primary', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id'),
mysql_collate='utf8mb4_0900_ai_ci',
mysql_default_charset='utf8mb4',
mysql_engine='InnoDB'
)
with op.batch_alter_table('spec_reference_cache', schema=None) as batch_op:
batch_op.create_index('ix_spec_reference_cache_type', ['type'], unique=False)
batch_op.create_index('ix_spec_reference_cache_process_model_id', ['process_model_id'], unique=False)
batch_op.create_index('ix_spec_reference_cache_identifier', ['identifier'], unique=False)
batch_op.create_index('ix_spec_reference_cache_display_name', ['display_name'], unique=False)
batch_op.create_index('_identifier_type_unique', ['identifier', 'type'], unique=False)
# ### end Alembic commands ###