Skip to content

Instantly share code, notes, and snippets.

@mvdbeek
Created May 19, 2025 14:43
Show Gist options
  • Save mvdbeek/060c41961fc25008a2d0965f48da64f5 to your computer and use it in GitHub Desktop.
Save mvdbeek/060c41961fc25008a2d0965f48da64f5 to your computer and use it in GitHub Desktop.
25.0 migrations
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/0c681a59dce1_add_on_delete_to_fkey_on_event_session_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/0c681a59dce1_add_on_delete_to_fkey_on_event_session_.py
new file mode 100644
index 00000000000..a449de1b6d7
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/0c681a59dce1_add_on_delete_to_fkey_on_event_session_.py
@@ -0,0 +1,40 @@
+"""Add on-delete to fkey on event.session_id
+
+Revision ID: 0c681a59dce1
+Revises: 24feca8a6a5a
+Create Date: 2025-03-22 11:49:53.739419
+
+"""
+
+from galaxy.model.database_object_names import build_foreign_key_name
+from galaxy.model.migrations.util import (
+ create_foreign_key,
+ drop_constraint,
+ transaction,
+)
+
+# revision identifiers, used by Alembic.
+revision = "0c681a59dce1"
+down_revision = "24feca8a6a5a"
+branch_labels = None
+depends_on = None
+
+session_table = "galaxy_session"
+job_table = "event"
+session_id_column = "session_id"
+
+job_session_fk = build_foreign_key_name(job_table, session_id_column)
+fkey_args = (job_session_fk, job_table, session_table, [session_id_column], ["id"])
+
+
+def upgrade():
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args, ondelete="SET NULL")
+
+
+def downgrade():
+ pass
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args)
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/23143e0bf1d8_add_doi_column_to_workflow_table.py b/lib/galaxy/model/migrations/alembic/versions_gxy/23143e0bf1d8_add_doi_column_to_workflow_table.py
new file mode 100644
index 00000000000..3b9aeb8c270
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/23143e0bf1d8_add_doi_column_to_workflow_table.py
@@ -0,0 +1,34 @@
+"""Add doi column to workflow table
+
+Revision ID: 23143e0bf1d8
+Revises: 71eeb8d91f92
+Create Date: 2025-04-16 13:19:04.848395
+
+"""
+
+from sqlalchemy import (
+ Column,
+ JSON,
+)
+
+from galaxy.model.migrations.util import (
+ add_column,
+ drop_column,
+)
+
+# revision identifiers, used by Alembic.
+revision = "b964490175fd"
+down_revision = "71eeb8d91f92"
+branch_labels = None
+depends_on = None
+
+table_name = "workflow"
+column_name = "doi"
+
+
+def upgrade():
+ add_column(table_name, Column(column_name, JSON))
+
+
+def downgrade():
+ drop_column(table_name, column_name)
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/24feca8a6a5a_add_on_delete_to_fkey_on_user_action_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/24feca8a6a5a_add_on_delete_to_fkey_on_user_action_.py
new file mode 100644
index 00000000000..fc7d85d025b
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/24feca8a6a5a_add_on_delete_to_fkey_on_user_action_.py
@@ -0,0 +1,40 @@
+"""Add on-delete to fkey on user_action.session_id
+
+Revision ID: 24feca8a6a5a
+Revises: cde5d2db77e7
+Create Date: 2025-03-22 11:47:02.069491
+
+"""
+
+from galaxy.model.database_object_names import build_foreign_key_name
+from galaxy.model.migrations.util import (
+ create_foreign_key,
+ drop_constraint,
+ transaction,
+)
+
+# revision identifiers, used by Alembic.
+revision = "24feca8a6a5a"
+down_revision = "cde5d2db77e7"
+branch_labels = None
+depends_on = None
+
+session_table = "galaxy_session"
+job_table = "user_action"
+session_id_column = "session_id"
+
+job_session_fk = build_foreign_key_name(job_table, session_id_column)
+fkey_args = (job_session_fk, job_table, session_table, [session_id_column], ["id"])
+
+
+def upgrade():
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args, ondelete="SET NULL")
+
+
+def downgrade():
+ pass
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args)
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/71eeb8d91f92_workflow_readme.py b/lib/galaxy/model/migrations/alembic/versions_gxy/71eeb8d91f92_workflow_readme.py
new file mode 100644
index 00000000000..b1f974719de
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/71eeb8d91f92_workflow_readme.py
@@ -0,0 +1,34 @@
+"""Implement fields needed for a workflow readme & help.
+
+Revision ID: 71eeb8d91f92
+Revises: a4c3ef999ab5
+Create Date: 2025-02-11 11:57:14.477337
+
+"""
+
+import sqlalchemy as sa
+
+from galaxy.model.migrations.util import (
+ add_column,
+ drop_column,
+)
+
+workflow_table_name = "workflow"
+
+# revision identifiers, used by Alembic.
+revision = "71eeb8d91f92"
+down_revision = "a4c3ef999ab5"
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ add_column(workflow_table_name, sa.Column("readme", sa.Text, nullable=True))
+ add_column(workflow_table_name, sa.Column("help", sa.Text, nullable=True))
+ add_column(workflow_table_name, sa.Column("logo_url", sa.Text, nullable=True))
+
+
+def downgrade():
+ drop_column(workflow_table_name, "readme")
+ drop_column(workflow_table_name, "help")
+ drop_column(workflow_table_name, "logo_url")
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/caeee878d7cd_add_on_delete_to_fkey_on_galaxy_session_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/caeee878d7cd_add_on_delete_to_fkey_on_galaxy_session_.py
new file mode 100644
index 00000000000..3194a6bfdf9
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/caeee878d7cd_add_on_delete_to_fkey_on_galaxy_session_.py
@@ -0,0 +1,40 @@
+"""Add on-delete to fkey on galaxy_session_to_history.session_id
+
+Revision ID: caeee878d7cd
+Revises: 0c681a59dce1
+Create Date: 2025-03-22 11:53:01.514335
+
+"""
+
+from galaxy.model.database_object_names import build_foreign_key_name
+from galaxy.model.migrations.util import (
+ create_foreign_key,
+ drop_constraint,
+ transaction,
+)
+
+# revision identifiers, used by Alembic.
+revision = "caeee878d7cd"
+down_revision = "0c681a59dce1"
+branch_labels = None
+depends_on = None
+
+session_table = "galaxy_session"
+job_table = "galaxy_session_to_history"
+session_id_column = "session_id"
+
+job_session_fk = build_foreign_key_name(job_table, session_id_column)
+fkey_args = (job_session_fk, job_table, session_table, [session_id_column], ["id"])
+
+
+def upgrade():
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args, ondelete="CASCADE")
+
+
+def downgrade():
+ pass
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args)
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/cde5d2db77e7_add_on_delete_to_fkey_on_job_session_id.py b/lib/galaxy/model/migrations/alembic/versions_gxy/cde5d2db77e7_add_on_delete_to_fkey_on_job_session_id.py
new file mode 100644
index 00000000000..06a3e7d1388
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/cde5d2db77e7_add_on_delete_to_fkey_on_job_session_id.py
@@ -0,0 +1,40 @@
+"""Add on-delete to fkey on job.session_id
+
+Revision ID: cde5d2db77e7
+Revises: b964490175fd
+Create Date: 2025-03-21 18:18:07.287968
+
+"""
+
+from galaxy.model.database_object_names import build_foreign_key_name
+from galaxy.model.migrations.util import (
+ create_foreign_key,
+ drop_constraint,
+ transaction,
+)
+
+# revision identifiers, used by Alembic.
+revision = "cde5d2db77e7"
+down_revision = "b964490175fd"
+branch_labels = None
+depends_on = None
+
+session_table = "galaxy_session"
+job_table = "job"
+session_id_column = "session_id"
+
+job_session_fk = build_foreign_key_name(job_table, session_id_column)
+fkey_args = (job_session_fk, job_table, session_table, [session_id_column], ["id"])
+
+
+def upgrade():
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args, ondelete="SET NULL")
+
+
+def downgrade():
+ pass
+ with transaction():
+ drop_constraint(job_session_fk, job_table)
+ create_foreign_key(*fkey_args)
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/ec25b23b08e2_implement_fixed_length_collections.py b/lib/galaxy/model/migrations/alembic/versions_gxy/ec25b23b08e2_implement_fixed_length_collections.py
new file mode 100644
index 00000000000..85aa441ca9e
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/ec25b23b08e2_implement_fixed_length_collections.py
@@ -0,0 +1,46 @@
+"""Implement fixed length collection types.
+
+Revision ID: ec25b23b08e2
+Revises: caeee878d7cd
+Create Date: 2024-12-09 10:28:54.902847
+
+"""
+
+from sqlalchemy import Column
+
+from galaxy.model.custom_types import JSONType
+from galaxy.model.migrations.util import (
+ add_column,
+ drop_column,
+ transaction,
+)
+
+# revision identifiers, used by Alembic.
+revision = "ec25b23b08e2"
+down_revision = "caeee878d7cd"
+branch_labels = None
+depends_on = None
+
+dataset_collection_element_table = "dataset_collection_element"
+dataset_collection_table = "dataset_collection"
+job_to_input_dataset_table = "job_to_input_dataset"
+job_to_input_dataset_collection_table = "job_to_input_dataset_collection"
+job_to_input_dataset_collection_element_table = "job_to_input_dataset_collection_element"
+
+
+def upgrade():
+ with transaction():
+ add_column(dataset_collection_table, Column("fields", JSONType(), default=None))
+
+ add_column(job_to_input_dataset_table, Column("adapter", JSONType(), default=None))
+ add_column(job_to_input_dataset_collection_table, Column("adapter", JSONType(), default=None))
+ add_column(job_to_input_dataset_collection_element_table, Column("adapter", JSONType(), default=None))
+
+
+def downgrade():
+ with transaction():
+ drop_column(dataset_collection_table, "fields")
+
+ drop_column(job_to_input_dataset_table, "adapter")
+ drop_column(job_to_input_dataset_collection_table, "adapter")
+ drop_column(job_to_input_dataset_collection_element_table, "adapter")
diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/f070559879f1_create_user_dynamic_tool_association_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/f070559879f1_create_user_dynamic_tool_association_.py
new file mode 100644
index 00000000000..5691466b330
--- /dev/null
+++ b/lib/galaxy/model/migrations/alembic/versions_gxy/f070559879f1_create_user_dynamic_tool_association_.py
@@ -0,0 +1,48 @@
+"""Create user_dynamic_tool_association table
+
+Revision ID: f070559879f1
+Revises: 75348cfb3715
+Create Date: 2024-12-06 14:56:18.494243
+
+"""
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy.sql import func
+
+from galaxy.model.migrations.util import (
+ add_column,
+ create_table,
+ drop_column,
+ drop_table,
+)
+
+# revision identifiers, used by Alembic.
+revision = "f070559879f1"
+down_revision = "ec25b23b08e2"
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # Create user_dynamic_tool_association table
+ create_table(
+ "user_dynamic_tool_association",
+ sa.Column("id", sa.Integer, primary_key=True),
+ sa.Column("dynamic_tool_id", sa.Integer, sa.ForeignKey("dynamic_tool.id"), index=True, nullable=False),
+ sa.Column("user_id", sa.Integer, sa.ForeignKey("galaxy_user.id"), index=True, nullable=False),
+ sa.Column("create_time", sa.DateTime, nullable=True, server_default=func.now()),
+ sa.Column("hidden", sa.Boolean, nullable=True, server_default=sa.text("false")),
+ sa.Column("active", sa.Boolean, nullable=True, server_default=sa.text("true")),
+ )
+
+ # Add the public column with a default value of False
+ add_column("dynamic_tool", sa.Column("public", sa.Boolean, nullable=False, server_default=sa.text("false")))
+ # Update existing rows (these have been created by admins) to make them public
+ op.execute("UPDATE dynamic_tool SET public = TRUE")
+
+
+def downgrade():
+ # Drop user_dynamic_tool_association table
+ drop_table("user_dynamic_tool_association")
+ drop_column("dynamic_tool", "public")
diff --git a/lib/galaxy/model/migrations/dbscript.py b/lib/galaxy/model/migrations/dbscript.py
index ec0180676db..0d0b4962352 100644
--- a/lib/galaxy/model/migrations/dbscript.py
+++ b/lib/galaxy/model/migrations/dbscript.py
@@ -46,6 +46,8 @@ REVISION_TAGS = {
"24.1": "04288b6a5b25",
"release_24.2": "a4c3ef999ab5",
"24.2": "a4c3ef999ab5",
+ "release_25.0": "f070559879f1",
+ "25.0": "f070559879f1",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment