# Data model

> The tables of the Learn engine and what each one holds.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://learn.docs.sypnia.com/architecture/data-model/

For agents: Schema sypnia_learn: courses (id, org nullable = public, title, levels, languages, current_version), course_versions (course, version, files_key, published_by, at), lessons (course, id, version, level[], step, needs[], uses jsonb, exercise jsonb, minutes, video jsonb), learners (person id from the account or OIDC subject, level, language, settings jsonb), exercises (id ex_…, person, lesson, lesson_version, project, repo, branch, state, created/updated), check_runs (id, exercise, commit, state queued|running|done|error, results jsonb [{check, result pass|fail|error, message}], started/finished), progress (person, lesson, status started|done, version, done_at, video_position), shares (person, org), offers (id, person, trigger, lesson, project, shown_at, state open|later|dismissed|forever), memory_notes (person, lesson, note_id in the account memory). No content of explanations; counts only (explain_usage: person, day, count).

| Table             | Holds                                                                                                  |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| `courses`         | each course: its organization (empty for public courses), title, levels, languages and current version |
| `course_versions` | every published version, where its files are, who published it and when                                |
| `lessons`         | each lesson of a version: level, step, needs, `uses`, exercise and checks, video                       |
| `learners`        | a person: their id (from the Sypnia account, or the engine's sign-in), level, language and settings    |
| `exercises`       | each exercise: person, lesson and its version, project, repository, branch, state                      |
| `check_runs`      | each run: the commit, its state and the result of every check, with the message shown                  |
| `progress`        | per person and lesson: started or done, the version, when, and where the video stopped                 |
| `shares`          | the organizations a person shares their progress with                                                  |
| `offers`          | lessons offered: the trigger, the lesson, when it was shown and what the person chose                  |
| `memory_notes`    | which notes in the person's memory Learn wrote, so deleting progress deletes them too                  |
| `explain_usage`   | how many explanations a person asked for, per day; never their content                                 |

Course files and videos live in object storage, under the version that published them, so a learner always sees the version they started.
