droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 1 | -- 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 | |
droy | d0a9b1a | 2008-01-29 19:51:46 +0000 | [diff] [blame] | 18 | DROP TABLE IF EXISTS event_log; |
droy | 3e7f3a8 | 2007-11-29 19:35:51 +0000 | [diff] [blame] | 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; |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 29 | |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 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, |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 37 | CONSTRAINT `file_progress_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE ON DELETE CASCADE |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 39 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 40 | DROP TABLE IF EXISTS `files`; |
| 41 | CREATE TABLE `files` ( |
droy | e5c9981 | 2007-11-28 21:36:51 +0000 | [diff] [blame] | 42 | `file_id` int(10) unsigned NOT NULL auto_increment, |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 43 | `project_id` varchar(100) NOT NULL, |
droy | b9c2cb1 | 2008-10-08 13:58:14 +0000 | [diff] [blame] | 44 | `plugin_id` varchar(100) NOT NULL, |
droy | 44cb1ba | 2007-12-18 15:19:34 +0000 | [diff] [blame] | 45 | `version` varchar(64) NOT NULL, |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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`), |
droy | c081e86 | 2007-11-30 16:37:35 +0000 | [diff] [blame] | 50 | CONSTRAINT `files_ibfk_1` FOREIGN KEY (`project_id`,`version`) REFERENCES `project_versions` (`project_id`,`version`) ON UPDATE CASCADE |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 51 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
droy | 0757c2c | 2009-03-31 19:37:36 +0000 | [diff] [blame] | 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 */ |
droy | 2251ca9 | 2010-01-20 14:08:49 +0000 | [diff] [blame] | 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 | |
droy | 0757c2c | 2009-03-31 19:37:36 +0000 | [diff] [blame] | 69 | UPDATE IGNORE project_progress SET is_stale = 1 where project_id = @PROJECT |
droy | 2251ca9 | 2010-01-20 14:08:49 +0000 | [diff] [blame] | 70 | AND version = @VERSION; |
droy | 0757c2c | 2009-03-31 19:37:36 +0000 | [diff] [blame] | 71 | END; |
| 72 | ;; |
| 73 | DELIMITER ; |
| 74 | /*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; |
| 75 | |
| 76 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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, |
droy | c94a452 | 2008-02-05 15:36:53 +0000 | [diff] [blame] | 84 | `iso_code` varchar(6) NOT NULL, |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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 | |
droy | 3bb0c96 | 2008-01-17 20:45:01 +0000 | [diff] [blame] | 93 | -- |
| 94 | -- Table structure for table `map_files` |
| 95 | -- |
| 96 | |
Kit Lo | 51854da | 2013-06-27 17:31:02 -0400 | [diff] [blame] | 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 | |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 113 | DROP TABLE IF EXISTS `project_source_locations`; |
| 114 | CREATE TABLE `project_source_locations` ( |
droy | 3bb0c96 | 2008-01-17 20:45:01 +0000 | [diff] [blame] | 115 | `project_id` varchar(100) NOT NULL, |
| 116 | `version` varchar(64) NOT NULL, |
droy | 3bb0c96 | 2008-01-17 20:45:01 +0000 | [diff] [blame] | 117 | `location` varchar(255) NOT NULL, |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 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 |
droy | 3bb0c96 | 2008-01-17 20:45:01 +0000 | [diff] [blame] | 120 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 121 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 122 | -- |
kitlo | d66aa99 | 2010-01-22 17:18:19 +0000 | [diff] [blame] | 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 | -- |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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 | |
kitlo | e3fea25 | 2010-01-25 02:13:49 +0000 | [diff] [blame] | 164 | -- |
| 165 | -- Table structure for table `project_progress` |
| 166 | -- |
| 167 | |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 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, |
droy | 6e6fb6d | 2008-05-15 17:11:29 +0000 | [diff] [blame] | 174 | `is_stale` tinyint unsigned not null default 0, |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 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 | |
kitlo | e3fea25 | 2010-01-25 02:13:49 +0000 | [diff] [blame] | 180 | -- |
| 181 | -- Table structure for table `project_versions` |
| 182 | -- |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 183 | |
droy | c081e86 | 2007-11-30 16:37:35 +0000 | [diff] [blame] | 184 | DROP TABLE IF EXISTS `project_versions`; |
| 185 | CREATE TABLE `project_versions` ( |
| 186 | `project_id` varchar(100) NOT NULL, |
droy | 44cb1ba | 2007-12-18 15:19:34 +0000 | [diff] [blame] | 187 | `version` varchar(64) NOT NULL, |
droy | c081e86 | 2007-11-30 16:37:35 +0000 | [diff] [blame] | 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 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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 | |
kitlo | e3fea25 | 2010-01-25 02:13:49 +0000 | [diff] [blame] | 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, |
kitlo | 29f4a97 | 2010-08-08 00:14:04 +0000 | [diff] [blame] | 215 | `is_active` tinyint(3) unsigned NOT NULL default '1', |
kitlo | e3fea25 | 2010-01-25 02:13:49 +0000 | [diff] [blame] | 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 | |
droy | 684f2b6 | 2008-06-02 20:52:29 +0000 | [diff] [blame] | 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 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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, |
droy | 0e2dff4 | 2008-09-24 15:35:34 +0000 | [diff] [blame] | 269 | `non_translatable` tinyint(4) default '0', |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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 |
atoulme | abd65d5 | 2009-01-09 23:47:54 +0000 | [diff] [blame] | 275 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 276 | |
droy | 6886461 | 2009-04-14 15:44:05 +0000 | [diff] [blame] | 277 | CREATE INDEX idx_value ON strings(value(40)); |
droy | 44cb1ba | 2007-12-18 15:19:34 +0000 | [diff] [blame] | 278 | |
droy | 44cb1ba | 2007-12-18 15:19:34 +0000 | [diff] [blame] | 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 | |
droy | 0757c2c | 2009-03-31 19:37:36 +0000 | [diff] [blame] | 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; |
droy | 44cb1ba | 2007-12-18 15:19:34 +0000 | [diff] [blame] | 298 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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, |
droy | 44cb1ba | 2007-12-18 15:19:34 +0000 | [diff] [blame] | 332 | `possibly_incorrect` tinyint unsigned NOT NULL default '0', |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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`), |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 340 | KEY `created_on` (`created_on`), |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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 | |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 346 | SET @OLD_SQL_MODE=@@SQL_MODE; |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 347 | DELIMITER ;; |
| 348 | /*!50003 SET SESSION SQL_MODE="" */;; |
droy | 28b2879 | 2008-05-21 20:54:29 +0000 | [diff] [blame] | 349 | DROP TRIGGER IF EXISTS `ins_version`;; |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 350 | |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 351 | /* This trigger sets the version to max(version) + 1. It also updates the file_progress table */ |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 352 | /* We check IF(NEW.version > 1) to determine if this is a NEW translation or one that replaces an existing one */ |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 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); |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 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); |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 364 | |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 365 | |
| 366 | /* update this file's progress */ |
| 367 | DELETE FROM file_progress where file_id = @FILE_ID |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 368 | AND language_id = NEW.language_id; |
| 369 | |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 370 | /* See notes above for the hairy select */ |
| 371 | INSERT INTO file_progress SET file_id = @FILE_ID, |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 372 | language_id = NEW.language_id, |
| 373 | pct_complete = ( |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 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 |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 378 | FROM files AS f |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 379 | LEFT JOIN strings AS s ON (s.file_id = f.file_id AND s.value <> "" and s.is_active) |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 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) |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 382 | WHERE f.file_id = @FILE_ID |
| 383 | ); |
droy | 6e6fb6d | 2008-05-15 17:11:29 +0000 | [diff] [blame] | 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 */ |
droy | 0757c2c | 2009-03-31 19:37:36 +0000 | [diff] [blame] | 388 | /* This portion of the trigger is similar to what is in the files table */ |
droy | 6e6fb6d | 2008-05-15 17:11:29 +0000 | [diff] [blame] | 389 | UPDATE IGNORE project_progress SET is_stale = 1 where project_id = @PROJECT |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 390 | AND version = @VERSION |
| 391 | AND language_id = NEW.language_id; |
droy | 6e6fb6d | 2008-05-15 17:11:29 +0000 | [diff] [blame] | 392 | |
| 393 | INSERT IGNORE INTO project_progress SET is_stale = 1, project_id = @PROJECT, |
| 394 | version = @VERSION, |
| 395 | language_id = NEW.language_id; |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 396 | |
droy | 5d4b64c | 2008-02-29 15:22:10 +0000 | [diff] [blame] | 397 | END; |
| 398 | ;; |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 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` ( |
| 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 '', |
droy | 8da30b3 | 2007-11-29 21:00:26 +0000 | [diff] [blame] | 416 | `is_committer` tinyint unsigned not null default 0, |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 417 | `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; |
droy | 97c8619 | 2007-11-28 22:00:22 +0000 | [diff] [blame] | 424 | |
droy | 5bb8117 | 2008-04-04 19:25:24 +0000 | [diff] [blame] | 425 | DROP TABLE IF EXISTS `scoreboard`; |
| 426 | CREATE 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 | |
droy | 97c8619 | 2007-11-28 22:00:22 +0000 | [diff] [blame] | 436 | |
| 437 | |
droy | 27e97e0 | 2007-11-27 16:44:19 +0000 | [diff] [blame] | 438 | /*!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 | |
droy | 6426bc0 | 2008-02-01 19:35:19 +0000 | [diff] [blame] | 448 | |
| 449 | |
| 450 | |
| 451 | |
| 452 | |
| 453 | /* |
| 454 | Babel data |
| 455 | User: babel@eclipse.org |
| 456 | pass: password |
| 457 | */ |
| 458 | |
| 459 | insert into profiles set login_name = "test", cryptpassword = "", realname = "tester", disabledtext = false, mybugslink = 1, extern_id = 1, disable_mail = false; |
droy | eccd983 | 2008-07-22 18:04:11 +0000 | [diff] [blame] | 460 | 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=''; |
kitlo | 32cd744 | 2010-02-15 16:29:22 +0000 | [diff] [blame] | 461 | 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=''; |
| 462 | 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=''; |
kitlo | 2e780dc | 2010-01-12 17:58:32 +0000 | [diff] [blame] | 463 | |
| 464 | insert into languages values (1, "en", null, "English", 1); |
| 465 | insert into languages values (null, "fr", null, "French", 1); |
| 466 | insert into languages values (null, "de", null, "German", 1); |
| 467 | insert into languages values (null, "es", null, "Spanish", 1); |
| 468 | insert into languages values (null, "it", null, "Italian", 1); |
| 469 | insert into languages values (null, "ja", null, "Japanese", 1); |
| 470 | insert into languages values (null, "ko", null, "Korean", 1); |
| 471 | insert into languages values (null, "pt_BR", "Brazilian", "Portuguese", 1); |
| 472 | insert into languages values (null, "zh", "Simplified", "Chinese", 1); |
| 473 | insert into languages values (null, "zh_TW", "Traditional", "Chinese", 1); |
| 474 | insert into languages values (null, "cs", null, "Czech", 1); |
| 475 | insert into languages values (null, "hu", null, "Hungarian", 1); |
| 476 | insert into languages values (null, "pl", null, "Polish", 1); |
| 477 | insert into languages values (null, "ru", null, "Russian", 1); |
| 478 | insert into languages values (null, "da", null, "Danish", 1); |
| 479 | insert into languages values (null, "nl", null, "Dutch", 1); |
| 480 | insert into languages values (null, "fi", null, "Finnish", 1); |
| 481 | insert into languages values (null, "el", null, "Greek", 1); |
| 482 | insert into languages values (null, "no", null, "Norwegian", 1); |
| 483 | insert into languages values (null, "pt", null, "Portuguese", 1); |
| 484 | insert into languages values (null, "sv", null, "Swedish", 1); |
| 485 | insert into languages values (null, "tr", null, "Turkish", 1); |
| 486 | insert into languages values (null, "ar", null, "Arabic", 1); |
| 487 | insert into languages values (null, "iw", null, "Hebrew", 1); |
| 488 | insert into languages values (null, "hi", null, "Hindi", 1); |
| 489 | insert into languages values (null, "ro", null, "Romanian", 1); |
| 490 | insert into languages values (null, "uk", null, "Ukrainian", 1); |
| 491 | insert into languages values (null, "ca", null, "Catalan", 1); |
| 492 | insert into languages values (null, "et", null, "Estonian", 1); |
| 493 | insert into languages values (null, "en_CA", "Canadian", "English", 1); |
| 494 | insert into languages values (null, "en_AU", "Australian", "English", 1); |
| 495 | insert into languages values (null, "mn", null, "Mongolian", 1); |
| 496 | insert into languages values (null, "id", null, "Indonesian", 1); |
| 497 | insert into languages values (null, "bg", null, "Bulgarian", 1); |
kitlo | 396bcca | 2010-02-11 20:03:25 +0000 | [diff] [blame] | 498 | insert into languages values (null, "sl", null, "Slovenian", 1); |
kitlo | f7ec1e8 | 2010-07-31 18:42:23 +0000 | [diff] [blame] | 499 | insert into languages values (null, "fa", null, "Persian", 1); |
kitlo | 98f0807 | 2010-12-14 06:09:23 +0000 | [diff] [blame] | 500 | insert into languages values (null, "sq", null, "Albanian", 1); |
kitlo | 9b40925 | 2011-06-16 00:44:29 +0000 | [diff] [blame] | 501 | insert into languages values (null, "ku", null, "Kurdish", 1); |
kitlo | 17d1b11 | 2011-08-21 05:21:21 +0000 | [diff] [blame] | 502 | insert into languages values (null, "sr", null, "Serbian", 1); |
kitlo | 535c5d8 | 2011-10-24 20:58:50 +0000 | [diff] [blame] | 503 | insert into languages values (null, "sk", null, "Slovak", 1); |
Kit Lo | 52fa0a3 | 2012-11-02 20:41:57 -0400 | [diff] [blame] | 504 | insert into languages values (null, "eu", null, "Basque", 1); |
Kit Lo | 6615a9a | 2012-11-26 23:35:49 -0500 | [diff] [blame] | 505 | insert into languages values (null, "ml", null, "Malayalam", 1); |
Kit Lo | c3fd7af | 2013-06-21 12:06:01 -0400 | [diff] [blame] | 506 | insert into languages values (null, "my", null, "Myanmar", 1); |
Kit Lo | 5767b22 | 2013-07-08 12:37:49 -0400 | [diff] [blame] | 507 | insert into languages values (null, "th", null, "Thai", 1); |
Kit Lo | 1a7adac | 2013-11-01 15:08:52 -0400 | [diff] [blame] | 508 | insert into languages values (null, "lt", null, "Lithuanian", 1); |
kitlo | 2e780dc | 2010-01-12 17:58:32 +0000 | [diff] [blame] | 509 | insert into languages values (null, "tl", null, "Klingon", 1); |
| 510 | |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 511 | insert into release_trains values ("kepler", "4.3.0", 1); |
droy | 2df7406 | 2008-07-03 12:45:46 +0000 | [diff] [blame] | 512 | |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 513 | insert into projects values ("eclipse", 1); |
| 514 | insert into projects values ("eclipse.orion", 1); |
kitlo | 98f0807 | 2010-12-14 06:09:23 +0000 | [diff] [blame] | 515 | |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 516 | insert into project_versions values ("eclipse", "4.3", 1);
|
Kit Lo | 1869b2d | 2013-06-20 09:52:07 -0400 | [diff] [blame] | 517 | insert into project_versions values ("eclipse.orion", "3.0", 1);
|
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 518 |
|
| 519 | insert into release_train_projects values ("kepler", "eclipse", "4.3");
|
Kit Lo | 1869b2d | 2013-06-20 09:52:07 -0400 | [diff] [blame] | 520 | insert into release_train_projects values ("kepler", "eclipse.orion", "3.0");
|
kitlo | 2e780dc | 2010-01-12 17:58:32 +0000 | [diff] [blame] | 521 | |
Kit Lo | 51854da | 2013-06-27 17:31:02 -0400 | [diff] [blame] | 522 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.framework.git/snapshot/R4_3.zip"); |
| 523 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.p2.git/snapshot/R4_3.zip"); |
| 524 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.git/snapshot/R4_3.zip"); |
| 525 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/snapshot/R4_3.zip"); |
| 526 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/snapshot/R4_3.zip"); |
| 527 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/snapshot/R4_3.zip"); |
| 528 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.git/snapshot/R4_3.zip"); |
| 529 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.ui.git/snapshot/R4_3.zip"); |
| 530 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.git/snapshot/R4_3.zip"); |
| 531 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.debug.git/snapshot/R4_3.zip"); |
| 532 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.team.git/snapshot/R4_3.zip"); |
| 533 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.text.git/snapshot/R4_3.zip"); |
| 534 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ua.git/snapshot/R4_3.zip"); |
| 535 | insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ui.git/snapshot/R4_3.zip"); |
Kit Lo | 1881f3b | 2013-07-19 07:55:07 -0400 | [diff] [blame] | 536 | 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"); |
kitlo | 98f0807 | 2010-12-14 06:09:23 +0000 | [diff] [blame] | 537 | |
Kit Lo | 6d440cc | 2013-03-02 19:56:45 -0500 | [diff] [blame] | 538 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.ibm\\.icu.*$/"); |
| 539 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.jcraft\\..*$/"); |
| 540 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^javax\\..*$/"); |
| 541 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.apache\\..*$/"); |
| 542 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.hamcrest\\..*$/"); |
| 543 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.junit.*$/"); |
| 544 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.mortbay\\..*$/"); |
| 545 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.objectweb\\..*$/"); |
| 546 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.sat4j\\..*$/"); |
| 547 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.w3c\\..*$/"); |
| 548 | insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^.*\\/jface\\/resource\\/.*$/"); |
Kit Lo | 1869b2d | 2013-06-20 09:52:07 -0400 | [diff] [blame] | 549 | insert into plugin_exclude_patterns values ("eclipse.orion", "3.0", "/^.*\\/bundle.properties$/"); |
kitlo | 9b40925 | 2011-06-16 00:44:29 +0000 | [diff] [blame] | 550 | |
droy | bafb7c4 | 2008-02-29 18:24:38 +0000 | [diff] [blame] | 551 | /* populate file_progress table */ |
droy | dc29484 | 2008-05-21 17:38:57 +0000 | [diff] [blame] | 552 | /* See also: dbmaintenance_15min.php */ |
droy | bafb7c4 | 2008-02-29 18:24:38 +0000 | [diff] [blame] | 553 | truncate table file_progress; |
| 554 | INSERT INTO file_progress |
droy | c2c2610 | 2008-05-21 16:01:40 +0000 | [diff] [blame] | 555 | 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 |
droy | bafb7c4 | 2008-02-29 18:24:38 +0000 | [diff] [blame] | 556 | FROM files AS f |
| 557 | INNER JOIN languages as l ON l.is_active = 1 |
droy | 45413ea | 2008-07-28 14:36:23 +0000 | [diff] [blame] | 558 | LEFT JOIN strings as s ON (s.file_id = f.file_id AND s.is_active AND s.value <> "" AND s.non_translatable = 0) |
droy | bafb7c4 | 2008-02-29 18:24:38 +0000 | [diff] [blame] | 559 | 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) |
| 561 | WHERE f.is_active = 1 |
| 562 | GROUP BY f.file_id, l.language_id; |
droy | 5bb8117 | 2008-04-04 19:25:24 +0000 | [diff] [blame] | 563 | DELETE FROM file_progress WHERE pct_complete = 0; |
| 564 | |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 565 | /* populate project_progress table */ |
| 566 | truncate table project_progress; |
| 567 | INSERT INTO project_progress |
| 568 | SELECT |
| 569 | p.project_id, |
| 570 | v.version, |
| 571 | l.language_id, |
droy | b156beb | 2008-05-15 17:16:44 +0000 | [diff] [blame] | 572 | IF(COUNT(s.string_id) > 0, ROUND(COUNT(t.string_id)/COUNT(s.string_id) * 100, 2), 0) AS pct_complete, |
| 573 | 0 |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 574 | FROM 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) |
| 583 | WHERE |
| 584 | s.value <> "" |
droy | 45413ea | 2008-07-28 14:36:23 +0000 | [diff] [blame] | 585 | AND s.non_translatable = 0 |
droy | d664f91 | 2008-05-14 15:45:10 +0000 | [diff] [blame] | 586 | AND p.is_active |
| 587 | GROUP BY p.project_id, v.version, l.language_id; |
| 588 | |
droy | 5bb8117 | 2008-04-04 19:25:24 +0000 | [diff] [blame] | 589 | /* populate scoreboard */ |
| 590 | truncate table scoreboard; |
| 591 | 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; |
| 592 | 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; |
droy | 0757c2c | 2009-03-31 19:37:36 +0000 | [diff] [blame] | 593 | INSERT INTO scoreboard SELECT NULL, "LASGEN", "Scoreboard Last Generated", MAX(translation_id) FROM translations; |
| 594 | |
| 595 | /* create a holding record for the MOTD */ |
kitlo | e3fea25 | 2010-01-25 02:13:49 +0000 | [diff] [blame] | 596 | INSERT INTO sys_values VALUES ("MOTD", NULL); |