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

Commit c44af7fb by Sascha Depold

added support for tests for postgres-native

1 parent f5f1cb15
Showing with 15 additions and 5 deletions
...@@ -21,15 +21,21 @@ var BusterHelpers = module.exports = { ...@@ -21,15 +21,21 @@ var BusterHelpers = module.exports = {
options.dialect = options.dialect || 'mysql' options.dialect = options.dialect || 'mysql'
options.logging = (options.hasOwnProperty('logging') ? options.logging : false) options.logging = (options.hasOwnProperty('logging') ? options.logging : false)
var sequelizeOptions = {
logging: options.logging,
dialect: options.dialect,
port: config[options.dialect].port
}
if (process.env.DIALECT === 'postgres-native') {
sequelizeOptions.native = true
}
return new Sequelize( return new Sequelize(
config[options.dialect].database, config[options.dialect].database,
config[options.dialect].username, config[options.dialect].username,
config[options.dialect].password, config[options.dialect].password,
{ sequelizeOptions
logging: options.logging,
dialect: options.dialect,
port: config[options.dialect].port
}
) )
}, },
...@@ -53,6 +59,10 @@ var BusterHelpers = module.exports = { ...@@ -53,6 +59,10 @@ var BusterHelpers = module.exports = {
getTestDialect: function() { getTestDialect: function() {
var envDialect = process.env.DIALECT || 'mysql' var envDialect = process.env.DIALECT || 'mysql'
if (envDialect === 'postgres-native') {
envDialect = 'postgres'
}
if (this.getSupportedDialects().indexOf(envDialect) === -1) { if (this.getSupportedDialects().indexOf(envDialect) === -1) {
throw new Error('The dialect you have passed is unknown. Did you really mean: ' + envDialect) throw new Error('The dialect you have passed is unknown. Did you really mean: ' + envDialect)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!