memEx/lib/memex/release.ex

25 lines
525 B
Elixir
Raw Normal View History

2022-07-25 19:31:54 -04:00
defmodule Memex.Release do
2022-01-22 20:44:38 -05:00
@moduledoc """
Contains mix tasks that can used in generated releases
"""
2022-07-25 19:31:54 -04:00
@app :memex
2021-09-04 16:19:23 -04:00
def rollback(repo, version) do
load_app()
{:ok, _, _} = 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, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end
end