Last Updated: February 25, 2016
·
487
· tlehman

rails database time traveler

This script allows you to conveniently see where you are in your rails app's "database history".

#!/bin/sh
# dbtt: Database Time Traveler

ls db/migrate/ | grep --colour -C 8 `rake db:version | awk -F: '{print $2}'`

From the root of a rails app, run this script (I used the name dbtt), and you will see the highlighted migration you are currently on.

This is useful for when you have several migrations and want to make sure you can smoothly roll back and move forward through them.