demarches-normaliennes/db/migrate/20210722133440_add_unique_index_to_champs.rb
2024-08-22 09:26:48 +02:00

16 lines
416 B
Ruby

# frozen_string_literal: true
class AddUniqueIndexToChamps < ActiveRecord::Migration[6.1]
include Database::MigrationHelpers
disable_ddl_transaction!
def up
delete_duplicates :champs, [:type_de_champ_id, :dossier_id, :row]
add_concurrent_index :champs, [:type_de_champ_id, :dossier_id, :row], unique: true
end
def down
remove_index :champs, [:type_de_champ_id, :dossier_id, :row]
end
end