From cbf0cc9057014d7e9060d2f1bd1f048563fcde72 Mon Sep 17 00:00:00 2001 From: Aidan Haran Date: Tue, 29 Aug 2023 11:18:32 +0100 Subject: [PATCH] Coerce test --- test/cases/coerced_tests.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/cases/coerced_tests.rb b/test/cases/coerced_tests.rb index e7996f968..23b2efb16 100644 --- a/test/cases/coerced_tests.rb +++ b/test/cases/coerced_tests.rb @@ -2145,6 +2145,17 @@ def test_in_order_of_with_enums_keys_coerced Book.where(author_id: nil, name: nil).delete_all Book.connection.add_index(:books, [:author_id, :name], unique: true) end + + # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite. + coerce_tests! :test_in_order_of_with_nil + def test_in_order_of_with_nil_coerced + Book.connection.remove_index(:books, column: [:author_id, :name]) + + original_test_in_order_of_with_nil + ensure + Book.where(author_id: nil, name: nil).delete_all + Book.connection.add_index(:books, [:author_id, :name], unique: true) + end end require "models/dashboard"