Skip to content

Instantly share code, notes, and snippets.

@ventsislaf
Last active May 18, 2023 14:14
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save ventsislaf/2c04c6d1b29376a2ba27 to your computer and use it in GitHub Desktop.
Save ventsislaf/2c04c6d1b29376a2ba27 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