droy | 5625bf3 | 2015-11-13 10:10:09 -0500 | [diff] [blame] | 1 | -- MySQL dump 10.10
|
| 2 | --
|
| 3 | -- Host: localhost Database: babel
|
| 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 |
|
| 18 | DROP TABLE IF EXISTS event_log;
|
| 19 | CREATE 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;
|
| 29 |
|
| 30 | DROP TABLE IF EXISTS `file_progress`;
|
| 31 | CREATE 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,
|
| 37 | CONSTRAINT `file_progress_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE ON DELETE CASCADE
|
| 38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 39 |
|
| 40 | DROP TABLE IF EXISTS `files`;
|
| 41 | CREATE TABLE `files` (
|
| 42 | `file_id` int(10) unsigned NOT NULL auto_increment,
|
| 43 | `project_id` varchar(100) NOT NULL,
|
| 44 | `plugin_id` varchar(100) NOT NULL,
|
| 45 | `version` varchar(64) NOT NULL,
|
| 46 | `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`),
|
| 50 | CONSTRAINT `files_ibfk_1` FOREIGN KEY (`project_id`,`version`) REFERENCES `project_versions` (`project_id`,`version`) ON UPDATE CASCADE
|
| 51 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 52 |
|
| 53 |
|
| 54 | SET @OLD_SQL_MODE=@@SQL_MODE;
|
| 55 | DELIMITER ;;
|
| 56 | /*!50003 SET SESSION SQL_MODE="" */;;
|
| 57 | DROP TRIGGER IF EXISTS `upd_is_active`;;
|
| 58 |
|
| 59 | /* This trigger will recursively update the is_active status of the strings of a file */
|
| 60 | CREATE 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 */
|
| 65 | /* 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 |
|
| 69 | UPDATE IGNORE project_progress SET is_stale = 1 where project_id = @PROJECT
|
| 70 | AND version = @VERSION;
|
| 71 | END;
|
| 72 | ;;
|
| 73 | DELIMITER ;
|
| 74 | /*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
|
| 75 |
|
| 76 |
|
| 77 | --
|
| 78 | -- Table structure for table `languages`
|
| 79 | --
|
| 80 |
|
| 81 | DROP TABLE IF EXISTS `languages`;
|
| 82 | CREATE TABLE `languages` (
|
| 83 | `language_id` smallint(5) unsigned NOT NULL auto_increment,
|
| 84 | `iso_code` varchar(6) NOT NULL,
|
| 85 | `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 |
|
| 93 | --
|
| 94 | -- Table structure for table `map_files`
|
| 95 | --
|
| 96 |
|
| 97 | DROP TABLE IF EXISTS `map_files`;
|
| 98 | CREATE 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 |
|
| 113 | DROP TABLE IF EXISTS `project_source_locations`;
|
| 114 | CREATE TABLE `project_source_locations` (
|
| 115 | `project_id` varchar(100) NOT NULL,
|
| 116 | `version` varchar(64) NOT NULL,
|
| 117 | `location` varchar(255) NOT NULL,
|
| 118 | 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
|
| 120 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 121 |
|
| 122 | --
|
| 123 | -- Table structure for table `plugin_exclude_patterns`
|
| 124 | --
|
| 125 |
|
| 126 | DROP TABLE IF EXISTS `plugin_exclude_patterns`;
|
| 127 | CREATE 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 | --
|
| 136 | -- Table structure for table `profiles`
|
| 137 | --
|
| 138 |
|
| 139 | DROP TABLE IF EXISTS `profiles`;
|
| 140 | CREATE 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 |
|
| 157 | DROP TABLE IF EXISTS `projects`;
|
| 158 | CREATE 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 |
|
| 164 | --
|
| 165 | -- Table structure for table `project_progress`
|
| 166 | --
|
| 167 |
|
| 168 | DROP TABLE IF EXISTS `project_progress`;
|
| 169 | CREATE 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,
|
| 174 | `is_stale` tinyint unsigned not null default 0,
|
| 175 | 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 |
|
| 180 | --
|
| 181 | -- Table structure for table `project_versions`
|
| 182 | --
|
| 183 |
|
| 184 | DROP TABLE IF EXISTS `project_versions`;
|
| 185 | CREATE TABLE `project_versions` (
|
| 186 | `project_id` varchar(100) NOT NULL,
|
| 187 | `version` varchar(64) NOT NULL,
|
| 188 | `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 |
|
| 193 | --
|
| 194 | -- Table structure for table `ratings`
|
| 195 | --
|
| 196 |
|
| 197 | DROP TABLE IF EXISTS `ratings`;
|
| 198 | CREATE 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 |
|
| 207 | --
|
| 208 | -- Table structure for table `release_trains`
|
| 209 | --
|
| 210 |
|
| 211 | DROP TABLE IF EXISTS `release_trains`;
|
| 212 | CREATE TABLE `release_trains` (
|
| 213 | `train_id` varchar(30) NOT NULL,
|
| 214 | `train_version` varchar(64) NOT NULL,
|
| 215 | `is_active` tinyint(3) unsigned NOT NULL default '1',
|
| 216 | PRIMARY KEY (`train_id`, `train_version`)
|
| 217 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 218 |
|
| 219 | --
|
| 220 | -- Table structure for table `release_train_projects`
|
| 221 | --
|
| 222 |
|
| 223 | DROP TABLE IF EXISTS `release_train_projects`;
|
| 224 | CREATE 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 |
|
| 232 | --
|
| 233 | -- Table structure for table `schema_info`
|
| 234 | --
|
| 235 |
|
| 236 | DROP TABLE IF EXISTS `schema_info`;
|
| 237 | CREATE 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 |
|
| 245 | DROP TABLE IF EXISTS `sessions`;
|
| 246 | CREATE 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 |
|
| 261 | CREATE 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,
|
| 269 | `non_translatable` tinyint(4) default '0',
|
| 270 | 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
|
| 275 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 276 |
|
| 277 | CREATE INDEX idx_value ON strings(value(40));
|
| 278 |
|
| 279 | DELIMITER ;;
|
| 280 | CREATE 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 | ;;
|
| 287 | DELIMITER ;
|
| 288 |
|
| 289 | --
|
| 290 | -- Table structure for table `sys_values`
|
| 291 | --
|
| 292 | DROP TABLE IF EXISTS `sys_values`;
|
| 293 | CREATE TABLE `sys_values` (
|
| 294 | `itemid` char(6) NOT NULL,
|
| 295 | `value` text,
|
| 296 | PRIMARY KEY (`itemid`)
|
| 297 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 298 |
|
| 299 | --
|
| 300 | -- Table structure for table `translation_archives`
|
| 301 | --
|
| 302 |
|
| 303 | DROP TABLE IF EXISTS `translation_archives`;
|
| 304 | CREATE 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 |
|
| 325 | DROP TABLE IF EXISTS `translations`;
|
| 326 | CREATE 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,
|
| 332 | `possibly_incorrect` tinyint unsigned NOT NULL default '0',
|
| 333 | `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`),
|
| 340 | KEY `created_on` (`created_on`),
|
| 341 | 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 |
|
| 346 | SET @OLD_SQL_MODE=@@SQL_MODE;
|
| 347 | DELIMITER ;;
|
| 348 | /*!50003 SET SESSION SQL_MODE="" */;;
|
| 349 | DROP TRIGGER IF EXISTS `ins_version`;;
|
| 350 |
|
| 351 | /* This trigger sets the version to max(version) + 1. It also updates the file_progress table */
|
| 352 | /* We check IF(NEW.version > 1) to determine if this is a NEW translation or one that replaces an existing one */
|
| 353 | /* (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" */
|
| 355 | CREATE 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);
|
| 359 |
|
| 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);
|
| 364 |
|
| 365 |
|
| 366 | /* update this file's progress */
|
| 367 | DELETE FROM file_progress where file_id = @FILE_ID
|
| 368 | AND language_id = NEW.language_id;
|
| 369 |
|
| 370 | /* See notes above for the hairy select */
|
| 371 | INSERT INTO file_progress SET file_id = @FILE_ID,
|
| 372 | language_id = NEW.language_id,
|
| 373 | pct_complete = (
|
| 374 | 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
|
| 378 | FROM files AS f
|
| 379 | LEFT JOIN strings AS s ON (s.file_id = f.file_id AND s.value <> "" and s.is_active)
|
| 380 | 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)
|
| 382 | WHERE f.file_id = @FILE_ID
|
| 383 | );
|
| 384 |
|
| 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 */
|
| 388 | /* This portion of the trigger is similar to what is in the files table */
|
| 389 | UPDATE IGNORE project_progress SET is_stale = 1 where project_id = @PROJECT
|
| 390 | AND version = @VERSION
|
| 391 | AND language_id = NEW.language_id;
|
| 392 |
|
| 393 | INSERT IGNORE INTO project_progress SET is_stale = 1, project_id = @PROJECT,
|
| 394 | version = @VERSION,
|
| 395 | language_id = NEW.language_id;
|
| 396 |
|
| 397 | END;
|
| 398 | ;;
|
| 399 | DELIMITER ;
|
| 400 | /*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
|
| 401 |
|
| 402 | --
|
| 403 | -- Table structure for table `users`
|
| 404 | --
|
| 405 |
|
| 406 | DROP TABLE IF EXISTS `users`;
|
| 407 | CREATE TABLE `users` (
|
Paul Pazderski | 10ba3f3 | 2019-08-28 13:47:44 +0200 | [diff] [blame] | 408 | `userid` int(10) unsigned NOT NULL auto_increment,
|
droy | 5625bf3 | 2015-11-13 10:10:09 -0500 | [diff] [blame] | 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 '',
|
| 416 | `is_committer` tinyint unsigned not null default 0,
|
| 417 | `updated_on` date NOT NULL,
|
| 418 | `updated_at` time NOT NULL,
|
| 419 | `created_on` date NOT NULL,
|
| 420 | `created_at` time NOT NULL,
|
Paul Pazderski | 10ba3f3 | 2019-08-28 13:47:44 +0200 | [diff] [blame] | 421 | `sub` varchar(128),
|
droy | 5625bf3 | 2015-11-13 10:10:09 -0500 | [diff] [blame] | 422 | PRIMARY KEY (`userid`),
|
Paul Pazderski | 10ba3f3 | 2019-08-28 13:47:44 +0200 | [diff] [blame] | 423 | KEY `primary_language_id` (`primary_language_id`),
|
| 424 | UNIQUE KEY `sub_idx` (`sub`)
|
droy | 5625bf3 | 2015-11-13 10:10:09 -0500 | [diff] [blame] | 425 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 426 |
|
| 427 | DROP TABLE IF EXISTS `scoreboard`;
|
| 428 | CREATE TABLE `scoreboard` (
|
| 429 | `id` int unsigned not null auto_increment,
|
| 430 | `itemid` char(6) NOT NULL,
|
| 431 | `value` varchar(256) NOT NULL default '',
|
| 432 | `quantity` double NOT NULL default 0,
|
| 433 | PRIMARY KEY (`id`),
|
| 434 | KEY(`quantity`)
|
| 435 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
| 441 |
|
| 442 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
| 443 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
| 444 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
| 445 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
| 446 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
| 447 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
| 448 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 | /*
|
| 456 | Babel data
|
| 457 | User: babel@eclipse.org
|
| 458 | pass: password
|
| 459 | */
|
| 460 |
|
| 461 | insert into profiles set login_name = "test", cryptpassword = "", realname = "tester", disabledtext = false, mybugslink = 1, extern_id = 1, disable_mail = false;
|
| 462 | insert 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='';
|
| 463 | insert 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='';
|
| 464 | insert 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='';
|
| 465 |
|
| 466 | insert into languages values (1, "en", null, "English", 1);
|
| 467 | insert into languages values (null, "fr", null, "French", 1);
|
| 468 | insert into languages values (null, "de", null, "German", 1);
|
| 469 | insert into languages values (null, "es", null, "Spanish", 1);
|
| 470 | insert into languages values (null, "it", null, "Italian", 1);
|
| 471 | insert into languages values (null, "ja", null, "Japanese", 1);
|
| 472 | insert into languages values (null, "ko", null, "Korean", 1);
|
| 473 | insert into languages values (null, "pt_BR", "Brazilian", "Portuguese", 1);
|
| 474 | insert into languages values (null, "zh", "Simplified", "Chinese", 1);
|
| 475 | insert into languages values (null, "zh_TW", "Traditional", "Chinese", 1);
|
| 476 | insert into languages values (null, "cs", null, "Czech", 1);
|
| 477 | insert into languages values (null, "hu", null, "Hungarian", 1);
|
| 478 | insert into languages values (null, "pl", null, "Polish", 1);
|
| 479 | insert into languages values (null, "ru", null, "Russian", 1);
|
| 480 | insert into languages values (null, "da", null, "Danish", 1);
|
| 481 | insert into languages values (null, "nl", null, "Dutch", 1);
|
| 482 | insert into languages values (null, "fi", null, "Finnish", 1);
|
| 483 | insert into languages values (null, "el", null, "Greek", 1);
|
| 484 | insert into languages values (null, "no", null, "Norwegian", 1);
|
| 485 | insert into languages values (null, "pt", null, "Portuguese", 1);
|
| 486 | insert into languages values (null, "sv", null, "Swedish", 1);
|
| 487 | insert into languages values (null, "tr", null, "Turkish", 1);
|
| 488 | insert into languages values (null, "ar", null, "Arabic", 1);
|
| 489 | insert into languages values (null, "iw", null, "Hebrew", 1);
|
| 490 | insert into languages values (null, "hi", null, "Hindi", 1);
|
| 491 | insert into languages values (null, "ro", null, "Romanian", 1);
|
| 492 | insert into languages values (null, "uk", null, "Ukrainian", 1);
|
| 493 | insert into languages values (null, "ca", null, "Catalan", 1);
|
| 494 | insert into languages values (null, "et", null, "Estonian", 1);
|
| 495 | insert into languages values (null, "en_CA", "Canadian", "English", 1);
|
| 496 | insert into languages values (null, "en_AU", "Australian", "English", 1);
|
| 497 | insert into languages values (null, "mn", null, "Mongolian", 1);
|
| 498 | insert into languages values (null, "id", null, "Indonesian", 1);
|
| 499 | insert into languages values (null, "bg", null, "Bulgarian", 1);
|
| 500 | insert into languages values (null, "sl", null, "Slovenian", 1);
|
| 501 | insert into languages values (null, "fa", null, "Persian", 1);
|
| 502 | insert into languages values (null, "sq", null, "Albanian", 1);
|
| 503 | insert into languages values (null, "ku", null, "Kurdish", 1);
|
| 504 | insert into languages values (null, "sr", null, "Serbian", 1);
|
| 505 | insert into languages values (null, "sk", null, "Slovak", 1);
|
| 506 | insert into languages values (null, "eu", null, "Basque", 1);
|
| 507 | insert into languages values (null, "ml", null, "Malayalam", 1);
|
| 508 | insert into languages values (null, "my", null, "Myanmar", 1);
|
| 509 | insert into languages values (null, "th", null, "Thai", 1);
|
| 510 | insert into languages values (null, "lt", null, "Lithuanian", 1);
|
| 511 | insert into languages values (null, "ne", null, "Nepali", 1);
|
| 512 | insert into languages values (null, "tl", null, "Klingon", 1);
|
| 513 |
|
| 514 | insert into release_trains values ("kepler", "4.3.0", 1);
|
| 515 |
|
| 516 | insert into projects values ("eclipse", 1);
|
| 517 | insert into projects values ("eclipse.orion", 1);
|
| 518 |
|
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 519 | insert into project_versions values ("eclipse", "4.3", 1);
|
Kit Lo | 1869b2d | 2013-06-20 09:52:07 -0400 | [diff] [blame] | 520 | insert into project_versions values ("eclipse.orion", "3.0", 1);
|
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 521 |
|
| 522 | insert into release_train_projects values ("kepler", "eclipse", "4.3");
|
Kit Lo | 1869b2d | 2013-06-20 09:52:07 -0400 | [diff] [blame] | 523 | insert into release_train_projects values ("kepler", "eclipse.orion", "3.0");
|
droy | 5625bf3 | 2015-11-13 10:10:09 -0500 | [diff] [blame] | 524 |
|
| 525 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.framework.git/snapshot/R4_3.zip");
|
| 526 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.p2.git/snapshot/R4_3.zip");
|
| 527 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.git/snapshot/R4_3.zip");
|
| 528 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/snapshot/R4_3.zip");
|
| 529 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/snapshot/R4_3.zip");
|
| 530 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/snapshot/R4_3.zip");
|
| 531 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.git/snapshot/R4_3.zip");
|
| 532 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.ui.git/snapshot/R4_3.zip");
|
| 533 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.git/snapshot/R4_3.zip");
|
| 534 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.debug.git/snapshot/R4_3.zip");
|
| 535 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.team.git/snapshot/R4_3.zip");
|
| 536 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.text.git/snapshot/R4_3.zip");
|
| 537 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ua.git/snapshot/R4_3.zip");
|
| 538 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ui.git/snapshot/R4_3.zip");
|
| 539 | insert into project_source_locations values ("eclipse.orion", "3.0", "http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/snapshot/R3_0.zip");
|
| 540 |
|
| 541 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.ibm\\.icu.*$/");
|
| 542 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.jcraft\\..*$/");
|
| 543 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^javax\\..*$/");
|
| 544 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.apache\\..*$/");
|
| 545 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.hamcrest\\..*$/");
|
| 546 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.junit.*$/");
|
| 547 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.mortbay\\..*$/");
|
| 548 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.objectweb\\..*$/");
|
| 549 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.sat4j\\..*$/");
|
| 550 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.w3c\\..*$/");
|
| 551 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^.*\\/jface\\/resource\\/.*$/");
|
| 552 | insert into plugin_exclude_patterns values ("eclipse.orion", "3.0", "/^.*\\/bundle.properties$/");
|
| 553 |
|
| 554 | /* populate file_progress table */
|
| 555 | /* See also: dbmaintenance_15min.php */
|
| 556 | truncate table file_progress;
|
| 557 | INSERT INTO file_progress
|
| 558 | select 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
|
| 559 | FROM files AS f
|
| 560 | INNER JOIN languages as l ON l.is_active = 1
|
| 561 | LEFT JOIN strings as s ON (s.file_id = f.file_id AND s.is_active AND s.value <> "" AND s.non_translatable = 0)
|
| 562 | LEFT JOIN translations AS t ON (s.string_id = t.string_id
|
| 563 | AND t.language_id = l.language_id AND t.is_active = 1)
|
| 564 | WHERE f.is_active = 1
|
| 565 | GROUP BY f.file_id, l.language_id;
|
| 566 | DELETE FROM file_progress WHERE pct_complete = 0;
|
| 567 |
|
| 568 | /* populate project_progress table */
|
| 569 | truncate table project_progress;
|
| 570 | INSERT INTO project_progress
|
| 571 | SELECT
|
| 572 | p.project_id,
|
| 573 | v.version,
|
| 574 | l.language_id,
|
| 575 | IF(COUNT(s.string_id) > 0, ROUND(COUNT(t.string_id)/COUNT(s.string_id) * 100, 2), 0) AS pct_complete,
|
| 576 | 0
|
| 577 | FROM projects as p
|
| 578 | INNER JOIN project_versions AS v ON v.project_id = p.project_id
|
| 579 | INNER JOIN files AS f
|
| 580 | ON (f.project_id = p.project_id AND f.version = v.version AND f.is_active)
|
| 581 | INNER JOIN strings AS s
|
| 582 | ON (s.file_id = f.file_id AND s.is_active)
|
| 583 | INNER JOIN languages AS l
|
| 584 | LEFT JOIN translations AS t
|
| 585 | ON (t.string_id = s.string_id AND t.language_id = l.language_id AND t.is_active)
|
| 586 | WHERE
|
| 587 | s.value <> ""
|
| 588 | AND s.non_translatable = 0
|
| 589 | AND p.is_active
|
| 590 | GROUP BY p.project_id, v.version, l.language_id;
|
| 591 |
|
| 592 | /* populate scoreboard */
|
| 593 | truncate table scoreboard;
|
| 594 | INSERT 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;
|
| 595 | INSERT 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;
|
| 596 | INSERT INTO scoreboard SELECT NULL, "LASGEN", "Scoreboard Last Generated", MAX(translation_id) FROM translations;
|
| 597 |
|
| 598 | /* create a holding record for the MOTD */
|
| 599 | INSERT INTO sys_values VALUES ("MOTD", NULL);
|