Reorder Rails database migrations files
On new Rails apps, that are not in production yet, I sometimes like to reorder my database migrations. I wrote a small Ruby script to automate things.
On new Rails apps, that are not in production yet, I sometimes like to reorder my database migrations. I wrote a small Ruby script to automate things.
#!/bin/sh
DB_NAME=mydatabase
DATE=`date +%Y%m%d%H%M%S`
DIR=/backups/pgsql
PG_DUMP=/usr/bin/pg_dump
$PG_DUMP $DB_NAME | bzip2 > $DIR/$DB_NAME_$DATE.sql.bz2
find $DIR -mtime +7 -exec rm {} \;