We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 410a6dd commit 7184881Copy full SHA for 7184881
src/SqlServer/src/Eventuous.SqlServer/Scripts/2_AppendEvents.sql
@@ -29,8 +29,9 @@ BEGIN
29
@current_version = @current_version OUTPUT,
30
@stream_id = @stream_id OUTPUT;
31
32
+ SET @new_version = @current_version + @count_messages;
33
+
34
BEGIN TRY
- SET @new_version = @current_version + @count_messages;
35
36
/*
37
If another writer raced us, the unique constraint (StreamId,StreamPosition) will throw here.
@@ -84,7 +85,8 @@ BEGIN
84
85
UPDATE s
86
SET [Version] = @new_version
87
FROM __schema__.Streams s
- WHERE s.StreamId = @stream_id;
88
+ WHERE s.StreamId = @stream_id
89
+ AND s.[Version] = @current_version;
90
91
-- final GlobalPosition value to return
92
SELECT @position = (
0 commit comments