Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start app in migration to avoid SSL errors #444

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/lib/core/release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ defmodule Core.Release do
@app :core

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

defp repos do
Application.fetch_env!(@app, :ecto_repos)
end

defp load_app do
:ssl.start()
Application.load(@app)
end
end
2 changes: 1 addition & 1 deletion core/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule Core.MixProject do
def application do
[
mod: {Core.Application, []},
extra_applications: [:logger, :runtime_tools, :csv]
extra_applications: [:logger, :runtime_tools, :csv, :ssl]
]
end

Expand Down
Loading