Merge branch 'MDL-81358' of https://github.com/paulholden/moodle
[moodle.git] / question / type / numerical / db / install.xml
blob8aab02126d14baa8b833a2eaf457b45e54edc400
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <XMLDB PATH="question/type/numerical/db" VERSION="20171210" COMMENT="XMLDB file for Moodle question/type/numerical"
3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4     xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
6   <TABLES>
7     <TABLE NAME="question_numerical" COMMENT="Options for numerical questions.">
8       <FIELDS>
9         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
10         <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Redundant, because of the answer field. Foreign key references question.id."/>
11         <FIELD NAME="answer" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references question_answers.id."/>
12         <FIELD NAME="tolerance" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="0.0" SEQUENCE="false" COMMENT="Allowed error when matching a response to this answer. I don't know why this is stored as a string."/>
13       </FIELDS>
14       <KEYS>
15         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
16         <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id"/>
17       </KEYS>
18       <INDEXES>
19         <INDEX NAME="answer" UNIQUE="false" FIELDS="answer"/>
20       </INDEXES>
21     </TABLE>
22     <TABLE NAME="question_numerical_options" COMMENT="Options for questions of type numerical This table is also used by the calculated question type">
23       <FIELDS>
24         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
25         <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
26         <FIELD NAME="showunits" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="How units are handled: 3) Not used at all, 0) Optional, or 1) must be right or penalty applied."/>
27         <FIELD NAME="unitsleft" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="display the unit at left as in $1.00"/>
28         <FIELD NAME="unitgradingtype" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 no penalty, 1 fraction response grade, 2 fraction total grade"/>
29         <FIELD NAME="unitpenalty" TYPE="number" LENGTH="12" NOTNULL="true" DEFAULT="0.1" SEQUENCE="false" DECIMALS="7" COMMENT="Penalty for getting the unit wrong, when they are being graded."/>
30       </FIELDS>
31       <KEYS>
32         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
33         <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id"/>
34       </KEYS>
35     </TABLE>
36     <TABLE NAME="question_numerical_units" COMMENT="Optional unit options for numerical questions. This table is also used by the calculated question type.">
37       <FIELDS>
38         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
39         <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references question.id"/>
40         <FIELD NAME="multiplier" TYPE="number" LENGTH="38" NOTNULL="true" DEFAULT="1.00000000000000000000" SEQUENCE="false" DECIMALS="19" COMMENT="The multiplier for this unit. For example, if the first unit is (1.0, 'cm'), another unit might be (0.1, 'mm') or (100.0, 'm')."/>
41         <FIELD NAME="unit" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" COMMENT="The unit. For example 'm' or 'kg'."/>
42       </FIELDS>
43       <KEYS>
44         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
45         <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id"/>
46       </KEYS>
47       <INDEXES>
48         <INDEX NAME="question-unit" UNIQUE="true" FIELDS="question, unit" COMMENT="Unique index to ensure that only one unit with a particular name is created for each question."/>
49       </INDEXES>
50     </TABLE>
51   </TABLES>
52 </XMLDB>