ERD Best Practices and Database Design

The Schemity blog: database design for software engineers, from crow's foot notation and context views to reverse engineering a live database and keeping your ERD in Git.

PostgreSQL: Changing an Integer Column to Boolean - In Place or a New Column, and the Four Errors on the Way
PostgreSQL: Changing an Integer Column to Boolean - In Place or a New Column, and the Four Errors on the Way
Schemity's guide to turning a Postgres 0/1 integer flag into boolean: the USING clause that works on every width, the errors the cast hits,...
What Breaks When a Database Diagram Reaches 1,000 Tables, and What We Redesigned
What Breaks When a Database Diagram Reaches 1,000 Tables, and What We Redesigned
Schemity at 1,035 tables and 1,822 relations: what broke, how drawing, line jumps, dragging and export were redesigned, the measured cost, a...
PostgreSQL Constraint Naming Convention: Which Pattern to Use, and How to Find the Names That Drifted
PostgreSQL Constraint Naming Convention: Which Pattern to Use, and How to Find the Names That Drifted
Schemity's guide to naming Postgres constraints and indexes: the pattern to pick, the 63-byte cut that makes two names collide, and a query...
PostgreSQL: Cannot Alter Type of a Column Used by a View - How to Change It, and How to Find Every View in the Way
PostgreSQL: Cannot Alter Type of a Column Used by a View - How to Change It, and How to Find Every View in the Way
Schemity's guide to the Postgres view error on a column type change: find every view in the chain, what dropping one loses, and how long rea...
PostgreSQL serial vs identity: Which to Use, and How to Convert Old serial Columns
PostgreSQL serial vs identity: Which to Use, and How to Convert Old serial Columns
Schemity's guide to serial vs identity keys in Postgres: five ways serial misbehaves, tested on 18.3, and the 3 ms conversion that needs no...
Database MCP Server: Should an AI Agent Run SQL or Only Read the Schema?
Database MCP Server: Should an AI Agent Run SQL or Only Read the Schema?
Schemity's guide to what a database MCP server should let an AI agent do: why a read-only transaction is not a guard, and what to use when t...
Changing a Column Type in SQLite: The Table Rebuild and What It Deletes
Changing a Column Type in SQLite: The Table Rebuild and What It Deletes
SQLite has no ALTER COLUMN TYPE, so the fix is a table rebuild. Schemity's guide to the three things a rebuild quietly deletes, and the scri...
ON DELETE SET NULL vs CASCADE vs RESTRICT in PostgreSQL: Which to Use
ON DELETE SET NULL vs CASCADE vs RESTRICT in PostgreSQL: Which to Use
Schemity's guide to picking a Postgres foreign key's ON DELETE action: what each does to the child row, and the three ways SET NULL is accep...
A PostgreSQL Role That Reads the Schema but Not the Data: What to Grant
A PostgreSQL Role That Reads the Schema but Not the Data: What to Grant
A Postgres role with only USAGE on a schema sees every table, key and view definition but no rows. What to grant, what it still learns, and...
Adding a NOT NULL Column to a Large PostgreSQL Table: Constant Default, Backfill or NOT VALID
Adding a NOT NULL Column to a Large PostgreSQL Table: Constant Default, Backfill or NOT VALID
A NOT NULL column on a 5M-row Postgres table took 10 ms with a constant default and 10.4 s with a volatile one. The safe steps, and how Sche...
PostgreSQL numeric vs double precision vs money: Which Type to Use for Prices
PostgreSQL numeric vs double precision vs money: Which Type to Use for Prices
Use numeric for prices in PostgreSQL. Why a float sum changed on every run over 1M rows, what money gets wrong, and how Schemity shows what...
PostgreSQL Generated Column vs Trigger: Which to Use for a Derived Column
PostgreSQL Generated Column vs Trigger: Which to Use for a Derived Column
Generated column or trigger for a derived value in Postgres? What each costs on 1M rows, when only a trigger works, and how Schemity shows w...
PostgreSQL Unique Constraint vs Unique Index: Which to Use, and How to Add One Without Locking the Table
PostgreSQL Unique Constraint vs Unique Index: Which to Use, and How to Add One Without Locking the Table
In Postgres, adding a unique constraint blocks reads and writes; a unique index blocks writes. Which to use, and how Schemity flags the lock...
Polymorphic Associations in PostgreSQL: One commentable_id Column or a Foreign Key per Table?
Polymorphic Associations in PostgreSQL: One commentable_id Column or a Foreign Key per Table?
PostgreSQL cannot enforce a polymorphic commentable_id. Prefer a foreign key per parent or a supertype table; Schemity draws the polymorphic...
Should an AI Agent Write Your Database Migrations? Review the Schema Change, Not the SQL
Should an AI Agent Write Your Database Migrations? Review the Schema Change, Not the SQL
Let an AI agent write the migration, but review what it does to the schema rather than its SQL. Schemity draws an agent's migration file as...
Reverse Engineering a Legacy Database: Let an AI Agent Group the ERD by Domain
Reverse Engineering a Legacy Database: Let an AI Agent Group the ERD by Domain
A reverse engineered ERD shows every table and no domains, because the domains live in the code. Schemity lets an AI agent read that code, g...
PostgreSQL varchar vs text: When a Length Limit Is Worth Declaring
PostgreSQL varchar vs text: When a Length Limit Is Worth Declaring
On PostgreSQL, text and varchar(n) store strings identically, so a length limit is a rule, not an optimization. Schemity's impact analysis s...
Foreign Key Constraints: When Skipping Them Is Right, and What It Costs Your Schema
Foreign Key Constraints: When Skipping Them Is Right, and What It Costs Your Schema
Declare foreign keys wherever your database and migration tooling allow them; where they cannot, skip the enforcement but not the documentat...
PostgreSQL UUID vs Bigint Primary Keys: How to Choose, and What uuidv7 Changed
PostgreSQL UUID vs Bigint Primary Keys: How to Choose, and What uuidv7 Changed
Bigint when one database issues every id, UUIDv7 when something else does, and UUIDv4 as a primary key in neither case. Schemity's fk-type-m...
Column Comments in PostgreSQL and MySQL: How to Document Columns Without a Migration
Column Comments in PostgreSQL and MySQL: How to Document Columns Without a Migration
A column comment costs a full migration cycle, and on MySQL it means restating the entire column definition. Schemity keeps field descriptio...
Circular Foreign Keys: How to Insert the First Row, and How to Find the Cycles You Cannot See
Circular Foreign Keys: How to Insert the First Row, and How to Find the Cycles You Cannot See
NOT NULL foreign keys that point at each other accept no rows. Three ways to insert the first one, and how Schemity's lint finds every cycle...
PostgreSQL timestamp vs timestamptz: Which to Use and How to Find the Wrong Ones
PostgreSQL timestamp vs timestamptz: Which to Use and How to Find the Wrong Ones
timestamptz records an instant, timestamp records a reading on a clock, and your ORM probably chose the second one. Schemity's timestamp-not...
Export a Database Data Dictionary: HTML, Markdown and Excel from Your ERD
Export a Database Data Dictionary: HTML, Markdown and Excel from Your ERD
Schemity exports the diagram as a data dictionary in HTML, Markdown and Excel, covering every column, constraint and relationship, and close...
Schema Linting vs Migration Linting: Which Database Problems Each One Can See
Schema Linting vs Migration Linting: Which Database Problems Each One Can See
Migration linters read the statement you are about to run. Schemity's schema lint reads the model you already have - seventeen rules checked...
Unique Constraints on Nullable Columns: What They Enforce and What They Exempt
Unique Constraints on Nullable Columns: What They Enforce and What They Exempt
A unique constraint covers only the rows where every column in the key has a value. Sometimes that exemption is the design and sometimes it...
Postgres Array Column vs Junction Table: What Each One Does to Your ERD
Postgres Array Column vs Junction Table: What Each One Does to Your ERD
An array of IDs is a many-to-many relationship with no foreign key and no line on the diagram. Schemity renders PostgreSQL array types as re...
DrawSQL Alternative: Database Design Software With No Table Limits
DrawSQL Alternative: Database Design Software With No Table Limits
DrawSQL has no live database connection and caps tables on every plan. Schemity is the offline DrawSQL alternative that reverse engineers yo...
You Cannot Tell Which of Your ERD Files Are Under Version Control
You Cannot Tell Which of Your ERD Files Are Under Version Control
Schemity marks every workspace whose folder sits inside a Git repository with a branch icon, so which database diagrams are version controll...
Why Schemity Has No Zoom: Fuzzy Search and a Minimap Instead
Why Schemity Has No Zoom: Fuzzy Search and a Minimap Instead
Schemity deliberately has no zoom control. Every zoom changes the geography of the diagram and costs you the mental work of re-finding where...
Database Views in Your ERD: Read-Only Entities, Not Fake Tables
Database Views in Your ERD: Read-Only Entities, Not Fake Tables
Most database design software ignores database views or draw them as editable tables. Schemity renders views and materialized views as read-...
SSMS Database Diagrams: Your ERD Is Trapped Inside the Database It Documents
SSMS Database Diagrams: Your ERD Is Trapped Inside the Database It Documents
SSMS stores database diagrams as binary rows in sysdiagrams - no file, no Git, no export. Schemity reverse engineers SQL Server into a local...
Supabase Schema Diagram: Get an ERD You Can Keep, Not a Dashboard View
Supabase Schema Diagram: Get an ERD You Can Keep, Not a Dashboard View
Supabase Studio's Schema Visualizer shows one schema at a time and keeps your layout in one browser's localStorage. Schemity connects to the...
ON DELETE CASCADE Is Invisible in Your ERD and in Your Database Logs
ON DELETE CASCADE Is Invisible in Your ERD and in Your Database Logs
Referential actions decide which rows a single DELETE destroys, yet most database design software never store them and MySQL never logs them...
Postgres Enum vs Check Constraint vs Lookup Table for a Status Column
Postgres Enum vs Check Constraint vs Lookup Table for a Status Column
Native Postgres enums make every value-set change a locking migration, and no diagram tool shows what the allowed values are. Schemity rende...
Lucidchart ERD Alternative: Database Design Software That Connects to Your Database
Lucidchart ERD Alternative: Database Design Software That Connects to Your Database
Lucidchart has no live database connection - schema arrives as a hand-exported CSV. Schemity is the Lucidchart ERD alternative that reverse...
Comparing Staging and Production Database Schemas Side by Side
Comparing Staging and Production Database Schemas Side by Side
Staging and production schemas drift apart, and a text diff of two SQL dumps won't show you where. Schemity opens both environments as diagr...
Roles and Permissions Table Design: Why Permissions Are Not Tenant-Scoped
Roles and Permissions Table Design: Why Permissions Are Not Tenant-Scoped
Roles carry a tenant_id and permissions do not, and that one asymmetry decides the whole design. How the roles, permissions, and junction ta...
Many-to-Many Relationships and Junction Tables: How to Model N:N in an ERD
Many-to-Many Relationships and Junction Tables: How to Model N:N in an ERD
A relational database cannot store a many-to-many relationship directly - it needs a junction table holding one foreign key per parent, whic...
Why Database Design Software Draws Your 1:1 Relationship as 1:N
Why Database Design Software Draws Your 1:1 Relationship as 1:N
database design software misdraws 1:1 relationships as 1:N because they ignore unique constraints. Schemity derives crow's foot cardinality...
Your DDD Context Map Is Already in Your Foreign Keys
Your DDD Context Map Is Already in Your Foreign Keys
Schemity's Context Map derives a DDD context map from the schema itself: each context view becomes a node, and every dependency arrow is bac...
Why Your ERD Export Turns Blurry - and How SVG Export Fixes It
Why Your ERD Export Turns Blurry - and How SVG Export Fixes It
Raster ERD exports blur, crop, or balloon in size. Schemity, database design software, exports crisp SVG or Mermaid text of the whole diagra...
The Data Dictionary Should Live in the ERD, Not in a Spreadsheet
The Data Dictionary Should Live in the ERD, Not in a Spreadsheet
Schemity attaches markdown descriptions to entities, legends, and context views, so what your tables mean lives inside the diagram - not in...
DbSchema Alternative: Database Design Software That Starts in Seconds
DbSchema Alternative: Database Design Software That Starts in Seconds
A DbSchema alternative at less than half the price: Schemity is database design software with JSON-in-Git storage and an MCP server for AI a...
You Don't Need a Diagram of All 800 Tables
You Don't Need a Diagram of All 800 Tables
Inherited a huge undocumented database? A full-schema poster is unreadable by design. Reverse engineer it into database design software, the...
ERD-First Database Design: One 60-Entity Schema, Sketch to Production
ERD-First Database Design: One 60-Entity Schema, Sketch to Production
A real workflow for a 60-entity schema: design the whole model up front, implement it context by context with AI-generated code, then let re...
Keeping Your ERD Updated Shouldn't Be a Second Job
Keeping Your ERD Updated Shouldn't Be a Second Job
ERDs go stale the moment the schema moves on, and re-importing destroys your layout. Schemity re-syncs the diagram from the live database ev...
Switching Database Design Software Shouldn't Mean Starting Over
Switching Database Design Software Shouldn't Mean Starting Over
Most diagram tools only let your schema out as a picture or bare DDL, so years of work stay trapped. Database design software with DBML and...
Database Design Software Free-Tier Limits: 15-Table and 60-Object Caps Distort Models
Database Design Software Free-Tier Limits: 15-Table and 60-Object Caps Distort Models
Free-tier database design software caps you at 15 tables or 60 objects and paywall private diagrams, so the pricing page ends up shaping you...
How to Keep ERD Relationship Lines Readable: Hops, Waypoints, Colors
How to Keep ERD Relationship Lines Readable: Hops, Waypoints, Colors
When relationship lines cross, most schema visualizers make you guess which one you were following. Schemity - database design software with...
AI Database Design With a Local Model: Schema Help That Never Leaves Your Machine
AI Database Design With a Local Model: Schema Help That Never Leaves Your Machine
Connect a local-model MCP host to Schemity's MCP server for private AI database design with zero cloud calls - for teams where cloud AI is b...
Supabase Studio and pgAdmin Won't Give You a Schema Diagram You Own
Supabase Studio and pgAdmin Won't Give You a Schema Diagram You Own
Supabase Studio draws your schema but keeps the layout in one browser's localStorage; pgAdmin's exports follow the UI theme. Database design...
Finding a Column Shouldn't Take a SQL Query
Finding a Column Shouldn't Take a SQL Query
Millions of developers query information_schema just to find which table holds a column. Database design software with fuzzy search across e...
Your ERD Shouldn't Be Able to Just Disappear
Your ERD Shouldn't Be Able to Just Disappear
Cloud diagram tools can lose your ERD - one day it is just gone from the list, and recovery means a support ticket or a paid tier. Database...
ChartDB Alternative: Database Design Software That Runs on Your Machine
ChartDB Alternative: Database Design Software That Runs on Your Machine
A ChartDB alternative that runs offline: Schemity is database design software with an MCP server for AI agents, diagrams stored as JSON in G...
Entity Templates: How to Stop Schema Naming and Field-Order Drift
Entity Templates: How to Stop Schema Naming and Field-Order Drift
Schema drift starts at the blank entity. How entity templates and convention-aware field placement in database design software keeps every t...
Documenting Your Production Database Shouldn't Feel Dangerous
Documenting Your Production Database Shouldn't Feel Dangerous
How to document a production database schema without fear: database design software that connects through SSH tunnels, keeps passwords in yo...
Your Client's Schema Doesn't Belong in Your Cloud Account
Your Client's Schema Doesn't Belong in Your Cloud Account
database design software for consultants and client work: one workspace per client, stored as local folders you can hand over or delete when...
Stop Hand-Translating Between SQL and Your ERD
Stop Hand-Translating Between SQL and Your ERD
Generate an ERD from a SQL dump, import CREATE TABLE statements in one paste, and turn diagram edits into a reviewed migration SQL diff - al...
AI Help With Your Database Design, Without a Vendor Cloud in the Middle
AI Help With Your Database Design, Without a Vendor Cloud in the Middle
Private AI database design over MCP: Claude Code or Cursor reads your schema through Schemity on your machine and stages edits you review. N...
You Cannot Judge Coupling and Cohesion From the Same View
You Cannot Judge Coupling and Cohesion From the Same View
Low coupling and high cohesion are two questions at two scales. See why the main ERD perspective and a database context view answer differen...
Database Context Views Should Show the Relationships They Hide
Database Context Views Should Show the Relationships They Hide
Database context views and ERD perspectives give focus by removing noise - but they also take. Here is what a sub-diagram in your database d...
Crow's Foot Notation in ER Diagrams: Every Symbol Mapped to SQL
Crow's Foot Notation in ER Diagrams: Every Symbol Mapped to SQL
A bar means one, a crow's foot means many, a circle means zero is allowed. This guide maps every crow's foot symbol in an ER diagram to the...
Multi-Tenant RBAC Schema Design: 7 Tables, Step by Step (With ERD)
Multi-Tenant RBAC Schema Design: 7 Tables, Step by Step (With ERD)
The complete multi-tenant RBAC schema is seven tables: tenants, users, members, roles, permissions, and two junction tables. Here is the ful...
dbdiagram.io Alternative: Database Design Software, One-Time Purchase
dbdiagram.io Alternative: Database Design Software, One-Time Purchase
dbdiagram.io's free tier is 10 public diagrams, then $14/month. Schemity is the offline dbdiagram.io alternative: private by default, diagra...
Database Design Software With Custom Waypoints and Color-Coded Relationships
Database Design Software With Custom Waypoints and Color-Coded Relationships
Most database design software treats schema work as a chore. What if database design software got out of the way - with ERD custom waypoints...
Database Design Software Built for Software Engineers Who Touch a Database
Database Design Software Built for Software Engineers Who Touch a Database
Import a workspace from anywhere on your machine and treat your ERD like infrastructure - version-controlled in Git, reviewed in PRs, and ke...
ERD Check Constraints: Show Business Rules in Your Diagram
ERD Check Constraints: Show Business Rules in Your Diagram
ERD check constraints support turns your schema into living documentation. See how domain-driven design database schema patterns surface val...
Keyboard-First ERD Design: Build a Schema Without Touching the Mouse
Keyboard-First ERD Design: Build a Schema Without Touching the Mouse
The best ideas happen fast. Most database design software makes you slow down. Database design software built for the speed of thought - key...
The ERD that lives in your Git repo
The ERD that lives in your Git repo
Stop exporting PNGs to Confluence. Database design software stores your database diagrams as JSON files you can version control, review in P...