Appearance
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
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
- Download the file above.
- Open dbdiagram.io/d → New Diagram.
- 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.sqlWhat's inside
- 24 tables in the
lmsschema — tenants, users, products, lessons, exams, tracks and activity tables. - 8 tables in the
metricsschema — 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 plainBIGINTwithoutREFERENCESconstraints; 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.