Open lukechilds opened 7 years ago
While its a good idea, this is also likely to break a lot of apps using node-sql
@spion Yep, would definitely have to be SemVer major.
Should just be a search and replace to update though:
const sql = require('sql');
to:
const Sql = require('sql');
const sql = new Sql();
Which is probably what most developers intended to implement.
Or to make upgrading super easy we could wrap the export in a function:
module.exports = new Sql(DEFAULT_DIALECT, {});
would become
module.exports = () => new Sql(DEFAULT_DIALECT, {});
And then you could literally do a search/replace to upgrade:
require('sql') -> require('sql')()
But personally I'd go with the first option.
Resolves https://github.com/brianc/node-sql/issues/365
Made the change mentioned in #365. Also fixed tests to work with new syntax.