← All tables
mdl_context
TRANSFORMMoodle context hierarchy · 6 columnsProposed target
legacy_context_map (migration only) + target ownership links
Migration rule
Use context to resolve course/module/user ownership and file scope
Verification required
Do not reproduce Moodle context table as runtime RBAC without a designed target permission model.
Tracking
Sign in to update status, owner and notes.
| Column | Type | Null | Default | Target mapping | Risk |
|---|---|---|---|---|---|
| id | bigint | Not null | Preserve as legacy source ID; generate target PK unless target accepts stable legacy key. | High: verify semantics/relationship/security | |
| contextlevel | bigint | Not null | '0' | Transform text/JSON/HTML as appropriate; sanitize and rewrite embedded Moodle URLs/file references. | Schema-only inference |
| instanceid | bigint | Not null | '0' | Resolve to target foreign key via source-ID crosswalk; do not assume numeric IDs match target IDs. | High: verify semantics/relationship/security |
| path | varchar(255) | Nullable | Map same-named field where semantics match; confirm target type, nullability, defaults and business meaning. | Schema-only inference | |
| depth | tinyint | Not null | '0' | Map same-named field where semantics match; confirm target type, nullability, defaults and business meaning. | Schema-only inference |
| locked | tinyint | Not null | '0' | Map through explicit enum/boolean translation; retain source value and test edge cases. | Schema-only inference |