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

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

class ChangeProjectIdIndexToBeUniqueOnVulnerabilityStatisticsTable < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  INDEX_NAME = 'index_vulnerability_statistics_on_unique_project_id'

  def up
    remove_index :vulnerability_statistics, :project_id # rubocop:disable Migration/RemoveIndex (table is empty)
    add_index :vulnerability_statistics, :project_id, name: INDEX_NAME, unique: true # rubocop:disable Migration/AddIndex (table is empty)
  end

  def down
    remove_index :vulnerability_statistics, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex (table is empty)
    add_index :vulnerability_statistics, :project_id # rubocop:disable Migration/AddIndex (table is empty)
  end
end