Thursday, September 5, 2013

Rails : Tasks : Truncate db with 1 command

Back to rails is fun.

Working on some project I wanted to clean the database to clear all junk data added while testing.

But wanted to do that with 1 command and checking if I can get clear database without opening pgadmin or run several commands like drop/ create/ migrate. And I also added seeds in the project to get default data for functionality.

I checked rake --tasks. Check below screen-shot with selected text.












That was the command which I was looking for. It worked. But it thrown error first that it can not drop database as per the notes in --tasks. But it first truncated/ migrated and at last the seeds were added to the tables. Easy....:). Loved it....:D

No comments:

Post a Comment