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

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

class AddIndexForCiBuildsMetrics < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_NAME = 'ci_builds_gitlab_monitor_metrics'

  def up
    add_concurrent_index(:ci_builds, [:status, :created_at, :project_id], where: "type = 'Ci::Build'", name: INDEX_NAME)
  end

  def down
    remove_concurrent_index_by_name(:ci_builds, INDEX_NAME)
  end
end