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

Commit f4b8b1bb by Mick Hansen

wrap undo/migrate in an authenticate call and log error

1 parent 9a0b38ac
Showing with 4 additions and 0 deletions
...@@ -229,6 +229,7 @@ if (program.migrate || program.undo) { ...@@ -229,6 +229,7 @@ if (program.migrate || program.undo) {
migratorOptions = _.merge(migratorOptions, { filesFilter: /\.js$|\.coffee$/ }) migratorOptions = _.merge(migratorOptions, { filesFilter: /\.js$|\.coffee$/ })
} }
sequelize.authenticate().success(function () {
var migrator = sequelize.getMigrator(migratorOptions) var migrator = sequelize.getMigrator(migratorOptions)
if (program.undo) { if (program.undo) {
...@@ -250,6 +251,9 @@ if (program.migrate || program.undo) { ...@@ -250,6 +251,9 @@ if (program.migrate || program.undo) {
process.exit(0) process.exit(0)
}) })
} }
}).error(function (err) {
console.error("Unable to connect to database: "+err)
})
} else { } else {
console.log('Cannot find "' + configuration.configFile + '". Have you run "sequelize --init"?') console.log('Cannot find "' + configuration.configFile + '". Have you run "sequelize --init"?')
process.exit(1) process.exit(1)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!