DB Check

Finds and fixes database consistency problems across Payload collections, with duplicate merging and reference repair in the admin panel.

Community 0 MIT v0.1.0

Installation

pnpm add @yairl/payload-db-check

About

DB Check is a Payload 3 plugin that surfaces database consistency problems across your collections from inside the admin panel. It adds a DB consistency page (at `/admin/db-check` by default, configurable) and an optional sidebar shortcut. You pick a collection, choose which checks to run, and start. Everything is read-only until you explicitly run a repair, and every repair previews what it will do first. The plugin runs three checks. Duplicates finds records that share a key you define, such as `fullName` plus `birthday`; the first key field is treated as the primary identity, so records sharing it but differing elsewhere are flagged as likely-but-unconfirmed duplicates. Broken references detects relationship and upload fields pointing at documents that no longer exist, discovering every relationship field from the schema including those nested in arrays, groups, tabs and blocks. One-sided links finds two-way relationships where only one side was written, listing candidate mirror pairs from the schema for you to confirm. Repairs are opt-in and gated. Merge duplicates lets you pick the surviving record, choose per field which copy's value wins, and select which copies contribute; inbound references are repointed to the survivor before the copies are deleted, so a merge never creates the dangling references the tool exists to find, and a bulk mode merges every group where all copies match on every field. Clear broken references strips dead ids while keeping the valid ones. Rebuild references recovers a deleted record's name from another MongoDB database on the same server and re-links by name, single or in bulk. Because merging deletes records, it is enabled per collection through the `mergeable` option. Checks themselves run against any collection. The plugin registers REST endpoints under `/api/db-check` (schema, databases, run, merge, repair, fix, link), all gated by an `access` predicate that defaults to any logged-in user. The reference-rebuild feature is MongoDB-specific and reads from another database on the same server without writing to it. Styles ship as a namespaced global stylesheet, so no CSS-module setup is required in the host app.

Package info

Package name
@yairl/payload-db-check
Latest version
0.1.0
Unpacked size
286 kB
License
MIT
Last publish
Jul 17, 2026

More from ylahav

View profile

Similar plugins

More in Admin