File size: 793 Bytes
bfaed46 59fddbd 10ceb35 bfaed46 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
defmodule MedicalTranscription.Release do
@moduledoc """
Used for executing DB release tasks when run in production without Mix
installed.
"""
@app :medical_transcription
def migrate do
load_app()
for repo <- repos() do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end
def rollback(repo, version) do
load_app()
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
end
def precompute_code_vectors do
load_app()
Application.ensure_all_started(:medical_transcription)
MedicalTranscription.Coding.VectorPrecomputation.run()
end
defp repos do
Application.fetch_env!(@app, :ecto_repos)
end
defp load_app do
Application.load(@app)
end
end
|