Closed romch007 closed 6 months ago
I have enabled the debug option in my postgresql configuration and added Event.on('db:query', Database.prettyPrint) to events.ts.
Event.on('db:query', Database.prettyPrint)
events.ts
When I run this query:
const loggedUser = auth.user! await loggedUser.load('groups', (group) => group.preload('boxes', (boxes) => { boxes .withScopes((scopes) => scopes.fetchUnresponsive()) .preload('sockets', (sockets) => sockets .preload('records', (records) => records.orderBy('created_at', 'desc').groupLimit(1)) .preload('chargeSessions', (chargeSessions) => chargeSessions.whereNull('charge_end').groupLimit(1) ) ) .preload('records', (records) => records.groupLimit(1)) .orderBy('id') }) )
the only output I get is:
"pg" User (1.67 ms) SELECT * FROM "users" WHERE "id" = ? LIMIT ? [ 2, 1 ]
However, when I manually add the debug option to the query (group.preload(...).debug(true)), I get the full query.
debug
group.preload(...).debug(true)
8.2.3
v20.5.0 and 9.8.0
Fixed in https://github.com/adonisjs/lucid/commit/b44d15ee658d6e673cc7a8c97d1b7e617ad3b504
I have enabled the debug option in my postgresql configuration and added
Event.on('db:query', Database.prettyPrint)
toevents.ts
.When I run this query:
the only output I get is:
However, when I manually add the
debug
option to the query (group.preload(...).debug(true)
), I get the full query.Package version
8.2.3
Node.js and npm version
v20.5.0 and 9.8.0
Sample Code (to reproduce the issue)
BONUS (a sample repo to reproduce the issue)