Guides

DBML guide

Schemadrop renders standard DBML. This page is the working subset you'll use daily; the full language spec lives at dbml.dbdiagram.io.

Tables

Table users {
  id uuid [pk]
  email text [unique, not null]
  name varchar
}

Column attributes: pk, unique, not null, increment, default: value, note: 'text'.

Relationships

Ref: posts.author_id > users.id   // many-to-one
Ref: profiles.user_id - users.id  // one-to-one

Each ref renders as an edge between the exact columns it names. Dragging a connection on the canvas writes the same Ref: line into your text.

Enums

Enum status {
  active
  suspended
}

Reference an enum by using its name as a column type.

Validation

Invalid DBML never breaks the canvas: it freezes at the last valid schema with an indicator while you keep typing. Errors show inline in the editor with line positions.