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