The short version
Schema diagrams go stale because they're static snapshots of a moving target. A migration adds a column, someone renames a table, and suddenly your beautiful diagram is wrong. The fix: generate diagrams from the live database, not from a file.
Why it happens
- Migrations don't update diagrams. You run
ALTER TABLE orders ADD COLUMN shipping_cost_cents integer;and nobody thinks to update the diagram. - Diagrams live in the wrong place. If your diagram is in Confluence or Figma, it's disconnected from the code.
- Nobody owns it. Diagram maintenance falls between "frontend" and "backend" and "DevOps."
The three fixes
Fix 1: Generate from the live database
Use dbdiagramr -- paste your connection string, get a diagram in seconds. Your schema is always current.
Fix 2: Generate in CI/CD
Add a schema diagram step to your CI pipeline. Run it on every push to main. The diagram is always one commit behind, but close enough.
Fix 3: One-page SCHEMA.md
Maintain a single markdown file with the schema overview. Update it in the same PR that adds or changes a column. Put it in your PR checklist.
FAQ
How often should I update my schema diagram?
Every time you add, remove, or rename a column. With dbdiagramr, it's always current.
Should I commit the diagram to git?
Yes. Commit it as an SVG or markdown file so it's versioned with your code.
What's the minimum viable schema documentation?
A one-page SCHEMA.md with table names, key columns, and relationships.