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