edgedb-js
edgedb-js copied to clipboard
Scoping issue when not using closure in `update`
const query = e
.insert(e.Movie, {
title: "Harry Potter",
rating: 5,
})
.unlessConflict(movie => ({
on: movie.title,
else: e.update(movie, () => ({
set: {
rating: e.op(movie.rating, "+", 1),
},
})),
}));
results in the following query
INSERT default::Movie {
title := "Harry Potter",
rating := 5
}
UNLESS CONFLICT ON default::Movie.title
ELSE ((WITH
__scope_0_Movie := default::Movie
UPDATE __scope_0_Movie SET {
rating := (DETACHED default::Movie.rating + 1)
}))