Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clearing rails app database on heroku production site

So I'm new to ROR and Heroku and need a little help. I've created an app and have deployed it; however, I'd like to clear out the database associated with it. Meaning I'd like to clear any users (and their attached data) that have been created thus far.

I've basically created several phony accounts to test out whether the database on the production site works, but now i'd like to clear this out, and start with a fresh database.

Is this possible without deleting the database entirely?

Any help would be sincerely appreciated. Thank you very much for your time!

like image 278
slovak_100 Avatar asked Aug 02 '11 02:08

slovak_100


Video Answer


2 Answers

You can use heroku pg:reset DATABASE command to reset the entire database. The command will simply drop and create the database.

You have to use heroku rake db:migrate to create the tables then.

Alternatively you can use rake db:reset command locally and then run heroku db:push to update the production db.

like image 77
Arun Kumar Arjunan Avatar answered Sep 21 '22 11:09

Arun Kumar Arjunan


heroku pg:reset DATABASE --confirm {app-name}  heroku run rake db:migrate  heroku run rake db:seed 
like image 40
Jigar Bhatt Avatar answered Sep 21 '22 11:09

Jigar Bhatt