Ecto-backed CouncilEx.Reliability store. Multi-replica safe.
Tested on Postgres via :postgrex. The portable INSERT ... ON CONFLICT DO UPDATE SQL also runs on SQLite (3.24+) via
:ecto_sqlite3.
Uses your application's existing Ecto.Repo (no extra connection
pool). Atomic counter increments via INSERT ... ON CONFLICT DO UPDATE.
Same Laplace-smoothed scoring math as the ETS / Redis backends.
Setup
Pick this backend and point it at your repo:
config :council_ex,
:reliability_store,
CouncilEx.Reliability.Ecto
config :council_ex, CouncilEx.Reliability.Ecto,
repo: MyApp.Repo,
table: "council_ex_reliability":repo is required. :table defaults to "council_ex_reliability".
Migration
Use CouncilEx.Persistence.Migration — see its moduledoc. The
:reliability component creates the council_ex_reliability table
(or <your_prefix>reliability if you override :table_prefix).
Failure mode
record/3 returns {:error, reason} on DB error. score/2 returns
nil (cold-start fallback) on DB error so callers don't crash.
Summary
Functions
@spec reset() :: :ok | {:error, term()}
Wipe all rows. Test-only / admin use.