Skip to content

Commit

Permalink
Migration for tool request implicit collections.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Nov 19, 2024
1 parent 68fe06a commit 74c06af
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""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,
)

from galaxy.model.migrations.util import (
add_column,
column_exists,
drop_column,
transaction,
)


# revision identifiers, used by Alembic.
revision = '1d1d7bf6ac02'
down_revision = 'a99a5b52ccb8'
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)

0 comments on commit 74c06af

Please sign in to comment.