FlowDiagram
Database & ER modelsDBML

Learning management system schema template

Courses, modules, lessons, enrolments, quizzes and progress tracking for an e-learning platform. This data model has 9 tables and 39 columns, joined by 11 relationships. FlowDiagram draws it as an entity-relationship diagram with crow's-foot notation.

Open in the editor →
  • Free — no account, no trial, no watermark
  • Fully editable shapes and connectors, not a screenshot
  • Export PNG, SVG or PDF, or share it as a link
  • Private: the diagram never leaves your browser

Tables in this data model

  • users — 4 columns
  • courses — 4 columns
  • modules — 4 columns
  • lessons — 5 columns
  • enrollments — 5 columns
  • lesson_progress — 5 columns
  • quizzes — 3 columns
  • quiz_attempts — 5 columns
  • certificates — 4 columns

How to use this ER diagram template

  1. Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
  2. Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
  3. Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
  4. Prefer text? Edit the DBML below and paste it in through ☰ → Import diagram; the finished model exports to SQL DDL or back to DBML.
  5. Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.

DBML source

The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.

Table users {
  id integer [pk]
  email varchar [unique]
  name varchar
  role varchar
}

Table courses {
  id integer [pk]
  instructor_id integer [ref: > users.id]
  title varchar
  published boolean
}

Table modules {
  id integer [pk]
  course_id integer [ref: > courses.id]
  title varchar
  position integer
}

Table lessons {
  id integer [pk]
  module_id integer [ref: > modules.id]
  title varchar
  video_url varchar
  duration_sec integer
}

Table enrollments {
  id integer [pk]
  user_id integer [ref: > users.id]
  course_id integer [ref: > courses.id]
  enrolled_at timestamp
  completed_at timestamp
}

Table lesson_progress {
  id integer [pk]
  enrollment_id integer [ref: > enrollments.id]
  lesson_id integer [ref: > lessons.id]
  seconds_watched integer
  completed boolean
}

Table quizzes {
  id integer [pk]
  module_id integer [ref: > modules.id]
  pass_mark integer
}

Table quiz_attempts {
  id integer [pk]
  quiz_id integer [ref: > quizzes.id]
  enrollment_id integer [ref: > enrollments.id]
  score integer
  attempted_at timestamp
}

Table certificates {
  id integer [pk]
  enrollment_id integer [ref: > enrollments.id]
  issued_at timestamp
  verify_code varchar [unique]
}

Related: Database schema diagram tool · All database & er models templates · All 521 templates