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

20210922084115_concurrent_index_resource_group_status_commit_id_for_ci_builds.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 922a9b64b55af2ea3615f4eba8961a5bd79215de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class ConcurrentIndexResourceGroupStatusCommitIdForCiBuilds < Gitlab::Database::Migration[1.0]
  INDEX_NAME = 'index_ci_builds_on_resource_group_and_status_and_commit_id'

  disable_ddl_transaction!

  # Indexes were pre-created on gitlab.com to avoid slowing down deployments
  # See: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70279

  # rubocop: disable Migration/PreventIndexCreation
  def up
    add_concurrent_index :ci_builds, [:resource_group_id, :status, :commit_id],
      where: 'resource_group_id IS NOT NULL',
      name: INDEX_NAME
  end
  # rubocop: enable Migration/PreventIndexCreation

  def down
    remove_concurrent_index_by_name :ci_builds, INDEX_NAME
  end
end