-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
CLI Doesn't Halt On Error? #106
Comments
Thanks for the report. Will check and fix soon. On Sun, Mar 8, 2015 at 10:25 PM, Paul Tiseo notifications@github.com
|
Alright so here is what I tried: I have the following migrations:
the broken migration looks like this:
Running the migrations results in the following output:
The meta table contains only the first migration. Looks perfectly fine for me. |
Can you paste the complete migration? |
Hello I think the original problem is that sequelize doesn't throw any error in the console, it just output to stdout an error message. I have a deployment .sh script running (in the middle of it) the command test.sh : |
I can reproduce this error. That's my test migration module.exports = {
up: function(queryInterface, Sequelize) {
queryInterface.changeColumn('Products', 'max_price', {
type: Sequelize.INTEGER(11),
references: {
model: 'Users',
key: 'id'
}
});
},
down: function(queryInterface) {
queryInterface.sequelize.query('ALTER TABLE Products DROP FOREIGN KEY Productstest_max_price_foreign_idx;');
queryInterface.removeIndex('Products', 'Productstest_max_price_foreign_idx');
}
}; When I try to do sequelize db:migrate:undo, sequelize throws error in the console but migration was removed anyway |
@BiletskiyDmitriy you need to return promise. |
When I run
sequelize db:migrate
I see the error (and get the root SQL error), but the processing continues onwards to subsequent files instead of halting and allowing the user to fix the error. The first error because I did not know UNSIGNED in a createTable() didn't work against postgresql. The code was just a single createTable() with a done() afterwards. The other was an extra parens in a raw SQL statement that created a function using amigration.sequelize.query(<string>).nodeify(done)
call.In both cases, I did get the proper SequelizeDatabaseError with a message that described the error well, But, it proceeded on with subsequent file... and triggering more errors as dependent objects were not created properly.
Using Node 0.12.0, CLI 1.3.1 and ORM 2.0.3.
Example error:
The text was updated successfully, but these errors were encountered: