Skip to content

Commit

Permalink
Start app in migration to avoid SSL errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed Aug 18, 2023
1 parent a7c8e06 commit ae3d9f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit ae3d9f5

Please sign in to comment.