Gerardo Gomez
10/19/2022, 6:37 PMtoSQL()
function? I’ve seen other ORMs that have this functionality. I don’t need to log this query (I saw that functionality) I need the raw statement at the moment the code is runKevin Lanthier
10/19/2022, 7:17 PMeverything
sent as sql to the databaseGerardo Gomez
10/19/2022, 7:21 PMconst query = await prisma.user.findMany().toSql();
Takeo Kusama
10/20/2022, 4:18 AMprisma.$on('query', (e) => {
if(global.loggerOn) {
console.log(e.query)
// global.currentQuery = e.query
// debugger
// so on
}
})
async function yourEntryPoint() {
global.loggerOn = true
await prisma.foo.findMany(...)
global.loggerOn = false
}
I can’t find way unsubscribes $on in document but you can also do so if it can instead of global flag.