ga-wdi-boston / full-stack-project

Other
8 stars 64 forks source link

Seeding production server #1016

Closed jbculbertson closed 7 years ago

jbculbertson commented 7 years ago

Hi - I have a rake file to seed my development site. i've used it many times and it works on the dev side, but I just tried it on my production side and it didn't work.

My steps on development: bin/rake db:nuke_pave bin/rake db:seed

Attempt on production: heroku run rake db: migrate heroku run rake db:seed - this paused because the user seed I created already exists. It seemed to update the recipes I seeded, but they don't attach to the user properly.

I don't see any issues that have the same problem - could someone help point me in the right direction?

cpearce31 commented 7 years ago

db:nuke_pave is an alias for several commands: bin/rake db:drop db:create db:migrate db:seed db:examples. You'll need to follow a similar procedure on Heroku so that the seeded data doesn't conflict with data that's already there.

jbculbertson commented 7 years ago

thanks Caleb - I started down that road, with heroku run rake db:drop, but get this error:

If you are sure you want to continue, run the same command with the environment variable: DISABLE_DATABASE_ENVIRONMENT_CHECK=1

cpearce31 commented 7 years ago

I think it's just asking you to make your intent very clear, since dropping a production database is usually not a thing you want to do. Are you able to do heroku run rake db:drop DISABLE_DATABASE_ENVIRONMENT_CHECK=1?

MicFin commented 7 years ago

Also take a look at using heroku pg:reset https://devcenter.heroku.com/articles/rake#limitations

jbculbertson commented 7 years ago

Nice, that worked. Thanks Mike and Caleb!