不要怂,就是干,撸起袖子干!

Commit cfce3a75 by Holger

* some code cleanup (after linting)

1 parent 14266ec7
......@@ -23,17 +23,17 @@ ConnectionManager.prototype.getConnection = function(options) {
var self = this;
options = options || {};
options.uuid = options.uuid || 'default';
options.inMemory = ((self.sequelize.options.storage || ':memory:') == ':memory:')?1:0;
options.inMemory = ((self.sequelize.options.storage || ':memory:') === ':memory:')?1:0;
if (self.connections[options.inMemory||options.uuid]) return Promise.resolve(self.connections[options.inMemory||options.uuid]);
if (self.connections[options.inMemory || options.uuid]) return Promise.resolve(self.connections[options.inMemory || options.uuid]);
return new Promise(function (resolve, reject) {
self.connections[options.inMemory||options.uuid] = new self.lib.Database(self.sequelize.options.storage || ':memory:', function(err) {
self.connections[options.inMemory || options.uuid] = new self.lib.Database(self.sequelize.options.storage || ':memory:', function(err) {
if (err) {
if (err.code === 'SQLITE_CANTOPEN') return reject('Failed to find SQL server. Please double check your settings.');
return reject(err);
}
resolve(self.connections[options.inMemory||options.uuid]);
resolve(self.connections[options.inMemory || options.uuid]);
});
}).tap(function (connection) {
if (self.sequelize.options.foreignKeys !== false) {
......
......@@ -591,7 +591,7 @@ module.exports = (function() {
).then(function (connection) {
var query = new self.dialect.Query(connection, self, callee, options);
return query.run(sql).finally(function() {
if (options.transaction || connection.filename == ":memory:") return;
if (options.transaction || (connection.filename === ":memory:")) return;
return self.connectionManager.releaseConnection(connection);
});
});
......
......@@ -55,10 +55,10 @@ describe(Support.getTestDialectTeaser("Transaction"), function () {
});
});
if (dialect == 'sqlite'){
if (dialect === 'sqlite'){
it('provides persistent transactions', function (done) {
var sequelize = new Support.Sequelize('database', 'username', 'password', {dialect: 'sqlite'});
var User = sequelize.define('user', {
var sequelize = new Support.Sequelize('database', 'username', 'password', {dialect: 'sqlite'}),
User = sequelize.define('user', {
username: Support.Sequelize.STRING,
awesome: Support.Sequelize.BOOLEAN
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!