Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted at 24. Aug '21

Cannot Rollback Named Database in Rails 6+

As far as I know it’s not possible in 6.x. Do it by hand - do the changes manually and remove migration number from table schema_migrations.

user@starz:~/current$ RAILS_ENV=production bin/rails db:rollback:oni_sorceress STEP=1
rails aborted!
Don't know how to build task 'db:rollback:oni_sorceress' (See the list of available tasks with `rails --tasks`)
Did you mean?  db:create:oni_sorceress
               db:drop:oni_sorceress
               db:migrate:oni_sorceress
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/railties-6.0.3.4/lib/rails/command.rb:48:in `invoke'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<main>'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/myrtana_sk/shared/bundle/ruby/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)

Add Comment