NOBUG: Fixed file access permissions
[moodle.git] / mod / forum / db / install.xml
CommitLineData
d7a4f74e 1<?xml version="1.0" encoding="UTF-8" ?>
5f219cf1 2<XMLDB PATH="mod/forum/db" VERSION="20160113" COMMENT="XMLDB file for Moodle mod/forum"
683ff5d4 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
5>
d7a4f74e 6 <TABLES>
7a18f49c 7 <TABLE NAME="forum" COMMENT="Forums contain and structure discussion">
d7a4f74e 8 <FIELDS>
7a18f49c
PS
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="type" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="general" SEQUENCE="false"/>
12 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
13 <FIELD NAME="intro" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
14 <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="text format of intro field"/>
15 <FIELD NAME="assessed" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
16 <FIELD NAME="assesstimestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
17 <FIELD NAME="assesstimefinish" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
18 <FIELD NAME="scale" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
19 <FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
20 <FIELD NAME="maxattachments" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Number of attachments allowed per post"/>
21 <FIELD NAME="forcesubscribe" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
22 <FIELD NAME="trackingtype" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
23 <FIELD NAME="rsstype" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
24 <FIELD NAME="rssarticles" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
25 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
26 <FIELD NAME="warnafter" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
27 <FIELD NAME="blockafter" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
28 <FIELD NAME="blockperiod" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
29 <FIELD NAME="completiondiscussions" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Nonzero if a certain number of posts are required to mark this forum completed for a user."/>
30 <FIELD NAME="completionreplies" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Nonzero if a certain number of replies are required to mark this forum complete for a user."/>
31 <FIELD NAME="completionposts" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Nonzero if a certain number of posts or replies (total) are required to mark this forum complete for a user."/>
506522d5 32 <FIELD NAME="displaywordcount" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d7a4f74e 33 </FIELDS>
34 <KEYS>
f3c3a4d3 35 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
d7a4f74e 36 </KEYS>
37 <INDEXES>
38 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
39 </INDEXES>
40 </TABLE>
7a18f49c 41 <TABLE NAME="forum_discussions" COMMENT="Forums are composed of discussions">
d7a4f74e 42 <FIELDS>
7a18f49c
PS
43 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
44 <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
45 <FIELD NAME="forum" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
46 <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
47 <FIELD NAME="firstpost" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
48 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
49 <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="-1" SEQUENCE="false"/>
50 <FIELD NAME="assessed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
51 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
52 <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
53 <FIELD NAME="timestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
54 <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
87b007b4 55 <FIELD NAME="pinned" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d7a4f74e 56 </FIELDS>
57 <KEYS>
7a18f49c
PS
58 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
59 <KEY NAME="forum" TYPE="foreign" FIELDS="forum" REFTABLE="forum" REFFIELDS="id"/>
d7a4f74e 60 </KEYS>
61 <INDEXES>
62 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
73de21ff 63 <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
d7a4f74e 64 </INDEXES>
65 </TABLE>
7a18f49c 66 <TABLE NAME="forum_posts" COMMENT="All posts are stored in this table">
d7a4f74e 67 <FIELDS>
7a18f49c
PS
68 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
69 <FIELD NAME="discussion" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
70 <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
71 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
72 <FIELD NAME="created" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
73 <FIELD NAME="modified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
74 <FIELD NAME="mailed" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
75 <FIELD NAME="subject" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
76 <FIELD NAME="message" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
77 <FIELD NAME="messageformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
78 <FIELD NAME="messagetrust" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
79 <FIELD NAME="attachment" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
80 <FIELD NAME="totalscore" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
81 <FIELD NAME="mailnow" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d7a4f74e 82 </FIELDS>
83 <KEYS>
7a18f49c
PS
84 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
85 <KEY NAME="discussion" TYPE="foreign" FIELDS="discussion" REFTABLE="forum_discussions" REFFIELDS="id"/>
86 <KEY NAME="parent" TYPE="foreign" FIELDS="parent" REFTABLE="forum_posts" REFFIELDS="id" COMMENT="note that to make this recursive FK working someday, the parent field must be decalred NULL"/>
d7a4f74e 87 </KEYS>
88 <INDEXES>
7a18f49c
PS
89 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
90 <INDEX NAME="created" UNIQUE="false" FIELDS="created"/>
91 <INDEX NAME="mailed" UNIQUE="false" FIELDS="mailed"/>
d7a4f74e 92 </INDEXES>
93 </TABLE>
7a18f49c 94 <TABLE NAME="forum_queue" COMMENT="For keeping track of posts that will be mailed in digest form">
d7a4f74e 95 <FIELDS>
7a18f49c
PS
96 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
97 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
98 <FIELD NAME="discussionid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
99 <FIELD NAME="postid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
100 <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The modified time of the original post"/>
d7a4f74e 101 </FIELDS>
102 <KEYS>
7a18f49c
PS
103 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
104 <KEY NAME="discussionid" TYPE="foreign" FIELDS="discussionid" REFTABLE="forum_discussions" REFFIELDS="id"/>
105 <KEY NAME="postid" TYPE="foreign" FIELDS="postid" REFTABLE="forum_posts" REFFIELDS="id"/>
d7a4f74e 106 </KEYS>
107 <INDEXES>
108 <INDEX NAME="user" UNIQUE="false" FIELDS="userid"/>
109 </INDEXES>
110 </TABLE>
7a18f49c 111 <TABLE NAME="forum_subscriptions" COMMENT="Keeps track of who is subscribed to what forum">
d7a4f74e 112 <FIELDS>
7a18f49c
PS
113 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
114 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
115 <FIELD NAME="forum" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d7a4f74e 116 </FIELDS>
117 <KEYS>
7a18f49c
PS
118 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
119 <KEY NAME="forum" TYPE="foreign" FIELDS="forum" REFTABLE="forum" REFFIELDS="id"/>
d7a4f74e 120 </KEYS>
121 <INDEXES>
122 <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
123 </INDEXES>
124 </TABLE>
8e08c731
AN
125 <TABLE NAME="forum_digests" COMMENT="Keeps track of user mail delivery preferences for each forum">
126 <FIELDS>
127 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
128 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
129 <FIELD NAME="forum" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
130 <FIELD NAME="maildigest" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="-1" SEQUENCE="false"/>
131 </FIELDS>
132 <KEYS>
133 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
134 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
135 <KEY NAME="forum" TYPE="foreign" FIELDS="forum" REFTABLE="forum" REFFIELDS="id"/>
136 <KEY NAME="forumdigest" TYPE="unique" FIELDS="forum, userid, maildigest"/>
137 </KEYS>
138 </TABLE>
7a18f49c 139 <TABLE NAME="forum_read" COMMENT="Tracks each users read posts">
d7a4f74e 140 <FIELDS>
7a18f49c
PS
141 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
142 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
143 <FIELD NAME="forumid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
144 <FIELD NAME="discussionid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
145 <FIELD NAME="postid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
146 <FIELD NAME="firstread" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
147 <FIELD NAME="lastread" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d7a4f74e 148 </FIELDS>
149 <KEYS>
f3c3a4d3 150 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
d7a4f74e 151 </KEYS>
152 <INDEXES>
7a18f49c
PS
153 <INDEX NAME="userid-forumid" UNIQUE="false" FIELDS="userid, forumid"/>
154 <INDEX NAME="userid-discussionid" UNIQUE="false" FIELDS="userid, discussionid"/>
f5c6e8db 155 <INDEX NAME="postid-userid" UNIQUE="false" FIELDS="postid, userid"/>
d7a4f74e 156 </INDEXES>
157 </TABLE>
7a18f49c 158 <TABLE NAME="forum_track_prefs" COMMENT="Tracks each users untracked forums">
d7a4f74e 159 <FIELDS>
7a18f49c
PS
160 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
161 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
162 <FIELD NAME="forumid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
d7a4f74e 163 </FIELDS>
164 <KEYS>
f3c3a4d3 165 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
d7a4f74e 166 </KEYS>
167 <INDEXES>
168 <INDEX NAME="userid-forumid" UNIQUE="false" FIELDS="userid, forumid"/>
169 </INDEXES>
170 </TABLE>
361a41d3
AN
171 <TABLE NAME="forum_discussion_subs" COMMENT="Users may choose to subscribe and unsubscribe from specific discussions.">
172 <FIELDS>
173 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
174 <FIELD NAME="forum" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
175 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
176 <FIELD NAME="discussion" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
eb451c79 177 <FIELD NAME="preference" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
361a41d3
AN
178 </FIELDS>
179 <KEYS>
180 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
181 <KEY NAME="forum" TYPE="foreign" FIELDS="forum" REFTABLE="forum" REFFIELDS="id"/>
182 <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
183 <KEY NAME="discussion" TYPE="foreign" FIELDS="discussion" REFTABLE="forum_discussions" REFFIELDS="id"/>
184 <KEY NAME="user_discussions" TYPE="unique" FIELDS="userid, discussion" COMMENT="Users may only have one discussion preferences per discussion"/>
185 </KEYS>
186 </TABLE>
d7a4f74e 187 </TABLES>
73de21ff 188</XMLDB>