Created
November 19, 2017 02:34
-
-
Save talentdeficit/d54526524500d0799ce403d55ba3ac95 to your computer and use it in GitHub Desktop.
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 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