Phoenix: Use Ecto to Recreate Your Database

06/30/20191 Min Read — In Elixir, Phoenix

Today I learned that it's a bad idea to drop a PostgreSQL table directly with PGAdmin. Afterwards, I got tons of errors, because the table was missing.

I you want to re-create your database from scratch, you should use Ecto.

If you want to completely roll back your database and re-create it, use:

mix ecto.reset

From Codebase:

reset is the equivalente of running the following commands:

mix ecto.drop
mix ecto.create
mix ecto.migrate
mix run priv/repo/seeds.exs

Further Reading