only start automigrator in prod env

This commit is contained in:
2022-01-22 20:12:32 -05:00
committed by oliviasculley
parent 3674eeaf5a
commit 46eed25a94
3 changed files with 11 additions and 3 deletions

View File

@ -15,13 +15,17 @@ defmodule Lokal.Application do
# Start the PubSub system
{Phoenix.PubSub, name: Lokal.PubSub},
# Start the Endpoint (http/https)
LokalWeb.Endpoint,
LokalWeb.Endpoint
# Start a worker by calling: Lokal.Worker.start_link(arg)
# {Lokal.Worker, arg}
# Automatically migrate on start
Lokal.Repo.Migrator
]
# Automatically migrate on start in prod
children =
if Application.get_env(:lokal, Lokal.Application, automigrate: false)[:automigrate],
do: children ++ [Lokal.Repo.Migrator],
else: children
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Lokal.Supervisor]