Verifies and additively repairs a PhoenixKit installation against the
generated PhoenixKit.Migrations.ExpectedSchema manifest (spec §6).
Usage
$ mix phoenix_kit.repair
$ mix phoenix_kit.repair --dry-run
$ mix phoenix_kit.repair --prefix=auth
$ mix phoenix_kit.repair --json
$ mix phoenix_kit.repair --adopt
$ mix phoenix_kit.repair --heal-comment
$ mix phoenix_kit.repair --unsafe-pooled
Options
--dry-run— plan only; never writes (creates, backfills, comment changes). Every finding that would otherwise be:repairedreports as:missinginstead. Equivalent in effect tomix phoenix_kit.repairalways running the read-only half — the flag exists so the command name staysrepairfor the write path and--dry-runopts into the identicalverify/1behavior without a separate subcommand.--prefix— schema prefix. Resolved the same waymix phoenix_kit.update/--statusresolve it:--prefixflag →config :phoenix_kit, :prefix→"public"(PhoenixKit.Install.PrefixConfig.resolve_prefix/1).--json— machine-readable output (PhoenixKit.Migrations.Repair.Report.to_json_map/1) instead of the human-readable report.--adopt— spec §6.4 R4. Only meaningful when the version comment is missing (half-installed/adopted/PgBouncer-stripped) — converges the floor-level slice and stamps the floor version iff it comes back clean.--heal-comment— spec §6.4 R2. Only meaningful when the schema is structurally ahead of what the comment claims — stamps the highest version whose objects are all present.--unsafe-pooled— required to proceed when a pooled connection (PgBouncer transaction-mode or similar) is detected; skips the advisory lock and FKVALIDATE CONSTRAINT(§6.3).
Exit codes
0 clean — nothing to report
1 the manifest is not generated yet, OR repairs were applied/are pending
2 a hard error (below-floor, above-current, concurrent migration,
pooled connection without --unsafe-pooled, adopt-required without
--adopt) OR report-only divergences are present in the findingsManifest not generated yet
PhoenixKit.Migrations.ExpectedSchema — the tool-generated manifest —
ships with this release, so the normal path is fully wired. The
not-generated branch remains for a checkout where the manifest has been
removed or replaced (config :phoenix_kit, :expected_schema_module):
every invocation then prints
PhoenixKit.Migrations.ExpectedSchema.Resolver.not_generated_message/0
and exits 1 rather than silently reporting a clean database.