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

16 lines
377 B
Ruby

# frozen_string_literal: true
class AddUniqueIndexToInvites < ActiveRecord::Migration[6.1]
include Database::MigrationHelpers
disable_ddl_transaction!
def up
delete_duplicates :invites, [:email, :dossier_id]
add_concurrent_index :invites, [:email, :dossier_id], unique: true
end
def down
remove_index :invites, column: [:email, :dossier_id]
end
end