Fix migrations: run after Repo starts, not before
This commit is contained in:
parent
93f2c32971
commit
df27209025
1 changed files with 3 additions and 8 deletions
|
|
@ -7,8 +7,6 @@ defmodule Microwaveprop.Application do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
migrate()
|
|
||||||
|
|
||||||
children = [
|
children = [
|
||||||
MicrowavepropWeb.Telemetry,
|
MicrowavepropWeb.Telemetry,
|
||||||
Microwaveprop.Repo,
|
Microwaveprop.Repo,
|
||||||
|
|
@ -24,6 +22,9 @@ defmodule Microwaveprop.Application do
|
||||||
opts = [strategy: :one_for_one, name: Microwaveprop.Supervisor]
|
opts = [strategy: :one_for_one, name: Microwaveprop.Supervisor]
|
||||||
result = Supervisor.start_link(children, opts)
|
result = Supervisor.start_link(children, opts)
|
||||||
|
|
||||||
|
# Run migrations after Repo is started
|
||||||
|
Microwaveprop.Release.migrate()
|
||||||
|
|
||||||
# Load ML model in dev/test only (Nx/Axon not compiled for prod)
|
# Load ML model in dev/test only (Nx/Axon not compiled for prod)
|
||||||
if Application.get_env(:microwaveprop, :load_ml_model, false) do
|
if Application.get_env(:microwaveprop, :load_ml_model, false) do
|
||||||
Microwaveprop.Propagation.load_ml_model()
|
Microwaveprop.Propagation.load_ml_model()
|
||||||
|
|
@ -32,12 +33,6 @@ defmodule Microwaveprop.Application do
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tell Phoenix to update the endpoint configuration
|
|
||||||
# whenever the application is updated.
|
|
||||||
defp migrate do
|
|
||||||
Microwaveprop.Release.migrate()
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def config_change(changed, _new, removed) do
|
def config_change(changed, _new, removed) do
|
||||||
MicrowavepropWeb.Endpoint.config_change(changed, removed)
|
MicrowavepropWeb.Endpoint.config_change(changed, removed)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue