From 2b11292ae7c8cca81eaac9ec4cee691fb05097a7 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 18 Nov 2024 15:49:11 -0500 Subject: [PATCH] Migration for tool request implicit collections. --- ...d7bf6ac02_tool_request_implicit_outputs.py | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/galaxy/model/migrations/alembic/versions_gxy/1d1d7bf6ac02_tool_request_implicit_outputs.py diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/1d1d7bf6ac02_tool_request_implicit_outputs.py b/lib/galaxy/model/migrations/alembic/versions_gxy/1d1d7bf6ac02_tool_request_implicit_outputs.py new file mode 100644 index 000000000000..027815c2382c --- /dev/null +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/1d1d7bf6ac02_tool_request_implicit_outputs.py @@ -0,0 +1,60 @@ +"""Track tool request implicit output collections. + +Revision ID: 1d1d7bf6ac02 +Revises: a99a5b52ccb8 +Create Date: 2024-11-18 15:39:42.900327 + +""" +import sqlalchemy as sa +from sqlalchemy import ( + Column, + Integer, + String, +) + +from galaxy.model.migrations.util import ( + create_foreign_key, + create_table, + drop_table, + transaction, +) + + +# revision identifiers, used by Alembic. +revision = '1d1d7bf6ac02' +down_revision = 'cbc46035eba0' +branch_labels = None +depends_on = None + +association_table_name = "ToolRequestImplicitCollectionAssociation" + + +def upgrade(): + with transaction(): + create_table( + association_table_name, + Column("id", Integer, primary_key=True), + Column("tool_request_id", Integer, index=True), + Column("dataset_collection_id", Integer, index=True), + Column("output_name", String(255), nullable=False), + ) + + create_foreign_key( + "fk_trica_tri", + association_table_name, + "tool_request", + ["tool_request_id"], + ["id"], + ) + + create_foreign_key( + "fk_trica_dci", + association_table_name, + "history_dataset_collection_association", + ["dataset_collection_id"], + ["id"], + ) + + +def downgrade(): + drop_table(association_table_name)