summaryrefslogtreecommitdiff
path: root/db/migrate/20211112073413_change_package_index_on_corpus.rb
blob: 6e8222f853caaffb6ed9841bc6a372ba3a5c419e (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 ChangePackageIndexOnCorpus < Gitlab::Database::Migration[1.0]
  INDEX_NAME = 'index_coverage_fuzzing_corpuses_on_package_id'

  disable_ddl_transaction!

  # Changing this index is safe.
  # The table does not have any data in it as it's behind a feature flag.
  def up
    remove_concurrent_index :coverage_fuzzing_corpuses, :package_id, name: INDEX_NAME
    add_concurrent_index :coverage_fuzzing_corpuses, :package_id, unique: true, name: INDEX_NAME
  end

  def down
    remove_concurrent_index :coverage_fuzzing_corpuses, :package_id, name: INDEX_NAME
    add_concurrent_index :coverage_fuzzing_corpuses, :package_id, name: INDEX_NAME
  end
end