@@ -720,6 +720,30 @@ defmodule AshPostgres.TemporalTest do
720720 ] = seats_timeline ( 1 )
721721 end
722722
723+ test "an atomic update through an exists at the current instant leaves later versions alone" do
724+ TestRepo . query! ( """
725+ INSERT INTO subscription (id, tier, seats, valid_at) VALUES
726+ (2, 'now', 1, tstzrange(now() - interval '1 day', now() + interval '1 day', '[)')),
727+ (2, 'later', 9, tstzrange(now() + interval '1 day', NULL, '[)'))
728+ """ )
729+
730+ Subscription
731+ |> Ash.Query . filter ( id == 2 )
732+ |> Ash . bulk_update! ( :add_seat_if_basic , % { } , strategy: :atomic )
733+
734+ assert [ [ "now" , 1 , _ ] , [ "now" , 1 , _ ] , [ "later" , 9 , _ ] ] = seats_timeline ( 2 )
735+ end
736+
737+ test "an atomic update through an exists, by code interface, applies only to the version valid at as_of" do
738+ AshPostgres.Test.Temporal.Domain . add_seat_if_basic! ( 1 , as_of: @ jan15 )
739+
740+ assert [
741+ [ "bronze" , 3 , ~U[ 2026-01-01 00:00:00.000000Z] ] ,
742+ [ "bronze" , 4 , ~U[ 2026-01-15 00:00:00.000000Z] ] ,
743+ [ "gold" , 5 , ~U[ 2026-02-01 00:00:00.000000Z] ]
744+ ] = seats_timeline ( 1 )
745+ end
746+
723747 test "an atomic update whose range spans two stored versions carves both" do
724748 [ bronze ] =
725749 Subscription
0 commit comments