@@ -26,7 +26,7 @@ defmodule AshPostgres.AggregateTest do
2626
2727 Comment
2828 |> Ash.Changeset . new ( % { title: "match" } )
29- |> Ash.Changeset . replace_relationship ( :post , post )
29+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
3030 |> Api . create! ( )
3131
3232 import Ash.Query
@@ -44,7 +44,7 @@ defmodule AshPostgres.AggregateTest do
4444
4545 Comment
4646 |> Ash.Changeset . new ( % { title: "match" } )
47- |> Ash.Changeset . replace_relationship ( :post , post )
47+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
4848 |> Api . create! ( )
4949
5050 assert % { aggregates: % { custom_count_of_comments: 2 } } =
@@ -77,12 +77,12 @@ defmodule AshPostgres.AggregateTest do
7777
7878 post
7979 |> Ash.Changeset . new ( )
80- |> Ash.Changeset . replace_relationship ( :linked_posts , [ post2 , post3 ] )
80+ |> Ash.Changeset . manage_relationship ( :linked_posts , [ post2 , post3 ] , type: :append_and_remove )
8181 |> Api . update! ( )
8282
8383 post2
8484 |> Ash.Changeset . new ( )
85- |> Ash.Changeset . replace_relationship ( :linked_posts , [ post3 ] )
85+ |> Ash.Changeset . manage_relationship ( :linked_posts , [ post3 ] , type: :append_and_remove )
8686 |> Api . update! ( )
8787
8888 assert [
@@ -104,7 +104,7 @@ defmodule AshPostgres.AggregateTest do
104104
105105 Comment
106106 |> Ash.Changeset . new ( % { title: "match" } )
107- |> Ash.Changeset . replace_relationship ( :post , post )
107+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
108108 |> Api . create! ( )
109109
110110 assert % { count_of_comments_called_match: 1 } =
@@ -115,7 +115,7 @@ defmodule AshPostgres.AggregateTest do
115115
116116 Comment
117117 |> Ash.Changeset . new ( % { title: "not_match" } )
118- |> Ash.Changeset . replace_relationship ( :post , post )
118+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
119119 |> Api . create! ( )
120120
121121 assert % { count_of_comments_called_match: 1 } =
@@ -148,12 +148,12 @@ defmodule AshPostgres.AggregateTest do
148148
149149 Comment
150150 |> Ash.Changeset . new ( % { title: "bbb" } )
151- |> Ash.Changeset . replace_relationship ( :post , post )
151+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
152152 |> Api . create! ( )
153153
154154 Comment
155155 |> Ash.Changeset . new ( % { title: "ccc" } )
156- |> Ash.Changeset . replace_relationship ( :post , post )
156+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
157157 |> Api . create! ( )
158158
159159 assert % { comment_titles: [ "bbb" , "ccc" ] } =
@@ -164,7 +164,7 @@ defmodule AshPostgres.AggregateTest do
164164
165165 Comment
166166 |> Ash.Changeset . new ( % { title: "aaa" } )
167- |> Ash.Changeset . replace_relationship ( :post , post )
167+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
168168 |> Api . create! ( )
169169
170170 assert % { comment_titles: [ "aaa" , "bbb" , "ccc" ] } =
@@ -197,7 +197,7 @@ defmodule AshPostgres.AggregateTest do
197197
198198 Comment
199199 |> Ash.Changeset . new ( % { title: "match" } )
200- |> Ash.Changeset . replace_relationship ( :post , post )
200+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
201201 |> Api . create! ( )
202202
203203 assert % { first_comment: "match" } =
@@ -208,7 +208,7 @@ defmodule AshPostgres.AggregateTest do
208208
209209 Comment
210210 |> Ash.Changeset . new ( % { title: "early match" } )
211- |> Ash.Changeset . replace_relationship ( :post , post )
211+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
212212 |> Api . create! ( )
213213
214214 assert % { first_comment: "early match" } =
@@ -226,7 +226,7 @@ defmodule AshPostgres.AggregateTest do
226226
227227 Comment
228228 |> Ash.Changeset . new ( % { title: "match" } )
229- |> Ash.Changeset . replace_relationship ( :post , post )
229+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
230230 |> Api . create! ( )
231231
232232 assert % { first_comment: "match" } =
@@ -251,17 +251,17 @@ defmodule AshPostgres.AggregateTest do
251251
252252 Comment
253253 |> Ash.Changeset . new ( % { title: "match" } )
254- |> Ash.Changeset . replace_relationship ( :post , post )
254+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
255255 |> Api . create! ( )
256256
257257 Comment
258258 |> Ash.Changeset . new ( % { title: "non_match" } )
259- |> Ash.Changeset . replace_relationship ( :post , post2 )
259+ |> Ash.Changeset . manage_relationship ( :post , post2 , type: :append_and_remove )
260260 |> Api . create! ( )
261261
262262 Comment
263263 |> Ash.Changeset . new ( % { title: "non_match2" } )
264- |> Ash.Changeset . replace_relationship ( :post , post2 )
264+ |> Ash.Changeset . manage_relationship ( :post , post2 , type: :append_and_remove )
265265 |> Api . create! ( )
266266
267267 assert % { title: "match" } =
@@ -305,7 +305,7 @@ defmodule AshPostgres.AggregateTest do
305305
306306 Comment
307307 |> Ash.Changeset . new ( % { title: "match" , likes: 2 } )
308- |> Ash.Changeset . replace_relationship ( :post , post )
308+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
309309 |> Api . create! ( )
310310
311311 assert % { sum_of_comment_likes: 2 } =
@@ -316,7 +316,7 @@ defmodule AshPostgres.AggregateTest do
316316
317317 Comment
318318 |> Ash.Changeset . new ( % { title: "match" , likes: 3 } )
319- |> Ash.Changeset . replace_relationship ( :post , post )
319+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
320320 |> Api . create! ( )
321321
322322 assert % { sum_of_comment_likes: 5 } =
@@ -334,7 +334,7 @@ defmodule AshPostgres.AggregateTest do
334334
335335 Comment
336336 |> Ash.Changeset . new ( % { title: "match" , likes: 2 } )
337- |> Ash.Changeset . replace_relationship ( :post , post )
337+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
338338 |> Api . create! ( )
339339
340340 assert % { sum_of_comment_likes_called_match: 2 } =
@@ -345,7 +345,7 @@ defmodule AshPostgres.AggregateTest do
345345
346346 Comment
347347 |> Ash.Changeset . new ( % { title: "not_match" , likes: 3 } )
348- |> Ash.Changeset . replace_relationship ( :post , post )
348+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
349349 |> Api . create! ( )
350350
351351 assert % { sum_of_comment_likes_called_match: 2 } =
@@ -370,7 +370,7 @@ defmodule AshPostgres.AggregateTest do
370370 comment =
371371 Comment
372372 |> Ash.Changeset . new ( % { title: "title" , likes: 2 } )
373- |> Ash.Changeset . replace_relationship ( :post , post )
373+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
374374 |> Api . create! ( )
375375
376376 Rating
@@ -395,7 +395,7 @@ defmodule AshPostgres.AggregateTest do
395395
396396 Comment
397397 |> Ash.Changeset . new ( % { title: "title" , likes: 2 } )
398- |> Ash.Changeset . replace_relationship ( :post , post )
398+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
399399 |> Api . create! ( )
400400
401401 Post
@@ -414,7 +414,7 @@ defmodule AshPostgres.AggregateTest do
414414
415415 Comment
416416 |> Ash.Changeset . new ( % { title: "match" , likes: 2 } )
417- |> Ash.Changeset . replace_relationship ( :post , post )
417+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
418418 |> Api . create! ( )
419419
420420 assert % { sum_of_comment_likes_called_match: 2 } =
@@ -425,7 +425,7 @@ defmodule AshPostgres.AggregateTest do
425425
426426 Comment
427427 |> Ash.Changeset . new ( % { title: "not_match" , likes: 3 } )
428- |> Ash.Changeset . replace_relationship ( :post , post )
428+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
429429 |> Api . create! ( )
430430
431431 assert % Ash.Page.Offset { results: [ % { sum_of_comment_likes_called_match: 2 } ] } =
@@ -451,12 +451,12 @@ defmodule AshPostgres.AggregateTest do
451451
452452 Comment
453453 |> Ash.Changeset . for_create ( :create , % { title: "match" , likes: 20 } )
454- |> Ash.Changeset . replace_relationship ( :post , post )
454+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
455455 |> Api . create! ( )
456456
457457 Comment
458458 |> Ash.Changeset . for_create ( :create , % { title: "match" , likes: 17 } )
459- |> Ash.Changeset . replace_relationship ( :post , post )
459+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
460460 |> Api . create! ( )
461461
462462 Comment
@@ -465,7 +465,7 @@ defmodule AshPostgres.AggregateTest do
465465 :created_at ,
466466 DateTime . add ( DateTime . utc_now ( ) , :timer . hours ( 24 ) * - 20 , :second )
467467 )
468- |> Ash.Changeset . replace_relationship ( :post , post )
468+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
469469 |> Api . create! ( )
470470
471471 assert % Post { sum_of_recent_popular_comment_likes: 37 } =
@@ -482,12 +482,12 @@ defmodule AshPostgres.AggregateTest do
482482
483483 Comment
484484 |> Ash.Changeset . for_create ( :create , % { title: "match" , likes: 20 } )
485- |> Ash.Changeset . replace_relationship ( :post , post )
485+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
486486 |> Api . create! ( )
487487
488488 Comment
489489 |> Ash.Changeset . for_create ( :create , % { title: "match" , likes: 17 } )
490- |> Ash.Changeset . replace_relationship ( :post , post )
490+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
491491 |> Api . create! ( )
492492
493493 Comment
@@ -496,7 +496,7 @@ defmodule AshPostgres.AggregateTest do
496496 :created_at ,
497497 DateTime . add ( DateTime . utc_now ( ) , :timer . hours ( 24 ) * - 20 , :second )
498498 )
499- |> Ash.Changeset . replace_relationship ( :post , post )
499+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
500500 |> Api . create! ( )
501501
502502 assert % Post { count_of_recent_popular_comments: 2 } =
@@ -515,17 +515,17 @@ defmodule AshPostgres.AggregateTest do
515515
516516 Comment
517517 |> Ash.Changeset . for_create ( :create , % { title: "match" } )
518- |> Ash.Changeset . replace_relationship ( :post , post )
518+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
519519 |> Api . create! ( )
520520
521521 Comment
522522 |> Ash.Changeset . for_create ( :create , % { title: "match" } )
523- |> Ash.Changeset . replace_relationship ( :post , post )
523+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
524524 |> Api . create! ( )
525525
526526 Comment
527527 |> Ash.Changeset . for_create ( :create , % { title: "match" } )
528- |> Ash.Changeset . replace_relationship ( :post , post )
528+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
529529 |> Api . create! ( )
530530
531531 assert % Post { count_of_comments_that_have_a_post: 3 } =
@@ -545,13 +545,13 @@ defmodule AshPostgres.AggregateTest do
545545 comment =
546546 Comment
547547 |> Ash.Changeset . for_create ( :create , % { title: "match" } )
548- |> Ash.Changeset . replace_relationship ( :post , post )
548+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
549549 |> Api . create! ( )
550550
551551 comment2 =
552552 Comment
553553 |> Ash.Changeset . for_create ( :create , % { title: "match" } )
554- |> Ash.Changeset . replace_relationship ( :post , post )
554+ |> Ash.Changeset . manage_relationship ( :post , post , type: :append_and_remove )
555555 |> Api . create! ( )
556556
557557 Rating
0 commit comments