Skip to content

Instantly share code, notes, and snippets.

@talentdeficit
Created November 19, 2017 02:34
Show Gist options
  • Save talentdeficit/d54526524500d0799ce403d55ba3ac95 to your computer and use it in GitHub Desktop.
Save talentdeficit/d54526524500d0799ce403d55ba3ac95 to your computer and use it in GitHub Desktop.
defmodule App.Repo.Migrator do
@moduledoc false
@doc false
use GenServer
def start_link() do
GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
end
## this processes only purpose is to run migrations on init
def init(state) do
migrations = Application.app_dir(:askuity_truth, "priv") <> "/db/migrations/"
_ = Ecto.Migrator.run(AskTruth.Db, migrations, :up, [ { :all, true } ])
{ :stop, :normal, state }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment