MDL-53149 mod_data: add timemodified field to db schema
[moodle.git] / mod / data / db / install.xml
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <XMLDB PATH="mod/data/db" VERSION="20160303" COMMENT="XMLDB file for Moodle mod/data"
3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4     xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
5 >
6   <TABLES>
7     <TABLE NAME="data" COMMENT="all database activities">
8       <FIELDS>
9         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
10         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
11         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
12         <FIELD NAME="intro" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
13         <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
14         <FIELD NAME="comments" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
15         <FIELD NAME="timeavailablefrom" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
16         <FIELD NAME="timeavailableto" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
17         <FIELD NAME="timeviewfrom" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
18         <FIELD NAME="timeviewto" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
19         <FIELD NAME="requiredentries" TYPE="int" LENGTH="8" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
20         <FIELD NAME="requiredentriestoview" TYPE="int" LENGTH="8" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
21         <FIELD NAME="maxentries" TYPE="int" LENGTH="8" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
22         <FIELD NAME="rssarticles" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
23         <FIELD NAME="singletemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
24         <FIELD NAME="listtemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
25         <FIELD NAME="listtemplateheader" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
26         <FIELD NAME="listtemplatefooter" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
27         <FIELD NAME="addtemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
28         <FIELD NAME="rsstemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
29         <FIELD NAME="rsstitletemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
30         <FIELD NAME="csstemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
31         <FIELD NAME="jstemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
32         <FIELD NAME="asearchtemplate" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
33         <FIELD NAME="approval" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
34         <FIELD NAME="manageapproved" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
35         <FIELD NAME="scale" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
36         <FIELD NAME="assessed" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
37         <FIELD NAME="assesstimestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
38         <FIELD NAME="assesstimefinish" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
39         <FIELD NAME="defaultsort" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
40         <FIELD NAME="defaultsortdir" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
41         <FIELD NAME="editany" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
42         <FIELD NAME="notification" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify people when things change"/>
43         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the settings for this database module instance were last modified."/>
44       </FIELDS>
45       <KEYS>
46         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
47       </KEYS>
48       <INDEXES>
49         <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
50       </INDEXES>
51     </TABLE>
52     <TABLE NAME="data_fields" COMMENT="every field available">
53       <FIELDS>
54         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
55         <FIELD NAME="dataid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
56         <FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
57         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
58         <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
59         <FIELD NAME="required" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Required fields must have a value when inserted by a user"/>
60         <FIELD NAME="param1" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
61         <FIELD NAME="param2" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
62         <FIELD NAME="param3" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
63         <FIELD NAME="param4" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
64         <FIELD NAME="param5" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
65         <FIELD NAME="param6" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
66         <FIELD NAME="param7" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
67         <FIELD NAME="param8" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
68         <FIELD NAME="param9" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
69         <FIELD NAME="param10" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
70       </FIELDS>
71       <KEYS>
72         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
73         <KEY NAME="dataid" TYPE="foreign" FIELDS="dataid" REFTABLE="data" REFFIELDS="id"/>
74       </KEYS>
75       <INDEXES>
76         <INDEX NAME="type-dataid" UNIQUE="false" FIELDS="type, dataid" COMMENT="used by data linking filter"/>
77       </INDEXES>
78     </TABLE>
79     <TABLE NAME="data_records" COMMENT="every record introduced">
80       <FIELDS>
81         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
82         <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
83         <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
84         <FIELD NAME="dataid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
85         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
86         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
87         <FIELD NAME="approved" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
88       </FIELDS>
89       <KEYS>
90         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
91         <KEY NAME="dataid" TYPE="foreign" FIELDS="dataid" REFTABLE="data" REFFIELDS="id"/>
92       </KEYS>
93     </TABLE>
94     <TABLE NAME="data_content" COMMENT="the content introduced in each record/fields">
95       <FIELDS>
96         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
97         <FIELD NAME="fieldid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
98         <FIELD NAME="recordid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
99         <FIELD NAME="content" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
100         <FIELD NAME="content1" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
101         <FIELD NAME="content2" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
102         <FIELD NAME="content3" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
103         <FIELD NAME="content4" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
104       </FIELDS>
105       <KEYS>
106         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
107         <KEY NAME="recordid" TYPE="foreign" FIELDS="recordid" REFTABLE="data_records" REFFIELDS="id"/>
108         <KEY NAME="fieldid" TYPE="foreign" FIELDS="fieldid" REFTABLE="data_fields" REFFIELDS="id"/>
109       </KEYS>
110     </TABLE>
111   </TABLES>
112 </XMLDB>