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

20210203223551_add_orphan_index_to_composer_cache_files.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2853977e5f3845a4ca2e4e7bac0e15984b91415 (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 AddOrphanIndexToComposerCacheFiles < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_NAME = 'index_composer_cache_files_where_namespace_id_is_null'

  def up
    add_concurrent_index :packages_composer_cache_files, :id, name: INDEX_NAME, where: 'namespace_id IS NULL'
  end

  def down
    remove_concurrent_index_by_name :packages_composer_cache_files, INDEX_NAME
  end
end