Fix migrations: run after Repo starts, not before

This commit is contained in:
Graham McIntire 2026-04-02 12:19:02 -05:00
parent 93f2c32971
commit df27209025
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -7,8 +7,6 @@ defmodule Microwaveprop.Application do
@impl true
def start(_type, _args) do
migrate()
children = [
MicrowavepropWeb.Telemetry,
Microwaveprop.Repo,
@ -24,6 +22,9 @@ defmodule Microwaveprop.Application do
opts = [strategy: :one_for_one, name: Microwaveprop.Supervisor]
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)
if Application.get_env(:microwaveprop, :load_ml_model, false) do
Microwaveprop.Propagation.load_ml_model()
@ -32,12 +33,6 @@ defmodule Microwaveprop.Application do
result
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
defp migrate do
Microwaveprop.Release.migrate()
end
@impl true
def config_change(changed, _new, removed) do
MicrowavepropWeb.Endpoint.config_change(changed, removed)