Skip to content

Exit when an exception occurs while creating/dropping the database #13187

wants to merge 1 commit into from

3 participants


The create and drop tasks currently rescue from Exception, print the error, and then continue happily along. This means that a command running these tasks returns a successful exit code even when they fail to do the only thing they’re supposed to do. This seems wrong, and results in unexpected behavior when scripting or chaining tasks. (Often there is an open connection to the database which blocks dropping.)

All other tasks here (e.g. purge, structure_dump, structure_load, load_seed, etc.) allow exceptions to bubble up. This change will allow create & drop to fail in the same way they do.

I haven’t added tests simply because it feels excessive to test for an exception being raised when it’s not actually raised in this method (and none of the other methods here test such a case). Arguably this change would delete tests that tested the exception rescuing, but no such (unit) tests appear to exist.

Ruby on Rails member

This change caused the build to fail. You'll likely need to modify existing tests to pass with this change.

Ruby on Rails member

Closing since there is no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.