Skip to content

Commit

Permalink
Merge pull request #17700 from ElectronicBlueberry/workflow-comment-i…
Browse files Browse the repository at this point in the history
…ndexing

[24.0] Workflow Comment Indexing
  • Loading branch information
mvdbeek authored Mar 15, 2024
2 parents e8f52c3 + bfef9d4 commit 845e306
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7727,7 +7727,7 @@ class WorkflowStep(Base, RepresentById):
uuid = Column(UUIDType)
label = Column(Unicode(255))
temp_input_connections: Optional[InputConnDictType]
parent_comment_id = Column(Integer, ForeignKey("workflow_comment.id"), nullable=True)
parent_comment_id = Column(Integer, ForeignKey("workflow_comment.id"), index=True, nullable=True)

parent_comment = relationship(
"WorkflowComment",
Expand Down Expand Up @@ -8174,7 +8174,7 @@ class WorkflowComment(Base, RepresentById):
type = Column(String(16))
color = Column(String(16))
data = Column(JSONType)
parent_comment_id = Column(Integer, ForeignKey("workflow_comment.id"), nullable=True)
parent_comment_id = Column(Integer, ForeignKey("workflow_comment.id"), index=True, nullable=True)

workflow = relationship(
"Workflow",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""add_indexes_for_workflow_comment_foreign_keys
Revision ID: 2dc3386d091f
Revises: 8a19186a6ee7
Create Date: 2024-03-13 15:25:52.587488
"""

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 = "2dc3386d091f"
down_revision = "8a19186a6ee7"
branch_labels = None
depends_on = None

workflow_comment_table_name = "workflow_comment"
workflow_step_table_name = "workflow_step"
workflow_id_column_name = "workflow_id"
parent_comment_id_column_name = "parent_comment_id"

workflow_step_parent_comment_index_name = build_index_name(workflow_step_table_name, parent_comment_id_column_name)
workflow_comment_workflow_id_index_name = build_index_name(workflow_comment_table_name, workflow_id_column_name)
workflow_comment_parent_comment_index_name = build_index_name(
workflow_comment_table_name, parent_comment_id_column_name
)


def upgrade():
create_index(workflow_step_parent_comment_index_name, workflow_step_table_name, [parent_comment_id_column_name])
create_index(workflow_comment_workflow_id_index_name, workflow_comment_table_name, [workflow_id_column_name])
create_index(
workflow_comment_parent_comment_index_name, workflow_comment_table_name, [parent_comment_id_column_name]
)


def downgrade():
drop_index(workflow_step_parent_comment_index_name, workflow_step_table_name)
drop_index(workflow_comment_workflow_id_index_name, workflow_comment_table_name)
drop_index(workflow_comment_parent_comment_index_name, workflow_comment_table_name)

0 comments on commit 845e306

Please sign in to comment.