← All projects

Ledgerline

The diagram of your database derived from what your code actually does — and a build that fails when the two disagree.

Ledgerline running against the memos repository: four failing findings, each naming the file and line of the join that relies on an undeclared relationship

The problem

Every ER diagram tool starts from CREATE TABLE or a live connection, draws a picture, and stops. The picture is stale within a week. Worse, the relationships a codebase actually relies on are the ones that never appear on it: the user_id with no foreign key behind it, the owner_type/owner_id pair, the join table only the ORM knows about.

Those are not cosmetic omissions. A relationship the queries depend on and the database does not know about is the one that lets a row point at nothing, skips the index it would have had, and pages somebody at two in the morning.

What I built

Decisions worth naming

Run against six real repositories

The interesting part is not the test suite. It is that the check has been run against Mastodon, Outline, NetBox, memos, Ory Kratos and Woodpecker CI, with every finding checked by hand against that repository's own schema file.

What is not finished