Skip to content

Commit 261b07f

Browse files
authored
find or create optional sequence create (#40)
1 parent e5517c8 commit 261b07f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Space.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ public function findOrCreate(array $query, ?array $data = null)
223223
if #tuples > 0 then
224224
return true, tuples[1]
225225
end
226-
if tuple[id_key] == 0 and box.sequence[space] then
226+
if tuple[id_key] == 0 then
227+
if box.sequence[space] == nil then
228+
box.sequence.create(space)
229+
end
227230
tuple[id_key] = box.sequence[space]:next()
228231
end
229232
return false, box.space[space]:insert(tuple)

0 commit comments

Comments
 (0)