Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb')
-rw-r--r--lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb b/lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb
index 9b278efaedd..8f785476aa0 100644
--- a/lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb
+++ b/lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb
@@ -14,7 +14,15 @@ module Gitlab
self.table_name = 'issue_metrics'
def self.from_2020
- where('EXTRACT(YEAR FROM first_mentioned_in_commit_at) > 2019')
+ where(first_mentioned_in_commit_at_condition)
+ end
+
+ def self.first_mentioned_in_commit_at_condition
+ if columns_hash['first_mentioned_in_commit_at'].sql_type == 'timestamp without time zone'
+ 'EXTRACT(YEAR FROM first_mentioned_in_commit_at) > 2019'
+ else
+ "EXTRACT(YEAR FROM first_mentioned_in_commit_at at time zone 'UTC') > 2019"
+ end
end
end
# rubocop: enable Style/Documentation