blob: bf00d447c155f84cb5a463c4f507395e4d0eadfe [file] [log] [blame]
droy27e97e02007-11-27 16:44:19 +00001-- MySQL dump 10.10
2--
3-- Host: localhost Database: babelstg
4-- ------------------------------------------------------
5-- Server version 5.0.18
6
7/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10/*!40101 SET NAMES utf8 */;
11/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12/*!40103 SET TIME_ZONE='+00:00' */;
13/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
droyd0a9b1a2008-01-29 19:51:46 +000018DROP TABLE IF EXISTS event_log;
droy3e7f3a82007-11-29 19:35:51 +000019CREATE TABLE `event_log` (
20 `event_id` int(10) unsigned NOT NULL auto_increment,
21 `table_name` varchar(100) NOT NULL,
22 `key_name` varchar(100) NOT NULL,
23 `key_value` varchar(100) default NULL,
24 `action` varchar(100) NOT NULL,
25 `userid` mediumint(9) NOT NULL,
26 `created_on` datetime NOT NULL,
27 PRIMARY KEY (`event_id`)
28) ENGINE=MyISAM DEFAULT CHARSET=utf8;
droy27e97e02007-11-27 16:44:19 +000029
droy5d4b64c2008-02-29 15:22:10 +000030DROP TABLE IF EXISTS `file_progress`;
31CREATE TABLE `file_progress` (
32 `file_id` int(10) unsigned NOT NULL,
33 `language_id` smallint(5) unsigned NOT NULL,
34 `pct_complete` float NOT NULL,
35 PRIMARY KEY (`file_id`, `language_id`),
36 CONSTRAINT `file_progress_ibfk_1` FOREIGN KEY (`file_id`) REFERENCES `files` (`file_id`) ON UPDATE CASCADE ON DELETE CASCADE,
Kit Lo6d440cc2013-03-02 19:56:45 -050037 CONSTRAINT `file_progress_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE ON DELETE CASCADE
droy5d4b64c2008-02-29 15:22:10 +000038) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39
droy27e97e02007-11-27 16:44:19 +000040DROP TABLE IF EXISTS `files`;
41CREATE TABLE `files` (
droye5c99812007-11-28 21:36:51 +000042 `file_id` int(10) unsigned NOT NULL auto_increment,
droy27e97e02007-11-27 16:44:19 +000043 `project_id` varchar(100) NOT NULL,
droyb9c2cb12008-10-08 13:58:14 +000044 `plugin_id` varchar(100) NOT NULL,
droy44cb1ba2007-12-18 15:19:34 +000045 `version` varchar(64) NOT NULL,
droy27e97e02007-11-27 16:44:19 +000046 `name` text NOT NULL,
47 `is_active` tinyint(3) unsigned NOT NULL default '1',
48 PRIMARY KEY (`file_id`),
49 KEY `project_id` (`project_id`),
droyc081e862007-11-30 16:37:35 +000050 CONSTRAINT `files_ibfk_1` FOREIGN KEY (`project_id`,`version`) REFERENCES `project_versions` (`project_id`,`version`) ON UPDATE CASCADE
droy27e97e02007-11-27 16:44:19 +000051) ENGINE=InnoDB DEFAULT CHARSET=utf8;
droy0757c2c2009-03-31 19:37:36 +000052
53
54SET @OLD_SQL_MODE=@@SQL_MODE;
55DELIMITER ;;
56/*!50003 SET SESSION SQL_MODE="" */;;
57DROP TRIGGER IF EXISTS `upd_is_active`;;
58
59/* This trigger will recursively update the is_active status of the strings of a file */
60CREATE TRIGGER `upd_is_active` AFTER UPDATE ON `files` FOR EACH ROW BEGIN
61 UPDATE strings set is_active = NEW.is_active WHERE strings.file_id = NEW.file_id;
62
63 /* update project_progress table to indicate this proj/lang/vers stats are stale */
64 /* don't know if record is there or not, so do both an insert and an update */
droy2251ca92010-01-20 14:08:49 +000065 /* This portion of the trigger is similar to what is in the translations table */
66 SET @PROJECT=(SELECT project_id FROM files WHERE file_id = NEW.file_id);
67 SET @VERSION=(SELECT version FROM files WHERE file_id = NEW.file_id);
68
droy0757c2c2009-03-31 19:37:36 +000069 UPDATE IGNORE project_progress SET is_stale = 1 where project_id = @PROJECT
droy2251ca92010-01-20 14:08:49 +000070 AND version = @VERSION;
droy0757c2c2009-03-31 19:37:36 +000071END;
72;;
73DELIMITER ;
74/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
75
76
droy27e97e02007-11-27 16:44:19 +000077--
78-- Table structure for table `languages`
79--
80
81DROP TABLE IF EXISTS `languages`;
82CREATE TABLE `languages` (
83 `language_id` smallint(5) unsigned NOT NULL auto_increment,
droyc94a4522008-02-05 15:36:53 +000084 `iso_code` varchar(6) NOT NULL,
droy27e97e02007-11-27 16:44:19 +000085 `locale` varchar(12) default NULL,
86 `name` varchar(50) NOT NULL,
87 `is_active` tinyint(3) unsigned NOT NULL default '1',
88 PRIMARY KEY (`language_id`),
89 KEY `iso_code` (`iso_code`),
90 KEY `locale` (`locale`)
91) ENGINE=InnoDB DEFAULT CHARSET=utf8;
92
droy3bb0c962008-01-17 20:45:01 +000093--
94-- Table structure for table `map_files`
95--
96
Kit Lo51854da2013-06-27 17:31:02 -040097DROP TABLE IF EXISTS `map_files`;
98CREATE TABLE `map_files` (
99 `project_id` varchar(100) NOT NULL,
100 `version` varchar(64) NOT NULL,
101 `filename` varchar(100) NOT NULL,
102 `location` varchar(255) NOT NULL,
103 `is_active` tinyint(3) unsigned NOT NULL default '1',
104 `is_map_file` tinyint(3) unsigned NOT NULL default '1',
105 PRIMARY KEY (`project_id`, `version`, `filename`),
106 CONSTRAINT `map_files_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
107) ENGINE=InnoDB DEFAULT CHARSET=utf8;
108
109--
110-- Table structure for table `project_source_locations`
111--
112
Kit Lo6d440cc2013-03-02 19:56:45 -0500113DROP TABLE IF EXISTS `project_source_locations`;
114CREATE TABLE `project_source_locations` (
droy3bb0c962008-01-17 20:45:01 +0000115 `project_id` varchar(100) NOT NULL,
116 `version` varchar(64) NOT NULL,
droy3bb0c962008-01-17 20:45:01 +0000117 `location` varchar(255) NOT NULL,
Kit Lo6d440cc2013-03-02 19:56:45 -0500118 PRIMARY KEY (`project_id`, `version`, `location`),
119 CONSTRAINT `project_source_locations_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
droy3bb0c962008-01-17 20:45:01 +0000120) ENGINE=InnoDB DEFAULT CHARSET=utf8;
121
droy27e97e02007-11-27 16:44:19 +0000122--
kitlod66aa992010-01-22 17:18:19 +0000123-- Table structure for table `plugin_exclude_patterns`
124--
125
126DROP TABLE IF EXISTS `plugin_exclude_patterns`;
127CREATE TABLE `plugin_exclude_patterns` (
128 `project_id` varchar(100) NOT NULL,
129 `version` varchar(64) NOT NULL,
130 `pattern` varchar(128) NOT NULL,
131 PRIMARY KEY (`project_id`, `version`, `pattern`),
132 CONSTRAINT `plugin_exclude_patterns_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
133) ENGINE=InnoDB DEFAULT CHARSET=utf8;
134
135--
droy27e97e02007-11-27 16:44:19 +0000136-- Table structure for table `profiles`
137--
138
139DROP TABLE IF EXISTS `profiles`;
140CREATE TABLE `profiles` (
141 `userid` mediumint(9) NOT NULL auto_increment,
142 `login_name` varchar(255) NOT NULL default '',
143 `cryptpassword` varchar(128) default NULL,
144 `realname` varchar(255) NOT NULL default '',
145 `disabledtext` mediumtext NOT NULL,
146 `mybugslink` tinyint(4) NOT NULL default '1',
147 `extern_id` varchar(64) default NULL,
148 `disable_mail` tinyint(4) NOT NULL default '0',
149 PRIMARY KEY (`userid`),
150 UNIQUE KEY `profiles_login_name_idx` (`login_name`)
151) ENGINE=MyISAM DEFAULT CHARSET=latin1;
152
153--
154-- Table structure for table `projects`
155--
156
157DROP TABLE IF EXISTS `projects`;
158CREATE TABLE `projects` (
159 `project_id` varchar(100) NOT NULL,
160 `is_active` tinyint(3) unsigned NOT NULL default '1',
161 PRIMARY KEY (`project_id`)
162) ENGINE=InnoDB DEFAULT CHARSET=utf8;
163
kitloe3fea252010-01-25 02:13:49 +0000164--
165-- Table structure for table `project_progress`
166--
167
droyd664f912008-05-14 15:45:10 +0000168DROP TABLE IF EXISTS `project_progress`;
169CREATE TABLE `project_progress` (
170 `project_id` varchar(100) NOT NULL,
171 `version` varchar(64) NOT NULL,
172 `language_id` smallint(5) unsigned NOT NULL,
173 `pct_complete` float NOT NULL,
droy6e6fb6d2008-05-15 17:11:29 +0000174 `is_stale` tinyint unsigned not null default 0,
droyd664f912008-05-14 15:45:10 +0000175 PRIMARY KEY (`project_id`, `version`, `language_id`),
176 CONSTRAINT `project_progress_ibfk_1` FOREIGN KEY (`project_id`, `version`) REFERENCES `project_versions` (`project_id`, `version`) ON UPDATE CASCADE ON DELETE CASCADE,
177 CONSTRAINT `project_progress_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE ON DELETE CASCADE
178) ENGINE=InnoDB DEFAULT CHARSET=utf8;
179
kitloe3fea252010-01-25 02:13:49 +0000180--
181-- Table structure for table `project_versions`
182--
droyd664f912008-05-14 15:45:10 +0000183
droyc081e862007-11-30 16:37:35 +0000184DROP TABLE IF EXISTS `project_versions`;
185CREATE TABLE `project_versions` (
186 `project_id` varchar(100) NOT NULL,
droy44cb1ba2007-12-18 15:19:34 +0000187 `version` varchar(64) NOT NULL,
droyc081e862007-11-30 16:37:35 +0000188 `is_active` tinyint(3) unsigned NOT NULL default '1',
189 PRIMARY KEY (`project_id`, `version`),
190 CONSTRAINT `project_versions_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
191) ENGINE=InnoDB DEFAULT CHARSET=utf8;
192
droy27e97e02007-11-27 16:44:19 +0000193--
194-- Table structure for table `ratings`
195--
196
197DROP TABLE IF EXISTS `ratings`;
198CREATE TABLE `ratings` (
199 `translation_id` int(10) unsigned NOT NULL,
200 `userid` int(10) unsigned NOT NULL,
201 `rating` tinyint(3) unsigned NOT NULL default '0',
202 `created_on` datetime NOT NULL,
203 PRIMARY KEY (`translation_id`,`userid`),
204 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`translation_id`) REFERENCES `translations` (`translation_id`) ON UPDATE CASCADE
205) ENGINE=InnoDB DEFAULT CHARSET=utf8;
206
kitloe3fea252010-01-25 02:13:49 +0000207--
208-- Table structure for table `release_trains`
209--
210
211DROP TABLE IF EXISTS `release_trains`;
212CREATE TABLE `release_trains` (
213 `train_id` varchar(30) NOT NULL,
214 `train_version` varchar(64) NOT NULL,
kitlo29f4a972010-08-08 00:14:04 +0000215 `is_active` tinyint(3) unsigned NOT NULL default '1',
kitloe3fea252010-01-25 02:13:49 +0000216 PRIMARY KEY (`train_id`, `train_version`)
217) ENGINE=InnoDB DEFAULT CHARSET=utf8;
218
219--
220-- Table structure for table `release_train_projects`
221--
222
droy684f2b62008-06-02 20:52:29 +0000223DROP TABLE IF EXISTS `release_train_projects`;
224CREATE TABLE `release_train_projects` (
225 `train_id` varchar(30) NOT NULL,
226 `project_id` varchar(100) NOT NULL,
227 `version` varchar(64) NOT NULL,
228 PRIMARY KEY (`train_id`, `project_id`, `version`),
229 CONSTRAINT `release_train_progress_ibfk_1` FOREIGN KEY (`project_id`, `version`) REFERENCES `project_versions` (`project_id`, `version`) ON UPDATE CASCADE ON DELETE CASCADE
230) ENGINE=InnoDB DEFAULT CHARSET=utf8;
231
droy27e97e02007-11-27 16:44:19 +0000232--
233-- Table structure for table `schema_info`
234--
235
236DROP TABLE IF EXISTS `schema_info`;
237CREATE TABLE `schema_info` (
238 `version` int(11) default NULL
239) ENGINE=MyISAM DEFAULT CHARSET=latin1;
240
241--
242-- Table structure for table `sessions`
243--
244
245DROP TABLE IF EXISTS `sessions`;
246CREATE TABLE `sessions` (
247 `id` int(11) unsigned NOT NULL auto_increment,
248 `userid` int(11) NOT NULL,
249 `gid` char(32) default NULL,
250 `subnet` char(15) default NULL,
251 `updated_at` datetime default NULL,
252 PRIMARY KEY (`id`),
253 KEY `gid` (`gid`),
254 KEY `userid` (`userid`)
255) ENGINE=InnoDB DEFAULT CHARSET=latin1;
256
257--
258-- Table structure for table `strings`
259--
260
droy27e97e02007-11-27 16:44:19 +0000261CREATE TABLE `strings` (
262 `string_id` int(10) unsigned NOT NULL auto_increment,
263 `file_id` int(10) unsigned NOT NULL,
264 `name` text NOT NULL,
265 `value` text NOT NULL,
266 `userid` int(10) unsigned NOT NULL,
267 `created_on` datetime NOT NULL,
268 `is_active` tinyint(1) unsigned default NULL,
droy0e2dff42008-09-24 15:35:34 +0000269 `non_translatable` tinyint(4) default '0',
droy27e97e02007-11-27 16:44:19 +0000270 PRIMARY KEY (`string_id`),
271 KEY `file_id` (`file_id`),
272 KEY `userid` (`userid`),
273 CONSTRAINT `strings_ibfk_1` FOREIGN KEY (`file_id`) REFERENCES `files` (`file_id`) ON UPDATE CASCADE,
274 CONSTRAINT `strings_ibfk_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON UPDATE CASCADE
atoulmeabd65d52009-01-09 23:47:54 +0000275) ENGINE=InnoDB DEFAULT CHARSET=utf8;
droy27e97e02007-11-27 16:44:19 +0000276
droy68864612009-04-14 15:44:05 +0000277CREATE INDEX idx_value ON strings(value(40));
droy44cb1ba2007-12-18 15:19:34 +0000278
droy44cb1ba2007-12-18 15:19:34 +0000279DELIMITER ;;
280CREATE TRIGGER `upd_string` AFTER UPDATE ON `strings` FOR EACH ROW
281 BEGIN
282 IF(NEW.value <> OLD.value) THEN
283 UPDATE translations SET possibly_incorrect = 1 WHERE string_id = NEW.string_id;
284 END IF;
285 END;
286;;
287DELIMITER ;
288
droy0757c2c2009-03-31 19:37:36 +0000289--
290-- Table structure for table `sys_values`
291--
292DROP TABLE IF EXISTS `sys_values`;
293CREATE TABLE `sys_values` (
294 `itemid` char(6) NOT NULL,
295 `value` text,
296 PRIMARY KEY (`itemid`)
297) ENGINE=InnoDB DEFAULT CHARSET=utf8;
droy44cb1ba2007-12-18 15:19:34 +0000298
droy27e97e02007-11-27 16:44:19 +0000299--
300-- Table structure for table `translation_archives`
301--
302
303DROP TABLE IF EXISTS `translation_archives`;
304CREATE TABLE `translation_archives` (
305 `translation_id` int(10) unsigned NOT NULL,
306 `string_id` int(10) unsigned NOT NULL,
307 `language_id` smallint(5) unsigned NOT NULL,
308 `version` int(10) unsigned NOT NULL default '1',
309 `value` text NOT NULL,
310 `is_active` tinyint(3) unsigned NOT NULL default '1',
311 `userid` int(10) unsigned NOT NULL,
312 `created_on` datetime NOT NULL,
313 PRIMARY KEY (`string_id`,`language_id`,`version`),
314 KEY `language_id` (`language_id`),
315 KEY `userid` (`userid`),
316 CONSTRAINT `translation_archives_ibfk_1` FOREIGN KEY (`string_id`) REFERENCES `strings` (`string_id`) ON UPDATE CASCADE,
317 CONSTRAINT `translation_archives_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE,
318 CONSTRAINT `translation_archives_ibfk_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON UPDATE CASCADE
319) ENGINE=InnoDB DEFAULT CHARSET=utf8;
320
321--
322-- Table structure for table `translations`
323--
324
325DROP TABLE IF EXISTS `translations`;
326CREATE TABLE `translations` (
327 `translation_id` int(10) unsigned NOT NULL auto_increment,
328 `string_id` int(10) unsigned NOT NULL,
329 `language_id` smallint(5) unsigned NOT NULL,
330 `version` int(10) unsigned NOT NULL default '1',
331 `value` text NOT NULL,
droy44cb1ba2007-12-18 15:19:34 +0000332 `possibly_incorrect` tinyint unsigned NOT NULL default '0',
droy27e97e02007-11-27 16:44:19 +0000333 `is_active` tinyint(3) unsigned NOT NULL default '1',
334 `userid` int(10) unsigned NOT NULL,
335 `created_on` datetime NOT NULL,
336 PRIMARY KEY (`string_id`,`language_id`,`version`),
337 KEY `translation_id` (`translation_id`),
338 KEY `language_id` (`language_id`),
339 KEY `userid` (`userid`),
droyd664f912008-05-14 15:45:10 +0000340 KEY `created_on` (`created_on`),
droy27e97e02007-11-27 16:44:19 +0000341 CONSTRAINT `translations_ibfk_1` FOREIGN KEY (`string_id`) REFERENCES `strings` (`string_id`) ON UPDATE CASCADE,
342 CONSTRAINT `translations_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE,
343 CONSTRAINT `translations_ibfk_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON UPDATE CASCADE
344) ENGINE=InnoDB DEFAULT CHARSET=utf8;
345
droy5d4b64c2008-02-29 15:22:10 +0000346SET @OLD_SQL_MODE=@@SQL_MODE;
droy27e97e02007-11-27 16:44:19 +0000347DELIMITER ;;
348/*!50003 SET SESSION SQL_MODE="" */;;
droy28b28792008-05-21 20:54:29 +0000349DROP TRIGGER IF EXISTS `ins_version`;;
droy27e97e02007-11-27 16:44:19 +0000350
droy5d4b64c2008-02-29 15:22:10 +0000351/* This trigger sets the version to max(version) + 1. It also updates the file_progress table */
droyd664f912008-05-14 15:45:10 +0000352/* We check IF(NEW.version > 1) to determine if this is a NEW translation or one that replaces an existing one */
droy5d4b64c2008-02-29 15:22:10 +0000353/* (COUNT(t.string_id) + 1) because it's a BEFORE INSERT trigger, the translated str is not in the DB yet */
354/* and without the +1 the percent would always be "one behind" */
355CREATE TRIGGER `ins_version` BEFORE INSERT ON `translations` FOR EACH ROW BEGIN
356 SET NEW.version =
357 (SELECT IFNULL(MAX(version),0)+1 FROM translations
358 WHERE string_id = NEW.string_id and language_id = NEW.language_id);
droyd664f912008-05-14 15:45:10 +0000359
360 /* Define a few fields we need here */
361 SET @FILE_ID=(SELECT file_id FROM strings WHERE string_id = NEW.string_id);
362 SET @PROJECT=(SELECT project_id FROM files WHERE file_id = @FILE_ID);
363 SET @VERSION=(SELECT version FROM files WHERE file_id = @FILE_ID);
droy5d4b64c2008-02-29 15:22:10 +0000364
droyd664f912008-05-14 15:45:10 +0000365
366 /* update this file's progress */
367 DELETE FROM file_progress where file_id = @FILE_ID
droy5d4b64c2008-02-29 15:22:10 +0000368 AND language_id = NEW.language_id;
369
droyd664f912008-05-14 15:45:10 +0000370 /* See notes above for the hairy select */
371 INSERT INTO file_progress SET file_id = @FILE_ID,
droy5d4b64c2008-02-29 15:22:10 +0000372 language_id = NEW.language_id,
373 pct_complete = (
droyd664f912008-05-14 15:45:10 +0000374 SELECT IF(NEW.version > 1,
375 IF(COUNT(s.string_id) > 0, (COUNT(t.string_id))/COUNT(s.string_id)*100,0),
376 IF(COUNT(s.string_id) > 0, (COUNT(t.string_id) + 1)/COUNT(s.string_id)*100,0)
377 ) AS translate_percent
droy5d4b64c2008-02-29 15:22:10 +0000378 FROM files AS f
droyd664f912008-05-14 15:45:10 +0000379 LEFT JOIN strings AS s ON (s.file_id = f.file_id AND s.value <> "" and s.is_active)
droy5d4b64c2008-02-29 15:22:10 +0000380 LEFT JOIN translations AS t ON (s.string_id = t.string_id
381 AND t.language_id = NEW.language_id AND t.is_active = 1)
droyd664f912008-05-14 15:45:10 +0000382 WHERE f.file_id = @FILE_ID
383 );
droy6e6fb6d2008-05-15 17:11:29 +0000384
385
386 /* update project_progress table to indicate this proj/lang/vers stats are stale */
387 /* don't know if record is there or not, so do both an insert and an update */
droy0757c2c2009-03-31 19:37:36 +0000388 /* This portion of the trigger is similar to what is in the files table */
droy6e6fb6d2008-05-15 17:11:29 +0000389 UPDATE IGNORE project_progress SET is_stale = 1 where project_id = @PROJECT
droyd664f912008-05-14 15:45:10 +0000390 AND version = @VERSION
391 AND language_id = NEW.language_id;
droy6e6fb6d2008-05-15 17:11:29 +0000392
393 INSERT IGNORE INTO project_progress SET is_stale = 1, project_id = @PROJECT,
394 version = @VERSION,
395 language_id = NEW.language_id;
droyd664f912008-05-14 15:45:10 +0000396
droy5d4b64c2008-02-29 15:22:10 +0000397END;
398;;
droy27e97e02007-11-27 16:44:19 +0000399DELIMITER ;
400/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
401
402--
403-- Table structure for table `users`
404--
405
406DROP TABLE IF EXISTS `users`;
407CREATE TABLE `users` (
408 `userid` int(10) unsigned NOT NULL,
409 `username` varchar(256) NOT NULL default '',
410 `first_name` varchar(256) NOT NULL default '',
411 `last_name` varchar(256) NOT NULL default '',
412 `email` varchar(256) NOT NULL default '',
413 `primary_language_id` int(11) NOT NULL default '0',
414 `hours_per_week` int(11) NOT NULL default '0',
415 `password_hash` varchar(256) NOT NULL default '',
droy8da30b32007-11-29 21:00:26 +0000416 `is_committer` tinyint unsigned not null default 0,
droy27e97e02007-11-27 16:44:19 +0000417 `updated_on` date NOT NULL,
418 `updated_at` time NOT NULL,
419 `created_on` date NOT NULL,
420 `created_at` time NOT NULL,
421 PRIMARY KEY (`userid`),
422 KEY `primary_language_id` (`primary_language_id`)
423) ENGINE=InnoDB DEFAULT CHARSET=utf8;
droy97c86192007-11-28 22:00:22 +0000424
droy5bb81172008-04-04 19:25:24 +0000425DROP TABLE IF EXISTS `scoreboard`;
426CREATE TABLE `scoreboard` (
427 `id` int unsigned not null auto_increment,
428 `itemid` char(6) NOT NULL,
429 `value` varchar(256) NOT NULL default '',
430 `quantity` double NOT NULL default 0,
431 PRIMARY KEY (`id`),
432 KEY(`quantity`)
433) ENGINE=InnoDB DEFAULT CHARSET=utf8;
434
435
droy97c86192007-11-28 22:00:22 +0000436
437
droy27e97e02007-11-27 16:44:19 +0000438/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
439
440/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
441/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
442/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
443/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
444/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
445/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
446/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
447
droy6426bc02008-02-01 19:35:19 +0000448
449
450
451
452
453/*
454Babel data
455User: babel@eclipse.org
456pass: password
457*/
458
459insert into profiles set login_name = "test", cryptpassword = "", realname = "tester", disabledtext = false, mybugslink = 1, extern_id = 1, disable_mail = false;
droyeccd9832008-07-22 18:04:11 +0000460insert into users set userid = 1, username = "babel@eclipse.org",first_name="babel",last_name="fish",email="babel@eclipse.org",primary_language_id = "",password_hash = "HSD9a.ShTTdvo", is_committer = true, updated_on = NOW(), updated_at='',created_on = NOW(), created_at='';
kitlo32cd7442010-02-15 16:29:22 +0000461insert into users set userid = 2, username = "genie@eclipse.org",first_name="babel",last_name="genie",email="genie@eclipse.org",primary_language_id = "",password_hash = "HSD9a.ShTTdvo", is_committer = true, updated_on = NOW(), updated_at='',created_on = NOW(), created_at='';
462insert into users set userid = 3, username = "syncup@eclipse.org",first_name="babel",last_name="syncup",email="syncup@eclipse.org",primary_language_id = "",password_hash = "HSD9a.ShTTdvo", is_committer = true, updated_on = NOW(), updated_at='',created_on = NOW(), created_at='';
kitlo2e780dc2010-01-12 17:58:32 +0000463
464insert into languages values (1, "en", null, "English", 1);
465insert into languages values (null, "fr", null, "French", 1);
466insert into languages values (null, "de", null, "German", 1);
467insert into languages values (null, "es", null, "Spanish", 1);
468insert into languages values (null, "it", null, "Italian", 1);
469insert into languages values (null, "ja", null, "Japanese", 1);
470insert into languages values (null, "ko", null, "Korean", 1);
471insert into languages values (null, "pt_BR", "Brazilian", "Portuguese", 1);
472insert into languages values (null, "zh", "Simplified", "Chinese", 1);
473insert into languages values (null, "zh_TW", "Traditional", "Chinese", 1);
474insert into languages values (null, "cs", null, "Czech", 1);
475insert into languages values (null, "hu", null, "Hungarian", 1);
476insert into languages values (null, "pl", null, "Polish", 1);
477insert into languages values (null, "ru", null, "Russian", 1);
478insert into languages values (null, "da", null, "Danish", 1);
479insert into languages values (null, "nl", null, "Dutch", 1);
480insert into languages values (null, "fi", null, "Finnish", 1);
481insert into languages values (null, "el", null, "Greek", 1);
482insert into languages values (null, "no", null, "Norwegian", 1);
483insert into languages values (null, "pt", null, "Portuguese", 1);
484insert into languages values (null, "sv", null, "Swedish", 1);
485insert into languages values (null, "tr", null, "Turkish", 1);
486insert into languages values (null, "ar", null, "Arabic", 1);
487insert into languages values (null, "iw", null, "Hebrew", 1);
488insert into languages values (null, "hi", null, "Hindi", 1);
489insert into languages values (null, "ro", null, "Romanian", 1);
490insert into languages values (null, "uk", null, "Ukrainian", 1);
491insert into languages values (null, "ca", null, "Catalan", 1);
492insert into languages values (null, "et", null, "Estonian", 1);
493insert into languages values (null, "en_CA", "Canadian", "English", 1);
494insert into languages values (null, "en_AU", "Australian", "English", 1);
495insert into languages values (null, "mn", null, "Mongolian", 1);
496insert into languages values (null, "id", null, "Indonesian", 1);
497insert into languages values (null, "bg", null, "Bulgarian", 1);
kitlo396bcca2010-02-11 20:03:25 +0000498insert into languages values (null, "sl", null, "Slovenian", 1);
kitlof7ec1e82010-07-31 18:42:23 +0000499insert into languages values (null, "fa", null, "Persian", 1);
kitlo98f08072010-12-14 06:09:23 +0000500insert into languages values (null, "sq", null, "Albanian", 1);
kitlo9b409252011-06-16 00:44:29 +0000501insert into languages values (null, "ku", null, "Kurdish", 1);
kitlo17d1b112011-08-21 05:21:21 +0000502insert into languages values (null, "sr", null, "Serbian", 1);
kitlo535c5d82011-10-24 20:58:50 +0000503insert into languages values (null, "sk", null, "Slovak", 1);
Kit Lo52fa0a32012-11-02 20:41:57 -0400504insert into languages values (null, "eu", null, "Basque", 1);
Kit Lo6615a9a2012-11-26 23:35:49 -0500505insert into languages values (null, "ml", null, "Malayalam", 1);
Kit Loc3fd7af2013-06-21 12:06:01 -0400506insert into languages values (null, "my", null, "Myanmar", 1);
Kit Lo5767b222013-07-08 12:37:49 -0400507insert into languages values (null, "th", null, "Thai", 1);
Kit Lo1a7adac2013-11-01 15:08:52 -0400508insert into languages values (null, "lt", null, "Lithuanian", 1);
kitlo2e780dc2010-01-12 17:58:32 +0000509insert into languages values (null, "tl", null, "Klingon", 1);
510
Kit Lo6d440cc2013-03-02 19:56:45 -0500511insert into release_trains values ("kepler", "4.3.0", 1);
droy2df74062008-07-03 12:45:46 +0000512
Kit Lo6d440cc2013-03-02 19:56:45 -0500513insert into projects values ("eclipse", 1);
514insert into projects values ("eclipse.orion", 1);
kitlo98f08072010-12-14 06:09:23 +0000515
Kit Lo6d440cc2013-03-02 19:56:45 -0500516insert into project_versions values ("eclipse", "4.3", 1);
Kit Lo1869b2d2013-06-20 09:52:07 -0400517insert into project_versions values ("eclipse.orion", "3.0", 1);
Kit Lo6d440cc2013-03-02 19:56:45 -0500518
519insert into release_train_projects values ("kepler", "eclipse", "4.3");
Kit Lo1869b2d2013-06-20 09:52:07 -0400520insert into release_train_projects values ("kepler", "eclipse.orion", "3.0");
kitlo2e780dc2010-01-12 17:58:32 +0000521
Kit Lo51854da2013-06-27 17:31:02 -0400522insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.framework.git/snapshot/R4_3.zip");
523insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.p2.git/snapshot/R4_3.zip");
524insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.git/snapshot/R4_3.zip");
525insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/snapshot/R4_3.zip");
526insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/snapshot/R4_3.zip");
527insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/snapshot/R4_3.zip");
528insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.git/snapshot/R4_3.zip");
529insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.ui.git/snapshot/R4_3.zip");
530insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.git/snapshot/R4_3.zip");
531insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.debug.git/snapshot/R4_3.zip");
532insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.team.git/snapshot/R4_3.zip");
533insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.text.git/snapshot/R4_3.zip");
534insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ua.git/snapshot/R4_3.zip");
535insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ui.git/snapshot/R4_3.zip");
Kit Lo1881f3b2013-07-19 07:55:07 -0400536insert into project_source_locations values ("eclipse.orion", "3.0", "http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/snapshot/R3_0.zip");
kitlo98f08072010-12-14 06:09:23 +0000537
Kit Lo6d440cc2013-03-02 19:56:45 -0500538insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.ibm\\.icu.*$/");
539insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.jcraft\\..*$/");
540insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^javax\\..*$/");
541insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.apache\\..*$/");
542insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.hamcrest\\..*$/");
543insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.junit.*$/");
544insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.mortbay\\..*$/");
545insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.objectweb\\..*$/");
546insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.sat4j\\..*$/");
547insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.w3c\\..*$/");
548insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^.*\\/jface\\/resource\\/.*$/");
Kit Lo1869b2d2013-06-20 09:52:07 -0400549insert into plugin_exclude_patterns values ("eclipse.orion", "3.0", "/^.*\\/bundle.properties$/");
kitlo9b409252011-06-16 00:44:29 +0000550
droybafb7c42008-02-29 18:24:38 +0000551/* populate file_progress table */
droydc294842008-05-21 17:38:57 +0000552/* See also: dbmaintenance_15min.php */
droybafb7c42008-02-29 18:24:38 +0000553truncate table file_progress;
554INSERT INTO file_progress
droyc2c26102008-05-21 16:01:40 +0000555select f.file_id, l.language_id, IF(COUNT(s.string_id) > 0, COUNT(t.string_id)/COUNT(s.string_id)*100,100) AS translate_percent
droybafb7c42008-02-29 18:24:38 +0000556FROM files AS f
557 INNER JOIN languages as l ON l.is_active = 1
droy45413ea2008-07-28 14:36:23 +0000558 LEFT JOIN strings as s ON (s.file_id = f.file_id AND s.is_active AND s.value <> "" AND s.non_translatable = 0)
droybafb7c42008-02-29 18:24:38 +0000559 LEFT JOIN translations AS t ON (s.string_id = t.string_id
560 AND t.language_id = l.language_id AND t.is_active = 1)
561WHERE f.is_active = 1
562GROUP BY f.file_id, l.language_id;
droy5bb81172008-04-04 19:25:24 +0000563DELETE FROM file_progress WHERE pct_complete = 0;
564
droyd664f912008-05-14 15:45:10 +0000565/* populate project_progress table */
566truncate table project_progress;
567INSERT INTO project_progress
568SELECT
569 p.project_id,
570 v.version,
571 l.language_id,
droyb156beb2008-05-15 17:16:44 +0000572 IF(COUNT(s.string_id) > 0, ROUND(COUNT(t.string_id)/COUNT(s.string_id) * 100, 2), 0) AS pct_complete,
573 0
droyd664f912008-05-14 15:45:10 +0000574FROM projects as p
575 INNER JOIN project_versions AS v ON v.project_id = p.project_id
576 INNER JOIN files AS f
577 ON (f.project_id = p.project_id AND f.version = v.version AND f.is_active)
578 INNER JOIN strings AS s
579 ON (s.file_id = f.file_id AND s.is_active)
580 INNER JOIN languages AS l
581 LEFT JOIN translations AS t
582 ON (t.string_id = s.string_id AND t.language_id = l.language_id AND t.is_active)
583WHERE
584 s.value <> ""
droy45413ea2008-07-28 14:36:23 +0000585 AND s.non_translatable = 0
droyd664f912008-05-14 15:45:10 +0000586 AND p.is_active
587GROUP BY p.project_id, v.version, l.language_id;
588
droy5bb81172008-04-04 19:25:24 +0000589/* populate scoreboard */
590truncate table scoreboard;
591INSERT INTO scoreboard SELECT NULL, "LANGPR", CONCAT(b.name,IF(ISNULL(b.locale),"",CONCAT(" ", b.locale))), count(*) as StringCount from translations as a inner join languages as b on b.language_id = a.language_id where a.value <> '' and a.is_active = 1 group by a.language_id order by StringCount desc;
592INSERT INTO scoreboard SELECT NULL, "TOPTR", CONCAT(first_name, IF(ISNULL(last_name),"",CONCAT(" ", last_name))), count(translations.string_id) as cnt from translations inner join users on users.userid = translations.userid where is_active=1 group by first_name, last_name order by cnt desc limit 20;
droy0757c2c2009-03-31 19:37:36 +0000593INSERT INTO scoreboard SELECT NULL, "LASGEN", "Scoreboard Last Generated", MAX(translation_id) FROM translations;
594
595/* create a holding record for the MOTD */
kitloe3fea252010-01-25 02:13:49 +0000596INSERT INTO sys_values VALUES ("MOTD", NULL);