X-Git-Url: http://git.squeep.com/?p=websub-hub;a=blobdiff_plain;f=src%2Fdb%2Fpostgres%2Findex.js;fp=src%2Fdb%2Fpostgres%2Findex.js;h=e7a006c6d73b5cddff92076653ee37f5548943a4;hp=e70aeb7b7883e2700dceb7ce7599d069bf8a515c;hb=92661d6fa967999e7e12e86a2f4d5ce314a02c9b;hpb=f3e42bc1c361f932ccbc0e40d3692cdbb77ee437 diff --git a/src/db/postgres/index.js b/src/db/postgres/index.js index e70aeb7..e7a006c 100644 --- a/src/db/postgres/index.js +++ b/src/db/postgres/index.js @@ -61,7 +61,7 @@ class DatabasePostgres extends Database { if (event && event.query && event.query.startsWith('NOTIFY')) { return; } - this.logger[queryLogLevel](_fileScope('pgp:query'), '', { ...common.pick(event, ['query', 'params']) }); + this.logger[queryLogLevel](_fileScope('pgp:query'), '', { ...common.pick(event || {}, ['query', 'params']) }); }; } @@ -71,7 +71,7 @@ class DatabasePostgres extends Database { }; // Deophidiate column names in-place, log results - pgpInitOptions.receive = (data, result, event) => { + pgpInitOptions.receive = ({ data, result, ctx: event }) => { const exemplaryRow = data[0]; for (const prop in exemplaryRow) { const camel = Database._camelfy(prop); @@ -88,7 +88,7 @@ class DatabasePostgres extends Database { return; } // Omitting .rows - const resultLog = common.pick(result, ['command', 'rowCount', 'duration']); + const resultLog = common.pick(result || {}, ['command', 'rowCount', 'duration']); this.logger[queryLogLevel](_fileScope('pgp:result'), '', { query: event.query, ...resultLog }); } };