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

Commit 9aa3773f by Mick Hansen

Merge pull request #5291 from stuartpb/patch-1

Fix "the dialect is not supported" error
2 parents 04dbc53d b1a86cf7
Showing with 22 additions and 24 deletions
......@@ -188,31 +188,29 @@ var Sequelize = function(database, username, password, options) {
dialectOptions: this.options.dialectOptions
};
try {
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. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite. ('+err+')');
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;
default:
throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite.');
}
this.dialect = new Dialect(this);
this.dialect.QueryGenerator.typeValidation = options.typeValidation;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!