I found a workaround for MySql DB
Important: in my case, I will change the database, but the whole database will have the same scheme, only the difference in their name and the data that they contain, and be sure to add any error handling you need.
In config / connection.js -------- disable union
mysql_database: { adapter: 'sails-mysql', host: 'localhost', user: 'root', //optional password: '12345', //optional database: 'db1', //optional pool: false },
Now go to
node_modules / sails-mysql / lib / connections / spawn.js
Add connectionObject.config = sails.SwitchDbConfig
connectionObject.config = sails.SwitchDbConfig var conn = mysql.createConnection(connectionObject.config); conn.connect(function (err) { afterwards(err, conn); });
Now finally install sails.SwitchDbConfig anywhere (service, controller, etc.). a
sails.SwitchDbConfig = { pool: false, connectionLimit: 5, waitForConnections: true, adapter: 'sails-mysql', host: 'localhost', user: 'root', password: '12345', database: sails.DB_NAME, identity: 'mysql_database' }
And finally, if you find something wrong, because you need to update .... please ping