Backup, Clear, And Restore A Postgresql Database For Rails

Posted By Weston Ganger

First Backup your database:

pg_dump dbname > outfile

To clear your database:

dropdb dbname
createdb dbname

To restore database 

psql dbname < infile

Then run your migrations

rake db:migrate RAILS_ENV=development

Article Topic:Software Development - Linux

Date:June 18, 2014