Uses FZF to retrieve a list of your Rails migrations, sorts them by their filename (so that most recent is at the bottom), and allows you to easily migrate that file up or down using bin/rails db:migrate:up VERSION=... or bin/rails db:migrate:down VERSION=... using the chosen file's schema version.
- You must have
fzfinstalled. - You need to be in your Rails app's directory
bin/railsmust exist in your Rails app directory
Copy the migrate-up and migrate-down scripts to a folder that is in your PATH. I use ~/bin/ and make sure I have the following in my ~/.zshrc or ~/.bashrc file:
export PATH=$HOME/bin:$PATHThen, from your Rails app directory, simply run either migrate-up or migrate-down and select a file from the list using the arrow keys, or start typing to use FZF's fuzzy-finder search.