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

Commit 035c7ebf by Ali Taheri

static dialect requires

1 parent abb9bd96
Showing with 20 additions and 1 deletions
......@@ -177,7 +177,26 @@ var Sequelize = function(database, username, password, options) {
};
try {
var Dialect = require('./dialects/' + this.getDialect());
var Dialect;
// Requiring the dialect in a switch-case to keep the
// require calls static. (Browserify fix)
switch (this.getDialect()){
case 'mariadb':
Dialect = require('./dialects/mariadb');
break;
case 'mssql':
Dialect = require('./dialects/mssql');
break;
case 'mysql':
Dialect = require('./dialects/mysql');
break;
case 'postgres':
Dialect = require('./dialects/postgres');
break;
case 'sqlite':
Dialect = require('./dialects/sqlite');
break;
}
this.dialect = new Dialect(this);
} catch (err) {
throw new Error('The dialect ' + this.getDialect() + ' is not supported. ('+err+')');
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!