From 9478a9522594be4ebea4ae63509301935734f632 Mon Sep 17 00:00:00 2001 From: Jon Van Oast Date: Mon, 8 Jan 2024 17:42:44 -0700 Subject: [PATCH] db migration (we hope) --- migrations/versions/effd65fb089e_.py | 82 ++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 migrations/versions/effd65fb089e_.py diff --git a/migrations/versions/effd65fb089e_.py b/migrations/versions/effd65fb089e_.py new file mode 100644 index 000000000..53afff97f --- /dev/null +++ b/migrations/versions/effd65fb089e_.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +"""empty message + +Revision ID: effd65fb089e +Revises: 53b0fec87272 +Create Date: 2024-01-05 18:24:21.360901 + +""" +import sqlalchemy as sa +from alembic import op + +import app +import app.extensions + +# revision identifiers, used by Alembic. +revision = 'effd65fb089e' +down_revision = '53b0fec87272' + + +def upgrade(): + """ + Upgrade Semantic Description: + ENTER DESCRIPTION HERE + """ + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('collaboration', schema=None) as batch_op: + batch_op.add_column( + sa.Column('export_initiator_guid', app.extensions.GUID(), nullable=True) + ) + batch_op.add_column( + sa.Column( + 'export_req_notification_guid', app.extensions.GUID(), nullable=True + ) + ) + batch_op.create_index( + batch_op.f('ix_collaboration_export_initiator_guid'), + ['export_initiator_guid'], + unique=False, + ) + batch_op.create_foreign_key( + batch_op.f('fk_collaboration_export_initiator_guid_user'), + 'user', + ['export_initiator_guid'], + ['guid'], + ) + batch_op.create_foreign_key( + batch_op.f('fk_collaboration_export_req_notification_guid_notification'), + 'notification', + ['export_req_notification_guid'], + ['guid'], + ) + + with op.batch_alter_table('collaboration_user_associations', schema=None) as batch_op: + batch_op.add_column( + sa.Column('export_approval_state', sa.String(length=32), nullable=False) + ) + + # ### end Alembic commands ### + + +def downgrade(): + """ + Downgrade Semantic Description: + ENTER DESCRIPTION HERE + """ + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('collaboration_user_associations', schema=None) as batch_op: + batch_op.drop_column('export_approval_state') + + with op.batch_alter_table('collaboration', schema=None) as batch_op: + batch_op.drop_constraint( + batch_op.f('fk_collaboration_export_req_notification_guid_notification'), + type_='foreignkey', + ) + batch_op.drop_constraint( + batch_op.f('fk_collaboration_export_initiator_guid_user'), type_='foreignkey' + ) + batch_op.drop_index(batch_op.f('ix_collaboration_export_initiator_guid')) + batch_op.drop_column('export_req_notification_guid') + batch_op.drop_column('export_initiator_guid') + + # ### end Alembic commands ###