Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db:migrate returns status code 0 when migration fails #110

Closed
renou opened this issue Mar 19, 2015 · 6 comments
Closed

db:migrate returns status code 0 when migration fails #110

renou opened this issue Mar 19, 2015 · 6 comments

Comments

@renou
Copy link

renou commented Mar 19, 2015

Migration failures on db level are not handled properly and the command returns success code 0 and prints

Using environment 'development'.
== 20150318142814-init: migrating =======
Possibly unhandled SequelizeDatabaseError: type "enum_Group_status" already exists

@sdepold
Copy link
Member

sdepold commented Mar 23, 2015

It would be nice if you could create a test as a pull request that shows the failing behavior. Otherwise I'll try to take a look at it at some point.

@renou
Copy link
Author

renou commented Mar 23, 2015

var sh = require('execSync');
var result = sh.exec('node_modules/.bin/sequelize db:migrate');
if(result.code === 0 && result.stdout.indexOf('SequelizeDatabaseError') > -1) {
  console.error('result has SequelizeDatabaseError but return code is 0');
  throw new Error(result.stdout);
} else {
  console.info(result.stdout);
}

you can run this with a migration that will fail (duplicate table, duplicate type...).

@theazureshadow
Copy link

+1. We need to fail deployments that didn't migrate correctly, and without an exit code our deployment scripts can't tell that they failed.

@arturhtml
Copy link

+1

1 similar comment
@sorin
Copy link

sorin commented Jul 9, 2015

+1

@sdepold
Copy link
Member

sdepold commented Jul 28, 2015

fixed in 1.7.4

codetriage-readme-bot pushed a commit to codetriage-readme-bot/cli that referenced this issue Jun 5, 2019
Update development instrucitons in Readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants