diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index b087eec862fd..1daa7af42dfd 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -10910,7 +10910,7 @@ def __repr__(self): Column("blurb", TrimmedString(255)), Column("peek", TEXT, key="_peek"), Column("tool_version", TEXT), - Column("extension", TrimmedString(64)), + Column("extension", TrimmedString(64), index=True), Column("metadata", MetadataType, key="_metadata"), Column("metadata_deferred", Boolean, key="metadata_deferred"), Column("parent_id", Integer, ForeignKey("history_dataset_association.id"), nullable=True), diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/55f02fd8ab6c_add_index_on_hda_extension.py b/lib/galaxy/model/migrations/alembic/versions_gxy/55f02fd8ab6c_add_index_on_hda_extension.py new file mode 100644 index 000000000000..cd13af341157 --- /dev/null +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/55f02fd8ab6c_add_index_on_hda_extension.py @@ -0,0 +1,33 @@ +"""Add index on history_dataset_association extension + +Revision ID: 55f02fd8ab6c +Revises: 2dc3386d091f +Create Date: 2024-03-25 11:14:40.005394 + +""" + +from galaxy.model.database_object_names import build_index_name +from galaxy.model.migrations.util import ( + create_index, + drop_index, +) + + +# revision identifiers, used by Alembic. +revision = "55f02fd8ab6c" +down_revision = "2dc3386d091f" +branch_labels = None +depends_on = None + + +hda_table_name = "history_dataset_association" +hda_extension_column_name = "extension" +hda_extension_index_name = build_index_name(hda_table_name, hda_extension_column_name) + + +def upgrade(): + create_index(hda_extension_index_name, hda_table_name, [hda_extension_column_name]) + + +def downgrade(): + drop_index(hda_extension_index_name, hda_table_name)