mei9nw
Last Updated: February 25, 2016
·
301
· tlehman
0dc69fc477295dd2209fd5ea5761b8b5

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.

Say Thanks
Respond