2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-04-27 13:55:39 +02:00
|
|
|
class AddUniqueIndexToIndividuals < ActiveRecord::Migration[6.1]
|
|
|
|
include Database::MigrationHelpers
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
delete_duplicates :individuals, [:dossier_id]
|
2021-04-27 16:57:46 +02:00
|
|
|
remove_index :individuals, [:dossier_id]
|
2021-04-27 13:55:39 +02:00
|
|
|
add_concurrent_index :individuals, [:dossier_id], unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
2021-04-27 16:57:46 +02:00
|
|
|
remove_index :individuals, [:dossier_id], unique: true
|
|
|
|
add_concurrent_index :individuals, [:dossier_id]
|
2021-04-27 13:55:39 +02:00
|
|
|
end
|
|
|
|
end
|