2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-04-27 13:55:39 +02:00
|
|
|
class AddUniqueIndexToProcedures < ActiveRecord::Migration[6.1]
|
|
|
|
include Database::MigrationHelpers
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
delete_duplicates :procedures, [:path, :closed_at, :hidden_at, :unpublished_at]
|
|
|
|
add_concurrent_index :procedures, [:path, :closed_at, :hidden_at, :unpublished_at], name: 'procedure_path_uniqueness', unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_index :procedures, [:path, :closed_at, :hidden_at, :unpublished_at], name: 'procedure_path_uniqueness'
|
|
|
|
end
|
|
|
|
end
|