Verifies GeoGenius's database prerequisites and fails host startup when they are not met.
Place this child in the host's supervision tree immediately after its Repo:
children = [
MyApp.Repo,
{GeoGenius.Preflight, repo: MyApp.Repo, prefix: "geo_genius"},
MyAppWeb.Endpoint
]The check runs once during start_link/1 and returns :ignore, so no process
remains in the tree. A failure raises GeoGenius.PreflightError, which aborts
startup rather than deferring the error to the first query.
A Repo pooled through Ecto.Adapters.SQL.Sandbox skips the check, because
the supervisor starts this child from a process that owns no sandbox
connection: the check would raise DBConnection.OwnershipError and take the
host's whole test suite down with it. guides/installation.md covers what a
host runs instead under the sandbox.
Summary
Functions
Builds the child spec for placing this preflight check in a supervision tree.
Runs the preflight check and returns :ignore on success.
Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
Builds the child spec for placing this preflight check in a supervision tree.
@spec start_link(keyword()) :: :ignore
Runs the preflight check and returns :ignore on success.
Raises GeoGenius.PreflightError on failure, aborting host startup.
:enabled? decides whether the check runs. It defaults to false for a Repo
configured with Ecto.Adapters.SQL.Sandbox and true for every other Repo.
Pass it explicitly to override that: enabled?: true verifies a sandboxed
Repo from a process that has checked a connection out, enabled?: false
skips the check wherever the host prefers to run it by hand.