File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed
src/packages/emmett-sqlite/src/eventStore/schema Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -115,24 +115,6 @@ const appendEventsRaw = async (
115
115
) ;
116
116
}
117
117
118
- const { sqlString, values } = buildEventInsertQuery (
119
- events ,
120
- expectedStreamVersion ,
121
- streamId ,
122
- streamType ,
123
- options ?. partition ?. toString ( ) ?? defaultTag ,
124
- ) ;
125
-
126
- const returningId = await db . querySingle < {
127
- global_position : string ;
128
- } | null > ( sqlString , values ) ;
129
-
130
- if ( returningId ?. global_position == null ) {
131
- throw new Error ( 'Could not find global position' ) ;
132
- }
133
-
134
- globalPosition = BigInt ( returningId . global_position ) ;
135
-
136
118
let position : { stream_position : string } | null ;
137
119
138
120
if ( expectedStreamVersion === 0n ) {
@@ -192,6 +174,24 @@ const appendEventsRaw = async (
192
174
} ;
193
175
}
194
176
}
177
+
178
+ const { sqlString, values } = buildEventInsertQuery (
179
+ events ,
180
+ expectedStreamVersion ,
181
+ streamId ,
182
+ streamType ,
183
+ options ?. partition ?. toString ( ) ?? defaultTag ,
184
+ ) ;
185
+
186
+ const returningId = await db . querySingle < {
187
+ global_position : string ;
188
+ } | null > ( sqlString , values ) ;
189
+
190
+ if ( returningId ?. global_position == null ) {
191
+ throw new Error ( 'Could not find global position' ) ;
192
+ }
193
+
194
+ globalPosition = BigInt ( returningId . global_position ) ;
195
195
} catch ( err : unknown ) {
196
196
if ( isSQLiteError ( err ) && isOptimisticConcurrencyError ( err ) ) {
197
197
return {
You can’t perform that action at this time.
0 commit comments