From: Roman Bazalevsky Date: Sat, 30 Nov 2013 14:05:35 +0000 (+0400) Subject: Добавлены структуры данных на стороне сервера MySQL X-Git-Url: https://git.rvb.name/openlib.git/commitdiff_plain/383d95da154278b563110813ded8f79ab9643efa?hp=b165402b0537b9d98281d9ce2adb83488f849d6f Добавлены структуры данных на стороне сервера MySQL --- diff --git a/metadata.sql b/metadata.sql new file mode 100644 index 0000000..3e078ad --- /dev/null +++ b/metadata.sql @@ -0,0 +1,313 @@ +-- MySQL dump 10.13 Distrib 5.5.34, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: metadata +-- ------------------------------------------------------ +-- Server version 5.5.34-0ubuntu0.13.10.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `authors` +-- + +DROP TABLE IF EXISTS `authors`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `authors` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `sort` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `NAMEIDX` (`name`) USING BTREE, + KEY `SORTIDX` (`sort`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=118680 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `books` +-- + +DROP TABLE IF EXISTS `books`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `books` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(512) DEFAULT NULL, + `sort` varchar(512) DEFAULT NULL, + `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `pubdate` timestamp NULL DEFAULT NULL, + `series_index` decimal(4,2) DEFAULT '1.00', + `isbn` varchar(45) DEFAULT NULL, + `path` varchar(2000) DEFAULT NULL, + `uuid` varchar(128) DEFAULT NULL, + `has_cover` int(11) DEFAULT '0', + `last_modified` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `SORTIDX` (`sort`(255)), + KEY `TITLEIDX` (`title`(255)), + KEY `TIMESTAMPIDX` (`timestamp`), + KEY `ISBNIDX` (`isbn`) +) ENGINE=InnoDB AUTO_INCREMENT=728948 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `books_authors_link` +-- + +DROP TABLE IF EXISTS `books_authors_link`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `books_authors_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) NOT NULL, + `author` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `book` (`book`,`author`), + KEY `books_authors_link_aidx` (`author`), + KEY `books_authors_link_bidx` (`book`), + CONSTRAINT `fk_books_authors_link_auth` FOREIGN KEY (`author`) REFERENCES `authors` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_books_authors_link_books` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=523239 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `books_languages_link` +-- + +DROP TABLE IF EXISTS `books_languages_link`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `books_languages_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) NOT NULL, + `lang_code` int(11) NOT NULL, + `item_order` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `book` (`book`,`lang_code`), + KEY `books_languages_link_aidx` (`lang_code`), + KEY `books_languages_link_bidx` (`book`), + CONSTRAINT `fk_books_languages_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT `fk_books_languages_link_lang` FOREIGN KEY (`lang_code`) REFERENCES `languages` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=488274 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `books_publishers_link` +-- + +DROP TABLE IF EXISTS `books_publishers_link`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `books_publishers_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) NOT NULL, + `publisher` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `books_publishers_link_aidx` (`publisher`), + KEY `books_publishers_link_bidx` (`book`), + CONSTRAINT `fk_books_publishers_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT `fk_books_publishers_link_pub` FOREIGN KEY (`publisher`) REFERENCES `publishers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=204595 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `books_series_link` +-- + +DROP TABLE IF EXISTS `books_series_link`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `books_series_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) NOT NULL, + `series` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `books_series_link_aidx` (`series`), + KEY `books_series_link_bidx` (`book`), + CONSTRAINT `fk_books_series_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT `fk_books_series_link_ser` FOREIGN KEY (`series`) REFERENCES `series` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=179786 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `books_tags_link` +-- + +DROP TABLE IF EXISTS `books_tags_link`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `books_tags_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) NOT NULL, + `tag` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `book` (`book`,`tag`), + KEY `books_tags_link_aidx` (`tag`), + KEY `books_tags_link_bidx` (`book`), + CONSTRAINT `fk_books_tags_link_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT `fk_books_tags_link_tag` FOREIGN KEY (`tag`) REFERENCES `tags` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=544808 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `comments` +-- + +DROP TABLE IF EXISTS `comments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `comments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) DEFAULT NULL, + `text` varchar(4000) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `book_UNIQUE` (`book`), + CONSTRAINT `fk_comments_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=414407 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `data` +-- + +DROP TABLE IF EXISTS `data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `data` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `book` int(11) NOT NULL, + `format` varchar(45) NOT NULL, + `uncompressed_size` int(11) DEFAULT NULL, + `name` varchar(2000) NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_data_book_idx` (`book`), + KEY `format_idx` (`format`), + CONSTRAINT `fk_data_book` FOREIGN KEY (`book`) REFERENCES `books` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=728543 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lang_alias` +-- + +DROP TABLE IF EXISTS `lang_alias`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lang_alias` ( + `alias` varchar(32) NOT NULL, + `lang_code` varchar(32) DEFAULT NULL, + PRIMARY KEY (`alias`), + KEY `fk_lang_alias_1_idx` (`lang_code`), + CONSTRAINT `fk_lang_alias_1` FOREIGN KEY (`lang_code`) REFERENCES `languages` (`lang_code`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `languages` +-- + +DROP TABLE IF EXISTS `languages`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `languages` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `lang_code` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `lang_code_UNIQUE` (`lang_code`) +) ENGINE=InnoDB AUTO_INCREMENT=204 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `processed_archives` +-- + +DROP TABLE IF EXISTS `processed_archives`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `processed_archives` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `filename` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `filename` (`filename`) +) ENGINE=InnoDB AUTO_INCREMENT=115 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `publishers` +-- + +DROP TABLE IF EXISTS `publishers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `publishers` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` longtext NOT NULL, + `sort` longtext, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=26395 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `series` +-- + +DROP TABLE IF EXISTS `series`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `series` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` longtext NOT NULL, + `sort` longtext, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=39266 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tags` +-- + +DROP TABLE IF EXISTS `tags`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tags` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` longtext NOT NULL, + PRIMARY KEY (`id`), + KEY `nameidx` (`name`(32)) +) ENGINE=InnoDB AUTO_INCREMENT=478 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tags_mapping` +-- + +DROP TABLE IF EXISTS `tags_mapping`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tags_mapping` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `tag_mask` varchar(45) NOT NULL, + `tag_result` varchar(45) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=316 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2013-11-30 18:05:09