forked from shibao/cannery
only automigrate in prod env
This commit is contained in:
parent
820ceed6bb
commit
7567281449
@ -21,6 +21,8 @@ config :cannery, CanneryWeb.Endpoint,
|
|||||||
live_view: [signing_salt: "zOLgd3lr"],
|
live_view: [signing_salt: "zOLgd3lr"],
|
||||||
registration: System.get_env("REGISTRATION") || "invite"
|
registration: System.get_env("REGISTRATION") || "invite"
|
||||||
|
|
||||||
|
config :cannery, Cannery.Application, automigrate: false
|
||||||
|
|
||||||
config :cannery, :generators,
|
config :cannery, :generators,
|
||||||
migration: true,
|
migration: true,
|
||||||
binary_id: true,
|
binary_id: true,
|
||||||
|
@ -15,6 +15,8 @@ config :cannery, Cannery.Repo,
|
|||||||
url: "ecto://postgres:postgres@localhost/cannery",
|
url: "ecto://postgres:postgres@localhost/cannery",
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
||||||
|
config :cannery, Cannery.Application, automigrate: true
|
||||||
|
|
||||||
# Do not print debug messages in production
|
# Do not print debug messages in production
|
||||||
config :logger, level: :info
|
config :logger, level: :info
|
||||||
|
|
||||||
|
@ -15,13 +15,17 @@ defmodule Cannery.Application do
|
|||||||
# Start the PubSub system
|
# Start the PubSub system
|
||||||
{Phoenix.PubSub, name: Cannery.PubSub},
|
{Phoenix.PubSub, name: Cannery.PubSub},
|
||||||
# Start the Endpoint (http/https)
|
# Start the Endpoint (http/https)
|
||||||
CanneryWeb.Endpoint,
|
CanneryWeb.Endpoint
|
||||||
# Start a worker by calling: Cannery.Worker.start_link(arg)
|
# Start a worker by calling: Cannery.Worker.start_link(arg)
|
||||||
# {Cannery.Worker, arg},
|
# {Cannery.Worker, arg}
|
||||||
# Automatically migrate on start
|
|
||||||
Cannery.Repo.Migrator
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Automatically migrate on start in prod
|
||||||
|
children =
|
||||||
|
if Application.get_env(:cannery, Cannery.Application, automigrate: false)[:automigrate],
|
||||||
|
do: children ++ [Cannery.Repo.Migrator],
|
||||||
|
else: children
|
||||||
|
|
||||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||||
# for other strategies and supported options
|
# for other strategies and supported options
|
||||||
opts = [strategy: :one_for_one, name: Cannery.Supervisor]
|
opts = [strategy: :one_for_one, name: Cannery.Supervisor]
|
||||||
|
Loading…
Reference in New Issue
Block a user