Closed mikaellanger closed 3 years ago
Hey, that's a good catch. Thank you for PR.
Quick Question - Instead of add "return" command everywhere isn't better to add in the method handleError
the exit(1)
?
The Symphony Command class wants the exit status returned from execute so I thought I'd better stick to that. No idea if it really matters though. 😄
All right, it is good to me. We need to handle the parent::execute
though.
Not quite sure I understand what you mean with "handle the parent::execute"?
Something like this:
$result = parent::execute($input, $output);
if ($result == 0) {
// Do what have to do
}
return $result;
Ok, updated. WDYT? Didn't have time to even run this yet though.
I am merging to branch 4.1.1 while I am doing some tests.
Meanwhile, you can download the version 4.1.1.x-dev
to use this code.
Getting an error code on failure is pretty important when running migrations from a script. For example, I would like to apply migrations in an init script in the official postgresql docker image in our CI, and also want to automate it in our deploy scripts. In both of these use-cases detecting that the migration failed is necessary.