2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-07-22 17:55:52 +02:00
|
|
|
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
|