cannery/lib/lokal/release.ex
2023-02-04 17:32:40 -05:00

28 lines
568 B
Elixir

defmodule Lokal.Release do
@moduledoc """
Contains mix tasks that can used in generated releases
"""
@app :lokal
def rollback(repo, version) do
load_app()
{:ok, _fun_return, _apps} =
Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
end
defp load_app do
Application.load(@app)
end
def migrate do
load_app()
for repo <- Application.fetch_env!(@app, :ecto_repos) do
{:ok, _fun_return, _apps} =
Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end
end