Elixir learnings - 2020 week 12

March 16, 2020

Gigalixir

Resetting your database

Drop into a remote console

gigalixir ps:remote_console

Tear down the database and re-seed it.

# Migrate down
Ecto.Migrator.run(MyApp.Repo, Application.app_dir(:app, "priv/repo/migrations"), :down, [all: true])
# Re run migrations
Ecto.Migrator.run(MyApp.Repo, Application.app_dir(:app, "priv/repo/migrations"), :up, [all: true])
# Run seeds
seed_script = Path.join(["#{:code.priv_dir(:app)}", "repo", "seeds.exs"])
Code.eval_file(seed_script)

© 2024, Built with ❤️ by Blake Dietz