Skip to content

DBML

DBML (Database Markup Language) is the schema-definition format used by dbdiagram.io. The OpenDB schema is published as a single DBML file you can drop into a diagram, convert to SQL DDL, or feed to other tooling.

Download

⬇ opendb.dbml

Single file with all 32 tables (24 in the lms schema, 8 in metrics) and the logical foreign-key references between them.

Open it in dbdiagram.io

  1. Download the file above.
  2. Open dbdiagram.io/dNew Diagram.
  3. Paste the file's contents in the editor (or use Import → DBML).

dbdiagram.io will render the full ER diagram. From there you can export as PostgreSQL DDL, MySQL, MSSQL, PDF or PNG.

Convert to SQL with the CLI

The official @dbml/cli generates DDL from the file:

bash
npm install -g @dbml/cli

# PostgreSQL
dbml2sql opendb.dbml --postgres -o opendb.sql

# MySQL
dbml2sql opendb.dbml --mysql -o opendb.sql

What's inside

  • 24 tables in the lms schema — tenants, users, products, lessons, exams, tracks and activity tables.
  • 8 tables in the metrics schema — pre-aggregated KPIs.
  • Composite primary keys declared via Indexes { (...) [pk] } blocks (e.g. metrics.daily_counters, lms.user_product_progress, lms.track_products).
  • Logical foreign keys declared as Ref: lines. The actual tables store these as plain BIGINT without REFERENCES constraints; the refs document the relationships used by analytical queries.

Notes

  • Tables are schema-qualified using DBML's "schema"."table" syntax, so dbdiagram.io will render the two schemas as separate groups.
  • The file is regenerated alongside the rest of the documentation; treat it as authoritative.

OpenDB · Cademi LMS Data Warehouse