diff --git a/migrations/versions/c51ea6590f5d_.py b/migrations/versions/c51ea6590f5d_.py new file mode 100644 index 00000000..bf55e451 --- /dev/null +++ b/migrations/versions/c51ea6590f5d_.py @@ -0,0 +1,58 @@ +"""empty message + +Revision ID: c51ea6590f5d +Revises: 7225d990740e +Create Date: 2022-02-02 16:20:52.951446 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c51ea6590f5d' +down_revision = '7225d990740e' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint('file_workflow_spec_id_fkey', 'file', type_='foreignkey') + op.drop_column('file', 'primary') + op.drop_column('file', 'is_status') + op.drop_column('file', 'archived') + op.drop_column('file', 'is_reference') + op.drop_column('file', 'is_review') + op.drop_column('file', 'primary_process_id') + op.drop_column('file', 'workflow_spec_id') + op.add_column('lookup_file', sa.Column('file_name', sa.String(), nullable=True)) + op.drop_constraint('lookup_file_file_model_id_fkey', 'lookup_file', type_='foreignkey') + op.drop_constraint('lookup_file_file_data_model_id_fkey', 'lookup_file', type_='foreignkey') + op.drop_column('lookup_file', 'file_model_id') + op.drop_column('lookup_file', 'file_data_model_id') + op.add_column('workflow_spec', sa.Column('primary_file_name', sa.String(), nullable=True)) + op.add_column('workflow_spec', sa.Column('primary_process_id', sa.String(), nullable=True)) + op.add_column('workflow_spec', sa.Column('is_review', sa.Boolean(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('workflow_spec', 'is_review') + op.drop_column('workflow_spec', 'primary_process_id') + op.drop_column('workflow_spec', 'primary_file_name') + op.add_column('lookup_file', sa.Column('file_data_model_id', sa.INTEGER(), autoincrement=False, nullable=True)) + op.add_column('lookup_file', sa.Column('file_model_id', sa.INTEGER(), autoincrement=False, nullable=True)) + op.create_foreign_key('lookup_file_file_data_model_id_fkey', 'lookup_file', 'file_data', ['file_data_model_id'], ['id']) + op.create_foreign_key('lookup_file_file_model_id_fkey', 'lookup_file', 'file', ['file_model_id'], ['id']) + op.drop_column('lookup_file', 'file_name') + op.add_column('file', sa.Column('workflow_spec_id', sa.VARCHAR(), autoincrement=False, nullable=True)) + op.add_column('file', sa.Column('primary_process_id', sa.VARCHAR(), autoincrement=False, nullable=True)) + op.add_column('file', sa.Column('is_review', sa.BOOLEAN(), autoincrement=False, nullable=True)) + op.add_column('file', sa.Column('is_reference', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False)) + op.add_column('file', sa.Column('archived', sa.BOOLEAN(), autoincrement=False, nullable=False)) + op.add_column('file', sa.Column('is_status', sa.BOOLEAN(), autoincrement=False, nullable=True)) + op.add_column('file', sa.Column('primary', sa.BOOLEAN(), autoincrement=False, nullable=False)) + op.create_foreign_key('file_workflow_spec_id_fkey', 'file', 'workflow_spec', ['workflow_spec_id'], ['id']) + # ### end Alembic commands ###