rails/rails — pull request #13187 by amarshall (2013-12-05 09:05:41+00:00)
Title: Exit when an exception occurs while creating/dropping the database

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.