From a214a6aedd7190fc4659bfce9f163e0bb62e9019 Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:31:14 -0500 Subject: [PATCH] Add migration (#931) --- .../migrations/versions/343b406f723d_.py | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 spiffworkflow-backend/migrations/versions/343b406f723d_.py diff --git a/spiffworkflow-backend/migrations/versions/343b406f723d_.py b/spiffworkflow-backend/migrations/versions/343b406f723d_.py new file mode 100644 index 00000000..19eb8fb7 --- /dev/null +++ b/spiffworkflow-backend/migrations/versions/343b406f723d_.py @@ -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 ###