back to notes

Rails: Reset the test database

A solution that worked for me to recreate and populate the test database from scratch

bin/rake db:schema:dump
RAILS_ENV=test bin/rake db:drop 
RAILS_ENV=test bin/rake db:create
RAILS_ENV=test bin/rake db:test:prepare 

INFO

bin/rake db:setup # Create the database, load the schema, and initialize with the seed data

bin/rake db:reset # Drop the database + (rake db:setup)


last updated april 2018