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

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

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

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_NAME = 'index_ci_builds_on_project_id_for_successfull_pages_deploy'

  def up
    add_concurrent_index(
      :ci_builds, :project_id,
      name: INDEX_NAME,
      where: "type='GenericCommitStatus' AND stage='deploy' AND name='pages:deploy' AND status = 'success'"
    )
  end

  def down
    remove_concurrent_index_by_name :ci_builds, INDEX_NAME
  end
end