Commit 7e0b67b7 authored by Michael Kozono's avatar Michael Kozono

Merge branch '299265-rearrange-stage-event-methods' into 'master'

Rearrange VSA stage event methods

See merge request gitlab-org/gitlab!60012
parents 33b50971 5c1b1e75
......@@ -17,8 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
issue_table[:closed_at]
def column_list
[issue_table[:closed_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
issue_metrics_table[:first_added_to_board_at]
def column_list
[issue_metrics_table[:first_added_to_board_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
issue_metrics_table[:first_associated_with_milestone_at]
def column_list
[issue_metrics_table[:first_associated_with_milestone_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
issue_table[:last_edited_at]
def column_list
[issue_table[:last_edited_at]]
end
end
end
......
......@@ -20,13 +20,8 @@ module Gitlab
true
end
def timestamp_projection
Arel.sql("#{join_expression_name}.created_at")
end
override :column_list
def column_list
[timestamp_projection]
[Arel.sql("#{join_expression_name}.created_at")]
end
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_metrics_table[:latest_closed_at]
def column_list
[mr_metrics_table[:latest_closed_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_metrics_table[:first_commit_at]
def column_list
[mr_metrics_table[:first_commit_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_table[:last_edited_at]
def column_list
[mr_table[:last_edited_at]]
end
end
end
......
......@@ -17,11 +17,6 @@ module Gitlab
MergeRequest
end
def timestamp_projection
Arel::Nodes::NamedFunction.new('COALESCE', column_list)
end
override :column_list
def column_list
[
issue_metrics_table[:first_mentioned_in_commit_at],
......
......@@ -17,8 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
issue_table[:created_at]
def column_list
[issue_table[:created_at]]
end
end
end
......
......@@ -17,13 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
mr_metrics_table[:first_deployed_to_production_at]
end
override :column_list
def column_list
[timestamp_projection]
[mr_metrics_table[:first_deployed_to_production_at]]
end
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -17,8 +17,8 @@ module Gitlab
Issue
end
def timestamp_projection
issue_metrics_table[:first_mentioned_in_commit_at]
def column_list
[issue_metrics_table[:first_mentioned_in_commit_at]]
end
end
end
......
......@@ -17,11 +17,6 @@ module Gitlab
Issue
end
def timestamp_projection
Arel::Nodes::NamedFunction.new('COALESCE', column_list)
end
override :column_list
def column_list
[
issue_metrics_table[:first_associated_with_milestone_at],
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_table[:created_at]
def column_list
[mr_table[:created_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_metrics_table[:first_deployed_to_production_at]
def column_list
[mr_metrics_table[:first_deployed_to_production_at]]
end
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_metrics_table[:latest_build_finished_at]
def column_list
[mr_metrics_table[:latest_build_finished_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_metrics_table[:latest_build_started_at]
def column_list
[mr_metrics_table[:latest_build_started_at]]
end
end
end
......
......@@ -17,8 +17,8 @@ module Gitlab
MergeRequest
end
def timestamp_projection
mr_metrics_table[:merged_at]
def column_list
[mr_metrics_table[:merged_at]]
end
end
end
......
......@@ -11,7 +11,6 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
override :column_list
def column_list
[timestamp_projection]
end
......
......@@ -17,11 +17,6 @@ module Gitlab
Issue
end
def timestamp_projection
Arel::Nodes::NamedFunction.new('COALESCE', column_list)
end
override :column_list
def column_list
[
issue_metrics_table[:first_associated_with_milestone_at],
......
......@@ -34,14 +34,16 @@ module Gitlab
# Each StageEvent must expose a timestamp or a timestamp like expression in order to build a range query.
# Example: get me all the Issue records between start event end end event
def timestamp_projection
raise NotImplementedError
columns = column_list
columns.one? ? columns.first : Arel::Nodes::NamedFunction.new('COALESCE', columns)
end
# List of columns that are referenced in the `timestamp_projection` expression
# Example timestamp projection: COALESCE(issue_metrics.created_at, issue_metrics.updated_at)
# Expected column list: issue_metrics.created_at, issue_metrics.updated_at
def column_list
[]
raise NotImplementedError
end
# Optionally a StageEvent may apply additional filtering or join other tables on the base query.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment