]> src.bluestatic.org Git - bugdar.git/blob - install/schema.php
r1557: Tagging 1.2.0 RC1
[bugdar.git] / install / schema.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $schema['adminsession'] = "
23 CREATE TABLE " . TABLE_PREFIX . "adminsession
24 (
25 sessionid varchar(250) NOT NULL,
26 userid int unsigned NOT NULL,
27 dateline int unsigned NOT NULL,
28 PRIMARY KEY (sessionid)
29 );";
30
31 $schema['attachment'] = "
32 CREATE TABLE " . TABLE_PREFIX . "attachment
33 (
34 attachmentid int unsigned NOT NULL AUTO_INCREMENT,
35 bugid int unsigned NOT NULL,
36 filename varchar(255) NOT NULL,
37 mimetype varchar(255) NOT NULL,
38 filesize bigint unsigned NOT NULL,
39 attachment blob NOT NULL,
40 description varchar(255) NOT NULL,
41 dateline bigint unsigned NOT NULL,
42 userid int unsigned NOT NULL,
43 obsolete bool NOT NULL,
44 PRIMARY KEY (attachmentid)
45 );";
46
47 $schema['automation'] = "
48 CREATE TABLE " . TABLE_PREFIX . "automation
49 (
50 actionid int unsigned NOT NULL AUTO_INCREMENT,
51 name varchar(255) NOT NULL,
52 description text NOT NULL,
53 fieldchanges text NOT NULL,
54 comment text NOT NULL,
55 PRIMARY KEY (actionid)
56 );";
57
58 $schema['bug'] = "
59 CREATE TABLE " . TABLE_PREFIX . "bug
60 (
61 bugid int unsigned NOT NULL AUTO_INCREMENT,
62 userid int unsigned NOT NULL,
63 dateline bigint unsigned NOT NULL,
64 product int unsigned NOT NULL,
65 component int unsigned NOT NULL,
66 version int unsigned NOT NULL,
67 summary varchar(255) NOT NULL,
68 priority int unsigned NOT NULL,
69 severity int unsigned NOT NULL,
70 status int unsigned NOT NULL,
71 resolution int unsigned NOT NULL,
72 assignedto int unsigned NOT NULL,
73 duplicateof int unsigned NOT NULL,
74 dependency text NOT NULL,
75 hidden smallint unsigned NOT NULL,
76 initialreport int unsigned NOT NULL,
77 lastposttime bigint unsigned NOT NULL,
78 lastpostby int unsigned NOT NULL,
79 hiddenlastposttime int unsigned NOT NULL,
80 hiddenlastpostby int unsigned NOT NULL,
81 username varchar(255) NOT NULL,
82 lastpostbyname varchar(255) NOT NULL,
83 hiddenlastpostbyname varchar(255) NOT NULL,
84 PRIMARY KEY (bugid),
85 FULLTEXT KEY summary (summary)
86 );";
87
88 $schema['bugfield'] = "
89 CREATE TABLE " . TABLE_PREFIX . "bugfield
90 (
91 fieldid int unsigned NOT NULL AUTO_INCREMENT,
92 name varchar(255) NOT NULL,
93 description text NOT NULL,
94 type varchar(50) NOT NULL,
95 selects text NOT NULL,
96 required smallint NOT NULL,
97 cansearch smallint NOT NULL,
98 regexmatch text NOT NULL,
99 defaultvalue text NOT NULL,
100 usedefault smallint NOT NULL,
101 maxlength smallint unsigned NOT NULL,
102 PRIMARY KEY (fieldid)
103 );";
104
105 $schema['bugfieldpermission'] = "
106 CREATE TABLE " . TABLE_PREFIX . "bugfieldpermission
107 (
108 usergroupid int unsigned NOT NULL,
109 fieldid int unsigned NOT NULL,
110 mask smallint unsigned NOT NULL,
111 PRIMARY KEY (usergroupid, fieldid)
112 );";
113
114 $schema['comment'] = "
115 CREATE TABLE " . TABLE_PREFIX . "comment
116 (
117 commentid int unsigned NOT NULL AUTO_INCREMENT,
118 bugid int unsigned NOT NULL,
119 userid int unsigned NOT NULL,
120 dateline bigint unsigned NOT NULL,
121 comment text NOT NULL,
122 comment_parsed text NOT NULL,
123 hidden smallint unsigned NOT NULL,
124 parselinks bool NULL,
125 PRIMARY KEY (commentid),
126 FULLTEXT KEY comment (comment)
127 );";
128
129 $schema['datastore'] = "
130 CREATE TABLE " . TABLE_PREFIX . "datastore
131 (
132 title varchar(255) NOT NULL,
133 data text NOT NULL,
134 PRIMARY KEY (title)
135 );";
136
137 $schema['favorite'] = "
138 CREATE TABLE " . TABLE_PREFIX . "favorite
139 (
140 userid int unsigned NOT NULL,
141 bugid int unsigned NOT NULL,
142 PRIMARY KEY (userid, bugid)
143 );";
144
145 $schema['fieldhelp'] = "
146 CREATE TABLE " . TABLE_PREFIX . "fieldhelp
147 (
148 keystring varchar(255) NOT NULL,
149 title varchar(255) NOT NULL,
150 body text NOT NULL,
151 PRIMARY KEY (keystring)
152 );";
153
154 $schema['history'] = "
155 CREATE TABLE " . TABLE_PREFIX . "history
156 (
157 historyid bigint unsigned NOT NULL AUTO_INCREMENT,
158 bugid int unsigned NOT NULL,
159 attachmentid int unsigned NOT NULL,
160 commentid int unsigned NOT NULL,
161 dateline bigint unsigned NOT NULL,
162 userid int unsigned NOT NULL,
163 field varchar(255) NOT NULL,
164 original text NOT NULL,
165 changed text NOT NULL,
166 PRIMARY KEY (historyid)
167 );";
168
169 $schema['language'] = "
170 CREATE TABLE " . TABLE_PREFIX . "language
171 (
172 languageid int unsigned NOT NULL AUTO_INCREMENT,
173 title varchar(255) NOT NULL,
174 langcode varchar(5) NOT NULL,
175 charset varchar(15) NOT NULL,
176 direction char(3) NOT NULL,
177 userselect smallint unsigned NOT NULL,
178 PRIMARY KEY (languageid),
179 UNIQUE KEY languagecode (langcode)
180 );";
181
182 $schema['passwordreset'] = "
183 CREATE TABLE " . TABLE_PREFIX . "passwordreset
184 (
185 activatorid varchar(250) NOT NULL,
186 userid int NOT NULL,
187 dateline int NOT NULL,
188 PRIMARY KEY (activatorid)
189 );";
190
191 $schema['permission'] = "
192 CREATE TABLE " . TABLE_PREFIX . "permission
193 (
194 usergroupid int unsigned NOT NULL,
195 productid int unsigned NOT NULL,
196 mask smallint NOT NULL,
197 PRIMARY KEY (usergroupid, productid)
198 );";
199
200 $schema['priority'] = "
201 CREATE TABLE " . TABLE_PREFIX . "priority
202 (
203 priorityid int unsigned NOT NULL AUTO_INCREMENT,
204 priority varchar(255) NOT NULL,
205 displayorder int unsigned NOT NULL,
206 PRIMARY KEY (priorityid)
207 );";
208
209 $schema['product'] = "
210 CREATE TABLE " . TABLE_PREFIX . "product
211 (
212 productid int unsigned NOT NULL AUTO_INCREMENT,
213 parentid int unsigned NULL,
214 displayorder int unsigned NOT NULL,
215 title varchar(255) NOT NULL,
216 description text NOT NULL,
217 PRIMARY KEY (productid)
218 );";
219
220 $schema['resolution'] = "
221 CREATE TABLE " . TABLE_PREFIX . "resolution
222 (
223 resolutionid int unsigned NOT NULL AUTO_INCREMENT,
224 resolution varchar(255) NOT NULL,
225 displayorder int unsigned NOT NULL,
226 PRIMARY KEY (resolutionid)
227 );";
228
229 $schema['search'] = "
230 CREATE TABLE " . TABLE_PREFIX . "search
231 (
232 searchid int unsigned NOT NULL AUTO_INCREMENT,
233 userid int unsigned NOT NULL,
234 dateline bigint unsigned NOT NULL,
235 query text NOT NULL,
236 ids text NOT NULL,
237 orderby text NOT NULL,
238 hilight varchar(255) NOT NULL,
239 resultcount int NULL,
240 name varchar(250) NULL,
241 PRIMARY KEY (searchid)
242 );";
243
244 $schema['setting'] = "
245 CREATE TABLE " . TABLE_PREFIX . "setting
246 (
247 varname varchar(255) NOT NULL,
248 value text NOT NULL,
249 PRIMARY KEY (varname)
250 );";
251
252 $schema['severity'] = "
253 CREATE TABLE " . TABLE_PREFIX . "severity
254 (
255 severityid int unsigned NOT NULL AUTO_INCREMENT,
256 severity varchar(255) NOT NULL,
257 displayorder int unsigned NOT NULL,
258 PRIMARY KEY (severityid)
259 );";
260
261 $schema['status'] = "
262 CREATE TABLE " . TABLE_PREFIX . "status
263 (
264 statusid int unsigned NOT NULL AUTO_INCREMENT,
265 status varchar(255) NOT NULL,
266 displayorder int unsigned NOT NULL,
267 color varchar(10) NOT NULL,
268 PRIMARY KEY (statusid)
269 );";
270
271 $schema['template'] = "
272 CREATE TABLE " . TABLE_PREFIX . "template
273 (
274 filename varchar(255) NOT NULL,
275 template text NOT NULL,
276 timestamp int unsigned NOT NULL,
277 PRIMARY KEY (filename)
278 );";
279
280 $schema['user'] = "
281 CREATE TABLE " . TABLE_PREFIX . "user
282 (
283 userid int unsigned NOT NULL AUTO_INCREMENT,
284 email varchar(255) NOT NULL,
285 displayname varchar(255) NOT NULL,
286 usergroupid int unsigned NOT NULL,
287 groupids text NULL,
288 password varchar(32) NOT NULL,
289 salt varchar(15) NOT NULL,
290 authkey varchar(65) NOT NULL,
291 showemail smallint unsigned NOT NULL,
292 showcolors bool NULL,
293 languageid int unsigned NOT NULL,
294 timezone float NOT NULL,
295 usedst bool NOT NULL,
296 hidestatuses text NOT NULL,
297 defaultsortkey varchar(50) NULL,
298 defaultsortas varchar(10) NULL,
299 columnoptions text NULL,
300 authid varchar(255) NULL,
301 PRIMARY KEY (userid)
302 );";
303
304 $schema['useractivation'] = "
305 CREATE TABLE " . TABLE_PREFIX . "useractivation
306 (
307 activator varchar(25) NOT NULL,
308 userid int unsigned NOT NULL,
309 dateline int unsigned NOT NULL,
310 usergroupid int unsigned NOT NULL,
311 PRIMARY KEY (activator)
312 );";
313
314 $schema['useremail'] = "
315 CREATE TABLE " . TABLE_PREFIX . "useremail
316 (
317 userid int unsigned NOT NULL,
318 mask int unsigned NOT NULL,
319 relation int unsigned NOT NULL
320 );";
321
322 $schema['usergroup'] = "
323 CREATE TABLE " . TABLE_PREFIX . "usergroup
324 (
325 usergroupid int unsigned NOT NULL AUTO_INCREMENT,
326 title varchar(255) NOT NULL,
327 displaytitle varchar(255) NOT NULL,
328 permissions int unsigned NOT NULL,
329 PRIMARY KEY (usergroupid)
330 );";
331
332 $schema['version'] = "
333 CREATE TABLE " . TABLE_PREFIX . "version
334 (
335 versionid int unsigned NOT NULL AUTO_INCREMENT,
336 productid int unsigned NOT NULL,
337 version varchar(255) NOT NULL,
338 displayorder int unsigned NOT NULL,
339 obsolete bool NULL,
340 PRIMARY KEY (versionid)
341 );";
342
343 $schema['vote'] = "
344 CREATE TABLE " . TABLE_PREFIX . "vote
345 (
346 bugid int unsigned NOT NULL,
347 userids text NOT NULL,
348 votefor int unsigned NOT NULL,
349 voteagainst int unsigned NOT NULL,
350 PRIMARY KEY (bugid)
351 );";
352
353 /*=====================================================================*\
354 || ###################################################################
355 || # $HeadURL$
356 || # $Id$
357 || ###################################################################
358 \*=====================================================================*/
359 ?>