demarches-normaliennes/db/migrate/20210427120002_add_unique_index_to_individuals.rb

15 lines
330 B
Ruby
Raw Normal View History

class AddUniqueIndexToIndividuals < ActiveRecord::Migration[6.1]
include Database::MigrationHelpers
disable_ddl_transaction!
def up
delete_duplicates :individuals, [:dossier_id]
add_concurrent_index :individuals, [:dossier_id], unique: true
end
def down
remove_index :individuals, [:dossier_id]
end
end