fix: pg driver doesn't return anything without .returning()
feat: disable .returning() is not supported warning message, it's useless.
This commit is contained in:
parent
bf10242180
commit
b58e12cad8
|
@ -28,7 +28,11 @@ class albumPOST extends Route {
|
|||
editedAt: now
|
||||
};
|
||||
|
||||
const dbRes = await db.table('albums').insert(insertObj).wasMutated();
|
||||
const dbRes = await db
|
||||
.table('albums')
|
||||
.insert(insertObj)
|
||||
.returning('id')
|
||||
.wasMutated();
|
||||
|
||||
insertObj.id = dbRes.pop();
|
||||
|
||||
|
|
|
@ -25,7 +25,10 @@ class tagPOST extends Route {
|
|||
editedAt: now
|
||||
};
|
||||
|
||||
const dbRes = await db.table('tags').insert(insertObj).wasMutated();
|
||||
const dbRes = await db.table('tags')
|
||||
.insert(insertObj)
|
||||
.returning('id')
|
||||
.wasMutated();
|
||||
|
||||
insertObj.id = dbRes.pop();
|
||||
|
||||
|
|
|
@ -40,6 +40,12 @@ const db = Knex({
|
|||
return result;
|
||||
},
|
||||
useNullAsDefault: process.env.DB_CLIENT === 'sqlite3',
|
||||
log: {
|
||||
warn: msg => {
|
||||
if (typeof msg === 'string' && msg.startsWith('.returning()')) return;
|
||||
console.warn(msg);
|
||||
}
|
||||
},
|
||||
userParams: {
|
||||
lastMutationTime: null
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue