Heroku does not reset the database

I am trying to reset my gerok database using this:

heroku pg:reset SHARED_DATABASE 

and then run:

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

But I get the following error:

 Validation failed: Email has already been taken 

I noticed that by logging into the gekku rails console, users are not deleted, and thus this check failed. What am I missing here?

+6
source share
2 answers

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

Replace the name of your application where I wrote {your application name}. For example, if your application is called my_great_app, you use:

heroku pg:reset SHARED_DATABASE --confirm my_great_app

To recreate a database without anything:

 heroku rake db:migrate 

To populate the database with your original data:

 heroku rake db:seed 

You can combine the last two in one action by doing this:

 heroku rake db:setup 
+9
source

I just went through this, here's what I did (step # 3 was missing from the other answers that stopped me for a while):

  1. heroku pg: info (to get the value HEROKU_POSTGRESQL_HEROKUCOLOR_URL)
  2. heroku pg: reset HEROKU_POSTGRESQL_HEROKUCOLOR_URL --confirm {application_name}
  3. the hero I start a rake db: scheme: load
  4. heroes run rake db: migrate
  5. hero rake run db: seed

According to: Heroku rake db: migrate does not create tables (Rails 5)

0
source

Source: https://habr.com/ru/post/903883/


All Articles