Browse Source

add release.ex

main
Inhji Y. 9 months ago
parent
commit
c56799033c
  1. 16
      lib/mirage/release.ex

16
lib/mirage/release.ex

@ -0,0 +1,16 @@
defmodule Mirage.Release do
def migrate do
for repo <- repos() do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end
def rollback(repo) do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, step: 1))
end
defp repos do
Application.load(:mirage)
Application.fetch_env!(:mirage, :ecto_repos)
end
end
Loading…
Cancel
Save