@@ -19,29 +19,29 @@ defmodule Ecto.Integration.UpsertAllTest do
1919 assert TestRepo . insert_all ( Post , [ post ] , on_conflict: :nothing ) == { 1 , nil }
2020 end
2121
22- test "insert_mode: :ignore_errors " do
22+ test "insert_mode: :ignore " do
2323 post = [ title: "first" , uuid: "6fa459ea-ee8a-3ca4-894e-db77e160355e" ]
2424 # First insert succeeds - 1 row inserted
2525 assert TestRepo . insert_all ( Post , [ post ] ,
2626 on_conflict: :nothing ,
27- insert_mode: :ignore_errors
27+ insert_mode: :ignore
2828 ) == { 1 , nil }
2929
3030 # Second insert is ignored due to duplicate - 0 rows inserted (INSERT IGNORE behavior)
3131 assert TestRepo . insert_all ( Post , [ post ] ,
3232 on_conflict: :nothing ,
33- insert_mode: :ignore_errors
33+ insert_mode: :ignore
3434 ) == { 0 , nil }
3535 end
3636
37- test "insert_mode: :ignore_errors with mixed records (some conflicts, some new)" do
37+ test "insert_mode: :ignore with mixed records (some conflicts, some new)" do
3838 # Insert an existing post
3939 existing_uuid = "6fa459ea-ee8a-3ca4-894e-db77e160355e"
4040 existing_post = [ title: "existing" , uuid: existing_uuid ]
4141
4242 assert TestRepo . insert_all ( Post , [ existing_post ] ,
4343 on_conflict: :nothing ,
44- insert_mode: :ignore_errors
44+ insert_mode: :ignore
4545 ) == { 1 , nil }
4646
4747 # Now insert a batch with one duplicate and two new records
@@ -57,7 +57,7 @@ defmodule Ecto.Integration.UpsertAllTest do
5757 # With INSERT IGNORE, only 2 rows should be inserted (the non-duplicates)
5858 assert TestRepo . insert_all ( Post , posts ,
5959 on_conflict: :nothing ,
60- insert_mode: :ignore_errors
60+ insert_mode: :ignore
6161 ) == { 2 , nil }
6262
6363 # Verify the data - should have 3 posts total (1 existing + 2 new)
@@ -72,15 +72,15 @@ defmodule Ecto.Integration.UpsertAllTest do
7272 assert TestRepo . exists? ( from p in Post , where: p . uuid == ^ new_uuid2 )
7373 end
7474
75- test "insert_mode: :ignore_errors with all duplicates" do
75+ test "insert_mode: :ignore with all duplicates" do
7676 # Insert initial posts
7777 uuid1 = "1fa459ea-ee8a-3ca4-894e-db77e160355e"
7878 uuid2 = "2fa459ea-ee8a-3ca4-894e-db77e160355e"
7979 initial_posts = [ [ title: "first" , uuid: uuid1 ] , [ title: "second" , uuid: uuid2 ] ]
8080
8181 assert TestRepo . insert_all ( Post , initial_posts ,
8282 on_conflict: :nothing ,
83- insert_mode: :ignore_errors
83+ insert_mode: :ignore
8484 ) == { 2 , nil }
8585
8686 # Try to insert all duplicates
@@ -89,7 +89,7 @@ defmodule Ecto.Integration.UpsertAllTest do
8989 # All are duplicates, so 0 rows inserted
9090 assert TestRepo . insert_all ( Post , duplicate_posts ,
9191 on_conflict: :nothing ,
92- insert_mode: :ignore_errors
92+ insert_mode: :ignore
9393 ) == { 0 , nil }
9494
9595 # Verify count unchanged
@@ -102,18 +102,21 @@ defmodule Ecto.Integration.UpsertAllTest do
102102 { 1 , nil } = TestRepo . insert_all ( Post , [ post ] , on_conflict: on_conflict )
103103
104104 assert TestRepo . insert_all ( Post , [ post ] , on_conflict: on_conflict ) ==
105- { 2 , nil }
105+ { 2 , nil }
106+
106107 assert TestRepo . all ( from p in Post , select: p . title ) == [ "second" ]
107108 end
108109
109110 test "on conflict query and conflict target" do
110111 on_conflict = from Post , update: [ set: [ title: "second" ] ]
111112 post = [ title: "first" , uuid: "6fa459ea-ee8a-3ca4-894e-db77e160355e" ]
113+
112114 assert TestRepo . insert_all ( Post , [ post ] , on_conflict: on_conflict ) ==
113- { 1 , nil }
115+ { 1 , nil }
114116
115117 assert TestRepo . insert_all ( Post , [ post ] , on_conflict: on_conflict ) ==
116- { 2 , nil }
118+ { 2 , nil }
119+
117120 assert TestRepo . all ( from p in Post , select: p . title ) == [ "second" ]
118121 end
119122end
0 commit comments