Drizzle Schema Validator

Paste a Drizzle schema (pgTable, mysqlTable, sqliteTable) to detect missing primary keys, broken relations, and other common mistakes. Everything runs in your browser.

Paste a Drizzle schema on the left to see validation results here.

What it checks

  • CheckMissingPrimaryKey — every table declares a primary key, either via .primaryKey() on a column or a composite primaryKey(...) helper.
  • TypeMismatchInRelations — foreign key columns use the same type family as the column they reference (e.g. a text column cannot reference a serial id).
  • DuplicateTableName / DuplicateColumnName — no collisions inside the schema.
  • MixedDialects — warns when pgTable, mysqlTable, and sqliteTable coexist in one file.
  • EmptyTable — a table with no columns is almost certainly a mistake.
  • NullablePrimaryKey — info-level nudge to add an explicit .notNull() on PK columns.

How it works

The validator uses a small TypeScript parser to locate every pgTable / mysqlTable / sqliteTable definition, then runs a set of rules against the parsed schema. Each rule returns issues with a line number and severity, which get surfaced in the editor gutter and the list on the right.