Making sure creation of SQL rows don't pass down null columns (no point).
This commit is contained in:
parent
d482b01263
commit
ab03435c84
|
@ -141,6 +141,12 @@ function buildCreate(
|
||||||
const { endpoint, body } = json
|
const { endpoint, body } = json
|
||||||
let query: KnexQuery = knex(endpoint.entityId)
|
let query: KnexQuery = knex(endpoint.entityId)
|
||||||
const parsedBody = parseBody(body)
|
const parsedBody = parseBody(body)
|
||||||
|
// make sure no null values in body for creation
|
||||||
|
for (let [key, value] of Object.entries(parsedBody)) {
|
||||||
|
if (value == null) {
|
||||||
|
delete parsedBody[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
// mysql can't use returning
|
// mysql can't use returning
|
||||||
if (opts.disableReturning) {
|
if (opts.disableReturning) {
|
||||||
return query.insert(parsedBody)
|
return query.insert(parsedBody)
|
||||||
|
|
Loading…
Reference in New Issue