summaryrefslogtreecommitdiff
path: root/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb
blob: e10e9a912cc87d849ee996ea1973ea1556785379 (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 AddDeployedDeploymentIdIndexToProjectPagesMetadata < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_NAME = 'index_on_pages_metadata_not_migrated'

  def up
    add_concurrent_index :project_pages_metadata, :project_id, where: "deployed = TRUE AND pages_deployment_id is NULL", name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :project_pages_metadata, INDEX_NAME
  end
end