[WIP] Moves the stage and ref from the table in a ci commit build to a plain one line text
Compare changes
Files
2- Yorick Peterse authored
The OR condition for source_project_id/target_project_id leads to a query plan that performs rather poorly on PostgreSQL due to the use of sub-queries. Because Rails offers no easy alternative for this particular problem we're forced to using a UNION for both conditions. The resulting query performs much faster than just using an OR.
+ 18
− 1
@@ -135,7 +135,6 @@ class MergeRequest < ActiveRecord::Base
@@ -135,7 +135,6 @@ class MergeRequest < ActiveRecord::Base
scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) }
scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) }
@@ -161,6 +160,24 @@ def self.link_reference_pattern
@@ -161,6 +160,24 @@ def self.link_reference_pattern