Reset a Heroku database

I’m currently developing a Play! application, and I use Heroku to deploy and test it.

But sometimes when deploying it, the application crashes when trying to start up. What happens is that the database contains data that are in conflict with the new schema that I’ve deployed (eg. new required foreign keys that don’t have a value…).

To fix this, the easiest way I’ve found is to reset my Heroku database. When connected to Heroku (with the Heroku Toolbelt), just run

heroku pg

which will display the list of your databases, then run

heroku pg:reset HEROKU_DATABASE_SOMEBASE

which will reset your database HEROKU_DATABASE_SOMEBASE.

Then you can restart your application with

heroku restart

and everything should be working fine.

No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

16dVFMiAWZ8kFY4QqTQewTQsbJUqzhWtPa

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Leave a Reply

Your email address will not be published. Required fields are marked *