rails--rails/railties/test/application
Nick Borromeo 0f09dfca36
Guard against using VERSION with db:rollback (#41430)
* Guard against using VERSION with db:rollback

I recently ran a migration that I needed to rollback, and admittedly, I often forget the proper incantation for this 😅
so the first thing I tried was to run `bin/rake db:rollback VERSION=123454679`. I had hoped that this reverted my
migration back and at first glance I thought it worked. However on closer inspection I realized that it was a different
migration, which initially confused me.

So I looked over the docs and saw that I was using the rake task incorrectly, and promptly corrected my mistake.

Proposal

Looking at the how the `:down` task is defined we see

8dc7439058/activerecord/lib/active_record/railties/databases.rake (L206-L211)

This got me thinking that maybe it would be helpful to have the opposite of this guard defined in `rollback` so that if
`VERSION` is passed it will raise an exception instead of just negecting the extra argument. This could help the user
realize that something went wrong instead of just seeing output and assuming that the rollback happened.

Change

We now raise an execption if `VERSION` is passed when attempting to rollback a migration

* update test name and fix failing test

* remove byebug

[Nick Borromeo + Kate Travers + Rafael Mendonça França]
2021-02-15 19:30:05 -05:00
..
configuration Use respond_to test helpers 2018-01-25 23:32:58 -05:00
initializers Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty 2020-10-30 00:25:50 +00:00
middleware Refactor CVE-2021-22881 fix 2021-02-13 12:03:23 -06:00
rack Log the remote IP addr of clients behind a proxy 2018-07-31 20:45:37 +05:30
rake Guard against using VERSION with db:rollback (#41430) 2021-02-15 19:30:05 -05:00
asset_debugging_test.rb Remove legacy media=screen default from stylesheet_link_tag. 2021-01-22 20:42:22 -03:00
assets_test.rb Use URI::DEFAULT_PARSER rather than instantiate a new one 2020-06-29 23:06:34 +02:00
bin_setup_test.rb Revert "Avoid chdir error in bin/setup test on Ruby master" 2020-12-26 15:01:24 +09:00
configuration_test.rb Fix Railties tests for 7.0 2021-02-04 12:56:48 -05:00
console_test.rb Remove all version checking for older Rubies in tests 2021-02-05 13:21:45 +09:00
content_security_policy_test.rb Add the ability to set the CSP nonce only to the specified directives 2019-06-22 12:44:37 +09:00
credentials_test.rb Restructure credentials after environment overrides. 2019-01-14 20:13:00 +01:00
current_attributes_integration_test.rb Use `try` only when we're unsure if the receiver would respond_to the method 2019-08-01 17:58:00 +09:00
dbconsole_test.rb Use correct variable 2018-09-11 07:06:30 +09:00
generators_test.rb Modernize scaffold generator (#41210) 2021-02-04 12:26:16 +01:00
help_test.rb
integration_test_case_test.rb require, require_relative, load by double quotes (#38841) 2020-03-29 16:30:52 -07:00
loading_test.rb Only execute route reloads once on boot for development environment 2020-12-03 15:55:41 -05:00
mailer_previews_test.rb Display exception messages using simple_format for a better and clearer 2020-11-09 21:48:24 +00:00
middleware_test.rb Only use ActionDispatch::ActionableExceptions middleware if local env 2020-11-25 16:15:53 -05:00
multi_db_rake_test.rb Generate abstract class when generating scaffold in another database 2020-07-29 12:43:45 -04:00
multiple_applications_test.rb Zeitwerk integration 2019-02-12 02:28:04 -08:00
paths_test.rb Bring back feature that allows loading external route iles: 2019-12-06 14:20:12 +01:00
per_request_digest_cache_test.rb Change the default digest for new apps to SHA256 2021-01-08 12:07:20 +01:00
permissions_policy_test.rb Use Feature-Policy header name for now 2020-11-19 16:08:09 +01:00
rackup_test.rb Remove unnecessary migration deletion 2017-11-08 13:24:16 +09:00
rake_test.rb Overwrite bin/yarn when running app:binstub:yarn 2021-02-10 15:41:03 -06:00
rendering_test.rb Lazily build path regex in PathParser 2020-05-31 15:28:24 -05:00
routing_test.rb Append development routes after reload hook 2020-11-09 18:01:50 -05:00
runner_test.rb Revert "Merge pull request #37215 from utilum/avoid_test_flunking_on_warning" 2019-12-25 17:13:09 +09:00
server_test.rb Allow a new `server` Railtie block: 2020-11-02 18:11:41 +00:00
system_test_case_test.rb Define the `url_options` needed for SytemTest inside the route proxy: 2019-07-24 01:18:00 +02:00
test_runner_test.rb Remove skipped TestRunner tests 2021-02-02 16:07:50 -05:00
test_test.rb require, require_relative, load by double quotes (#38841) 2020-03-29 16:30:52 -07:00
url_generation_test.rb Fix secret_key_base for Railties 2019-03-13 16:41:29 -04:00
version_test.rb
watcher_test.rb Correctly classify the files and directories that pass to watcher 2019-09-02 11:22:39 +09:00
zeitwerk_integration_test.rb Refactor schema migration on connection 2020-03-09 09:59:36 -04:00