Changes
Page history
Create database tables
authored
Sep 27, 2024
by
Elke Kreim
Show whitespace changes
Inline
Side-by-side
database-tables.md
0 → 100644
View page @
339142a7
### Database Tables
Tables required to fetch enrolled users depending on their course role.
#### mdl_user_enrolments
You can find API documentation for Enrolement API here:
https://moodledev.io/docs/4.4/apis/subsystems/enrol
```
bash
Table
"public.mdl_user_enrolments"
Column | Type | Collation | Nullable | Default
--------------
+--------+-----------+----------+-------------------------------------------------
id
| bigint | | not null | nextval
(
'mdl_user_enrolments_id_seq'
::regclass
)
status | bigint | | not null | 0
enrolid | bigint | | not null |
userid | bigint | | not null |
timestart | bigint | | not null | 0
timeend | bigint | | not null | 2147483647
modifierid | bigint | | not null | 0
timecreated | bigint | | not null | 0
timemodified | bigint | | not null | 0
Indexes:
"mdl_userenro_id_pk"
PRIMARY KEY, btree
(
id
)
"mdl_userenro_enr_ix"
btree
(
enrolid
)
"mdl_userenro_enruse_uix"
UNIQUE, btree
(
enrolid, userid
)
"mdl_userenro_mod_ix"
btree
(
modifierid
)
"mdl_userenro_use_ix"
btree
(
userid
)
```
### mdl_role
```
bash
Table
"public.mdl_role"
Column | Type | Collation | Nullable | Default
-------------
+------------------------+-----------+----------+--------------------------------------
id
| bigint | | not null | nextval
(
'mdl_role_id_seq'
::regclass
)
name | character varying
(
255
)
| | not null |
''
::character varying
shortname | character varying
(
100
)
| | not null |
''
::character varying
description | text | | not null |
sortorder | bigint | | not null | 0
archetype | character varying
(
30
)
| | not null |
''
::character varying
Indexes:
"mdl_role_id_pk"
PRIMARY KEY, btree
(
id
)
"mdl_role_sho_uix"
UNIQUE, btree
(
shortname
)
"mdl_role_sor_uix"
UNIQUE, btree
(
sortorder
)
```
### mdl_role_assignment
```
bash
Table
"public.mdl_role_assignments"
Column | Type | Collation | Nullable | Default
--------------
+------------------------+-----------+----------+--------------------------------------------------
id
| bigint | | not null | nextval
(
'mdl_role_assignments_id_seq'
::regclass
)
roleid | bigint | | not null | 0
contextid | bigint | | not null | 0
userid | bigint | | not null | 0
timemodified | bigint | | not null | 0
modifierid | bigint | | not null | 0
component | character varying
(
100
)
| | not null |
''
::character varying
itemid | bigint | | not null | 0
sortorder | bigint | | not null | 0
Indexes:
"mdl_roleassi_id_pk"
PRIMARY KEY, btree
(
id
)
"mdl_roleassi_comiteuse_ix"
btree
(
component, itemid, userid
)
"mdl_roleassi_con_ix"
btree
(
contextid
)
"mdl_roleassi_rol_ix"
btree
(
roleid
)
"mdl_roleassi_rolcon_ix"
btree
(
roleid, contextid
)
"mdl_roleassi_sor_ix"
btree
(
sortorder
)
"mdl_roleassi_use_ix"
btree
(
userid
)
"mdl_roleassi_useconrol_ix"
btree
(
userid, contextid, roleid
)
```