blob: 1e7499ca4f17c503d45f040d2a4b95182cafcad2 [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
30DROP TABLE IF EXISTS `files`;
31CREATE TABLE `files` (
droye5c99812007-11-28 21:36:51 +000032 `file_id` int(10) unsigned NOT NULL auto_increment,
droy27e97e02007-11-27 16:44:19 +000033 `project_id` varchar(100) NOT NULL,
droy44cb1ba2007-12-18 15:19:34 +000034 `version` varchar(64) NOT NULL,
droy27e97e02007-11-27 16:44:19 +000035 `name` text NOT NULL,
36 `is_active` tinyint(3) unsigned NOT NULL default '1',
37 PRIMARY KEY (`file_id`),
38 KEY `project_id` (`project_id`),
droyc081e862007-11-30 16:37:35 +000039 CONSTRAINT `files_ibfk_1` FOREIGN KEY (`project_id`,`version`) REFERENCES `project_versions` (`project_id`,`version`) ON UPDATE CASCADE
droy27e97e02007-11-27 16:44:19 +000040) ENGINE=InnoDB DEFAULT CHARSET=utf8;
41
42--
43-- Table structure for table `languages`
44--
45
46DROP TABLE IF EXISTS `languages`;
47CREATE TABLE `languages` (
48 `language_id` smallint(5) unsigned NOT NULL auto_increment,
49 `iso_code` char(2) NOT NULL,
50 `locale` varchar(12) default NULL,
51 `name` varchar(50) NOT NULL,
52 `is_active` tinyint(3) unsigned NOT NULL default '1',
53 PRIMARY KEY (`language_id`),
54 KEY `iso_code` (`iso_code`),
55 KEY `locale` (`locale`)
56) ENGINE=InnoDB DEFAULT CHARSET=utf8;
57
droy3bb0c962008-01-17 20:45:01 +000058
59
60--
61-- Table structure for table `map_files`
62--
63
64DROP TABLE IF EXISTS `map_files`;
65CREATE TABLE `map_files` (
66 `project_id` varchar(100) NOT NULL,
67 `version` varchar(64) NOT NULL,
68 `filename` varchar(100) NOT NULL,
69 `location` varchar(255) NOT NULL,
70 `is_active` tinyint(3) unsigned NOT NULL default '1',
71 PRIMARY KEY (`project_id`, `version`, `filename`),
72 CONSTRAINT `map_files_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
73) ENGINE=InnoDB DEFAULT CHARSET=utf8;
74
droy27e97e02007-11-27 16:44:19 +000075--
76-- Table structure for table `profiles`
77--
78
79DROP TABLE IF EXISTS `profiles`;
80CREATE TABLE `profiles` (
81 `userid` mediumint(9) NOT NULL auto_increment,
82 `login_name` varchar(255) NOT NULL default '',
83 `cryptpassword` varchar(128) default NULL,
84 `realname` varchar(255) NOT NULL default '',
85 `disabledtext` mediumtext NOT NULL,
86 `mybugslink` tinyint(4) NOT NULL default '1',
87 `extern_id` varchar(64) default NULL,
88 `disable_mail` tinyint(4) NOT NULL default '0',
89 PRIMARY KEY (`userid`),
90 UNIQUE KEY `profiles_login_name_idx` (`login_name`)
91) ENGINE=MyISAM DEFAULT CHARSET=latin1;
92
93--
94-- Table structure for table `projects`
95--
96
97DROP TABLE IF EXISTS `projects`;
98CREATE TABLE `projects` (
99 `project_id` varchar(100) NOT NULL,
100 `is_active` tinyint(3) unsigned NOT NULL default '1',
101 PRIMARY KEY (`project_id`)
102) ENGINE=InnoDB DEFAULT CHARSET=utf8;
103
droyc081e862007-11-30 16:37:35 +0000104DROP TABLE IF EXISTS `project_versions`;
105CREATE TABLE `project_versions` (
106 `project_id` varchar(100) NOT NULL,
droy44cb1ba2007-12-18 15:19:34 +0000107 `version` varchar(64) NOT NULL,
droyc081e862007-11-30 16:37:35 +0000108 `is_active` tinyint(3) unsigned NOT NULL default '1',
109 PRIMARY KEY (`project_id`, `version`),
110 CONSTRAINT `project_versions_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
111) ENGINE=InnoDB DEFAULT CHARSET=utf8;
112
droy27e97e02007-11-27 16:44:19 +0000113--
114-- Table structure for table `ratings`
115--
116
117DROP TABLE IF EXISTS `ratings`;
118CREATE TABLE `ratings` (
119 `translation_id` int(10) unsigned NOT NULL,
120 `userid` int(10) unsigned NOT NULL,
121 `rating` tinyint(3) unsigned NOT NULL default '0',
122 `created_on` datetime NOT NULL,
123 PRIMARY KEY (`translation_id`,`userid`),
124 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`translation_id`) REFERENCES `translations` (`translation_id`) ON UPDATE CASCADE
125) ENGINE=InnoDB DEFAULT CHARSET=utf8;
126
127--
128-- Table structure for table `schema_info`
129--
130
131DROP TABLE IF EXISTS `schema_info`;
132CREATE TABLE `schema_info` (
133 `version` int(11) default NULL
134) ENGINE=MyISAM DEFAULT CHARSET=latin1;
135
136--
137-- Table structure for table `sessions`
138--
139
140DROP TABLE IF EXISTS `sessions`;
141CREATE TABLE `sessions` (
142 `id` int(11) unsigned NOT NULL auto_increment,
143 `userid` int(11) NOT NULL,
144 `gid` char(32) default NULL,
145 `subnet` char(15) default NULL,
146 `updated_at` datetime default NULL,
147 PRIMARY KEY (`id`),
148 KEY `gid` (`gid`),
149 KEY `userid` (`userid`)
150) ENGINE=InnoDB DEFAULT CHARSET=latin1;
151
152--
153-- Table structure for table `strings`
154--
155
156DROP TABLE IF EXISTS `strings`;
157CREATE TABLE `strings` (
158 `string_id` int(10) unsigned NOT NULL auto_increment,
159 `file_id` int(10) unsigned NOT NULL,
160 `name` text NOT NULL,
161 `value` text NOT NULL,
162 `userid` int(10) unsigned NOT NULL,
163 `created_on` datetime NOT NULL,
164 `is_active` tinyint(1) unsigned default NULL,
165 PRIMARY KEY (`string_id`),
166 KEY `file_id` (`file_id`),
167 KEY `userid` (`userid`),
168 CONSTRAINT `strings_ibfk_1` FOREIGN KEY (`file_id`) REFERENCES `files` (`file_id`) ON UPDATE CASCADE,
169 CONSTRAINT `strings_ibfk_2` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON UPDATE CASCADE
170) ENGINE=InnoDB DEFAULT CHARSET=utf8;
171
droy44cb1ba2007-12-18 15:19:34 +0000172
droy44cb1ba2007-12-18 15:19:34 +0000173DELIMITER ;;
174CREATE TRIGGER `upd_string` AFTER UPDATE ON `strings` FOR EACH ROW
175 BEGIN
176 IF(NEW.value <> OLD.value) THEN
177 UPDATE translations SET possibly_incorrect = 1 WHERE string_id = NEW.string_id;
178 END IF;
179 END;
180;;
181DELIMITER ;
182
183
184
droy27e97e02007-11-27 16:44:19 +0000185--
186-- Table structure for table `translation_archives`
187--
188
189DROP TABLE IF EXISTS `translation_archives`;
190CREATE TABLE `translation_archives` (
191 `translation_id` int(10) unsigned NOT NULL,
192 `string_id` int(10) unsigned NOT NULL,
193 `language_id` smallint(5) unsigned NOT NULL,
194 `version` int(10) unsigned NOT NULL default '1',
195 `value` text NOT NULL,
196 `is_active` tinyint(3) unsigned NOT NULL default '1',
197 `userid` int(10) unsigned NOT NULL,
198 `created_on` datetime NOT NULL,
199 PRIMARY KEY (`string_id`,`language_id`,`version`),
200 KEY `language_id` (`language_id`),
201 KEY `userid` (`userid`),
202 CONSTRAINT `translation_archives_ibfk_1` FOREIGN KEY (`string_id`) REFERENCES `strings` (`string_id`) ON UPDATE CASCADE,
203 CONSTRAINT `translation_archives_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE,
204 CONSTRAINT `translation_archives_ibfk_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON UPDATE CASCADE
205) ENGINE=InnoDB DEFAULT CHARSET=utf8;
206
207--
208-- Table structure for table `translations`
209--
210
211DROP TABLE IF EXISTS `translations`;
212CREATE TABLE `translations` (
213 `translation_id` int(10) unsigned NOT NULL auto_increment,
214 `string_id` int(10) unsigned NOT NULL,
215 `language_id` smallint(5) unsigned NOT NULL,
216 `version` int(10) unsigned NOT NULL default '1',
217 `value` text NOT NULL,
droy44cb1ba2007-12-18 15:19:34 +0000218 `possibly_incorrect` tinyint unsigned NOT NULL default '0',
droy27e97e02007-11-27 16:44:19 +0000219 `is_active` tinyint(3) unsigned NOT NULL default '1',
220 `userid` int(10) unsigned NOT NULL,
221 `created_on` datetime NOT NULL,
222 PRIMARY KEY (`string_id`,`language_id`,`version`),
223 KEY `translation_id` (`translation_id`),
224 KEY `language_id` (`language_id`),
225 KEY `userid` (`userid`),
226 CONSTRAINT `translations_ibfk_1` FOREIGN KEY (`string_id`) REFERENCES `strings` (`string_id`) ON UPDATE CASCADE,
227 CONSTRAINT `translations_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE,
228 CONSTRAINT `translations_ibfk_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON UPDATE CASCADE
229) ENGINE=InnoDB DEFAULT CHARSET=utf8;
230
231/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
232DELIMITER ;;
233/*!50003 SET SESSION SQL_MODE="" */;;
234/*!50003 CREATE TRIGGER `ins_version` BEFORE INSERT ON `translations` FOR EACH ROW SET NEW.version =
droye4e2e332007-11-29 19:59:12 +0000235 (SELECT IFNULL(MAX(version),0)+1 FROM translations
droy8da30b32007-11-29 21:00:26 +0000236 WHERE string_id = NEW.string_id and language_id = NEW.language_id) */;;
droy27e97e02007-11-27 16:44:19 +0000237
238DELIMITER ;
239/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
240
241--
242-- Table structure for table `users`
243--
244
245DROP TABLE IF EXISTS `users`;
246CREATE TABLE `users` (
247 `userid` int(10) unsigned NOT NULL,
248 `username` varchar(256) NOT NULL default '',
249 `first_name` varchar(256) NOT NULL default '',
250 `last_name` varchar(256) NOT NULL default '',
251 `email` varchar(256) NOT NULL default '',
252 `primary_language_id` int(11) NOT NULL default '0',
253 `hours_per_week` int(11) NOT NULL default '0',
254 `password_hash` varchar(256) NOT NULL default '',
droy8da30b32007-11-29 21:00:26 +0000255 `is_committer` tinyint unsigned not null default 0,
droy27e97e02007-11-27 16:44:19 +0000256 `updated_on` date NOT NULL,
257 `updated_at` time NOT NULL,
258 `created_on` date NOT NULL,
259 `created_at` time NOT NULL,
260 PRIMARY KEY (`userid`),
261 KEY `primary_language_id` (`primary_language_id`)
262) ENGINE=InnoDB DEFAULT CHARSET=utf8;
droy97c86192007-11-28 22:00:22 +0000263
264insert into languages values(null, "en", null, "English", 1);
265
266
267insert into projects values("eclipse", 1);
268
269
270
droy27e97e02007-11-27 16:44:19 +0000271/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
272
273/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
274/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
275/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
276/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
277/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
278/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
279/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
280