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

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

class AddApiIndexForInternalProjects < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  INTERNAL_PROJECTS_INDEX_NAME = "index_projects_api_created_at_id_for_vis10"

  disable_ddl_transaction!

  def up
    add_concurrent_index :projects, [:created_at, :id],
      where: "visibility_level = 10 AND pending_delete = false",
      name: INTERNAL_PROJECTS_INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :projects, INTERNAL_PROJECTS_INDEX_NAME
  end
end