简体   繁体   中英

Is it possible to show a log of database queries in AdonisJs?

Ruby on Rails allows seeing a log of the queries made to the database in all environments (dev, test, production). Is there a way one can replicate such functionality in Adonis.js?

I'm not sure about older versions of Adonis, but in 4 you can set debug option to true in your config/database.js :

mysql: {
  client: 'mysql2',
  connection: {
    ...
  },
  debug: true // here!
},

More here: https://adonisjs.com/docs/4.1/database#_debugging

使用$ DEBUG=knex* yarn test运行测试将显示有关正在进行的查询的信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM