NOBUG: Fixed file access permissions
[moodle.git] / lib / db / install.xml
CommitLineData
67d7d694 1<?xml version="1.0" encoding="UTF-8" ?>
6c0bfb14 2<XMLDB PATH="lib/db" VERSION="20140918" COMMENT="XMLDB file for core Moodle tables"
647a2566 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
5>
67d7d694 6 <TABLES>
7a18f49c 7 <TABLE NAME="config" COMMENT="Moodle configuration variables">
67d7d694 8 <FIELDS>
7a18f49c
PS
9 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
10 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
11 <FIELD NAME="value" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
67d7d694 12 </FIELDS>
13 <KEYS>
7a18f49c
PS
14 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
15 <KEY NAME="name" TYPE="unique" FIELDS="name"/>
67d7d694 16 </KEYS>
17 </TABLE>
7a18f49c 18 <TABLE NAME="config_plugins" COMMENT="Moodle modules and plugins configuration variables">
67d7d694 19 <FIELDS>
7a18f49c
PS
20 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
21 <FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="core" SEQUENCE="false"/>
22 <FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
23 <FIELD NAME="value" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
67d7d694 24 </FIELDS>
25 <KEYS>
7a18f49c
PS
26 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
27 <KEY NAME="plugin_name" TYPE="unique" FIELDS="plugin, name"/>
67d7d694 28 </KEYS>
29 </TABLE>
7a18f49c 30 <TABLE NAME="config_log" COMMENT="Changes done in server configuration through admin UI">
301bf0b2 31 <FIELDS>
7a18f49c
PS
32 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
33 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
34 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
35 <FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
36 <FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
37 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
38 <FIELD NAME="oldvalue" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
301bf0b2 39 </FIELDS>
40 <KEYS>
7a18f49c
PS
41 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
42 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
301bf0b2 43 </KEYS>
44 <INDEXES>
45 <INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified"/>
46 </INDEXES>
47 </TABLE>
7a18f49c 48 <TABLE NAME="upgrade_log" COMMENT="Upgrade logging">
1f20942c 49 <FIELDS>
7a18f49c
PS
50 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
51 <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="type: 0==info, 1==notice, 2==error"/>
52 <FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
53 <FIELD NAME="version" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="plugin or main version if known"/>
54 <FIELD NAME="targetversion" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="version of plugin or core specified in version.php at the time of upgrade loggging"/>
55 <FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
56 <FIELD NAME="details" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
57 <FIELD NAME="backtrace" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
58 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
59 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1f20942c 60 </FIELDS>
61 <KEYS>
7a18f49c
PS
62 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
63 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
1f20942c 64 </KEYS>
65 <INDEXES>
7a18f49c
PS
66 <INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified"/>
67 <INDEX NAME="type-timemodified" UNIQUE="false" FIELDS="type, timemodified"/>
68 </INDEXES>
69 </TABLE>
70 <TABLE NAME="course" COMMENT="Central course table">
71 <FIELDS>
72 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
73 <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
74 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
75 <FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false"/>
76 <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
77 <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
78 <FIELD NAME="summary" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
79 <FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
80 <FIELD NAME="format" TYPE="char" LENGTH="21" NOTNULL="true" DEFAULT="topics" SEQUENCE="false"/>
81 <FIELD NAME="showgrades" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
7a18f49c
PS
82 <FIELD NAME="newsitems" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
83 <FIELD NAME="startdate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
84 <FIELD NAME="marker" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
85 <FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
86 <FIELD NAME="legacyfiles" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="course files are not necessary any more: 0 no legacy files, 1 legacy files disabled, 2 legacy files enabled"/>
87 <FIELD NAME="showreports" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
88 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
89 <FIELD NAME="visibleold" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="the state of visible field when hiding parent category, this helps us to recover hidden states when unhiding the parent category later"/>
90 <FIELD NAME="groupmode" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
91 <FIELD NAME="groupmodeforce" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
92 <FIELD NAME="defaultgroupingid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="default grouping used in course modules, does not have key intentionally"/>
93 <FIELD NAME="lang" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
62321a7b 94 <FIELD NAME="calendartype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
7a18f49c
PS
95 <FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
96 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
97 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
98 <FIELD NAME="requested" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
99 <FIELD NAME="enablecompletion" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = allow use of 'completion' progress-tracking on this course. 0 = disable completion tracking on this course."/>
7a18f49c 100 <FIELD NAME="completionnotify" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify users when they complete this course"/>
299cfee5 101 <FIELD NAME="cacherev" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Incrementing revision for validating the course content cache"/>
67d7d694 102 </FIELDS>
103 <KEYS>
52cb2e47 104 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 105 </KEYS>
106 <INDEXES>
7a18f49c
PS
107 <INDEX NAME="category" UNIQUE="false" FIELDS="category"/>
108 <INDEX NAME="idnumber" UNIQUE="false" FIELDS="idnumber"/>
109 <INDEX NAME="shortname" UNIQUE="false" FIELDS="shortname"/>
110 <INDEX NAME="sortorder" UNIQUE="false" FIELDS="sortorder"/>
67d7d694 111 </INDEXES>
112 </TABLE>
7a18f49c 113 <TABLE NAME="course_categories" COMMENT="Course categories">
67d7d694 114 <FIELDS>
7a18f49c
PS
115 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
116 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
117 <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
118 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
119 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
120 <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
121 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
122 <FIELD NAME="coursecount" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
123 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
124 <FIELD NAME="visibleold" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="the state of visible field when hiding parent category, this helps us to recover hidden states when unhiding the parent category later"/>
125 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
126 <FIELD NAME="depth" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
127 <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
128 <FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false" COMMENT="Theme for the category"/>
67d7d694 129 </FIELDS>
130 <KEYS>
7a18f49c
PS
131 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
132 <KEY NAME="parent" TYPE="foreign" FIELDS="parent" REFTABLE="course_categories" REFFIELDS="id" COMMENT="note that to make this recursive FK working someday, the parent field must be declared NULL"/>
67d7d694 133 </KEYS>
134 </TABLE>
7a18f49c 135 <TABLE NAME="course_completion_aggr_methd" COMMENT="Course completion aggregation methods for criteria">
2be4d090 136 <FIELDS>
7a18f49c
PS
137 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
138 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
139 <FIELD NAME="criteriatype" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The criteria type we are aggregating, or NULL if complete course aggregation"/>
140 <FIELD NAME="method" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = all, 2 = any, 3 = fraction, 4 = unit"/>
141 <FIELD NAME="value" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="NULL = all/any, 0..1 for method 'fraction', &gt; 0 for method 'unit'"/>
2be4d090
MD
142 </FIELDS>
143 <KEYS>
144 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
145 </KEYS>
146 <INDEXES>
7a18f49c
PS
147 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
148 <INDEX NAME="criteriatype" UNIQUE="false" FIELDS="criteriatype"/>
149 <INDEX NAME="coursecriteriatype" UNIQUE="true" FIELDS="course, criteriatype"/>
2be4d090
MD
150 </INDEXES>
151 </TABLE>
7a18f49c 152 <TABLE NAME="course_completion_criteria" COMMENT="Course completion criteria">
2be4d090 153 <FIELDS>
7a18f49c
PS
154 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
155 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
156 <FIELD NAME="criteriatype" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Type of criteria"/>
157 <FIELD NAME="module" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Type of module (if using module criteria type)"/>
158 <FIELD NAME="moduleinstance" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Module instance id (if using module criteria type)"/>
159 <FIELD NAME="courseinstance" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Course instance id (if using course criteria type)"/>
160 <FIELD NAME="enrolperiod" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Number of days after enrolment the course is completed (if using enrolperiod criteria type)"/>
161 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Timestamp of the date for course completion (if using date criteria type)"/>
162 <FIELD NAME="gradepass" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="The minimum grade needed to pass the course (if passing grade criteria enabled)"/>
163 <FIELD NAME="role" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
2be4d090
MD
164 </FIELDS>
165 <KEYS>
166 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
167 </KEYS>
168 <INDEXES>
169 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
170 </INDEXES>
171 </TABLE>
7a18f49c 172 <TABLE NAME="course_completion_crit_compl" COMMENT="Course completion user records">
2be4d090 173 <FIELDS>
7a18f49c
PS
174 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
175 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
176 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
177 <FIELD NAME="criteriaid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Completion criteria this references"/>
178 <FIELD NAME="gradefinal" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="The final grade for the course (included regardless of whether a passing grade was required)"/>
179 <FIELD NAME="unenroled" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Timestamp when the user was unenroled"/>
180 <FIELD NAME="timecompleted" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
2be4d090
MD
181 </FIELDS>
182 <KEYS>
183 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
184 </KEYS>
185 <INDEXES>
7a18f49c
PS
186 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
187 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
188 <INDEX NAME="criteriaid" UNIQUE="false" FIELDS="criteriaid"/>
189 <INDEX NAME="timecompleted" UNIQUE="false" FIELDS="timecompleted"/>
190 <INDEX NAME="useridcoursecriteriaid" UNIQUE="true" FIELDS="userid, course, criteriaid"/>
2be4d090
MD
191 </INDEXES>
192 </TABLE>
7a18f49c 193 <TABLE NAME="course_completions" COMMENT="Course completion records">
2be4d090 194 <FIELDS>
7a18f49c
PS
195 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
196 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
197 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
198 <FIELD NAME="timeenrolled" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
199 <FIELD NAME="timestarted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
200 <FIELD NAME="timecompleted" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
201 <FIELD NAME="reaggregate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2be4d090
MD
202 </FIELDS>
203 <KEYS>
204 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
205 </KEYS>
206 <INDEXES>
7a18f49c
PS
207 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
208 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
209 <INDEX NAME="timecompleted" UNIQUE="false" FIELDS="timecompleted"/>
210 <INDEX NAME="useridcourse" UNIQUE="true" FIELDS="userid, course"/>
211 </INDEXES>
212 </TABLE>
213 <TABLE NAME="enrol" COMMENT="Instances of enrolment plugins used in courses, fields marked as custom have a plugin defined meaning, core does not touch them. Create a new linked table if you need even more custom fields.">
214 <FIELDS>
215 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
216 <FIELD NAME="enrol" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
217 <FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0..9 are system constants, 0 means active enrolment, see ENROL_STATUS_* constants, plugins may define own status greater than 10"/>
218 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
219 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="order of enrol plugins in each course"/>
220 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Optional instance name"/>
221 <FIELD NAME="enrolperiod" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - enrolment duration"/>
222 <FIELD NAME="enrolstartdate" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - start of self enrolment"/>
223 <FIELD NAME="enrolenddate" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - end of enrolment"/>
224 <FIELD NAME="expirynotify" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - notify users before expiration"/>
225 <FIELD NAME="expirythreshold" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - when should be the participants notified"/>
226 <FIELD NAME="notifyall" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - Notify both participant and person responsible for enrolments"/>
227 <FIELD NAME="password" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - enrolment or access password"/>
228 <FIELD NAME="cost" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - enrolment cost"/>
229 <FIELD NAME="currency" TYPE="char" LENGTH="3" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - cost currency"/>
230 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Custom - the default role given to participants who self-enrol"/>
231 <FIELD NAME="customint1" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
232 <FIELD NAME="customint2" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
233 <FIELD NAME="customint3" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
234 <FIELD NAME="customint4" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
235 <FIELD NAME="customint5" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
236 <FIELD NAME="customint6" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
237 <FIELD NAME="customint7" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
238 <FIELD NAME="customint8" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general int"/>
239 <FIELD NAME="customchar1" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name"/>
240 <FIELD NAME="customchar2" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name"/>
241 <FIELD NAME="customchar3" TYPE="char" LENGTH="1333" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name"/>
242 <FIELD NAME="customdec1" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7" COMMENT="Custom - general decimal"/>
243 <FIELD NAME="customdec2" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7" COMMENT="Custom - general decimal"/>
244 <FIELD NAME="customtext1" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
245 <FIELD NAME="customtext2" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
246 <FIELD NAME="customtext3" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
247 <FIELD NAME="customtext4" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text"/>
248 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
249 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
df997f84
PS
250 </FIELDS>
251 <KEYS>
7a18f49c
PS
252 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
253 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
df997f84
PS
254 </KEYS>
255 <INDEXES>
256 <INDEX NAME="enrol" UNIQUE="false" FIELDS="enrol"/>
257 </INDEXES>
258 </TABLE>
7a18f49c 259 <TABLE NAME="user_enrolments" COMMENT="Users participating in courses (aka enrolled users) - everybody who is participating/visible in course, that means both teachers and students">
67d7d694 260 <FIELDS>
7a18f49c
PS
261 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
262 <FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0..9 are system constants, 0 means active participation, see ENROL_PARTICIPATION_* constants, plugins may define own status greater than 10"/>
263 <FIELD NAME="enrolid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
264 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
265 <FIELD NAME="timestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
266 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="2147483647" SEQUENCE="false"/>
267 <FIELD NAME="modifierid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
268 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
269 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
67d7d694 270 </FIELDS>
271 <KEYS>
7a18f49c
PS
272 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
273 <KEY NAME="enrolid" TYPE="foreign" FIELDS="enrolid" REFTABLE="enrol" REFFIELDS="id"/>
274 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
275 <KEY NAME="modifierid" TYPE="foreign" FIELDS="modifierid" REFTABLE="user" REFFIELDS="id"/>
67d7d694 276 </KEYS>
277 <INDEXES>
df997f84 278 <INDEX NAME="enrolid-userid" UNIQUE="true" FIELDS="enrolid, userid" COMMENT="Only one enrolment per plugin allowed"/>
67d7d694 279 </INDEXES>
280 </TABLE>
7a18f49c
PS
281 <TABLE NAME="course_modules" COMMENT="course_modules table retrofitted from MySQL">
282 <FIELDS>
283 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
284 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
285 <FIELD NAME="module" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
286 <FIELD NAME="instance" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
287 <FIELD NAME="section" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
288 <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="customizable idnumber"/>
289 <FIELD NAME="added" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
290 <FIELD NAME="score" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
291 <FIELD NAME="indent" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
292 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
293 <FIELD NAME="visibleold" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
294 <FIELD NAME="groupmode" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
295 <FIELD NAME="groupingid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
7a18f49c
PS
296 <FIELD NAME="completion" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether the completion-tracking facilities are enabled for this activity. 0 = not enabled (database default) 1 = manual tracking, user can tick this activity off (UI default for most activity types) 2 = automatic tracking, system should mark completion according to rules specified in course_moduleS_completion"/>
297 <FIELD NAME="completiongradeitemnumber" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Grade-item number used to track automatic completion, if applicable."/>
298 <FIELD NAME="completionview" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Controls whether a page view is part of the automatic completion requirements for this activity. 0 = view not required 1 = view required"/>
299 <FIELD NAME="completionexpected" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Date at which students are expected to complete this activity. This field is used when displaying student progress."/>
7a18f49c 300 <FIELD NAME="showdescription" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Some module types support a 'description' which shows within the module pages. This option controls whether it also displays on the course main page. 0 = does not display (default), 1 = displays"/>
8e97006a 301 <FIELD NAME="availability" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Availability restrictions for viewing this activity, in JSON format. Null if no restrictions."/>
67d7d694 302 </FIELDS>
303 <KEYS>
7a18f49c
PS
304 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
305 <KEY NAME="groupingid" TYPE="foreign" FIELDS="groupingid" REFTABLE="groupings" REFFIELDS="id"/>
67d7d694 306 </KEYS>
307 <INDEXES>
7a18f49c
PS
308 <INDEX NAME="visible" UNIQUE="false" FIELDS="visible"/>
309 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
310 <INDEX NAME="module" UNIQUE="false" FIELDS="module"/>
311 <INDEX NAME="instance" UNIQUE="false" FIELDS="instance"/>
312 <INDEX NAME="idnumber-course" UNIQUE="false" FIELDS="idnumber, course" COMMENT="non unique index (although programatically we are guarantying some sort of uniqueness both under this table and the grade_items one). TODO: We need a central store of module idnumbers in the future."/>
67d7d694 313 </INDEXES>
314 </TABLE>
7a18f49c 315 <TABLE NAME="course_modules_completion" COMMENT="Stores the completion state (completed or not completed, etc) of each user on each activity.">
4e781c7b 316 <FIELDS>
7a18f49c
PS
317 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
318 <FIELD NAME="coursemoduleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Activity that has been completed (or not)."/>
319 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of user who has (or hasn't) completed the activity."/>
320 <FIELD NAME="completionstate" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false" COMMENT="Whether or not the user has completed the activity. Available states: 0 = not completed [if there's no row in this table, that also counts as 0] 1 = completed 2 = completed, show passed 3 = completed, show failed"/>
321 <FIELD NAME="viewed" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Tracks whether or not this activity has been viewed. NULL = we are not tracking viewed for this activity 0 = not viewed 1 = viewed"/>
322 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time at which the completion state last changed."/>
4e781c7b 323 </FIELDS>
324 <KEYS>
325 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
326 </KEYS>
327 <INDEXES>
7a18f49c
PS
328 <INDEX NAME="coursemoduleid" UNIQUE="false" FIELDS="coursemoduleid" COMMENT="For quick access via course-module (e.g. when displaying course module settings page and we need to determine whether anyone has completed it)."/>
329 <INDEX NAME="userid-coursemoduleid" UNIQUE="true" FIELDS="userid, coursemoduleid"/>
4e781c7b 330 </INDEXES>
331 </TABLE>
7a18f49c 332 <TABLE NAME="course_sections" COMMENT="to define the sections for each course">
67d7d694 333 <FIELDS>
7a18f49c
PS
334 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
335 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
336 <FIELD NAME="section" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
337 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
338 <FIELD NAME="summary" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
339 <FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
340 <FIELD NAME="sequence" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
341 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
8e97006a 342 <FIELD NAME="availability" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Availability restrictions for viewing this section, in JSON format. Null if no restrictions."/>
67d7d694 343 </FIELDS>
344 <KEYS>
52cb2e47 345 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 346 </KEYS>
347 <INDEXES>
cf76b335 348 <INDEX NAME="course_section" UNIQUE="true" FIELDS="course, section"/>
67d7d694 349 </INDEXES>
350 </TABLE>
7a18f49c 351 <TABLE NAME="course_request" COMMENT="course requests">
67d7d694 352 <FIELDS>
7a18f49c
PS
353 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
354 <FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false"/>
355 <FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
356 <FIELD NAME="summary" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
357 <FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
358 <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
359 <FIELD NAME="reason" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
360 <FIELD NAME="requester" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
361 <FIELD NAME="password" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
67d7d694 362 </FIELDS>
363 <KEYS>
52cb2e47 364 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 365 </KEYS>
366 <INDEXES>
367 <INDEX NAME="shortname" UNIQUE="false" FIELDS="shortname"/>
368 </INDEXES>
369 </TABLE>
7a18f49c 370 <TABLE NAME="course_format_options" COMMENT="Stores format-specific options for the course or course section">
29ac9fc1 371 <FIELDS>
7a18f49c
PS
372 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
373 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Id of the course"/>
374 <FIELD NAME="format" TYPE="char" LENGTH="21" NOTNULL="true" SEQUENCE="false" COMMENT="Format this option is for"/>
375 <FIELD NAME="sectionid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Null if this is a course option, otherwise id of the section this option is for"/>
376 <FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Name of the format option"/>
377 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Value of the format option"/>
29ac9fc1
MG
378 </FIELDS>
379 <KEYS>
7a18f49c
PS
380 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
381 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
29ac9fc1
MG
382 </KEYS>
383 <INDEXES>
384 <INDEX NAME="formatoption" UNIQUE="true" FIELDS="courseid, format, sectionid, name"/>
385 </INDEXES>
386 </TABLE>
7a18f49c 387 <TABLE NAME="filter_active" COMMENT="Stores information about which filters are active in which contexts. Also the filter sort order. See get_active_filters in lib/filterlib.php for how this data is used.">
0fc9c009 388 <FIELDS>
7a18f49c
PS
389 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
390 <FIELD NAME="filter" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The filter internal name, like 'tex'."/>
391 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="References context.id."/>
392 <FIELD NAME="active" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="Whether this filter is active in this context. +1 = On, -1 = Off, no row with this contextid = inherit. As a special case, when contextid points to the system context, -9999 means this filter is completely disabled."/>
393 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Only relevant if contextid points to the system context. In other cases this field should contain 0. The order in which the filters should be applied."/>
0fc9c009 394 </FIELDS>
395 <KEYS>
7a18f49c
PS
396 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
397 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
0fc9c009 398 </KEYS>
399 <INDEXES>
400 <INDEX NAME="contextid-filter" UNIQUE="true" FIELDS="contextid, filter"/>
401 </INDEXES>
402 </TABLE>
7a18f49c 403 <TABLE NAME="filter_config" COMMENT="Stores per-context configuration settings for filters which have them.">
0fc9c009 404 <FIELDS>
7a18f49c
PS
405 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
406 <FIELD NAME="filter" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The filter internal name, like 'tex'."/>
407 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="References context.id."/>
408 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The config variable name."/>
409 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="The correspoding config variable value."/>
0fc9c009 410 </FIELDS>
411 <KEYS>
7a18f49c
PS
412 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
413 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
0fc9c009 414 </KEYS>
415 <INDEXES>
416 <INDEX NAME="contextid-filter-name" UNIQUE="true" FIELDS="contextid, filter, name" COMMENT="In each context, at most one value per name per filter."/>
417 </INDEXES>
418 </TABLE>
7a18f49c
PS
419 <TABLE NAME="event" COMMENT="For everything with a time associated to it">
420 <FIELDS>
421 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
e2e9ff65 422 <FIELD NAME="name" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
7a18f49c
PS
423 <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
424 <FIELD NAME="format" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
425 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
426 <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
427 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
428 <FIELD NAME="repeatid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
429 <FIELD NAME="modulename" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
430 <FIELD NAME="instance" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
431 <FIELD NAME="eventtype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
432 <FIELD NAME="timestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
433 <FIELD NAME="timeduration" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
434 <FIELD NAME="visible" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
435 <FIELD NAME="uuid" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
436 <FIELD NAME="sequence" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
437 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
438 <FIELD NAME="subscriptionid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The event_subscription id this event is associated with."/>
67d7d694 439 </FIELDS>
440 <KEYS>
52cb2e47 441 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 442 </KEYS>
443 <INDEXES>
7a18f49c
PS
444 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
445 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
446 <INDEX NAME="timestart" UNIQUE="false" FIELDS="timestart"/>
447 <INDEX NAME="timeduration" UNIQUE="false" FIELDS="timeduration"/>
448 <INDEX NAME="groupid-courseid-visible-userid" UNIQUE="false" FIELDS="groupid, courseid, visible, userid" COMMENT="used for calendar view"/>
67d7d694 449 </INDEXES>
450 </TABLE>
7a18f49c 451 <TABLE NAME="cache_filters" COMMENT="For keeping information about cached data">
67d7d694 452 <FIELDS>
7a18f49c
PS
453 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
454 <FIELD NAME="filter" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false"/>
455 <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
456 <FIELD NAME="md5key" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false"/>
457 <FIELD NAME="rawtext" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
458 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
67d7d694 459 </FIELDS>
460 <KEYS>
52cb2e47 461 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 462 </KEYS>
463 <INDEXES>
464 <INDEX NAME="filter_md5key" UNIQUE="false" FIELDS="filter, md5key"/>
465 </INDEXES>
466 </TABLE>
7a18f49c 467 <TABLE NAME="log" COMMENT="Every action is logged as far as possible">
67d7d694 468 <FIELDS>
7a18f49c
PS
469 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
470 <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
471 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
472 <FIELD NAME="ip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false"/>
473 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
474 <FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
475 <FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
476 <FIELD NAME="action" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
477 <FIELD NAME="url" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
478 <FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
67d7d694 479 </FIELDS>
480 <KEYS>
52cb2e47 481 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 482 </KEYS>
483 <INDEXES>
7a18f49c
PS
484 <INDEX NAME="course-module-action" UNIQUE="false" FIELDS="course, module, action"/>
485 <INDEX NAME="time" UNIQUE="false" FIELDS="time"/>
486 <INDEX NAME="action" UNIQUE="false" FIELDS="action"/>
487 <INDEX NAME="userid-course" UNIQUE="false" FIELDS="userid, course"/>
488 <INDEX NAME="cmid" UNIQUE="false" FIELDS="cmid"/>
67d7d694 489 </INDEXES>
490 </TABLE>
7a18f49c 491 <TABLE NAME="log_queries" COMMENT="Logged database queries.">
b4154c2d 492 <FIELDS>
7a18f49c
PS
493 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
494 <FIELD NAME="qtype" TYPE="int" LENGTH="5" NOTNULL="true" SEQUENCE="false" COMMENT="query type constant"/>
495 <FIELD NAME="sqltext" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="query sql"/>
496 <FIELD NAME="sqlparams" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="query parameters"/>
497 <FIELD NAME="error" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="is error"/>
498 <FIELD NAME="info" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="detailed info such as error text"/>
499 <FIELD NAME="backtrace" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="php execution trace"/>
500 <FIELD NAME="exectime" TYPE="number" LENGTH="10" NOTNULL="true" SEQUENCE="false" DECIMALS="5" COMMENT="query execution time in seconds as float"/>
501 <FIELD NAME="timelogged" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="timestamp when log info stored into db"/>
b4154c2d 502 </FIELDS>
503 <KEYS>
504 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
505 </KEYS>
506 </TABLE>
7a18f49c 507 <TABLE NAME="log_display" COMMENT="For a particular module/action, specifies a moodle table/field">
67d7d694 508 <FIELDS>
7a18f49c
PS
509 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
510 <FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
511 <FIELD NAME="action" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
512 <FIELD NAME="mtable" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
513 <FIELD NAME="field" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false"/>
514 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="owner of the log action"/>
67d7d694 515 </FIELDS>
516 <KEYS>
52cb2e47 517 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 518 </KEYS>
519 <INDEXES>
520 <INDEX NAME="module-action" UNIQUE="true" FIELDS="module, action"/>
521 </INDEXES>
522 </TABLE>
7a18f49c 523 <TABLE NAME="message" COMMENT="Stores all unread messages">
67d7d694 524 <FIELDS>
7a18f49c
PS
525 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
526 <FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
527 <FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
528 <FIELD NAME="subject" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="The message subject"/>
529 <FIELD NAME="fullmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
530 <FIELD NAME="fullmessageformat" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the full message"/>
531 <FIELD NAME="fullmessagehtml" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="html format of message"/>
532 <FIELD NAME="smallmessage" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Smal version of message (eg sms)"/>
533 <FIELD NAME="notification" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
534 <FIELD NAME="contexturl" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="If this message is a notification of an event contexturl should contain a link to view this event. For example if its a notification of a forum post contexturl should contain a link to the forum post."/>
535 <FIELD NAME="contexturlname" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Display text for the contexturl"/>
536 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
67d7d694 537 </FIELDS>
538 <KEYS>
52cb2e47 539 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 540 </KEYS>
541 <INDEXES>
7a18f49c
PS
542 <INDEX NAME="useridfrom" UNIQUE="false" FIELDS="useridfrom"/>
543 <INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
67d7d694 544 </INDEXES>
545 </TABLE>
7a18f49c 546 <TABLE NAME="message_read" COMMENT="Stores all messages that have been read">
67d7d694 547 <FIELDS>
7a18f49c
PS
548 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
549 <FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
550 <FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
551 <FIELD NAME="subject" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="The message subject"/>
552 <FIELD NAME="fullmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
553 <FIELD NAME="fullmessageformat" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the full message"/>
554 <FIELD NAME="fullmessagehtml" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="html format of message"/>
555 <FIELD NAME="smallmessage" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Smal version of message (eg sms)"/>
556 <FIELD NAME="notification" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
557 <FIELD NAME="contexturl" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="If this message is a notification of an event contexturl should contain a link to view this event. For example if its a notification of a forum post contexturl should contain a link to the forum post."/>
558 <FIELD NAME="contexturlname" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Display text for the contexturl"/>
559 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
560 <FIELD NAME="timeread" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
67d7d694 561 </FIELDS>
562 <KEYS>
52cb2e47 563 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 564 </KEYS>
565 <INDEXES>
7a18f49c
PS
566 <INDEX NAME="useridfrom" UNIQUE="false" FIELDS="useridfrom"/>
567 <INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
67d7d694 568 </INDEXES>
569 </TABLE>
7a18f49c 570 <TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
67d7d694 571 <FIELDS>
7a18f49c
PS
572 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
573 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
574 <FIELD NAME="contactid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
575 <FIELD NAME="blocked" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
67d7d694 576 </FIELDS>
577 <KEYS>
52cb2e47 578 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 579 </KEYS>
580 <INDEXES>
581 <INDEX NAME="userid-contactid" UNIQUE="true" FIELDS="userid, contactid"/>
582 </INDEXES>
583 </TABLE>
7a18f49c 584 <TABLE NAME="modules" COMMENT="modules available in the site">
67d7d694 585 <FIELDS>
7a18f49c
PS
586 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
587 <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
7a18f49c
PS
588 <FIELD NAME="cron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
589 <FIELD NAME="lastcron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
590 <FIELD NAME="search" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
591 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
67d7d694 592 </FIELDS>
593 <KEYS>
52cb2e47 594 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 595 </KEYS>
596 <INDEXES>
597 <INDEX NAME="name" UNIQUE="false" FIELDS="name"/>
598 </INDEXES>
599 </TABLE>
7a18f49c 600 <TABLE NAME="my_pages" COMMENT="Extra user pages for the My Moodle system">
03d9401e 601 <FIELDS>
7a18f49c
PS
602 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
603 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="The user who owns this page or 0 for system defaults"/>
604 <FIELD NAME="name" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" COMMENT="The page name (freeform text)"/>
605 <FIELD NAME="private" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Whether or not the page is private (dashboard) or public (profile)"/>
606 <FIELD NAME="sortorder" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The order of the pages for a user"/>
03d9401e
MD
607 </FIELDS>
608 <KEYS>
609 <KEY NAME="id" TYPE="primary" FIELDS="id"/>
610 </KEYS>
611 <INDEXES>
612 <INDEX NAME="user_idx" UNIQUE="false" FIELDS="userid, private"/>
613 </INDEXES>
614 </TABLE>
7a18f49c
PS
615 <TABLE NAME="sessions" COMMENT="Database based session storage - now recommended">
616 <FIELDS>
617 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
618 <FIELD NAME="state" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 means normal session"/>
619 <FIELD NAME="sid" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="Session id"/>
620 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
621 <FIELD NAME="sessdata" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="session content"/>
622 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
623 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
624 <FIELD NAME="firstip" TYPE="char" LENGTH="45" NOTNULL="false" SEQUENCE="false"/>
625 <FIELD NAME="lastip" TYPE="char" LENGTH="45" NOTNULL="false" SEQUENCE="false"/>
67d7d694 626 </FIELDS>
627 <KEYS>
52cb2e47 628 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
7a18f49c 629 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
67d7d694 630 </KEYS>
631 <INDEXES>
7a18f49c
PS
632 <INDEX NAME="state" UNIQUE="false" FIELDS="state"/>
633 <INDEX NAME="sid" UNIQUE="true" FIELDS="sid"/>
634 <INDEX NAME="timecreated" UNIQUE="false" FIELDS="timecreated"/>
635 <INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified"/>
67d7d694 636 </INDEXES>
637 </TABLE>
7a18f49c 638 <TABLE NAME="timezone" COMMENT="Rules for calculating local wall clock time for users">
8b9b5109 639 <FIELDS>
7a18f49c
PS
640 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
641 <FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
642 <FIELD NAME="year" TYPE="int" LENGTH="11" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
643 <FIELD NAME="tzrule" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
644 <FIELD NAME="gmtoff" TYPE="int" LENGTH="11" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
645 <FIELD NAME="dstoff" TYPE="int" LENGTH="11" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
646 <FIELD NAME="dst_month" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
647 <FIELD NAME="dst_startday" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
648 <FIELD NAME="dst_weekday" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
649 <FIELD NAME="dst_skipweeks" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
650 <FIELD NAME="dst_time" TYPE="char" LENGTH="6" NOTNULL="true" DEFAULT="00:00" SEQUENCE="false"/>
651 <FIELD NAME="std_month" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
652 <FIELD NAME="std_startday" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
653 <FIELD NAME="std_weekday" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
654 <FIELD NAME="std_skipweeks" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
655 <FIELD NAME="std_time" TYPE="char" LENGTH="6" NOTNULL="true" DEFAULT="00:00" SEQUENCE="false"/>
656 </FIELDS>
657 <KEYS>
658 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
659 </KEYS>
660 </TABLE>
661 <TABLE NAME="user" COMMENT="One record for each person">
662 <FIELDS>
663 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
664 <FIELD NAME="auth" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="manual" SEQUENCE="false"/>
665 <FIELD NAME="confirmed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
666 <FIELD NAME="policyagreed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
667 <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
668 <FIELD NAME="suspended" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="suspended flag prevents users to log in"/>
669 <FIELD NAME="mnethostid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
670 <FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
ec2d8ceb 671 <FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
7a18f49c
PS
672 <FIELD NAME="idnumber" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
673 <FIELD NAME="firstname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
674 <FIELD NAME="lastname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
675 <FIELD NAME="email" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
676 <FIELD NAME="emailstop" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
677 <FIELD NAME="icq" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false"/>
678 <FIELD NAME="skype" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
679 <FIELD NAME="yahoo" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
680 <FIELD NAME="aim" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
681 <FIELD NAME="msn" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
682 <FIELD NAME="phone1" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
683 <FIELD NAME="phone2" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
a8fd33b0
MG
684 <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
685 <FIELD NAME="department" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
686 <FIELD NAME="address" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
7a18f49c
PS
687 <FIELD NAME="city" TYPE="char" LENGTH="120" NOTNULL="true" SEQUENCE="false"/>
688 <FIELD NAME="country" TYPE="char" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
689 <FIELD NAME="lang" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="en" SEQUENCE="false"/>
62321a7b 690 <FIELD NAME="calendartype" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="gregorian" SEQUENCE="false"/>
7a18f49c
PS
691 <FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
692 <FIELD NAME="timezone" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="99" SEQUENCE="false"/>
693 <FIELD NAME="firstaccess" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
694 <FIELD NAME="lastaccess" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
695 <FIELD NAME="lastlogin" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
696 <FIELD NAME="currentlogin" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
697 <FIELD NAME="lastip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false"/>
698 <FIELD NAME="secret" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false"/>
699 <FIELD NAME="picture" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 means no image uploaded, positive values are revisions thta prevent caching problems, negative values are reserved for future use"/>
700 <FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
701 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
0c4c981f 702 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
7a18f49c
PS
703 <FIELD NAME="mailformat" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
704 <FIELD NAME="maildigest" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
705 <FIELD NAME="maildisplay" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="2" SEQUENCE="false"/>
7a18f49c
PS
706 <FIELD NAME="autosubscribe" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
707 <FIELD NAME="trackforums" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
708 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
709 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
710 <FIELD NAME="trustbitmask" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
711 <FIELD NAME="imagealt" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="alt tag for user uploaded image"/>
a327f25e
AG
712 <FIELD NAME="lastnamephonetic" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Last name phonetic"/>
713 <FIELD NAME="firstnamephonetic" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="First name phonetic"/>
714 <FIELD NAME="middlename" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Middle name"/>
715 <FIELD NAME="alternatename" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Alternate name - Useful for three-name countries."/>
8b9b5109 716 </FIELDS>
717 <KEYS>
52cb2e47 718 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
8b9b5109 719 </KEYS>
720 <INDEXES>
7a18f49c
PS
721 <INDEX NAME="username" UNIQUE="true" FIELDS="mnethostid, username"/>
722 <INDEX NAME="deleted" UNIQUE="false" FIELDS="deleted"/>
723 <INDEX NAME="confirmed" UNIQUE="false" FIELDS="confirmed"/>
724 <INDEX NAME="firstname" UNIQUE="false" FIELDS="firstname"/>
725 <INDEX NAME="lastname" UNIQUE="false" FIELDS="lastname"/>
726 <INDEX NAME="city" UNIQUE="false" FIELDS="city"/>
727 <INDEX NAME="country" UNIQUE="false" FIELDS="country"/>
728 <INDEX NAME="lastaccess" UNIQUE="false" FIELDS="lastaccess"/>
729 <INDEX NAME="email" UNIQUE="false" FIELDS="email"/>
730 <INDEX NAME="auth" UNIQUE="false" FIELDS="auth"/>
731 <INDEX NAME="idnumber" UNIQUE="false" FIELDS="idnumber"/>
a327f25e
AG
732 <INDEX NAME="firstnamephonetic" UNIQUE="false" FIELDS="firstnamephonetic"/>
733 <INDEX NAME="lastnamephonetic" UNIQUE="false" FIELDS="lastnamephonetic"/>
734 <INDEX NAME="middlename" UNIQUE="false" FIELDS="middlename"/>
735 <INDEX NAME="alternatename" UNIQUE="false" FIELDS="alternatename"/>
8b9b5109 736 </INDEXES>
737 </TABLE>
7a18f49c 738 <TABLE NAME="user_preferences" COMMENT="Allows modules to store arbitrary user preferences">
d3f31bf2 739 <FIELDS>
7a18f49c
PS
740 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
741 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
742 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
743 <FIELD NAME="value" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
d3f31bf2 744 </FIELDS>
745 <KEYS>
52cb2e47 746 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
d3f31bf2 747 </KEYS>
748 <INDEXES>
7a18f49c
PS
749 <INDEX NAME="userid-name" UNIQUE="true" FIELDS="userid, name"/>
750 </INDEXES>
751 </TABLE>
752 <TABLE NAME="user_lastaccess" COMMENT="To keep track of course page access times, used in online participants block, and participants list">
753 <FIELDS>
754 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
755 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
756 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
757 <FIELD NAME="timeaccess" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
758 </FIELDS>
759 <KEYS>
760 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
761 </KEYS>
762 <INDEXES>
763 <INDEX NAME="userid-courseid" UNIQUE="true" FIELDS="userid, courseid"/>
764 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
d3f31bf2 765 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
766 </INDEXES>
767 </TABLE>
7a18f49c 768 <TABLE NAME="scale" COMMENT="Defines grading scales">
d3f31bf2 769 <FIELDS>
7a18f49c
PS
770 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
771 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
772 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
773 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
774 <FIELD NAME="scale" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
775 <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
776 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
777 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d3f31bf2 778 </FIELDS>
779 <KEYS>
7a18f49c 780 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
d3f31bf2 781 </KEYS>
782 <INDEXES>
7a18f49c 783 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
d3f31bf2 784 </INDEXES>
785 </TABLE>
7a18f49c 786 <TABLE NAME="scale_history" COMMENT="History table">
67d7d694 787 <FIELDS>
7a18f49c
PS
788 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
789 <FIELD NAME="action" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="created/modified/deleted constants"/>
790 <FIELD NAME="oldid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
791 <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="What caused the modification? manual/module/import/..."/>
792 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The last time this grade_item was modified"/>
793 <FIELD NAME="loggeduser" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this outcome"/>
794 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
795 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
796 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
797 <FIELD NAME="scale" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
798 <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
67d7d694 799 </FIELDS>
800 <KEYS>
52cb2e47 801 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
7a18f49c
PS
802 <KEY NAME="oldid" TYPE="foreign" FIELDS="oldid" REFTABLE="scale" REFFIELDS="id"/>
803 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
804 <KEY NAME="loggeduser" TYPE="foreign" FIELDS="loggeduser" REFTABLE="user" REFFIELDS="id"/>
67d7d694 805 </KEYS>
806 <INDEXES>
7a18f49c 807 <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete"/>
67d7d694 808 </INDEXES>
809 </TABLE>
7a18f49c 810 <TABLE NAME="stats_daily" COMMENT="to accumulate daily stats">
67d7d694 811 <FIELDS>
7a18f49c
PS
812 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
813 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
814 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
815 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id of role for the aggregates"/>
816 <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" COMMENT="type of stat"/>
817 <FIELD NAME="stat1" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="stat1. usually used for reads"/>
818 <FIELD NAME="stat2" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="stat2. usually used for writes."/>
67d7d694 819 </FIELDS>
820 <KEYS>
52cb2e47 821 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 822 </KEYS>
823 <INDEXES>
7a18f49c
PS
824 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
825 <INDEX NAME="timeend" UNIQUE="false" FIELDS="timeend"/>
826 <INDEX NAME="roleid" UNIQUE="false" FIELDS="roleid"/>
67d7d694 827 </INDEXES>
828 </TABLE>
7a18f49c 829 <TABLE NAME="stats_weekly" COMMENT="To accumulate weekly stats">
67d7d694 830 <FIELDS>
7a18f49c
PS
831 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
832 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
833 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
834 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id of role for the aggregates"/>
835 <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" COMMENT="type of stat"/>
836 <FIELD NAME="stat1" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="stat1. usually used for reads"/>
837 <FIELD NAME="stat2" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="stat2. usually used for writes."/>
67d7d694 838 </FIELDS>
839 <KEYS>
52cb2e47 840 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 841 </KEYS>
842 <INDEXES>
7a18f49c
PS
843 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
844 <INDEX NAME="timeend" UNIQUE="false" FIELDS="timeend"/>
845 <INDEX NAME="roleid" UNIQUE="false" FIELDS="roleid"/>
67d7d694 846 </INDEXES>
847 </TABLE>
7a18f49c 848 <TABLE NAME="stats_monthly" COMMENT="To accumulate monthly stats">
67d7d694 849 <FIELDS>
7a18f49c
PS
850 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
851 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
852 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
853 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id of role for the aggregates"/>
854 <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" COMMENT="type of stat"/>
855 <FIELD NAME="stat1" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="stat1. usually used for reads"/>
856 <FIELD NAME="stat2" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="stat2. usually used for writes."/>
67d7d694 857 </FIELDS>
858 <KEYS>
52cb2e47 859 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 860 </KEYS>
861 <INDEXES>
7a18f49c
PS
862 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
863 <INDEX NAME="timeend" UNIQUE="false" FIELDS="timeend"/>
864 <INDEX NAME="roleid" UNIQUE="false" FIELDS="roleid"/>
67d7d694 865 </INDEXES>
866 </TABLE>
7a18f49c 867 <TABLE NAME="stats_user_daily" COMMENT="To accumulate daily stats per course/user">
67d7d694 868 <FIELDS>
7a18f49c
PS
869 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
870 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
871 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
872 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
873 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
874 <FIELD NAME="statsreads" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
875 <FIELD NAME="statswrites" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
876 <FIELD NAME="stattype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
67d7d694 877 </FIELDS>
878 <KEYS>
52cb2e47 879 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 880 </KEYS>
881 <INDEXES>
7a18f49c
PS
882 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
883 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
884 <INDEX NAME="roleid" UNIQUE="false" FIELDS="roleid"/>
885 <INDEX NAME="timeend" UNIQUE="false" FIELDS="timeend"/>
67d7d694 886 </INDEXES>
887 </TABLE>
7a18f49c 888 <TABLE NAME="stats_user_weekly" COMMENT="To accumulate weekly stats per course/user">
67d7d694 889 <FIELDS>
7a18f49c
PS
890 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
891 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
892 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
893 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
894 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
895 <FIELD NAME="statsreads" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
896 <FIELD NAME="statswrites" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
897 <FIELD NAME="stattype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
67d7d694 898 </FIELDS>
899 <KEYS>
52cb2e47 900 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 901 </KEYS>
902 <INDEXES>
7a18f49c
PS
903 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
904 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
905 <INDEX NAME="roleid" UNIQUE="false" FIELDS="roleid"/>
906 <INDEX NAME="timeend" UNIQUE="false" FIELDS="timeend"/>
67d7d694 907 </INDEXES>
908 </TABLE>
7a18f49c 909 <TABLE NAME="stats_user_monthly" COMMENT="To accumulate monthly stats per course/user">
67d7d694 910 <FIELDS>
7a18f49c
PS
911 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
912 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
913 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
914 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
915 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
916 <FIELD NAME="statsreads" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
917 <FIELD NAME="statswrites" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
918 <FIELD NAME="stattype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
67d7d694 919 </FIELDS>
920 <KEYS>
7a18f49c 921 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
67d7d694 922 </KEYS>
923 <INDEXES>
7a18f49c
PS
924 <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
925 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
926 <INDEX NAME="roleid" UNIQUE="false" FIELDS="roleid"/>
927 <INDEX NAME="timeend" UNIQUE="false" FIELDS="timeend"/>
928 </INDEXES>
929 </TABLE>
930 <TABLE NAME="post" COMMENT="Generic post table to hold data blog entries etc in different modules">
931 <FIELDS>
932 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
933 <FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
934 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
935 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
936 <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
937 <FIELD NAME="moduleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
938 <FIELD NAME="coursemoduleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
939 <FIELD NAME="subject" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false"/>
940 <FIELD NAME="summary" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
941 <FIELD NAME="content" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
942 <FIELD NAME="uniquehash" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
943 <FIELD NAME="rating" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
944 <FIELD NAME="format" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
945 <FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
946 <FIELD NAME="attachment" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="attachment"/>
947 <FIELD NAME="publishstate" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="draft" SEQUENCE="false"/>
948 <FIELD NAME="lastmodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
949 <FIELD NAME="created" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
950 <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
951 </FIELDS>
952 <KEYS>
953 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
954 <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
955 </KEYS>
956 <INDEXES>
957 <INDEX NAME="id-userid" UNIQUE="true" FIELDS="id, userid"/>
958 <INDEX NAME="lastmodified" UNIQUE="false" FIELDS="lastmodified"/>
959 <INDEX NAME="module" UNIQUE="false" FIELDS="module"/>
960 <INDEX NAME="subject" UNIQUE="false" FIELDS="subject"/>
67d7d694 961 </INDEXES>
962 </TABLE>
7a18f49c 963 <TABLE NAME="role" COMMENT="moodle roles">
5a1d8354 964 <FIELDS>
7a18f49c
PS
965 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
966 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Empty names are automatically localised"/>
967 <FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
968 <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Empty descriptions may be automatically localised"/>
969 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
970 <FIELD NAME="archetype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="Role archetype is used during install and role reset, marks admin role and helps in site settings"/>
5a1d8354 971 </FIELDS>
972 <KEYS>
52cb2e47 973 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
5a1d8354 974 </KEYS>
a1bdf659 975 <INDEXES>
7a18f49c
PS
976 <INDEX NAME="sortorder" UNIQUE="true" FIELDS="sortorder"/>
977 <INDEX NAME="shortname" UNIQUE="true" FIELDS="shortname" COMMENT="Enforces the constraint that role shortnames must be unique."/>
a1bdf659 978 </INDEXES>
5a1d8354 979 </TABLE>
7a18f49c 980 <TABLE NAME="context" COMMENT="one of these must be set">
5a1d8354 981 <FIELDS>
7a18f49c
PS
982 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
983 <FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
984 <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
985 <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
986 <FIELD NAME="depth" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
5a1d8354 987 </FIELDS>
988 <KEYS>
52cb2e47 989 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
5a1d8354 990 </KEYS>
a1bdf659 991 <INDEXES>
7a18f49c
PS
992 <INDEX NAME="contextlevel-instanceid" UNIQUE="true" FIELDS="contextlevel, instanceid"/>
993 <INDEX NAME="instanceid" UNIQUE="false" FIELDS="instanceid"/>
994 <INDEX NAME="path" UNIQUE="false" FIELDS="path" HINTS="varchar_pattern_ops"/>
a1bdf659 995 </INDEXES>
996 </TABLE>
7a18f49c 997 <TABLE NAME="context_temp" COMMENT="Used by build_context_path() in upgrade and cron to keep context depths and paths in sync.">
d5d2f8a6 998 <FIELDS>
7a18f49c
PS
999 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="This id isn't autonumeric/sequence. It's the context-&gt;id"/>
1000 <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1001 <FIELD NAME="depth" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
d5d2f8a6 1002 </FIELDS>
1003 <KEYS>
52cb2e47 1004 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
d5d2f8a6 1005 </KEYS>
1006 </TABLE>
7a18f49c 1007 <TABLE NAME="capabilities" COMMENT="this defines all capabilities">
a1bdf659 1008 <FIELDS>
7a18f49c
PS
1009 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1010 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1011 <FIELD NAME="captype" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
1012 <FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1013 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
1014 <FIELD NAME="riskbitmask" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
a1bdf659 1015 </FIELDS>
1016 <KEYS>
7a18f49c
PS
1017 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1018 <KEY NAME="name" TYPE="unique" FIELDS="name"/>
a1bdf659 1019 </KEYS>
5a1d8354 1020 </TABLE>
7a18f49c 1021 <TABLE NAME="role_allow_assign" COMMENT="this defines what role can assign what role">
de16da72 1022 <FIELDS>
7a18f49c
PS
1023 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1024 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1025 <FIELD NAME="allowassign" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
de16da72 1026 </FIELDS>
1027 <KEYS>
7a18f49c
PS
1028 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1029 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1030 <KEY NAME="allowassign" TYPE="foreign" FIELDS="allowassign" REFTABLE="role" REFFIELDS="id"/>
de16da72 1031 </KEYS>
1032 <INDEXES>
1033 <INDEX NAME="roleid-allowassign" UNIQUE="true" FIELDS="roleid, allowassign"/>
1034 </INDEXES>
1035 </TABLE>
7a18f49c 1036 <TABLE NAME="role_allow_override" COMMENT="this defines what role can override what role">
de16da72 1037 <FIELDS>
7a18f49c
PS
1038 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1039 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1040 <FIELD NAME="allowoverride" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
de16da72 1041 </FIELDS>
1042 <KEYS>
7a18f49c
PS
1043 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1044 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1045 <KEY NAME="allowoverride" TYPE="foreign" FIELDS="allowoverride" REFTABLE="role" REFFIELDS="id"/>
de16da72 1046 </KEYS>
1047 <INDEXES>
1048 <INDEX NAME="roleid-allowoverride" UNIQUE="true" FIELDS="roleid, allowoverride"/>
1049 </INDEXES>
1050 </TABLE>
7a18f49c 1051 <TABLE NAME="role_allow_switch" COMMENT="This table stores which which other roles a user is allowed to switch to if they have one role.">
82701e24 1052 <FIELDS>
7a18f49c
PS
1053 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1054 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The role the user has."/>
1055 <FIELD NAME="allowswitch" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of a role that the user is allowed to switch to as a result of having this role."/>
82701e24 1056 </FIELDS>
1057 <KEYS>
7a18f49c
PS
1058 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1059 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1060 <KEY NAME="allowswitch" TYPE="foreign" FIELDS="allowswitch" REFTABLE="role" REFFIELDS="id"/>
82701e24 1061 </KEYS>
1062 <INDEXES>
1063 <INDEX NAME="roleid-allowoverride" UNIQUE="true" FIELDS="roleid, allowswitch" COMMENT="Each pair (roleid, allowswitch) must appear at most once."/>
1064 </INDEXES>
1065 </TABLE>
7a18f49c 1066 <TABLE NAME="role_assignments" COMMENT="assigning roles in different context">
5a1d8354 1067 <FIELDS>
7a18f49c
PS
1068 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1069 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1070 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1071 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1072 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1073 <FIELD NAME="modifierid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1074 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="plugin responsible responsible for role assignment, empty when manually assigned"/>
1075 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Id of enrolment/auth instance responsible for this role assignment"/>
1076 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
5a1d8354 1077 </FIELDS>
1078 <KEYS>
7a18f49c
PS
1079 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1080 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1081 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
1082 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
5a1d8354 1083 </KEYS>
a1bdf659 1084 <INDEXES>
7a18f49c
PS
1085 <INDEX NAME="sortorder" UNIQUE="false" FIELDS="sortorder"/>
1086 <INDEX NAME="rolecontext" UNIQUE="false" FIELDS="roleid, contextid" COMMENT="Index on roleid and contextid"/>
1087 <INDEX NAME="usercontextrole" UNIQUE="false" FIELDS="userid, contextid, roleid" COMMENT="Index on userid, contextid and roleid"/>
1088 <INDEX NAME="component-itemid-userid" UNIQUE="false" FIELDS="component, itemid, userid"/>
a1bdf659 1089 </INDEXES>
5a1d8354 1090 </TABLE>
7a18f49c 1091 <TABLE NAME="role_capabilities" COMMENT="permission has to be signed, overriding a capability for a particular role in a particular context">
5a1d8354 1092 <FIELDS>
7a18f49c
PS
1093 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1094 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1095 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1096 <FIELD NAME="capability" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1097 <FIELD NAME="permission" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1098 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1099 <FIELD NAME="modifierid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
5a1d8354 1100 </FIELDS>
1101 <KEYS>
7a18f49c
PS
1102 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1103 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1104 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
1105 <KEY NAME="modifierid" TYPE="foreign" FIELDS="modifierid" REFTABLE="user" REFFIELDS="id"/>
1106 <KEY NAME="capability" TYPE="foreign" FIELDS="capability" REFTABLE="capabilities" REFFIELDS="name"/>
5a1d8354 1107 </KEYS>
a1bdf659 1108 <INDEXES>
1109 <INDEX NAME="roleid-contextid-capability" UNIQUE="true" FIELDS="roleid, contextid, capability"/>
1110 </INDEXES>
5a1d8354 1111 </TABLE>
7a18f49c 1112 <TABLE NAME="role_names" COMMENT="role names in native strings">
5a1d8354 1113 <FIELDS>
7a18f49c
PS
1114 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1115 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1116 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1117 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
5a1d8354 1118 </FIELDS>
1119 <KEYS>
7a18f49c
PS
1120 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1121 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1122 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
5a1d8354 1123 </KEYS>
a1bdf659 1124 <INDEXES>
1125 <INDEX NAME="roleid-contextid" UNIQUE="true" FIELDS="roleid, contextid"/>
1126 </INDEXES>
5a1d8354 1127 </TABLE>
7a18f49c 1128 <TABLE NAME="role_sortorder" COMMENT="sort order of course managers in a course">
b318ecfd 1129 <FIELDS>
7a18f49c
PS
1130 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1131 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1132 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1133 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1134 <FIELD NAME="sortoder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
b318ecfd 1135 </FIELDS>
1136 <KEYS>
7a18f49c
PS
1137 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1138 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
1139 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1140 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
b318ecfd 1141 </KEYS>
1142 <INDEXES>
1143 <INDEX NAME="userid-roleid-contextid" UNIQUE="true" FIELDS="userid, roleid, contextid"/>
1144 </INDEXES>
1145 </TABLE>
7a18f49c 1146 <TABLE NAME="role_context_levels" COMMENT="Lists which roles can be assigned at which context levels. The assignment is allowed in the corresponding row is present in this table.">
01a80f51 1147 <FIELDS>
7a18f49c
PS
1148 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1149 <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1150 <FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
01a80f51 1151 </FIELDS>
1152 <KEYS>
7a18f49c
PS
1153 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1154 <KEY NAME="contextlevel-roleid" TYPE="unique" FIELDS="contextlevel, roleid"/>
1155 <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
1156 </KEYS>
1157 </TABLE>
1158 <TABLE NAME="user_info_field" COMMENT="Customisable user profile fields">
1159 <FIELDS>
1160 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1161 <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="shortname" SEQUENCE="false" COMMENT="short name for each field"/>
1162 <FIELD NAME="name" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="field name"/>
1163 <FIELD NAME="datatype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Type of data held in this field"/>
1164 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of field"/>
1165 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1166 <FIELD NAME="categoryid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id from category table"/>
1167 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="order within the category"/>
1168 <FIELD NAME="required" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Field required"/>
1169 <FIELD NAME="locked" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Field locked"/>
1170 <FIELD NAME="visible" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Visibility: private, public, hidden"/>
1171 <FIELD NAME="forceunique" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="should the field contain unique data"/>
1172 <FIELD NAME="signup" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="display field on signup page"/>
1173 <FIELD NAME="defaultdata" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Default value for this field"/>
1174 <FIELD NAME="defaultdataformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1175 <FIELD NAME="param1" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="General parameter field"/>
1176 <FIELD NAME="param2" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="General parameter field"/>
1177 <FIELD NAME="param3" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="General parameter field"/>
1178 <FIELD NAME="param4" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="General parameter field"/>
1179 <FIELD NAME="param5" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="General parameter field"/>
adecf1c4 1180 </FIELDS>
1181 <KEYS>
52cb2e47 1182 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
adecf1c4 1183 </KEYS>
1184 </TABLE>
7a18f49c 1185 <TABLE NAME="user_info_category" COMMENT="Customisable fields categories">
adecf1c4 1186 <FIELDS>
7a18f49c
PS
1187 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1188 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Category name"/>
1189 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Display order"/>
adecf1c4 1190 </FIELDS>
1191 <KEYS>
52cb2e47 1192 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
adecf1c4 1193 </KEYS>
1194 </TABLE>
7a18f49c 1195 <TABLE NAME="user_info_data" COMMENT="Data for the customisable user fields">
adecf1c4 1196 <FIELDS>
7a18f49c
PS
1197 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1198 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id from the user table"/>
1199 <FIELD NAME="fieldid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id from the field table"/>
1200 <FIELD NAME="data" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Field data"/>
1201 <FIELD NAME="dataformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
adecf1c4 1202 </FIELDS>
1203 <KEYS>
52cb2e47 1204 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
adecf1c4 1205 </KEYS>
0d92d04f 1206 <INDEXES>
37032563 1207 <INDEX NAME="userfieldidx" UNIQUE="true" FIELDS="userid, fieldid"/>
0d92d04f 1208 </INDEXES>
adecf1c4 1209 </TABLE>
7a18f49c 1210 <TABLE NAME="question_categories" COMMENT="Categories are for grouping questions">
4f089b21 1211 <FIELDS>
7a18f49c
PS
1212 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1213 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1214 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="context that this category is shared in"/>
1215 <FIELD NAME="info" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
1216 <FIELD NAME="infoformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1217 <FIELD NAME="stamp" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1218 <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1219 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="999" SEQUENCE="false"/>
4f089b21 1220 </FIELDS>
1221 <KEYS>
7a18f49c
PS
1222 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1223 <KEY NAME="parent" TYPE="foreign" FIELDS="parent" REFTABLE="question_categories" REFFIELDS="id" COMMENT="note that to make this recursive FK working someday, the parent field must be declared NULL"/>
4f089b21 1224 </KEYS>
1225 <INDEXES>
1226 <INDEX NAME="contextid" UNIQUE="false" FIELDS="contextid" COMMENT="links to context table"/>
1227 </INDEXES>
1228 </TABLE>
7a18f49c
PS
1229 <TABLE NAME="question" COMMENT="The questions themselves">
1230 <FIELDS>
1231 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1232 <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1233 <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1234 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1235 <FIELD NAME="questiontext" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
1236 <FIELD NAME="questiontextformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1237 <FIELD NAME="generalfeedback" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="to store the question feedback"/>
1238 <FIELD NAME="generalfeedbackformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1239 <FIELD NAME="defaultmark" TYPE="number" LENGTH="12" NOTNULL="true" DEFAULT="1" SEQUENCE="false" DECIMALS="7"/>
1240 <FIELD NAME="penalty" TYPE="number" LENGTH="12" NOTNULL="true" DEFAULT="0.3333333" SEQUENCE="false" DECIMALS="7"/>
1241 <FIELD NAME="qtype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
1242 <FIELD NAME="length" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
1243 <FIELD NAME="stamp" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1244 <FIELD NAME="version" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1245 <FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1246 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="time question was created"/>
1247 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="time that question was last modified"/>
1248 <FIELD NAME="createdby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="userid of person who created this question"/>
1249 <FIELD NAME="modifiedby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="userid of person who last edited this question"/>
4f089b21 1250 </FIELDS>
1251 <KEYS>
7a18f49c
PS
1252 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1253 <KEY NAME="category" TYPE="foreign" FIELDS="category" REFTABLE="question_categories" REFFIELDS="id"/>
1254 <KEY NAME="parent" TYPE="foreign" FIELDS="parent" REFTABLE="question" REFFIELDS="id" COMMENT="note that to make this recursive FK working someday, the parent field must be declared NULL"/>
1255 <KEY NAME="createdby" TYPE="foreign" FIELDS="createdby" REFTABLE="user" REFFIELDS="id" COMMENT="foreign (createdby) references user (id)"/>
1256 <KEY NAME="modifiedby" TYPE="foreign" FIELDS="modifiedby" REFTABLE="user" REFFIELDS="id" COMMENT="foreign (modifiedby) references user (id)"/>
4f089b21 1257 </KEYS>
1258 </TABLE>
7a18f49c 1259 <TABLE NAME="question_answers" COMMENT="Answers, with a fractional grade (0-1) and feedback">
4f089b21 1260 <FIELDS>
7a18f49c
PS
1261 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1262 <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1263 <FIELD NAME="answer" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
1264 <FIELD NAME="answerformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1265 <FIELD NAME="fraction" TYPE="number" LENGTH="12" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="7"/>
1266 <FIELD NAME="feedback" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
1267 <FIELD NAME="feedbackformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
4f089b21 1268 </FIELDS>
1269 <KEYS>
7a18f49c
PS
1270 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1271 <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id"/>
4f089b21 1272 </KEYS>
1273 </TABLE>
7a18f49c 1274 <TABLE NAME="question_hints" COMMENT="Stores the the part of the question definition that gives different feedback after each try in interactive and similar behaviours.">
4f089b21 1275 <FIELDS>
7a18f49c
PS
1276 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1277 <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1278 <FIELD NAME="hint" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="The text of the feedback to be given."/>
1279 <FIELD NAME="hintformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the hint."/>
1280 <FIELD NAME="shownumcorrect" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Whether the feedback should include a message about how many things the student got right. This is only applicable to certain question types (for example matching or multiple choice multiple-response)."/>
1281 <FIELD NAME="clearwrong" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Whether any wrong choices should be cleared before the next try. Whether this is applicable, and what it means, depends on the question type, as with the shownumright option."/>
1282 <FIELD NAME="options" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="A space for any other question-type specific options."/>
4f089b21 1283 </FIELDS>
1284 <KEYS>
7a18f49c
PS
1285 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1286 <KEY NAME="questionid" TYPE="foreign" FIELDS="questionid" REFTABLE="question" REFFIELDS="id"/>
bb28e3bc
TH
1287 </KEYS>
1288 </TABLE>
7a18f49c 1289 <TABLE NAME="question_usages" COMMENT="This table's main purpose it to assign a unique id to each attempt at a set of questions by some part of Moodle. A question usage is made up of a number of question_attempts.">
bb28e3bc 1290 <FIELDS>
7a18f49c
PS
1291 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1292 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Every question usage must be associated with some context."/>
1293 <FIELD NAME="component" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The plugin this attempt belongs to, e.g. 'mod_quiz', 'block_questionoftheday', 'filter_embedquestion'."/>
1294 <FIELD NAME="preferredbehaviour" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The archetypal behaviour that should be used for question attempts in this usage."/>
bb28e3bc
TH
1295 </FIELDS>
1296 <KEYS>
7a18f49c
PS
1297 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1298 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
bb28e3bc
TH
1299 </KEYS>
1300 </TABLE>
7a18f49c 1301 <TABLE NAME="question_attempts" COMMENT="Each row here corresponds to an attempt at one question, as part of a question_usage. A question_attempt will have some question_attempt_steps">
bb28e3bc 1302 <FIELDS>
7a18f49c
PS
1303 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1304 <FIELD NAME="questionusageid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Foreign key, references question_usages.id"/>
1305 <FIELD NAME="slot" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Used to number the questions in one attempt sequentially."/>
1306 <FIELD NAME="behaviour" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The name of the question behaviour that is managing this question attempt."/>
1307 <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of the question being attempted. Foreign key references question.id."/>
1308 <FIELD NAME="variant" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="The variant of the qusetion being used."/>
1309 <FIELD NAME="maxmark" TYPE="number" LENGTH="12" NOTNULL="true" SEQUENCE="false" DECIMALS="7" COMMENT="The grade this question is marked out of in this attempt."/>
1310 <FIELD NAME="minfraction" TYPE="number" LENGTH="12" NOTNULL="true" SEQUENCE="false" DECIMALS="7" COMMENT="Some questions can award negative marks. This indicates the most negative mark that can be awarded, on the faction scale where the maximum positive mark is 1."/>
4e3d8293 1311 <FIELD NAME="maxfraction" TYPE="number" LENGTH="12" NOTNULL="true" DEFAULT="1" SEQUENCE="false" DECIMALS="7" COMMENT="Some questions can give fractions greater than 1. This indicates the greatest fraction that can be awarded."/>
7a18f49c
PS
1312 <FIELD NAME="flagged" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether this question has been flagged within the attempt."/>
1313 <FIELD NAME="questionsummary" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="If this question uses randomisation, it should set this field to summarise what random version the student actually saw. This is a human-readable textual summary of the student's response which might, for example, be used in a report."/>
1314 <FIELD NAME="rightanswer" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="This is a human-readable textual summary of the right answer to this question. Might be used, for example on the quiz preview, to help people who are testing the question. Or might be used in reports."/>
1315 <FIELD NAME="responsesummary" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="This is a textual summary of the student's response (basically what you would expect to in the Quiz responses report)."/>
1316 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was last changed."/>
bb28e3bc
TH
1317 </FIELDS>
1318 <KEYS>
7a18f49c
PS
1319 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1320 <KEY NAME="questionid" TYPE="foreign" FIELDS="questionid" REFTABLE="question" REFFIELDS="id"/>
1321 <KEY NAME="questionusageid" TYPE="foreign" FIELDS="questionusageid" REFTABLE="question_usages" REFFIELDS="id"/>
bb28e3bc
TH
1322 </KEYS>
1323 <INDEXES>
1324 <INDEX NAME="questionusageid-slot" UNIQUE="true" FIELDS="questionusageid, slot"/>
bbea9369 1325 <INDEX NAME="behaviour" UNIQUE="false" FIELDS="behaviour" COMMENT="Required because we need to be able to determine efficiently which behaviours are in use."/>
bb28e3bc
TH
1326 </INDEXES>
1327 </TABLE>
7a18f49c 1328 <TABLE NAME="question_attempt_steps" COMMENT="Stores one step in in a question attempt. As well as the data here, the step will have some data in the question_attempt_step_data table.">
bb28e3bc 1329 <FIELDS>
7a18f49c
PS
1330 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1331 <FIELD NAME="questionattemptid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Foreign key, references question_attempt.id"/>
1332 <FIELD NAME="sequencenumber" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Numbers the steps in a question attempt sequentially."/>
1333 <FIELD NAME="state" TYPE="char" LENGTH="13" NOTNULL="true" SEQUENCE="false" COMMENT="One of the constants defined by the question_state class, giving the state of the question at the end of this step."/>
1334 <FIELD NAME="fraction" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7" COMMENT="The grade for this question, when graded out of 1. Needs to be multiplied by question_attempt.maxmark to get the actual mark for the question."/>
1335 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time-stamp of the action that lead to this state being created."/>
1336 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user whose action lead to this state being created."/>
bb28e3bc
TH
1337 </FIELDS>
1338 <KEYS>
7a18f49c
PS
1339 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1340 <KEY NAME="questionattemptid" TYPE="foreign" FIELDS="questionattemptid" REFTABLE="question_attempts" REFFIELDS="id"/>
1341 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
4f089b21 1342 </KEYS>
bb28e3bc
TH
1343 <INDEXES>
1344 <INDEX NAME="questionattemptid-sequencenumber" UNIQUE="true" FIELDS="questionattemptid, sequencenumber"/>
1345 </INDEXES>
1346 </TABLE>
7a18f49c 1347 <TABLE NAME="question_attempt_step_data" COMMENT="Each question_attempt_step has an associative array of the data that was submitted by the user in the POST request. It can also contain extra data from the question type or behaviour to avoid re-computation. The convention is that names belonging to the behaviour start with -, and cached values added to the submitted data start with _, or _-">
bb28e3bc 1348 <FIELDS>
7a18f49c
PS
1349 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1350 <FIELD NAME="attemptstepid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Foreign key, references question_attempt_steps.id"/>
1351 <FIELD NAME="name" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The name of this bit of data."/>
1352 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="The corresponding value"/>
bb28e3bc
TH
1353 </FIELDS>
1354 <KEYS>
7a18f49c
PS
1355 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1356 <KEY NAME="attemptstepid" TYPE="foreign" FIELDS="attemptstepid" REFTABLE="question_attempt_steps" REFFIELDS="id"/>
bb28e3bc
TH
1357 </KEYS>
1358 <INDEXES>
1359 <INDEX NAME="attemptstepid-name" UNIQUE="true" FIELDS="attemptstepid, name"/>
1360 </INDEXES>
4f089b21 1361 </TABLE>
25b2b0ec
MG
1362 <TABLE NAME="question_statistics" COMMENT="Statistics for individual questions used in an activity.">
1363 <FIELDS>
1364 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1365 <FIELD NAME="hashcode" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="sha1 hash of serialized qubaids_condition class. Unique for every combination of class name and property."/>
1366 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1367 <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1368 <FIELD NAME="slot" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The position in the quiz where this question appears"/>
1369 <FIELD NAME="subquestion" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false"/>
1239d287 1370 <FIELD NAME="variant" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
25b2b0ec
MG
1371 <FIELD NAME="s" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1372 <FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" SEQUENCE="false" DECIMALS="5"/>
1373 <FIELD NAME="negcovar" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1374 <FIELD NAME="discriminationindex" TYPE="number" LENGTH="15" NOTNULL="false" SEQUENCE="false" DECIMALS="5"/>
1375 <FIELD NAME="discriminativeefficiency" TYPE="number" LENGTH="15" NOTNULL="false" SEQUENCE="false" DECIMALS="5"/>
1376 <FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" SEQUENCE="false" DECIMALS="10"/>
1377 <FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" SEQUENCE="false" DECIMALS="10"/>
1378 <FIELD NAME="subquestions" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
1379 <FIELD NAME="maxmark" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7"/>
1380 <FIELD NAME="positions" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="positions in which this item appears. Only used for random questions."/>
1381 <FIELD NAME="randomguessscore" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7" COMMENT="An estimate of the score a student would get by guessing randomly."/>
1382 </FIELDS>
1383 <KEYS>
1384 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1385 </KEYS>
1386 </TABLE>
1387 <TABLE NAME="question_response_analysis" COMMENT="Analysis of student responses given to questions.">
1388 <FIELDS>
1389 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1390 <FIELD NAME="hashcode" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="sha1 hash of serialized qubaids_condition class. Unique for every combination of class name and property."/>
038014c4 1391 <FIELD NAME="whichtries" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
25b2b0ec
MG
1392 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1393 <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
9d3d859c 1394 <FIELD NAME="variant" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
25b2b0ec
MG
1395 <FIELD NAME="subqid" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
1396 <FIELD NAME="aid" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
1397 <FIELD NAME="response" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
25b2b0ec
MG
1398 <FIELD NAME="credit" TYPE="number" LENGTH="15" NOTNULL="true" SEQUENCE="false" DECIMALS="5"/>
1399 </FIELDS>
1400 <KEYS>
0a5aa65b 1401 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
25b2b0ec
MG
1402 </KEYS>
1403 </TABLE>
038014c4
JP
1404 <TABLE NAME="question_response_count" COMMENT="Count for each responses for each try at a question.">
1405 <FIELDS>
1406 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1407 <FIELD NAME="analysisid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1408 <FIELD NAME="try" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1409 <FIELD NAME="rcount" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1410 </FIELDS>
1411 <KEYS>
0a5aa65b
1412 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1413 <KEY NAME="analysisid" TYPE="foreign" FIELDS="analysisid" REFTABLE="question_response_analysis" REFFIELDS="id"/>
1414 </KEYS>
038014c4 1415 </TABLE>
7a18f49c 1416 <TABLE NAME="mnet_application" COMMENT="Information about applications on remote hosts">
6392a62d 1417 <FIELDS>
7a18f49c
PS
1418 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1419 <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
1420 <FIELD NAME="display_name" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
1421 <FIELD NAME="xmlrpc_server_url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1422 <FIELD NAME="sso_land_url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1423 <FIELD NAME="sso_jump_url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
6392a62d 1424 </FIELDS>
1425 <KEYS>
52cb2e47 1426 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
6392a62d 1427 </KEYS>
1428 </TABLE>
7a18f49c 1429 <TABLE NAME="mnet_host" COMMENT="Information about the local and remote hosts for RPC">
9654f633 1430 <FIELDS>
7a18f49c
PS
1431 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Unique Host ID"/>
1432 <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1433 <FIELD NAME="wwwroot" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1434 <FIELD NAME="ip_address" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false"/>
1435 <FIELD NAME="name" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false"/>
1436 <FIELD NAME="public_key" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
1437 <FIELD NAME="public_key_expires" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1438 <FIELD NAME="transport" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1439 <FIELD NAME="portno" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1440 <FIELD NAME="last_connect_time" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1441 <FIELD NAME="last_log_id" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1442 <FIELD NAME="force_theme" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1443 <FIELD NAME="theme" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
1444 <FIELD NAME="applicationid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
9654f633 1445 </FIELDS>
1446 <KEYS>
7a18f49c
PS
1447 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_host table"/>
1448 <KEY NAME="applicationid" TYPE="foreign" FIELDS="applicationid" REFTABLE="mnet_application" REFFIELDS="id"/>
9654f633 1449 </KEYS>
1450 </TABLE>
7a18f49c 1451 <TABLE NAME="mnet_host2service" COMMENT="Information about the services for a given host">
9654f633 1452 <FIELDS>
7a18f49c
PS
1453 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1454 <FIELD NAME="hostid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1455 <FIELD NAME="serviceid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1456 <FIELD NAME="publish" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1457 <FIELD NAME="subscribe" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
9654f633 1458 </FIELDS>
1459 <KEYS>
1460 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_host2service table"/>
1461 </KEYS>
1462 <INDEXES>
0db6adc9 1463 <INDEX NAME="hostid_serviceid" UNIQUE="true" FIELDS="hostid, serviceid"/>
9654f633 1464 </INDEXES>
1465 </TABLE>
7a18f49c 1466 <TABLE NAME="mnet_log" COMMENT="Store session data from users migrating to other sites">
9654f633 1467 <FIELDS>
7a18f49c
PS
1468 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1469 <FIELD NAME="hostid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique host ID"/>
1470 <FIELD NAME="remoteid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1471 <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1472 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1473 <FIELD NAME="ip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false"/>
1474 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1475 <FIELD NAME="coursename" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
1476 <FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
1477 <FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1478 <FIELD NAME="action" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
1479 <FIELD NAME="url" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
1480 <FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
9654f633 1481 </FIELDS>
1482 <KEYS>
6e783f21 1483 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_log table"/>
9654f633 1484 </KEYS>
1485 <INDEXES>
1486 <INDEX NAME="hostid_userid_course" UNIQUE="false" FIELDS="hostid, userid, course"/>
1487 </INDEXES>
1488 </TABLE>
7a18f49c 1489 <TABLE NAME="mnet_rpc" COMMENT="Functions or methods that we may publish or subscribe to">
9654f633 1490 <FIELDS>
7a18f49c
PS
1491 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Unique Function ID"/>
1492 <FIELD NAME="functionname" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
1493 <FIELD NAME="xmlrpcpath" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false"/>
1494 <FIELD NAME="plugintype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
1495 <FIELD NAME="pluginname" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
1496 <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1497 <FIELD NAME="help" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
1498 <FIELD NAME="profile" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Method signature"/>
1499 <FIELD NAME="filename" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
1500 <FIELD NAME="classname" TYPE="char" LENGTH="150" NOTNULL="false" SEQUENCE="false"/>
1501 <FIELD NAME="static" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
9654f633 1502 </FIELDS>
1503 <KEYS>
1504 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_rpc table"/>
1505 </KEYS>
1506 <INDEXES>
8586dbe2 1507 <INDEX NAME="enabled_xmlrpcpath" UNIQUE="false" FIELDS="enabled, xmlrpcpath"/>
9654f633 1508 </INDEXES>
1509 </TABLE>
7a18f49c 1510 <TABLE NAME="mnet_remote_rpc" COMMENT="This table describes functions that might be called remotely (we have less information about them than local functions)">
8586dbe2 1511 <FIELDS>
7a18f49c
PS
1512 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1513 <FIELD NAME="functionname" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
1514 <FIELD NAME="xmlrpcpath" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false"/>
1515 <FIELD NAME="plugintype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
1516 <FIELD NAME="pluginname" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
1517 <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
8586dbe2
PL
1518 </FIELDS>
1519 <KEYS>
1520 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1521 </KEYS>
1522 </TABLE>
7a18f49c 1523 <TABLE NAME="mnet_service" COMMENT="A service is a group of functions">
9654f633 1524 <FIELDS>
7a18f49c
PS
1525 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Unique Service ID"/>
1526 <FIELD NAME="name" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
1527 <FIELD NAME="description" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
1528 <FIELD NAME="apiversion" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1529 <FIELD NAME="offer" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Do we even offer this service?"/>
9654f633 1530 </FIELDS>
1531 <KEYS>
1532 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_service table"/>
1533 </KEYS>
1534 </TABLE>
7a18f49c 1535 <TABLE NAME="mnet_service2rpc" COMMENT="Group functions or methods under a service">
9654f633 1536 <FIELDS>
7a18f49c
PS
1537 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Required ID field"/>
1538 <FIELD NAME="serviceid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique service ID"/>
1539 <FIELD NAME="rpcid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique Function ID"/>
9654f633 1540 </FIELDS>
1541 <KEYS>
1542 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_service2rpc table"/>
1543 </KEYS>
1544 <INDEXES>
1545 <INDEX NAME="rpcid_serviceid" UNIQUE="true" FIELDS="rpcid, serviceid"/>
1546 </INDEXES>
1547 </TABLE>
7a18f49c 1548 <TABLE NAME="mnet_remote_service2rpc" COMMENT="Group functions or methods under a service">
8586dbe2 1549 <FIELDS>
7a18f49c
PS
1550 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Required ID field"/>
1551 <FIELD NAME="serviceid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique service ID"/>
1552 <FIELD NAME="rpcid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique Function ID"/>
8586dbe2
PL
1553 </FIELDS>
1554 <KEYS>
1555 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_remote_service2rpc table"/>
1556 </KEYS>
1557 <INDEXES>
1558 <INDEX NAME="rpcid_serviceid" UNIQUE="true" FIELDS="rpcid, serviceid"/>
1559 </INDEXES>
1560 </TABLE>
7a18f49c 1561 <TABLE NAME="mnet_session" COMMENT="Store session data from users migrating to other sites">
9654f633 1562 <FIELDS>
7a18f49c
PS
1563 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Required ID field"/>
1564 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique user ID"/>
1565 <FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Unique username"/>
1566 <FIELD NAME="token" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="Unique SHA1 Token"/>
1567 <FIELD NAME="mnethostid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Unique remote host ID"/>
1568 <FIELD NAME="useragent" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="SHA1 hash of User Agent"/>
1569 <FIELD NAME="confirm_timeout" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="UNIX timestamp for expiry of session"/>
1570 <FIELD NAME="session_id" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="The PHP Session ID"/>
1571 <FIELD NAME="expires" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Expire time of session on peer"/>
9654f633 1572 </FIELDS>
1573 <KEYS>
1574 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_session table"/>
1575 </KEYS>
1576 <INDEXES>
1577 <INDEX NAME="token" UNIQUE="true" FIELDS="token"/>
1578 </INDEXES>
1579 </TABLE>
7a18f49c 1580 <TABLE NAME="mnet_sso_access_control" COMMENT="Users by host permitted (or not) to login from a remote provider">
9654f633 1581 <FIELDS>
7a18f49c
PS
1582 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Required ID field"/>
1583 <FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Username"/>
1584 <FIELD NAME="mnet_host_id" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="id of mnet host"/>
1585 <FIELD NAME="accessctrl" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="allow" SEQUENCE="false" COMMENT="Whether or not this user/host can login"/>
9654f633 1586 </FIELDS>
1587 <KEYS>
1588 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the mnet_sso_access_control table"/>
1589 </KEYS>
1590 <INDEXES>
1591 <INDEX NAME="mnethostid_username" UNIQUE="true" FIELDS="mnet_host_id, username"/>
1592 </INDEXES>
1593 </TABLE>
7a18f49c 1594 <TABLE NAME="events_queue" COMMENT="This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the event_queue_handlers table.">
d3f31bf2 1595 <FIELDS>
7a18f49c
PS
1596 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1597 <FIELD NAME="eventdata" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="serialized version of the data object passed to the event handler."/>
1598 <FIELD NAME="stackdump" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="serialized debug_backtrace showing where the event was fired from"/>
1599 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="$USER-&amp;gt;id when the event was fired"/>
1600 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="time stamp of the first time this was added"/>
d3f31bf2 1601 </FIELDS>
1602 <KEYS>
7a18f49c
PS
1603 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1604 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
d3f31bf2 1605 </KEYS>
1606 </TABLE>
7a18f49c 1607 <TABLE NAME="events_handlers" COMMENT="This table is for storing which components requests what type of event, and the location of the responsible handlers. For example, the assignment registers 'grade_updated' event with a function assignment_grade_handler() that should be called event time an 'grade_updated' event is triggered by grade_update() function.">
ec36253d 1608 <FIELDS>
7a18f49c
PS
1609 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1610 <FIELD NAME="eventname" TYPE="char" LENGTH="166" NOTNULL="true" SEQUENCE="false" COMMENT="name of the event, e.g. 'grade_updated'"/>
1611 <FIELD NAME="component" TYPE="char" LENGTH="166" NOTNULL="true" SEQUENCE="false" COMMENT="e.g. moodle, mod_forum, block_rss_client"/>
1612 <FIELD NAME="handlerfile" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="path to the file of the function, eg /grade/export/lib.php"/>
1613 <FIELD NAME="handlerfunction" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="serialized string or array describing function, suitable to be passed to call_user_func()"/>
1614 <FIELD NAME="schedule" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="'cron' or 'instant'."/>
1615 <FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="number of failed attempts to process this handler"/>
1616 <FIELD NAME="internal" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="1 means standard plugin handler, 0 indicates if event handler sends data to external systems, this is used for example to prevent immediate sending of events from pending db transactions"/>
ec36253d 1617 </FIELDS>
1618 <KEYS>
52cb2e47 1619 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
ec36253d 1620 </KEYS>
1621 <INDEXES>
650462df 1622 <INDEX NAME="eventname-component" UNIQUE="true" FIELDS="eventname, component"/>
ec36253d 1623 </INDEXES>
1624 </TABLE>
7a18f49c
PS
1625 <TABLE NAME="events_queue_handlers" COMMENT="This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the event_queues table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted after a successful event processing by the specified handler.">
1626 <FIELDS>
1627 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1628 <FIELD NAME="queuedeventid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="foreign key id corresponding to the id of the event_queues table"/>
1629 <FIELD NAME="handlerid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="foreign key id corresponding to the id of the event_handlers table"/>
1630 <FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="number of failed attempts to process this handler"/>
1631 <FIELD NAME="errormessage" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="if an error happened last time we tried to process this event, record it here."/>
1632 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="time stamp of the last attempt to run this from the queue"/>
1633 </FIELDS>
1634 <KEYS>
1635 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1636 <KEY NAME="queuedeventid" TYPE="foreign" FIELDS="queuedeventid" REFTABLE="events_queue" REFFIELDS="id"/>
1637 <KEY NAME="handlerid" TYPE="foreign" FIELDS="handlerid" REFTABLE="events_handlers" REFFIELDS="id"/>
1638 </KEYS>
1639 </TABLE>
1640 <TABLE NAME="grade_outcomes" COMMENT="This table describes the outcomes used in the system. An outcome is a statement tied to a rubric scale from low to high, such as â\80\9cNot met, Borderline, Metâ\80\9d (stored as 0,1 or 2)">
1641 <FIELDS>
1642 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="id of the table"/>
1643 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Mostly these are defined site wide ie NULL"/>
1644 <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The short name or code for this outcome statement"/>
1645 <FIELD NAME="fullname" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="The full description of the outcome (usually 1 sentence)"/>
1646 <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The recommended scale for this outcome."/>
1647 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="outcome description"/>
1648 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1649 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the time this outcome was first created"/>
1650 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the time this outcome was last updated"/>
1651 <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this outcome"/>
1652 </FIELDS>
1653 <KEYS>
1654 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1655 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1656 <KEY NAME="scaleid" TYPE="foreign" FIELDS="scaleid" REFTABLE="scale" REFFIELDS="id"/>
1657 <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
1658 <KEY NAME="courseid-shortname" TYPE="unique" FIELDS="courseid, shortname"/>
1659 </KEYS>
1660 </TABLE>
1661 <TABLE NAME="grade_outcomes_courses" COMMENT="stores what outcomes are used in what courses.">
1662 <FIELDS>
1663 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1664 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="id of the course"/>
1665 <FIELD NAME="outcomeid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="id of the outcome"/>
1666 </FIELDS>
1667 <KEYS>
1668 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1669 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1670 <KEY NAME="outcomeid" TYPE="foreign" FIELDS="outcomeid" REFTABLE="grade_outcomes" REFFIELDS="id"/>
1671 <KEY NAME="courseid-outcomeid" TYPE="unique" FIELDS="courseid, outcomeid"/>
1672 </KEYS>
1673 </TABLE>
1674 <TABLE NAME="grade_categories" COMMENT="This table keeps information about categories, used for grouping items.">
1675 <FIELDS>
1676 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1677 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this grade category is part of"/>
1678 <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Categories can be hierarchical"/>
1679 <FIELD NAME="depth" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="How many parents does this category have?"/>
1680 <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="shows the path as /1/2/3 (like course_categories)"/>
1681 <FIELD NAME="fullname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The name of this grade category"/>
1682 <FIELD NAME="aggregation" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="A constant pointing to one of the predefined aggregation strategies (none, mean,median,sum, etc)"/>
1683 <FIELD NAME="keephigh" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Keep only the X highest items"/>
1684 <FIELD NAME="droplow" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Drop the X lowest items"/>
1685 <FIELD NAME="aggregateonlygraded" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="aggregate only graded activities"/>
1686 <FIELD NAME="aggregateoutcomes" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Aggregate outcomes"/>
1687 <FIELD NAME="aggregatesubcats" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="ignore subcategories in aggregation"/>
1688 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1689 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1690 <FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1691 </FIELDS>
1692 <KEYS>
1693 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1694 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1695 <KEY NAME="parent" TYPE="foreign" FIELDS="parent" REFTABLE="grade_categories" REFFIELDS="id"/>
1696 </KEYS>
1697 </TABLE>
1698 <TABLE NAME="grade_items" COMMENT="This table keeps information about gradeable items (ie columns). If an activity (eg an assignment or quiz) has multiple grade_items associated with it (eg several outcomes or numerical grades), then there will be a corresponding multiple number of rows in this table.">
1699 <FIELDS>
1700 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1701 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The course this item is part of"/>
1702 <FIELD NAME="categoryid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="(optional) the category group this item belongs to"/>
1703 <FIELD NAME="itemname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The name of this item (pushed in by the module)"/>
1704 <FIELD NAME="itemtype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="'mod', 'blocks', 'import', 'calculated' etc"/>
1705 <FIELD NAME="itemmodule" TYPE="char" LENGTH="30" NOTNULL="false" SEQUENCE="false" COMMENT="'forum', 'quiz', 'csv', etc"/>
1706 <FIELD NAME="iteminstance" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="id of the item module"/>
1707 <FIELD NAME="itemnumber" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Can be used to distinguish multiple grades for an activity"/>
1708 <FIELD NAME="iteminfo" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Info and notes about this item XXX"/>
1709 <FIELD NAME="idnumber" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Arbitrary idnumber provided by the module responsible"/>
1710 <FIELD NAME="calculation" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Formula describing how to derive this grade from other items, referring to them using giXXX where XXX is grade item id ... eg something like: =sin(square([#gi20#])) + [#gi30#]"/>
1711 <FIELD NAME="gradetype" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="0 = none, 1 = value, 2 = scale, 3 = text"/>
1712 <FIELD NAME="grademax" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" DECIMALS="5" COMMENT="What is the maximum allowable grade?"/>
1713 <FIELD NAME="grademin" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="What is the minimum allowable grade?"/>
1714 <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If this grade is based on a scale, which one is it?"/>
1715 <FIELD NAME="outcomeid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If this grade is related to an outcome, which one is it?"/>
1716 <FIELD NAME="gradepass" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="What grade is needed to pass? grademin &amp;lt; gradepass &amp;lt;= grademax"/>
1717 <FIELD NAME="multfactor" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="1.0" SEQUENCE="false" DECIMALS="5" COMMENT="Multiply all grades by this"/>
1718 <FIELD NAME="plusfactor" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="Add this to all grades"/>
1719 <FIELD NAME="aggregationcoef" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="Aggregation coefficient used for category weights or other aggregation types"/>
1720 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Sorting order of the columns"/>
1721 <FIELD NAME="display" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Display as real grades, percentages (in reference to the minimum and maximum grades) or letters (A, B, C etc..), or course default (0)"/>
1722 <FIELD NAME="decimals" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Also known as precision, the number of digits after the decimal point symbol."/>
1723 <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 is hidden, &amp;gt; 1 is a date to hide until (prevents viewing)"/>
1724 <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 is locked, &amp;gt; 1 is a date to lock until (prevents update)"/>
1725 <FIELD NAME="locktime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="lock all final grades after this date"/>
1726 <FIELD NAME="needsupdate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If this flag is set, then the whole column will be recalculated"/>
1727 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The first time this grade_item was created"/>
1728 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The last time this grade_item was modified"/>
1729 </FIELDS>
1730 <KEYS>
1731 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1732 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1733 <KEY NAME="categoryid" TYPE="foreign" FIELDS="categoryid" REFTABLE="grade_categories" REFFIELDS="id"/>
1734 <KEY NAME="scaleid" TYPE="foreign" FIELDS="scaleid" REFTABLE="scale" REFFIELDS="id"/>
1735 <KEY NAME="outcomeid" TYPE="foreign" FIELDS="outcomeid" REFTABLE="grade_outcomes" REFFIELDS="id"/>
1736 </KEYS>
1737 <INDEXES>
1738 <INDEX NAME="locked-locktime" UNIQUE="false" FIELDS="locked, locktime" COMMENT="used in grading cron"/>
1739 <INDEX NAME="itemtype-needsupdate" UNIQUE="false" FIELDS="itemtype, needsupdate" COMMENT="used in grading cron"/>
1740 <INDEX NAME="gradetype" UNIQUE="false" FIELDS="gradetype" COMMENT="index for gradetype"/>
1741 <INDEX NAME="idnumber-courseid" UNIQUE="false" FIELDS="idnumber, courseid" COMMENT="non unique index (although programatically we are guarantying some sort of uniqueness both under this table and the course_modules one). TODO: We need a central store of module idnumbers in the future."/>
1742 </INDEXES>
1743 </TABLE>
1744 <TABLE NAME="grade_grades" COMMENT="grade_grades This table keeps individual grades for each user and each item, exactly as imported or submitted by modules. The rawgrademax/min and rawscaleid are stored here to record the values at the time the grade was stored, because teachers might change this for an activity! All the results are normalised/resampled for the final grade value.">
1745 <FIELDS>
1746 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1747 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The item this grade belongs to"/>
1748 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who this grade is for"/>
1749 <FIELD NAME="rawgrade" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="If the grade is a float value (or has been converted to one)"/>
1750 <FIELD NAME="rawgrademax" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" DECIMALS="5" COMMENT="The maximum allowable grade when this was created"/>
1751 <FIELD NAME="rawgrademin" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The minimum allowable grade when this was created"/>
1752 <FIELD NAME="rawscaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If this grade is based on a scale, which one was it?"/>
1753 <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this grade"/>
1754 <FIELD NAME="finalgrade" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="The final grade (cached) after all calculations are made"/>
1755 <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="show 0, hide 1 or hide until date"/>
1756 <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="not locked 0, locked from date"/>
1757 <FIELD NAME="locktime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="automatic locking of final grade, 0 means none, date otherwise"/>
1758 <FIELD NAME="exported" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="date of last grade export, 0 if none"/>
1759 <FIELD NAME="overridden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="indicates grade overridden from gradebook, 0 means none, date means overridden"/>
1760 <FIELD NAME="excluded" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="grade excluded from aggregation functions, date means when excluded"/>
1761 <FIELD NAME="feedback" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="grading feedback"/>
1762 <FIELD NAME="feedbackformat" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="format of feedback text"/>
1763 <FIELD NAME="information" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="optiona information"/>
1764 <FIELD NAME="informationformat" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="format of information text"/>
1765 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the time this grade was first created"/>
1766 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the time this grade was last modified"/>
1767 </FIELDS>
1768 <KEYS>
1769 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1770 <KEY NAME="itemid" TYPE="foreign" FIELDS="itemid" REFTABLE="grade_items" REFFIELDS="id"/>
1771 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
1772 <KEY NAME="rawscaleid" TYPE="foreign" FIELDS="rawscaleid" REFTABLE="scale" REFFIELDS="id"/>
1773 <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
1774 <KEY NAME="userid-itemid" TYPE="unique" FIELDS="userid, itemid" COMMENT="one entry per user per item"/>
5cb564aa 1775 </KEYS>
173403cf 1776 <INDEXES>
6c9f6725 1777 <INDEX NAME="locked-locktime" UNIQUE="false" FIELDS="locked, locktime" COMMENT="used in grading cron"/>
173403cf 1778 </INDEXES>
5cb564aa 1779 </TABLE>
7a18f49c 1780 <TABLE NAME="grade_outcomes_history" COMMENT="History table">
5cb564aa 1781 <FIELDS>
7a18f49c
PS
1782 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1783 <FIELD NAME="action" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="created/modified/deleted constants"/>
1784 <FIELD NAME="oldid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1785 <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="What caused the modification? manual/module/import/..."/>
1786 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The last time this grade_item was modified"/>
1787 <FIELD NAME="loggeduser" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this outcome"/>
1788 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Mostly these are defined site wide ie NULL"/>
1789 <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The short name or code for this outcome statement"/>
1790 <FIELD NAME="fullname" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="The full description of the outcome (usually 1 sentence)"/>
1791 <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The recommended scale for this outcome."/>
1792 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Outcome description"/>
1793 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
5cb564aa 1794 </FIELDS>
1795 <KEYS>
7a18f49c
PS
1796 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1797 <KEY NAME="oldid" TYPE="foreign" FIELDS="oldid" REFTABLE="grade_outcomes" REFFIELDS="id"/>
1798 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1799 <KEY NAME="scaleid" TYPE="foreign" FIELDS="scaleid" REFTABLE="scale" REFFIELDS="id"/>
1800 <KEY NAME="loggeduser" TYPE="foreign" FIELDS="loggeduser" REFTABLE="user" REFFIELDS="id"/>
5cb564aa 1801 </KEYS>
d3f31bf2 1802 <INDEXES>
1803 <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete"/>
1804 </INDEXES>
5cb564aa 1805 </TABLE>
7a18f49c
PS
1806 <TABLE NAME="grade_categories_history" COMMENT="History of grade_categories">
1807 <FIELDS>
1808 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1809 <FIELD NAME="action" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="created/modified/deleted constants"/>
1810 <FIELD NAME="oldid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1811 <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="What caused the modification? manual/module/import/..."/>
1812 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The last time this grade_item was modified"/>
1813 <FIELD NAME="loggeduser" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this outcome"/>
1814 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this grade category is part of"/>
1815 <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Categories can be hierarchical"/>
1816 <FIELD NAME="depth" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="How many parents does this category have?"/>
1817 <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="shows the path as /1/2/3 (like course_categories)"/>
1818 <FIELD NAME="fullname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The name of this grade category"/>
1819 <FIELD NAME="aggregation" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="A constant pointing to one of the predefined aggregation strategies (none, mean,median,sum, etc)"/>
1820 <FIELD NAME="keephigh" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Keep only the X highest items"/>
1821 <FIELD NAME="droplow" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Drop the X lowest items"/>
1822 <FIELD NAME="aggregateonlygraded" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="aggregate only graded items"/>
1823 <FIELD NAME="aggregateoutcomes" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Aggregate outcomes"/>
1824 <FIELD NAME="aggregatesubcats" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="ignore subcategories in aggregation"/>
1825 <FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d3f31bf2 1826 </FIELDS>
1827 <KEYS>
7a18f49c
PS
1828 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1829 <KEY NAME="oldid" TYPE="foreign" FIELDS="oldid" REFTABLE="grade_categories" REFFIELDS="id"/>
1830 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1831 <KEY NAME="parent" TYPE="foreign" FIELDS="parent" REFTABLE="grade_categories" REFFIELDS="id"/>
1832 <KEY NAME="loggeduser" TYPE="foreign" FIELDS="loggeduser" REFTABLE="user" REFFIELDS="id"/>
d3f31bf2 1833 </KEYS>
1834 <INDEXES>
1835 <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete"/>
1836 </INDEXES>
1837 </TABLE>
7a18f49c
PS
1838 <TABLE NAME="grade_items_history" COMMENT="History of grade_items">
1839 <FIELDS>
1840 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1841 <FIELD NAME="action" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="created/modified/deleted constants"/>
1842 <FIELD NAME="oldid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1843 <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="What caused the modification? manual/module/import/..."/>
1844 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The last time this grade_item was modified"/>
1845 <FIELD NAME="loggeduser" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this outcome"/>
1846 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The course this item is part of"/>
1847 <FIELD NAME="categoryid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="(optional) the category group this item belongs to"/>
1848 <FIELD NAME="itemname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The name of this item (pushed in by the module)"/>
1849 <FIELD NAME="itemtype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="'mod', 'blocks', 'import', 'calculated' etc"/>
1850 <FIELD NAME="itemmodule" TYPE="char" LENGTH="30" NOTNULL="false" SEQUENCE="false" COMMENT="'forum', 'quiz', 'csv', etc"/>
1851 <FIELD NAME="iteminstance" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="id of the item module"/>
1852 <FIELD NAME="itemnumber" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Can be used to distinguish multiple grades for an activity"/>
1853 <FIELD NAME="iteminfo" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Info and notes about this item XXX"/>
1854 <FIELD NAME="idnumber" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Arbitrary idnumber provided by the module responsible"/>
1855 <FIELD NAME="calculation" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Formula describing how to derive this grade from other items, referring to them using giXXX where XXX is grade item id ... eg something like: =sin(square([#gi20#])) + [#gi30#]"/>
1856 <FIELD NAME="gradetype" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="0 = none, 1 = value, 2 = scale, 3 = text"/>
1857 <FIELD NAME="grademax" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" DECIMALS="5" COMMENT="What is the maximum allowable grade?"/>
1858 <FIELD NAME="grademin" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="What is the minimum allowable grade?"/>
1859 <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If this grade is based on a scale, which one is it?"/>
1860 <FIELD NAME="outcomeid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If this grade is related to an outcome, which one is it?"/>
1861 <FIELD NAME="gradepass" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="What grade is needed to pass? grademin &amp;lt; gradepass &amp;lt;= grademax"/>
1862 <FIELD NAME="multfactor" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="1.0" SEQUENCE="false" DECIMALS="5" COMMENT="Multiply all grades by this"/>
1863 <FIELD NAME="plusfactor" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="Add this to all grades"/>
1864 <FIELD NAME="aggregationcoef" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="Aggregation coefficient used for category weights or other aggregation types"/>
1865 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Sorting order of the columns"/>
1866 <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 is hidden, &amp;gt; 1 is a date to hide until (prevents viewing)"/>
1867 <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 is locked, &amp;gt; 1 is a date to lock until (prevents update)"/>
1868 <FIELD NAME="locktime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="lock all final grades after this date"/>
1869 <FIELD NAME="needsupdate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If this flag is set, then the whole column will be recalculated"/>
1870 <FIELD NAME="display" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1871 <FIELD NAME="decimals" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
1872 </FIELDS>
1873 <KEYS>
1874 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1875 <KEY NAME="oldid" TYPE="foreign" FIELDS="oldid" REFTABLE="grade_items" REFFIELDS="id"/>
1876 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
1877 <KEY NAME="categoryid" TYPE="foreign" FIELDS="categoryid" REFTABLE="grade_categories" REFFIELDS="id"/>
1878 <KEY NAME="scaleid" TYPE="foreign" FIELDS="scaleid" REFTABLE="scale" REFFIELDS="id"/>
1879 <KEY NAME="outcomeid" TYPE="foreign" FIELDS="outcomeid" REFTABLE="grade_outcomes" REFFIELDS="id"/>
1880 <KEY NAME="loggeduser" TYPE="foreign" FIELDS="loggeduser" REFTABLE="user" REFFIELDS="id"/>
aaff71da 1881 </KEYS>
1882 <INDEXES>
1883 <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete"/>
1884 </INDEXES>
1885 </TABLE>
7a18f49c
PS
1886 <TABLE NAME="grade_grades_history" COMMENT="History table">
1887 <FIELDS>
1888 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1889 <FIELD NAME="action" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="created/modified/deleted constants"/>
1890 <FIELD NAME="oldid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1891 <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="What caused the modification? manual/module/import/..."/>
1892 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The last time this grade_item was modified"/>
1893 <FIELD NAME="loggeduser" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this outcome"/>
1894 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The item this grade belongs to"/>
1895 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who this grade is for"/>
1896 <FIELD NAME="rawgrade" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="If the grade is a float value (or has been converted to one)"/>
1897 <FIELD NAME="rawgrademax" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" DECIMALS="5" COMMENT="The maximum allowable grade when this was created"/>
1898 <FIELD NAME="rawgrademin" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The minimum allowable grade when this was created"/>
1899 <FIELD NAME="rawscaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If this grade is based on a scale, which one was it?"/>
1900 <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the userid of the person who last modified this grade"/>
1901 <FIELD NAME="finalgrade" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="The final grade (cached) after all calculations are made"/>
1902 <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="show 0, hide 1 or hide until date"/>
1903 <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="not locked 0, locked from date"/>
1904 <FIELD NAME="locktime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="automatic locking of final grade, 0 means none, date otherwise"/>
1905 <FIELD NAME="exported" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="date of last grade export, 0 if none"/>
1906 <FIELD NAME="overridden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="indicates grade overridden from gradebook, 0 means none, date means overridden"/>
1907 <FIELD NAME="excluded" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="grade excluded from aggregation functions, date means when excluded"/>
1908 <FIELD NAME="feedback" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="grading feedback"/>
1909 <FIELD NAME="feedbackformat" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="format of feedback text"/>
1910 <FIELD NAME="information" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="optiona information"/>
1911 <FIELD NAME="informationformat" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="format of information text"/>
1912 </FIELDS>
1913 <KEYS>
1914 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1915 <KEY NAME="oldid" TYPE="foreign" FIELDS="oldid" REFTABLE="grade_grades" REFFIELDS="id"/>
1916 <KEY NAME="itemid" TYPE="foreign" FIELDS="itemid" REFTABLE="grade_items" REFFIELDS="id"/>
1917 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
1918 <KEY NAME="rawscaleid" TYPE="foreign" FIELDS="rawscaleid" REFTABLE="scale" REFFIELDS="id"/>
1919 <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
1920 <KEY NAME="loggeduser" TYPE="foreign" FIELDS="loggeduser" REFTABLE="user" REFFIELDS="id"/>
5cb564aa 1921 </KEYS>
aaff71da 1922 <INDEXES>
5fb49674
MN
1923 <INDEX NAME="action" UNIQUE="false" FIELDS="action" COMMENT="insert/update/delete"/>
1924 <INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified"/>
aaff71da 1925 </INDEXES>
1926 </TABLE>
7a18f49c 1927 <TABLE NAME="grade_import_newitem" COMMENT="temporary table for storing new grade_item names from grade import">
aaff71da 1928 <FIELDS>
7a18f49c
PS
1929 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1930 <FIELD NAME="itemname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="new grade item name"/>
1931 <FIELD NAME="importcode" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="import batch code for identification"/>
1932 <FIELD NAME="importer" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="user importing the data"/>
aaff71da 1933 </FIELDS>
1934 <KEYS>
7a18f49c
PS
1935 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1936 <KEY NAME="importer" TYPE="foreign" FIELDS="importer" REFTABLE="user" REFFIELDS="id"/>
aaff71da 1937 </KEYS>
5cb564aa 1938 </TABLE>
7a18f49c 1939 <TABLE NAME="grade_import_values" COMMENT="Temporary table for importing grades">
4d40aa14 1940 <FIELDS>
7a18f49c
PS
1941 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1942 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="if set, this points to existing grade_items id"/>
1943 <FIELD NAME="newgradeitem" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="if set, points to the id of grade_import_newitem"/>
1944 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1945 <FIELD NAME="finalgrade" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="raw grade value"/>
1946 <FIELD NAME="feedback" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
1947 <FIELD NAME="importcode" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="similar to backup_code, a unique batch code for identifying one batch of imports"/>
1948 <FIELD NAME="importer" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
4d40aa14 1949 </FIELDS>
1950 <KEYS>
7a18f49c
PS
1951 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1952 <KEY NAME="itemid" TYPE="foreign" FIELDS="itemid" REFTABLE="grade_items" REFFIELDS="id"/>
1953 <KEY NAME="newgradeitem" TYPE="foreign" FIELDS="newgradeitem" REFTABLE="grade_import_newitem" REFFIELDS="id"/>
1954 <KEY NAME="importer" TYPE="foreign" FIELDS="importer" REFTABLE="user" REFFIELDS="id" COMMENT="user who is importing"/>
4d40aa14 1955 </KEYS>
1956 </TABLE>
7a18f49c 1957 <TABLE NAME="tag" COMMENT="Tag table - this generic table will replace the old &quot;tags&quot; table.">
79642064 1958 <FIELDS>
7a18f49c
PS
1959 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1960 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1961 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1962 <FIELD NAME="rawname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The raw, unnormalised name for the tag as entered by users"/>
1963 <FIELD NAME="tagtype" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
1964 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
1965 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1966 <FIELD NAME="flag" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="a tag can be 'flagged' as inappropriate"/>
1967 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
79642064 1968 </FIELDS>
1969 <KEYS>
7a18f49c
PS
1970 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1971 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
79642064 1972 </KEYS>
1973 <INDEXES>
7a18f49c
PS
1974 <INDEX NAME="name" UNIQUE="true" FIELDS="name" COMMENT="tag names are unique"/>
1975 <INDEX NAME="idname" UNIQUE="true" FIELDS="id, name" COMMENT="Improves performance of autocomplete in tag block"/>
50a61064 1976 </INDEXES>
79642064 1977 </TABLE>
7a18f49c 1978 <TABLE NAME="tag_correlation" COMMENT="The rationale for the 'tag_correlation' table is performance. It works as a cache for a potentially heavy load query done at the 'tag_instance' table. So, the 'tag_correlation' table stores redundant information derived from the 'tag_instance' table">
79642064 1979 <FIELDS>
7a18f49c
PS
1980 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1981 <FIELD NAME="tagid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
1982 <FIELD NAME="correlatedtags" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
79642064 1983 </FIELDS>
1984 <KEYS>
7a18f49c
PS
1985 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
1986 <KEY NAME="tagid" TYPE="foreign" FIELDS="tagid" REFTABLE="tag" REFFIELDS="id"/>
79642064 1987 </KEYS>
79642064 1988 </TABLE>
7a18f49c 1989 <TABLE NAME="tag_instance" COMMENT="tag_instance table holds the information of associations between tags and other items">
79642064 1990 <FIELDS>
7a18f49c
PS
1991 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
1992 <FIELD NAME="tagid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
8dfc4d9c 1993 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Defines the Moodle component which the tag was added to"/>
7a18f49c
PS
1994 <FIELD NAME="itemtype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
1995 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
8dfc4d9c 1996 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The context id of the item that was tagged"/>
7a18f49c
PS
1997 <FIELD NAME="tiuserid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1998 <FIELD NAME="ordering" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Maintains the order of the tag instances of an item"/>
8dfc4d9c 1999 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
7a18f49c 2000 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="timemodified"/>
79642064 2001 </FIELDS>
2002 <KEYS>
7a18f49c
PS
2003 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2004 <KEY NAME="tagid" TYPE="foreign" FIELDS="tagid" REFTABLE="tag" REFFIELDS="id"/>
8dfc4d9c 2005 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
79642064 2006 </KEYS>
2007 <INDEXES>
38fb8190 2008 <INDEX NAME="itemtype-itemid-tagid-tiuserid" UNIQUE="true" FIELDS="itemtype, itemid, tagid, tiuserid"/>
79642064 2009 </INDEXES>
2010 </TABLE>
7a18f49c 2011 <TABLE NAME="groups" COMMENT="Each record represents a group.">
2524b0f2 2012 <FIELDS>
7a18f49c
PS
2013 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2014 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2015 <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
2016 <FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Short human readable unique name for the group."/>
2017 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
2018 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2019 <FIELD NAME="enrolmentkey" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/>
2020 <FIELD NAME="picture" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2021 <FIELD NAME="hidepicture" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2022 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2023 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2524b0f2 2024 </FIELDS>
2025 <KEYS>
7a18f49c
PS
2026 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2027 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
2524b0f2 2028 </KEYS>
74b714df
ARN
2029 <INDEXES>
2030 <INDEX NAME="idnumber" UNIQUE="false" FIELDS="idnumber"/>
2031 </INDEXES>
2524b0f2 2032 </TABLE>
7a18f49c 2033 <TABLE NAME="groupings" COMMENT="A grouping is a collection of groups. WAS: groups_groupings">
2524b0f2 2034 <FIELDS>
7a18f49c
PS
2035 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2036 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2037 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Short human readable unique name for group."/>
2038 <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
2039 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
2040 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2041 <FIELD NAME="configdata" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="extra configuration data - may be used by group IU tools"/>
2042 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2043 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2524b0f2 2044 </FIELDS>
2045 <KEYS>
7a18f49c
PS
2046 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2047 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
2524b0f2 2048 </KEYS>
74b714df
ARN
2049 <INDEXES>
2050 <INDEX NAME="idnumber" UNIQUE="false" FIELDS="idnumber"/>
2051 </INDEXES>
2524b0f2 2052 </TABLE>
7a18f49c 2053 <TABLE NAME="groups_members" COMMENT="Link a user to a group.">
2524b0f2 2054 <FIELDS>
7a18f49c
PS
2055 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2056 <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2057 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2058 <FIELD NAME="timeadded" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2059 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Defines the Moodle component which added this group membership (e.g. 'auth_myplugin'), or blank if it was added manually. (Entries which are created by a Moodle component cannot be removed in the normal user interface.)"/>
2060 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If the 'component' field is set, this can be used to define the instance of the component that created the entry. Otherwise should be left as default (0)."/>
2524b0f2 2061 </FIELDS>
2062 <KEYS>
7a18f49c
PS
2063 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2064 <KEY NAME="groupid" TYPE="foreign" FIELDS="groupid" REFTABLE="groups" REFFIELDS="id"/>
2065 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
2524b0f2 2066 </KEYS>
2067 </TABLE>
7a18f49c 2068 <TABLE NAME="groupings_groups" COMMENT="Link a grouping to a group (note, groups can be in multiple groupings ONLY in a course). WAS: groups_groupings_groups">
2524b0f2 2069 <FIELDS>
7a18f49c
PS
2070 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2071 <FIELD NAME="groupingid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2072 <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2073 <FIELD NAME="timeadded" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2524b0f2 2074 </FIELDS>
2075 <KEYS>
7a18f49c
PS
2076 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2077 <KEY NAME="groupingid" TYPE="foreign" FIELDS="groupingid" REFTABLE="groupings" REFFIELDS="id"/>
2078 <KEY NAME="groupid" TYPE="foreign" FIELDS="groupid" REFTABLE="groups" REFFIELDS="id"/>
2524b0f2 2079 </KEYS>
2080 </TABLE>
7a18f49c 2081 <TABLE NAME="cohort" COMMENT="Each record represents one cohort (aka site-wide group).">
f733845d 2082 <FIELDS>
7a18f49c
PS
2083 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2084 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Context is usually ignored in sync operations so that the cohorts may be moved freely around in the context tree without any side affects."/>
2085 <FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Short human readable name for the cohort, does not have to be unique"/>
2086 <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Unique identifier of a cohort, useful especially for mapping to external entities"/>
2087 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Standard description text box"/>
2088 <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
2089 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Component (plugintype_pluignname) that manages the cohort, manual modifications are allowed only when set to NULL"/>
2090 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2091 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
f733845d
PS
2092 </FIELDS>
2093 <KEYS>
7a18f49c
PS
2094 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2095 <KEY NAME="context" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
f733845d
PS
2096 </KEYS>
2097 </TABLE>
7a18f49c 2098 <TABLE NAME="cohort_members" COMMENT="Link a user to a cohort.">
f733845d 2099 <FIELDS>
7a18f49c
PS
2100 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2101 <FIELD NAME="cohortid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2102 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2103 <FIELD NAME="timeadded" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
f733845d
PS
2104 </FIELDS>
2105 <KEYS>
7a18f49c
PS
2106 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2107 <KEY NAME="cohortid" TYPE="foreign" FIELDS="cohortid" REFTABLE="cohort" REFFIELDS="id"/>
2108 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
f733845d
PS
2109 </KEYS>
2110 <INDEXES>
2111 <INDEX NAME="cohortid-userid" UNIQUE="true" FIELDS="cohortid, userid" COMMENT="enforce unique index"/>
2112 </INDEXES>
2113 </TABLE>
7a18f49c 2114 <TABLE NAME="user_private_key" COMMENT="access keys used in cookieless scripts - rss, etc.">
61c6071f 2115 <FIELDS>
7a18f49c
PS
2116 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2117 <FIELD NAME="script" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="plugin, module - unique identifier"/>
2118 <FIELD NAME="value" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="private access key value"/>
2119 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="owner"/>
2120 <FIELD NAME="instance" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="optional instance id"/>
2121 <FIELD NAME="iprestriction" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="ip restriction"/>
2122 <FIELD NAME="validuntil" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="timestampt - valid until data"/>
2123 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="created timestamp"/>
61c6071f 2124 </FIELDS>
2125 <KEYS>
7a18f49c
PS
2126 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2127 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="id from user table"/>
61c6071f 2128 </KEYS>
2129 <INDEXES>
2130 <INDEX NAME="script-value" UNIQUE="false" FIELDS="script, value" COMMENT="index used for key validation"/>
2131 </INDEXES>
2132 </TABLE>
7a18f49c 2133 <TABLE NAME="grade_letters" COMMENT="Repository for grade letters, for courses and other moodle entities that use grades.">
e480c18c 2134 <FIELDS>
7a18f49c
PS
2135 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2136 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="What contextid does this letter apply to (for now these will always be courses, but later...)"/>
2137 <FIELD NAME="lowerboundary" TYPE="number" LENGTH="10" NOTNULL="true" SEQUENCE="false" DECIMALS="5" COMMENT="The lower boundary of the letter. Its upper boundary is the lower boundary of the next highest letter, unless there is none above, in which case it's grademax for that grade_item."/>
2138 <FIELD NAME="letter" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The display value of the letter. Can be any character or string of characters (OK, A, 10% etc..)"/>
e480c18c 2139 </FIELDS>
2140 <KEYS>
52cb2e47 2141 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
e480c18c 2142 </KEYS>
284abb09 2143 <INDEXES>
a1f27717 2144 <INDEX NAME="contextid-lowerboundary-letter" UNIQUE="true" FIELDS="contextid, lowerboundary, letter" COMMENT="index used when fetching context letters"/>
284abb09 2145 </INDEXES>
e480c18c 2146 </TABLE>
7a18f49c 2147 <TABLE NAME="cache_flags" COMMENT="Cache of time-sensitive flags">
e4a5c864 2148 <FIELDS>
7a18f49c
PS
2149 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2150 <FIELD NAME="flagtype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2151 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2152 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2153 <FIELD NAME="value" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
2154 <FIELD NAME="expiry" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
e4a5c864 2155 </FIELDS>
2156 <KEYS>
2157 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2158 </KEYS>
2159 <INDEXES>
7a18f49c
PS
2160 <INDEX NAME="flagtype" UNIQUE="false" FIELDS="flagtype"/>
2161 <INDEX NAME="name" UNIQUE="false" FIELDS="name"/>
e4a5c864 2162 </INDEXES>
2163 </TABLE>
7a18f49c 2164 <TABLE NAME="grade_settings" COMMENT="gradebook settings">
e0724506 2165 <FIELDS>
7a18f49c
PS
2166 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2167 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2168 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2169 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
e0724506 2170 </FIELDS>
2171 <KEYS>
7a18f49c
PS
2172 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2173 <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
e0724506 2174 </KEYS>
2175 <INDEXES>
2176 <INDEX NAME="courseid-name" UNIQUE="true" FIELDS="courseid, name"/>
2177 </INDEXES>
2178 </TABLE>
7a18f49c 2179 <TABLE NAME="webdav_locks" COMMENT="Resource locks for WebDAV users">
156df4ed 2180 <FIELDS>
7a18f49c
PS
2181 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2182 <FIELD NAME="token" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2183 <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2184 <FIELD NAME="expiry" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2185 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2186 <FIELD NAME="recursive" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2187 <FIELD NAME="exclusivelock" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2188 <FIELD NAME="created" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2189 <FIELD NAME="modified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2190 <FIELD NAME="owner" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
156df4ed 2191 </FIELDS>
2192 <KEYS>
7a18f49c
PS
2193 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2194 <KEY NAME="token" TYPE="unique" FIELDS="token"/>
156df4ed 2195 </KEYS>
2196 <INDEXES>
7a18f49c
PS
2197 <INDEX NAME="path" UNIQUE="false" FIELDS="path"/>
2198 <INDEX NAME="expiry" UNIQUE="false" FIELDS="expiry"/>
156df4ed 2199 </INDEXES>
2200 </TABLE>
7a18f49c 2201 <TABLE NAME="portfolio_instance" COMMENT="base table (not including config data) for instances of portfolio plugins.">
ac5efef6 2202 <FIELDS>
7a18f49c
PS
2203 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2204 <FIELD NAME="plugin" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" COMMENT="fk to plugin"/>
2205 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name of plugin instance"/>
2206 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="whether this instance is visible or not"/>
98978c2e 2207 </FIELDS>
2208 <KEYS>
2209 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2210 </KEYS>
2211 </TABLE>
7a18f49c 2212 <TABLE NAME="portfolio_instance_config" COMMENT="config for portfolio plugin instances">
ac5efef6 2213 <FIELDS>
7a18f49c
PS
2214 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2215 <FIELD NAME="instance" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="instance of plugin we're configurating"/>
2216 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="config field"/>
2217 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="config value"/>
ac5efef6 2218 </FIELDS>
2219 <KEYS>
7a18f49c
PS
2220 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2221 <KEY NAME="instancefk" TYPE="foreign" FIELDS="instance" REFTABLE="portfolio_instance" REFFIELDS="id" COMMENT="fk to plugin instance"/>
ac5efef6 2222 </KEYS>
2223 <INDEXES>
2224 <INDEX NAME="name" UNIQUE="false" FIELDS="name" COMMENT="name index"/>
2225 </INDEXES>
2226 </TABLE>
7a18f49c 2227 <TABLE NAME="portfolio_instance_user" COMMENT="user data for portfolio instances.">
ac5efef6 2228 <FIELDS>
7a18f49c
PS
2229 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2230 <FIELD NAME="instance" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="fk to instance table"/>
2231 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="fk to user table"/>
2232 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name of config item"/>
2233 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="value of config item"/>
ac5efef6 2234 </FIELDS>
2235 <KEYS>
7a18f49c
PS
2236 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2237 <KEY NAME="instancefk" TYPE="foreign" FIELDS="instance" REFTABLE="portfolio_instance" REFFIELDS="id" COMMENT="fk to portfolio_instance"/>
2238 <KEY NAME="userfk" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="fk to user table"/>
ac5efef6 2239 </KEYS>
2240 </TABLE>
7a18f49c 2241 <TABLE NAME="portfolio_log" COMMENT="log of portfolio transfers (used to later check for duplicates)">
04f35360 2242 <FIELDS>
7a18f49c
PS
2243 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2244 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="user who exported content"/>
2245 <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="time of transfer (in the case of a queued transfer this is the time the actual transfer ran, not when the user started)"/>
2246 <FIELD NAME="portfolio" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="fk to portfolio_instance"/>
2247 <FIELD NAME="caller_class" TYPE="char" LENGTH="150" NOTNULL="true" SEQUENCE="false" COMMENT="the name of the class used to create the transfer"/>
2248 <FIELD NAME="caller_file" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="path to file to include where the class definition lives. (relative to dirroot)"/>
2249 <FIELD NAME="caller_component" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="the component name responsible for exporting"/>
2250 <FIELD NAME="caller_sha1" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="sha1 of exported content as far as the caller is concerned (before the portfolio plugin gets a hold of it)"/>
2251 <FIELD NAME="tempdataid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="old id from portfolio_tempdata. This is so that we can gracefully catch a race condition between an external system requesting a file and causing the tempdata to be deleted, before the user gets the &quot;your transfer is requested&quot; page"/>
2252 <FIELD NAME="returnurl" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="the original &quot;returnurl&quot; of the export - takes us to the moodle page we started from"/>
2253 <FIELD NAME="continueurl" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="the url the external system has set to view the transfer"/>
04f35360 2254 </FIELDS>
2255 <KEYS>
7a18f49c
PS
2256 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2257 <KEY NAME="userfk" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="fk to user table"/>
2258 <KEY NAME="portfoliofk" TYPE="foreign" FIELDS="portfolio" REFTABLE="portfolio_instance" REFFIELDS="id" COMMENT="fk to portfolio_instance"/>
04f35360 2259 </KEYS>
2260 </TABLE>
7a18f49c 2261 <TABLE NAME="portfolio_tempdata" COMMENT="stores temporary data for portfolio exports. the id of this table is used for the itemid for the temporary files area. cron can clean up stale records (and associated file data) after expirytime.">
04f35360 2262 <FIELDS>
7a18f49c
PS
2263 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2264 <FIELD NAME="data" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="dumping ground for portfolio callers to store their data in."/>
2265 <FIELD NAME="expirytime" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="time this record will expire (used for cron cleanups) - the start of export + 24 hours"/>
2266 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="psuedo fk to user. this is stored in the serialised data structure in the data field, but added here for ease of lookups."/>
2267 <FIELD NAME="instance" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="which portfolio plugin instance is being used"/>
fd0e0192 2268 <FIELD NAME="queued" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Value 1 means the entry should be processed in cron."/>
04f35360 2269 </FIELDS>
2270 <KEYS>
7a18f49c
PS
2271 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2272 <KEY NAME="userfk" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="fk to usertable"/>
2273 <KEY NAME="instance" TYPE="foreign" FIELDS="instance" REFTABLE="portfolio_instance" REFFIELDS="id" COMMENT="fk to portfolio_instance"/>
04f35360 2274 </KEYS>
2275 </TABLE>
7a18f49c 2276 <TABLE NAME="message_providers" COMMENT="This table stores the message providers (modules and core systems)">
3b120e46 2277 <FIELDS>
7a18f49c
PS
2278 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="id of the table, please edit me"/>
2279 <FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="The full name of the message provider in standard form"/>
2280 <FIELD NAME="component" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" COMMENT="The name of the component that produces these messages"/>
2281 <FIELD NAME="capability" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Optional: permission that is required on the user's setting screen to see this message provider."/>
3b120e46 2282 </FIELDS>
2283 <KEYS>
2284 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
2285 </KEYS>
120b3758 2286 <INDEXES>
2287 <INDEX NAME="componentname" UNIQUE="true" FIELDS="component, name" COMMENT="Unique index"/>
2288 </INDEXES>
3b120e46 2289 </TABLE>
7a18f49c 2290 <TABLE NAME="message_processors" COMMENT="List of message output plugins">
3b120e46 2291 <FIELDS>
7a18f49c
PS
2292 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2293 <FIELD NAME="name" TYPE="char" LENGTH="166" NOTNULL="true" SEQUENCE="false" COMMENT="Name of the message processor"/>
2294 <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Defines if processor is enabled"/>
3b120e46 2295 </FIELDS>
2296 <KEYS>
2297 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
2298 </KEYS>
2299 </TABLE>
7a18f49c 2300 <TABLE NAME="message_working" COMMENT="Lists all the messages and processors that need to be processed">
3b120e46 2301 <FIELDS>
7a18f49c
PS
2302 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="id of the table, please edit me"/>
2303 <FIELD NAME="unreadmessageid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="message that still needs some processing (on message table)"/>
2304 <FIELD NAME="processorid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The processor with processes the message"/>
3b120e46 2305 </FIELDS>
2306 <KEYS>
2307 <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
2308 </KEYS>
d750d41e
MC
2309 <INDEXES>
2310 <INDEX NAME="unreadmessageid_idx" UNIQUE="false" FIELDS="unreadmessageid" COMMENT="Index on unreadmessage id"/>
2311 </INDEXES>
3b120e46 2312 </TABLE>
7a18f49c
PS
2313 <TABLE NAME="files" COMMENT="description of files, content is stored in sha1 file pool">
2314 <FIELDS>
2315 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2316 <FIELD NAME="contenthash" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="sha1 hash of file content"/>
2317 <FIELD NAME="pathnamehash" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="complete file path sha1 hash - unique for each file"/>
2318 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The context id defined in context table - identifies the instance of plugin owning the file"/>
2319 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Full name of the component owning the area"/>
2320 <FIELD NAME="filearea" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" COMMENT="Like &quot;coursefiles&quot;. &quot;submission&quot;, &quot;intro&quot; and &quot;content&quot; (images and swf linked from summaries), etc."/>
2321 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Optional - some plugin specific item id (eg. forum post, blog entry or assignment submission, user id for user files)"/>
2322 <FIELD NAME="filepath" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Optional - relative path to file from module content root, useful in Scorm and Resource mod - most of the mods do not need this"/>
2323 <FIELD NAME="filename" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The full Unicode name of this file (case sensitive) - some chars are not allowed though"/>
2324 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Optional - general userid field - meaning depending on plugin"/>
2325 <FIELD NAME="filesize" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2326 <FIELD NAME="mimetype" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="type of file - jpeg image, open document spreadsheet"/>
2327 <FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="number greater than 0 means something is wrong with this file (virus, missing, etc.)"/>
2328 <FIELD NAME="source" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="contains the reference if the file is imported from external sites"/>
2329 <FIELD NAME="author" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The original author of the file"/>
2330 <FIELD NAME="license" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="license of the file to guide reuse"/>
2331 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2332 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2333 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="order of files"/>
2334 <FIELD NAME="referencefileid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Use to indicate file is a proxy for repository file"/>
172dd12c 2335 </FIELDS>
2336 <KEYS>
7a18f49c
PS
2337 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2338 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
2339 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
2340 <KEY NAME="referencefileid" TYPE="foreign" FIELDS="referencefileid" REFTABLE="files_reference" REFFIELDS="id"/>
172dd12c 2341 </KEYS>
2342 <INDEXES>
7a18f49c
PS
2343 <INDEX NAME="component-filearea-contextid-itemid" UNIQUE="false" FIELDS="component, filearea, contextid, itemid"/>
2344 <INDEX NAME="contenthash" UNIQUE="false" FIELDS="contenthash"/>
2345 <INDEX NAME="pathnamehash" UNIQUE="true" FIELDS="pathnamehash"/>
172dd12c 2346 </INDEXES>
2347 </TABLE>
7a18f49c 2348 <TABLE NAME="files_reference" COMMENT="Store files references">
67233725 2349 <FIELDS>
7a18f49c
PS
2350 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2351 <FIELD NAME="repositoryid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2352 <FIELD NAME="lastsync" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Last time the proxy file was synced with repository"/>
7a18f49c
PS
2353 <FIELD NAME="reference" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Identification of the external file. Repository plugins are interpreting it to locate the external file."/>
2354 <FIELD NAME="referencehash" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="Internal implementation detail, contains SHA1 hash of the reference field. Can be indexed and used for comparison. Not meant to be used by a non-core code."/>
67233725
DC
2355 </FIELDS>
2356 <KEYS>
7a18f49c
PS
2357 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2358 <KEY NAME="repositoryid" TYPE="foreign" FIELDS="repositoryid" REFTABLE="repository_instances" REFFIELDS="id"/>
67233725 2359 </KEYS>
6bbf31c3 2360 <INDEXES>
463882d0 2361 <INDEX NAME="uq_external_file" UNIQUE="true" FIELDS="referencehash, repositoryid" COMMENT="The combination of repositoryid and reference field is supposed to be a unique identification of an external file. Because the reference is a TEXT field, we can't use to compose the index. So we use the referencehash instead and the file API is responsible to keep it up-to-date"/>
6bbf31c3 2362 </INDEXES>
67233725 2363 </TABLE>
7a18f49c 2364 <TABLE NAME="repository" COMMENT="This table contains one entry for every configured external repository instance.">
27051e43 2365 <FIELDS>
7a18f49c
PS
2366 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2367 <FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2368 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="1" SEQUENCE="false"/>
2369 <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
27051e43 2370 </FIELDS>
2371 <KEYS>
2372 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2373 </KEYS>
2374 </TABLE>
7a18f49c 2375 <TABLE NAME="repository_instances" COMMENT="This table contains one entry for every configured external repository instance.">
27051e43 2376 <FIELDS>
7a18f49c
PS
2377 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2378 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2379 <FIELD NAME="typeid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2380 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2381 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2382 <FIELD NAME="username" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2383 <FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2384 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
2385 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
2386 <FIELD NAME="readonly" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
27051e43 2387 </FIELDS>
2388 <KEYS>
2389 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2390 </KEYS>
2391 </TABLE>
7a18f49c 2392 <TABLE NAME="repository_instance_config" COMMENT="The config for intances">
27051e43 2393 <FIELDS>
7a18f49c
PS
2394 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2395 <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2396 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2397 <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
27051e43 2398 </FIELDS>
2399 <KEYS>
2400 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2401 </KEYS>
2402 </TABLE>
7a18f49c 2403 <TABLE NAME="backup_courses" COMMENT="To store every course backup status">
f1953d38 2404 <FIELDS>
7a18f49c
PS
2405 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2406 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2407 <FIELD NAME="laststarttime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2408 <FIELD NAME="lastendtime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
70f210c0 2409 <FIELD NAME="laststatus" TYPE="char" LENGTH="1" NOTNULL="true" DEFAULT="5" SEQUENCE="false"/>
7a18f49c 2410 <FIELD NAME="nextstarttime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
f1953d38 2411 </FIELDS>
2412 <KEYS>
7a18f49c
PS
2413 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2414 <KEY NAME="courseid" TYPE="unique" FIELDS="courseid"/>
f1953d38 2415 </KEYS>
2416 </TABLE>
7a18f49c 2417 <TABLE NAME="block" COMMENT="contains all installed blocks">
ab2eb65c 2418 <FIELDS>
7a18f49c
PS
2419 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2420 <FIELD NAME="name" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false"/>
7a18f49c
PS
2421 <FIELD NAME="cron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2422 <FIELD NAME="lastcron" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2423 <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
ab2eb65c 2424 </FIELDS>
2425 <KEYS>
2426 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2427 </KEYS>
66b10689 2428 <INDEXES>
2429 <INDEX NAME="name" UNIQUE="true" FIELDS="name"/>
2430 </INDEXES>
ab2eb65c 2431 </TABLE>
7a18f49c 2432 <TABLE NAME="block_instances" COMMENT="This table stores block instances. The type of block this is is given by the blockname column. The places this block instance appears is controlled by the parentcontexid, showinsubcontexts, pagetypepattern and subpagepattern fields. Where the block appears on the page (by default) is controlled by the defaultposition and defaultweight columns. The block's own configuration is stored serialized in configdata.">
ab2eb65c 2433 <FIELDS>
7a18f49c
PS
2434 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2435 <FIELD NAME="blockname" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="The type of block this is. Foreign key, references block.name."/>
2436 <FIELD NAME="parentcontextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The context within which this block appears. Foreign key, references context.id."/>
2437 <FIELD NAME="showinsubcontexts" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="If 1, this block appears on all matching pages in subcontexts of parentcontextid, as well in pages belonging to parentcontextid."/>
2438 <FIELD NAME="pagetypepattern" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" COMMENT="The types of page this block appears on. Either an exact page type like mod-quiz-view, or a pattern like mod-quiz-* or course-view-*. Note that course-view-* will match course-view."/>
2439 <FIELD NAME="subpagepattern" TYPE="char" LENGTH="16" NOTNULL="false" SEQUENCE="false" COMMENT="Further restrictions on where this block appears. In some places, e.g. during a quiz or lesson attempt, different pages have different subpage ids. If this field is not null, the block only appears on that particular subpage."/>
2440 <FIELD NAME="defaultregion" TYPE="char" LENGTH="16" NOTNULL="true" SEQUENCE="false" COMMENT="Which block region this block should appear in on each page, in the absence of a specific position in the block_positions table."/>
2441 <FIELD NAME="defaultweight" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Used to order the blocks within a block region. Again, may be overridden by the block_positions table for a specific page where this block appears."/>
2442 <FIELD NAME="configdata" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="A serialized blob of configuration data for this block instance."/>
ab2eb65c 2443 </FIELDS>
2444 <KEYS>
7a18f49c
PS
2445 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2446 <KEY NAME="parentcontextid" TYPE="foreign" FIELDS="parentcontextid" REFTABLE="context" REFFIELDS="id"/>
ab2eb65c 2447 </KEYS>
2448 <INDEXES>
13a0d3d3 2449 <INDEX NAME="parentcontextid-showinsubcontexts-pagetypepattern-subpagepattern" UNIQUE="false" FIELDS="parentcontextid, showinsubcontexts, pagetypepattern, subpagepattern"/>
ab2eb65c 2450 </INDEXES>
2451 </TABLE>
7a18f49c 2452 <TABLE NAME="block_positions" COMMENT="Stores the position of a sticky block_instance on a another page than the one where it was added.">
ab2eb65c 2453 <FIELDS>
7a18f49c
PS
2454 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2455 <FIELD NAME="blockinstanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The block_instance this position relates to."/>
2456 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="With pagetype and subpage, defines the page we are setting the position for."/>
2457 <FIELD NAME="pagetype" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" COMMENT="With contextid and subpage, defines the page we are setting the position for."/>
2458 <FIELD NAME="subpage" TYPE="char" LENGTH="16" NOTNULL="true" SEQUENCE="false" COMMENT="With contextid and pagetype, defines the page we are setting the position for."/>
2459 <FIELD NAME="visible" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="Whether this block instance is visible on this page."/>
2460 <FIELD NAME="region" TYPE="char" LENGTH="16" NOTNULL="true" SEQUENCE="false" COMMENT="Which block region on this page this block should appear in."/>
2461 <FIELD NAME="weight" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Used to order the blocks within a block region."/>
ab2eb65c 2462 </FIELDS>
2463 <KEYS>
7a18f49c
PS
2464 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2465 <KEY NAME="blockinstanceid" TYPE="foreign" FIELDS="blockinstanceid" REFTABLE="block_instances" REFFIELDS="id"/>
2466 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
ab2eb65c 2467 </KEYS>
2468 <INDEXES>
66b10689 2469 <INDEX NAME="blockinstanceid-contextid-pagetype-subpage" UNIQUE="true" FIELDS="blockinstanceid, contextid, pagetype, subpage"/>
ab2eb65c 2470 </INDEXES>
2471 </TABLE>
7a18f49c 2472 <TABLE NAME="comments" COMMENT="moodle comments module">
5a529a53 2473 <FIELDS>
7a18f49c
PS
2474 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2475 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2476 <FIELD NAME="commentarea" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2477 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2478 <FIELD NAME="content" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
2479 <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2480 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2481 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
5a529a53 2482 </FIELDS>
2483 <KEYS>
2484 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2485 </KEYS>
2486 </TABLE>
7a18f49c 2487 <TABLE NAME="external_services" COMMENT="built in and custom external services">
5a529a53 2488 <FIELDS>
7a18f49c
PS
2489 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2490 <FIELD NAME="name" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false"/>
2491 <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
2492 <FIELD NAME="requiredcapability" TYPE="char" LENGTH="150" NOTNULL="false" SEQUENCE="false"/>
2493 <FIELD NAME="restrictedusers" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
2494 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
2495 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2496 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
2497 <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="a unique shortname"/>
2498 <FIELD NAME="downloadfiles" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 if the service allow people to download file from webservice/plugins.php - 0 if not"/>
106c55fb 2499 <FIELD NAME="uploadfiles" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 if the service allow people to upload files to webservice/upload.php - 0 if not"/>
5a529a53 2500 </FIELDS>
2501 <KEYS>
2502 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2503 </KEYS>
2504 <INDEXES>
975341d1 2505 <INDEX NAME="name" UNIQUE="true" FIELDS="name"/>
5a529a53 2506 </INDEXES>
2507 </TABLE>
7a18f49c 2508 <TABLE NAME="external_functions" COMMENT="list of all external functions">
5a529a53 2509 <FIELDS>
7a18f49c
PS
2510 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2511 <FIELD NAME="name" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false"/>
2512 <FIELD NAME="classname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
2513 <FIELD NAME="methodname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
2514 <FIELD NAME="classpath" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2515 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
2516 <FIELD NAME="capabilities" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="all capabilities that are required to be run by the function (separated by comma)"/>
5a529a53 2517 </FIELDS>
2518 <KEYS>
2519 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2520 </KEYS>
2521 <INDEXES>
975341d1 2522 <INDEX NAME="name" UNIQUE="true" FIELDS="name" COMMENT="the external function names must be globally unique"/>
5a529a53 2523 </INDEXES>
2524 </TABLE>
7a18f49c 2525 <TABLE NAME="external_services_functions" COMMENT="lists functions available in each service group">
cae83708 2526 <FIELDS>
7a18f49c
PS
2527 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2528 <FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2529 <FIELD NAME="functionname" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false"/>
cae83708 2530 </FIELDS>
2531 <KEYS>
7a18f49c
PS
2532 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2533 <KEY NAME="externalserviceid" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id"/>
cae83708 2534 </KEYS>
cae83708 2535 </TABLE>
7a18f49c 2536 <TABLE NAME="external_services_users" COMMENT="users allowed to use services with restricted users flag">
cae83708 2537 <FIELDS>
7a18f49c
PS
2538 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2539 <FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2540 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2541 <FIELD NAME="iprestriction" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="ip restriction"/>
2542 <FIELD NAME="validuntil" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="timestampt - valid until data"/>
2543 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="created timestamp"/>
9baf6825 2544 </FIELDS>
2545 <KEYS>
7a18f49c
PS
2546 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2547 <KEY NAME="externalserviceid" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id"/>
2548 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
9baf6825 2549 </KEYS>
9c8c6c29 2550 </TABLE>
7a18f49c 2551 <TABLE NAME="external_tokens" COMMENT="Security tokens for accessing of external services">
1942103f 2552 <FIELDS>
7a18f49c
PS
2553 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2554 <FIELD NAME="token" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="security token, aka private access key"/>
2555 <FIELD NAME="tokentype" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="type of token: 0=permanent, no session; 1=linked to current browser session via sid; 2=permanent, with emulated session"/>
2556 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="owner of the token"/>
2557 <FIELD NAME="externalserviceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2558 <FIELD NAME="sid" TYPE="char" LENGTH="128" NOTNULL="false" SEQUENCE="false" COMMENT="link to browser or emulated session"/>
2559 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="context id where in token valid"/>
2560 <FIELD NAME="creatorid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="user id of the token creator (useful to know when the administrator created a token and so display the token to a specific administrator)"/>
2561 <FIELD NAME="iprestriction" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="ip restriction"/>
2562 <FIELD NAME="validuntil" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="timestampt - valid until data"/>
2563 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="created timestamp"/>
2564 <FIELD NAME="lastaccess" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="last access timestamp"/>
1942103f
PS
2565 </FIELDS>
2566 <KEYS>
7a18f49c
PS
2567 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2568 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
2569 <KEY NAME="externalserviceid" TYPE="foreign" FIELDS="externalserviceid" REFTABLE="external_services" REFFIELDS="id"/>
2570 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
2571 <KEY NAME="creatorid" TYPE="foreign" FIELDS="creatorid" REFTABLE="user" REFFIELDS="id"/>
1942103f
PS
2572 </KEYS>
2573 </TABLE>
7a18f49c 2574 <TABLE NAME="blog_association" COMMENT="Associations of blog entries with courses and module instances">
cc82aef6 2575 <FIELDS>
7a18f49c
PS
2576 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2577 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2578 <FIELD NAME="blogid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
cc82aef6
NC
2579 </FIELDS>
2580 <KEYS>
7a18f49c
PS
2581 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2582 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
2583 <KEY NAME="blogid" TYPE="foreign" FIELDS="blogid" REFTABLE="post" REFFIELDS="id"/>
cc82aef6
NC
2584 </KEYS>
2585 </TABLE>
7a18f49c 2586 <TABLE NAME="blog_external" COMMENT="External blog links used for RSS copying of blog entries to Moodle user blogs">
cc82aef6 2587 <FIELDS>
7a18f49c
PS
2588 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2589 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2590 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2591 <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
2592 <FIELD NAME="url" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
2593 <FIELD NAME="filtertags" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Comma-separated list of tags that will be used to filter which entries are copied over from the external blog. They refer to existing tags in the external blog."/>
2594 <FIELD NAME="failedlastsync" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether or not the last sync failed for some reason"/>
2595 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
2596 <FIELD NAME="timefetched" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
cc82aef6
NC
2597 </FIELDS>
2598 <KEYS>
7a18f49c
PS
2599 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2600 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
cc82aef6
NC
2601 </KEYS>
2602 </TABLE>
7a18f49c 2603 <TABLE NAME="rating" COMMENT="moodle ratings">
a09aeee4 2604 <FIELDS>
7a18f49c
PS
2605 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2606 <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2607 <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
2608 <FIELD NAME="ratingarea" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false"/>
2609 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2610 <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2611 <FIELD NAME="rating" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2612 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2613 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
2614 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
a09aeee4
AD
2615 </FIELDS>
2616 <KEYS>
7a18f49c
PS
2617 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2618 <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id" COMMENT="Relates to context.id"/>
2619 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="Relates to user.id"/>
a09aeee4 2620 </KEYS>
ffec817e 2621 <INDEXES>
2b04c41c 2622 <INDEX NAME="uniqueuserrating" UNIQUE="false" FIELDS="component, ratingarea, contextid, itemid" COMMENT="These fields define a unique user rating of an item"/>
ffec817e 2623 </INDEXES>
a09aeee4 2624 </TABLE>
7a18f49c 2625 <TABLE NAME="license" COMMENT="store licenses used by moodle">
1dce6261 2626 <FIELDS>
7a18f49c
PS
2627 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2628 <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2629 <FIELD NAME="fullname" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
2630 <FIELD NAME="source" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2631 <FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
2632 <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
1dce6261
DC
2633 </FIELDS>
2634 <KEYS>
2635 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2636 </KEYS>
2637 </TABLE>
7a18f49c 2638 <TABLE NAME="registration_hubs" COMMENT="hub where the site is registered on with their associated token">
07ab0c80 2639 <FIELDS>
7a18f49c
PS
2640 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2641 <FIELD NAME="token" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="the token to communicate with the hub by web service"/>
2642 <FIELD NAME="hubname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2643 <FIELD NAME="huburl" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
2644 <FIELD NAME="confirmed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
2645 <FIELD NAME="secret" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="the unique site identifier for this hub"/>
07ab0c80 2646 </FIELDS>
2647 <KEYS>
2648 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2649 </KEYS>
2650 </TABLE>
7a18f49c 2651 <TABLE NAME="backup_controllers" COMMENT="To store the backup_controllers as they are used">
ee4d3dee 2652 <FIELDS>
7a18f49c
PS
2653 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
2654 <FIELD NAME="backupid" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="unique id of the backup"/>
2655 <FIELD NAME="operation" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="backup" SEQUENCE="false" COMMENT="Type of operation (backup/restore)"/>
2656 <FIELD NAME="type" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Type of the backup (activity/section/course)"/>
2657 <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="id of the module/section/activity being backup"/>
2658 <FIELD NAME="format" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="format of the backup (moodle/imscc...)"/>
2659 <FIELD NAME="interactive" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="is the backup interactive (1-yes/0-no)"/>
2660 <FIELD NAME="purpose" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="purpose (target) of the backup (general, import, hub...)"/>
2661 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="user that owns/performs the backup"/>
2662 <FIELD NAME="status" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="current status of the backup (configured, ui, running...)"/>
2663 <FIELD NAME="execution" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="type of execution (immediate/delayed)"/>
2664 <FIELD NAME="executiontime" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="epoch secs when the backup should be executed (for delayed backups only)"/>
2665 <FIELD NAME="checksum" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="checksum of the backup_controller object"/>
2666 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="time the controller was created"/>
2667 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="last time the controller was modified"/>
2668 <FIELD NAME="controller" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="serialised backup_controller object"/>
ee4d3dee
EL
2669 </FIELDS>
2670 <KEYS>
7a18f49c
PS
2671 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
2672 <KEY NAME="backupid_uk" TYPE="unique" FIELDS="backupid"/>
2673 <KEY NAME="userid_fk" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
ee4d3dee
EL
2674 </KEYS>
2675 <INDEXES>
2676 <INDEX NAME="typeitem_ix" UNIQUE="false" FIELDS="type, itemid"/>
2677 </INDEXES>
2678 </TABLE>
7a18f49c 2679 <TABLE NAME="backup_logs" COMMENT="To store all the logs from backup and restore operations (by db logger)">
a934bd23 2680 <FIELDS>
7a18f49c
PS