Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku not resetting database

I am attempting to reset my database on heroku using this:

heroku pg:reset SHARED_DATABASE

and then run:

heroku run rake db:create db:migrate db:seed

But I am getting the following error:

Validation failed: Email has already been taken

I have noticed by going into the heroku rails console that the users are not being dropped and thus this validation has failed. What am I missing here?

like image 815
John Avatar asked Dec 16 '11 03:12

John


People also ask

How often does heroku rotate database credentials?

Heroku does not perform and scheduled credential rotation for Common Runtime databases. However, during certain types of maintenance events (for example patching for security) the credentials will be rotated automatically.

Does Heroku provide free database?

A handy feature of the Heroku Postgres database is that it allows for easy experimentation or prototyping. Heroku even offers a free plan for hosting PostgreSQL databases.


1 Answers

Try this: heroku pg:reset SHARED_DATABASE --confirm {the name of your app}

Substitute the name of your app where I have written {the name of your app}. For example, if your app is called my_great_app then you use:

heroku pg:reset SHARED_DATABASE --confirm my_great_app

To recreate the database with nothing in it:

heroku rake db:migrate

To populate the database with your seed data:

heroku rake db:seed

You can combine the last two into one action by executing this:

heroku rake db:setup
like image 156
Jatin Ganhotra Avatar answered Sep 28 '22 08:09

Jatin Ganhotra