diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-08 13:33:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-08 13:33:01 +0300 |
commit | 6edb7e9bb152d919c215f35bd6cb7d52fd3d99be (patch) | |
tree | f12ef4b7953932f9b2b9c28313277bf636115bc8 /db/post_migrate | |
parent | 305ea394efd2d5afe16234406dede486d9ca37af (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-ee
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb | 4 | ||||
-rw-r--r-- | db/post_migrate/20211004110927_schedule_fix_first_mentioned_in_commit_at_job.rb | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb b/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb index cfc37c55121..2c2c3ac00af 100644 --- a/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb +++ b/db/post_migrate/20211004110500_add_temporary_index_to_issue_metrics.rb @@ -6,7 +6,9 @@ class AddTemporaryIndexToIssueMetrics < Gitlab::Database::Migration[1.0] INDEX_NAME = 'index_issue_metrics_first_mentioned_in_commit' def up - add_concurrent_index :issue_metrics, :issue_id, where: 'EXTRACT(YEAR FROM first_mentioned_in_commit_at) > 2019', name: INDEX_NAME + condition = Gitlab::BackgroundMigration::FixFirstMentionedInCommitAt::TmpIssueMetrics + .first_mentioned_in_commit_at_condition + add_concurrent_index :issue_metrics, :issue_id, where: condition, name: INDEX_NAME end def down diff --git a/db/post_migrate/20211004110927_schedule_fix_first_mentioned_in_commit_at_job.rb b/db/post_migrate/20211004110927_schedule_fix_first_mentioned_in_commit_at_job.rb index c7612db3aaf..ffdb7f80f0e 100644 --- a/db/post_migrate/20211004110927_schedule_fix_first_mentioned_in_commit_at_job.rb +++ b/db/post_migrate/20211004110927_schedule_fix_first_mentioned_in_commit_at_job.rb @@ -8,8 +8,8 @@ class ScheduleFixFirstMentionedInCommitAtJob < Gitlab::Database::Migration[1.0] disable_ddl_transaction! def up - scope = define_batchable_model('issue_metrics') - .where('EXTRACT(YEAR FROM first_mentioned_in_commit_at) > 2019') + scope = Gitlab::BackgroundMigration::FixFirstMentionedInCommitAt::TmpIssueMetrics + .from_2020 queue_background_migration_jobs_by_range_at_intervals( scope, |