cfurrow / fzf-rails-migrate-commands

Scripts that use fzf to easily `up`/`down` your Rails database migration files. Great for quickly switching git branches.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

migrate-up and migrate-down commands

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.

Prerequisite

  • You must have fzf installed.
  • You need to be in your Rails app's directory
  • bin/rails must exist in your Rails app directory

Install

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:$PATH

Then, 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.

About

Scripts that use fzf to easily `up`/`down` your Rails database migration files. Great for quickly switching git branches.


Languages

Language:Shell 100.0%