Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangtheman/90d0db4d4badd7027f9f7e0ad2ff004a to your computer and use it in GitHub Desktop.
Save yangtheman/90d0db4d4badd7027f9f7e0ad2ff004a to your computer and use it in GitHub Desktop.
Reset database on Heroku running Phoenix app

Note: Don't do this on a production evniroment!

Get the heroku database name:

heroku pg:info

Name can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337.

Reset the database:

heroku pg:reset DATABASE_NAME

Run the migrations:

heroku run MIX_ENV=prod mix ecto.migrate

Insert the seed data:

heroku run MIX_ENV=prod mix run priv/repo/seeds.exs

Restart the dynos:

heroku restart

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment