-
-
Save Faolain/374930ef6bc75dcd61cb0ab3a9b9df32 to your computer and use it in GitHub Desktop.
Run seeds in an Elixir Distillery app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule :release_tasks do | |
def seed do | |
:ok = Application.load(:myapp) | |
[:postgrex, :ecto, :logger] | |
|> Enum.each(&Application.ensure_all_started/1) | |
Myapp.Repo.start_link | |
path = Application.app_dir(:myapp, "priv/repo/seeds.exs") | |
if File.regular?(path) do | |
Code.require_file(path) | |
end | |
:init.stop() | |
end | |
end | |
# now at the command line run ./bin/myapp command release_tasks seed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment