Hi in local I can reset my database as follows:
rake db:drop db:create db:migrate db:seed
But we have a staging version deployed on heroku, the above commands do not work there
How to properly reset the database? we're using postgresql addon
你是这个意思:
heroku pg:reset DATABASE_URL
Well rake db:drop db:create
won't work in your heroku environment, instead you need to reset your postgresql using the following command
heroku pg:reset HEROKU_POSTGRESQL_URL -a app_name
After run the above command your database will be as new, then you need to run rake db:migrate db:seed
That's all, for get your HEROKU_POSTGRESQL_URL you need to go to the dashboard of your app and select the Heroku Postgres add-on, then in the dashboard of the add-on you will find this part:
Psql: heroku pg:psql --app grupoly-staging HEROKU_POSTGRESQL_BLACK
The HEROKU_POSTGRESQL_BLACK is the url of your postgredatabase
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.