Добавлены структуры данных на стороне сервера MySQL
[openlib.git] / metadata.sql
1 -- MySQL dump 10.13  Distrib 5.5.34, for debian-linux-gnu (x86_64)
2 --
3 -- Host: localhost    Database: metadata
4 -- ------------------------------------------------------
5 -- Server version       5.5.34-0ubuntu0.13.10.1
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 --
19 -- Table structure for table `authors`
20 --
21
22 DROP TABLE IF EXISTS `authors`;
23 /*!40101 SET @saved_cs_client     = @@character_set_client */;
24 /*!40101 SET character_set_client = utf8 */;
25 CREATE TABLE `authors` (
26   `id` int(11) NOT NULL AUTO_INCREMENT,
27   `name` varchar(255) NOT NULL,
28   `sort` varchar(255) DEFAULT NULL,
29   PRIMARY KEY (`id`),
30   UNIQUE KEY `NAMEIDX` (`name`) USING BTREE,
31   KEY `SORTIDX` (`sort`) USING BTREE
32 ) ENGINE=InnoDB AUTO_INCREMENT=118680 DEFAULT CHARSET=utf8;
33 /*!40101 SET character_set_client = @saved_cs_client */;
34
35 --
36 -- Table structure for table `books`
37 --
38
39 DROP TABLE IF EXISTS `books`;
40 /*!40101 SET @saved_cs_client     = @@character_set_client */;
41 /*!40101 SET character_set_client = utf8 */;
42 CREATE TABLE `books` (
43   `id` int(11) NOT NULL AUTO_INCREMENT,
44   `title` varchar(512) DEFAULT NULL,
45   `sort` varchar(512) DEFAULT NULL,
46   `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
47   `pubdate` timestamp NULL DEFAULT NULL,
48   `series_index` decimal(4,2) DEFAULT '1.00',
49   `isbn` varchar(45) DEFAULT NULL,
50   `path` varchar(2000) DEFAULT NULL,
51   `uuid` varchar(128) DEFAULT NULL,
52   `has_cover` int(11) DEFAULT '0',
53   `last_modified` timestamp NULL DEFAULT NULL,
54   PRIMARY KEY (`id`),
55   KEY `SORTIDX` (`sort`(255)),
56   KEY `TITLEIDX` (`title`(255)),
57   KEY `TIMESTAMPIDX` (`timestamp`),
58   KEY `ISBNIDX` (`isbn`)
59 ) ENGINE=InnoDB AUTO_INCREMENT=728948 DEFAULT CHARSET=utf8;
60 /*!40101 SET character_set_client = @saved_cs_client */;
61
62 --
63 -- Table structure for table `books_authors_link`
64 --
65
66 DROP TABLE IF EXISTS `books_authors_link`;
67 /*!40101 SET @saved_cs_client     = @@character_set_client */;
68 /*!40101 SET character_set_client = utf8 */;
69 CREATE TABLE `books_authors_link` (
70   `id` int(11) NOT NULL AUTO_INCREMENT,
71   `book` int(11) NOT NULL,
72   `author` int(11) NOT NULL,
73   PRIMARY KEY (`id`),
74   UNIQUE KEY `book` (`book`,`author`),
75   KEY `books_authors_link_aidx` (`author`),
76   KEY `books_authors_link_bidx` (`book`),
77   CONSTRAINT `fk_books_authors_link_auth` FOREIGN KEY (`author`) REFERENCES `authors` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
78   CONSTRAINT `fk_books_authors_link_books` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
79 ) ENGINE=InnoDB AUTO_INCREMENT=523239 DEFAULT CHARSET=utf8;
80 /*!40101 SET character_set_client = @saved_cs_client */;
81
82 --
83 -- Table structure for table `books_languages_link`
84 --
85
86 DROP TABLE IF EXISTS `books_languages_link`;
87 /*!40101 SET @saved_cs_client     = @@character_set_client */;
88 /*!40101 SET character_set_client = utf8 */;
89 CREATE TABLE `books_languages_link` (
90   `id` int(11) NOT NULL AUTO_INCREMENT,
91   `book` int(11) NOT NULL,
92   `lang_code` int(11) NOT NULL,
93   `item_order` int(11) NOT NULL DEFAULT '0',
94   PRIMARY KEY (`id`),
95   UNIQUE KEY `book` (`book`,`lang_code`),
96   KEY `books_languages_link_aidx` (`lang_code`),
97   KEY `books_languages_link_bidx` (`book`),
98   CONSTRAINT `fk_books_languages_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
99   CONSTRAINT `fk_books_languages_link_lang` FOREIGN KEY (`lang_code`) REFERENCES `languages` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
100 ) ENGINE=InnoDB AUTO_INCREMENT=488274 DEFAULT CHARSET=utf8;
101 /*!40101 SET character_set_client = @saved_cs_client */;
102
103 --
104 -- Table structure for table `books_publishers_link`
105 --
106
107 DROP TABLE IF EXISTS `books_publishers_link`;
108 /*!40101 SET @saved_cs_client     = @@character_set_client */;
109 /*!40101 SET character_set_client = utf8 */;
110 CREATE TABLE `books_publishers_link` (
111   `id` int(11) NOT NULL AUTO_INCREMENT,
112   `book` int(11) NOT NULL,
113   `publisher` int(11) NOT NULL,
114   PRIMARY KEY (`id`),
115   KEY `books_publishers_link_aidx` (`publisher`),
116   KEY `books_publishers_link_bidx` (`book`),
117   CONSTRAINT `fk_books_publishers_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
118   CONSTRAINT `fk_books_publishers_link_pub` FOREIGN KEY (`publisher`) REFERENCES `publishers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
119 ) ENGINE=InnoDB AUTO_INCREMENT=204595 DEFAULT CHARSET=utf8;
120 /*!40101 SET character_set_client = @saved_cs_client */;
121
122 --
123 -- Table structure for table `books_series_link`
124 --
125
126 DROP TABLE IF EXISTS `books_series_link`;
127 /*!40101 SET @saved_cs_client     = @@character_set_client */;
128 /*!40101 SET character_set_client = utf8 */;
129 CREATE TABLE `books_series_link` (
130   `id` int(11) NOT NULL AUTO_INCREMENT,
131   `book` int(11) NOT NULL,
132   `series` int(11) NOT NULL,
133   PRIMARY KEY (`id`),
134   KEY `books_series_link_aidx` (`series`),
135   KEY `books_series_link_bidx` (`book`),
136   CONSTRAINT `fk_books_series_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
137   CONSTRAINT `fk_books_series_link_ser` FOREIGN KEY (`series`) REFERENCES `series` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
138 ) ENGINE=InnoDB AUTO_INCREMENT=179786 DEFAULT CHARSET=utf8;
139 /*!40101 SET character_set_client = @saved_cs_client */;
140
141 --
142 -- Table structure for table `books_tags_link`
143 --
144
145 DROP TABLE IF EXISTS `books_tags_link`;
146 /*!40101 SET @saved_cs_client     = @@character_set_client */;
147 /*!40101 SET character_set_client = utf8 */;
148 CREATE TABLE `books_tags_link` (
149   `id` int(11) NOT NULL AUTO_INCREMENT,
150   `book` int(11) NOT NULL,
151   `tag` int(11) NOT NULL,
152   PRIMARY KEY (`id`),
153   UNIQUE KEY `book` (`book`,`tag`),
154   KEY `books_tags_link_aidx` (`tag`),
155   KEY `books_tags_link_bidx` (`book`),
156   CONSTRAINT `fk_books_tags_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
157   CONSTRAINT `fk_books_tags_link_tag` FOREIGN KEY (`tag`) REFERENCES `tags` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
158 ) ENGINE=InnoDB AUTO_INCREMENT=544808 DEFAULT CHARSET=utf8;
159 /*!40101 SET character_set_client = @saved_cs_client */;
160
161 --
162 -- Table structure for table `comments`
163 --
164
165 DROP TABLE IF EXISTS `comments`;
166 /*!40101 SET @saved_cs_client     = @@character_set_client */;
167 /*!40101 SET character_set_client = utf8 */;
168 CREATE TABLE `comments` (
169   `id` int(11) NOT NULL AUTO_INCREMENT,
170   `book` int(11) DEFAULT NULL,
171   `text` varchar(4000) DEFAULT NULL,
172   PRIMARY KEY (`id`),
173   UNIQUE KEY `book_UNIQUE` (`book`),
174   CONSTRAINT `fk_comments_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
175 ) ENGINE=InnoDB AUTO_INCREMENT=414407 DEFAULT CHARSET=utf8;
176 /*!40101 SET character_set_client = @saved_cs_client */;
177
178 --
179 -- Table structure for table `data`
180 --
181
182 DROP TABLE IF EXISTS `data`;
183 /*!40101 SET @saved_cs_client     = @@character_set_client */;
184 /*!40101 SET character_set_client = utf8 */;
185 CREATE TABLE `data` (
186   `id` int(11) NOT NULL AUTO_INCREMENT,
187   `book` int(11) NOT NULL,
188   `format` varchar(45) NOT NULL,
189   `uncompressed_size` int(11) DEFAULT NULL,
190   `name` varchar(2000) NOT NULL,
191   PRIMARY KEY (`id`),
192   KEY `fk_data_book_idx` (`book`),
193   KEY `format_idx` (`format`),
194   CONSTRAINT `fk_data_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
195 ) ENGINE=InnoDB AUTO_INCREMENT=728543 DEFAULT CHARSET=utf8;
196 /*!40101 SET character_set_client = @saved_cs_client */;
197
198 --
199 -- Table structure for table `lang_alias`
200 --
201
202 DROP TABLE IF EXISTS `lang_alias`;
203 /*!40101 SET @saved_cs_client     = @@character_set_client */;
204 /*!40101 SET character_set_client = utf8 */;
205 CREATE TABLE `lang_alias` (
206   `alias` varchar(32) NOT NULL,
207   `lang_code` varchar(32) DEFAULT NULL,
208   PRIMARY KEY (`alias`),
209   KEY `fk_lang_alias_1_idx` (`lang_code`),
210   CONSTRAINT `fk_lang_alias_1` FOREIGN KEY (`lang_code`) REFERENCES `languages` (`lang_code`) ON DELETE NO ACTION ON UPDATE NO ACTION
211 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
212 /*!40101 SET character_set_client = @saved_cs_client */;
213
214 --
215 -- Table structure for table `languages`
216 --
217
218 DROP TABLE IF EXISTS `languages`;
219 /*!40101 SET @saved_cs_client     = @@character_set_client */;
220 /*!40101 SET character_set_client = utf8 */;
221 CREATE TABLE `languages` (
222   `id` int(11) NOT NULL AUTO_INCREMENT,
223   `lang_code` varchar(10) DEFAULT NULL,
224   PRIMARY KEY (`id`),
225   UNIQUE KEY `lang_code_UNIQUE` (`lang_code`)
226 ) ENGINE=InnoDB AUTO_INCREMENT=204 DEFAULT CHARSET=utf8;
227 /*!40101 SET character_set_client = @saved_cs_client */;
228
229 --
230 -- Table structure for table `processed_archives`
231 --
232
233 DROP TABLE IF EXISTS `processed_archives`;
234 /*!40101 SET @saved_cs_client     = @@character_set_client */;
235 /*!40101 SET character_set_client = utf8 */;
236 CREATE TABLE `processed_archives` (
237   `id` int(11) NOT NULL AUTO_INCREMENT,
238   `filename` varchar(255) DEFAULT NULL,
239   PRIMARY KEY (`id`),
240   UNIQUE KEY `filename` (`filename`)
241 ) ENGINE=InnoDB AUTO_INCREMENT=115 DEFAULT CHARSET=utf8;
242 /*!40101 SET character_set_client = @saved_cs_client */;
243
244 --
245 -- Table structure for table `publishers`
246 --
247
248 DROP TABLE IF EXISTS `publishers`;
249 /*!40101 SET @saved_cs_client     = @@character_set_client */;
250 /*!40101 SET character_set_client = utf8 */;
251 CREATE TABLE `publishers` (
252   `id` int(11) NOT NULL AUTO_INCREMENT,
253   `name` longtext NOT NULL,
254   `sort` longtext,
255   PRIMARY KEY (`id`)
256 ) ENGINE=InnoDB AUTO_INCREMENT=26395 DEFAULT CHARSET=utf8;
257 /*!40101 SET character_set_client = @saved_cs_client */;
258
259 --
260 -- Table structure for table `series`
261 --
262
263 DROP TABLE IF EXISTS `series`;
264 /*!40101 SET @saved_cs_client     = @@character_set_client */;
265 /*!40101 SET character_set_client = utf8 */;
266 CREATE TABLE `series` (
267   `id` int(11) NOT NULL AUTO_INCREMENT,
268   `name` longtext NOT NULL,
269   `sort` longtext,
270   PRIMARY KEY (`id`)
271 ) ENGINE=InnoDB AUTO_INCREMENT=39266 DEFAULT CHARSET=utf8;
272 /*!40101 SET character_set_client = @saved_cs_client */;
273
274 --
275 -- Table structure for table `tags`
276 --
277
278 DROP TABLE IF EXISTS `tags`;
279 /*!40101 SET @saved_cs_client     = @@character_set_client */;
280 /*!40101 SET character_set_client = utf8 */;
281 CREATE TABLE `tags` (
282   `id` int(11) NOT NULL AUTO_INCREMENT,
283   `name` longtext NOT NULL,
284   PRIMARY KEY (`id`),
285   KEY `nameidx` (`name`(32))
286 ) ENGINE=InnoDB AUTO_INCREMENT=478 DEFAULT CHARSET=utf8;
287 /*!40101 SET character_set_client = @saved_cs_client */;
288
289 --
290 -- Table structure for table `tags_mapping`
291 --
292
293 DROP TABLE IF EXISTS `tags_mapping`;
294 /*!40101 SET @saved_cs_client     = @@character_set_client */;
295 /*!40101 SET character_set_client = utf8 */;
296 CREATE TABLE `tags_mapping` (
297   `id` int(11) NOT NULL AUTO_INCREMENT,
298   `tag_mask` varchar(45) NOT NULL,
299   `tag_result` varchar(45) NOT NULL,
300   PRIMARY KEY (`id`)
301 ) ENGINE=InnoDB AUTO_INCREMENT=316 DEFAULT CHARSET=utf8;
302 /*!40101 SET character_set_client = @saved_cs_client */;
303 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
304
305 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
306 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
307 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
308 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
309 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
310 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
311 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
312
313 -- Dump completed on 2013-11-30 18:05:09