debian-mirror-gitlab/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb
2020-08-09 17:44:08 +05:30

18 lines
733 B
Ruby

# 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