Skip to main content

DBML Export

Export your schema as DBML (Database Markup Language) — a human-readable format for database schema documentation.

What is DBML?

DBML is an open-source DSL for defining database schemas. It's more readable than SQL for documentation purposes.

Steps

  1. Click Export in the top-right of the ERD panel
  2. Select DBML
  3. Click Download or Copy to clipboard

DBML example

Table users {
id integer [pk, increment]
email varchar(255) [not null, unique]
name varchar(255)
role user_role [not null, default: 'member']
created_at timestamp [not null, default: `now()`]
}

Table posts {
id integer [pk, increment]
user_id integer [not null, ref: > users.id]
title varchar(500) [not null]
body text
created_at timestamp [not null, default: `now()`]
}

Enum user_role {
admin
member
viewer
}

Use cases

  • Store in your repo as a schema documentation file
  • Use with DBML-compatible code generators