Thursday 30 June 2016

Purge or recreate a Ruby on Rails database




I have a dev Ruby on Rails database full of data. I want to delete everything and rebuild the database. I'm thinking of using something like:



rake db:recreate


Is this possible?


Answer



I know two ways to do this:



This will reset your database and reload your current schema with all:




rake db:reset db:migrate


This will destroy your db and then create it and then migrate your current schema:



rake db:drop db:create db:migrate


All data will be lost in both scenarios.



No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...