The sails.js
framework doesn't support transaction. In the GitHub issues, they talk about transaction()
. But it's not suitable to code multiple queries in a transaction.
So I think one solution that use node-mysql module. But I think that if I create new connection to MySQL and use still sails.js framework connecting to database by waterline, the performance could be diminished.
Is it true?
You don't have to open a separate sails-mysql
connection. You can use the query
method of the adapter to gain access to the underlying MySQL node driver and perform arbitrary queries, including transactions. See this answer for an example.