insipid-edit-me.sql 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  2. START TRANSACTION;
  3. SET time_zone = "+00:00";
  4. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  5. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  6. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  7. /*!40101 SET NAMES utf8mb4 */;
  8. --
  9. -- Database: `insipid`
  10. --
  11. -- --------------------------------------------------------
  12. --
  13. -- Table structure for table `#REPLACE_ME#_category`
  14. --
  15. DROP TABLE IF EXISTS `#REPLACE_ME#_category`;
  16. CREATE TABLE `#REPLACE_ME#_category` (
  17. `id` int NOT NULL,
  18. `name` varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL
  19. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=COMPACT;
  20. -- --------------------------------------------------------
  21. --
  22. -- Table structure for table `#REPLACE_ME#_categoryrelation`
  23. --
  24. DROP TABLE IF EXISTS `#REPLACE_ME#_categoryrelation`;
  25. CREATE TABLE `#REPLACE_ME#_categoryrelation` (
  26. `linkid` int NOT NULL,
  27. `categoryid` int NOT NULL
  28. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=COMPACT;
  29. -- --------------------------------------------------------
  30. --
  31. -- Stand-in structure for view `#REPLACE_ME#_combined`
  32. -- (See below for the actual view)
  33. --
  34. DROP VIEW IF EXISTS `#REPLACE_ME#_combined`;
  35. CREATE TABLE `#REPLACE_ME#_combined` (
  36. `category` varchar(128)
  37. ,`categoryId` int
  38. ,`created` datetime
  39. ,`description` varchar(255)
  40. ,`hash` char(32)
  41. ,`id` int
  42. ,`image` varchar(255)
  43. ,`link` mediumtext
  44. ,`status` int
  45. ,`tag` varchar(64)
  46. ,`tagId` int
  47. ,`title` varchar(255)
  48. );
  49. -- --------------------------------------------------------
  50. --
  51. -- Table structure for table `#REPLACE_ME#_link`
  52. --
  53. DROP TABLE IF EXISTS `#REPLACE_ME#_link`;
  54. CREATE TABLE `#REPLACE_ME#_link` (
  55. `id` int NOT NULL,
  56. `link` mediumtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
  57. `created` datetime NOT NULL,
  58. `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  59. `status` int NOT NULL,
  60. `description` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  61. `title` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  62. `image` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  63. `hash` char(32) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  64. `search` text COLLATE utf8mb4_unicode_520_ci NOT NULL
  65. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=COMPACT;
  66. -- --------------------------------------------------------
  67. --
  68. -- Table structure for table `#REPLACE_ME#_tag`
  69. --
  70. DROP TABLE IF EXISTS `#REPLACE_ME#_tag`;
  71. CREATE TABLE `#REPLACE_ME#_tag` (
  72. `id` int NOT NULL,
  73. `name` varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL
  74. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=COMPACT;
  75. -- --------------------------------------------------------
  76. --
  77. -- Table structure for table `#REPLACE_ME#_tagrelation`
  78. --
  79. DROP TABLE IF EXISTS `#REPLACE_ME#_tagrelation`;
  80. CREATE TABLE `#REPLACE_ME#_tagrelation` (
  81. `linkid` int NOT NULL,
  82. `tagid` int NOT NULL
  83. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=COMPACT;
  84. -- --------------------------------------------------------
  85. --
  86. -- Structure for view `#REPLACE_ME#_combined`
  87. --
  88. DROP TABLE IF EXISTS `#REPLACE_ME#_combined`;
  89. CREATE VIEW `#REPLACE_ME#_combined` AS
  90. select `#REPLACE_ME#_link`.`id` AS `id`,
  91. `#REPLACE_ME#_link`.`link` AS `link`,
  92. `#REPLACE_ME#_link`.`created` AS `created`,
  93. `#REPLACE_ME#_link`.`status` AS `status`,
  94. `#REPLACE_ME#_link`.`description` AS `description`,
  95. `#REPLACE_ME#_link`.`title` AS `title`,
  96. `#REPLACE_ME#_link`.`image` AS `image`,
  97. `#REPLACE_ME#_link`.`hash` AS `hash`,
  98. `#REPLACE_ME#_tag`.`name` AS `tag`,
  99. `#REPLACE_ME#_tag`.`id` AS `tagId`,
  100. `#REPLACE_ME#_category`.`name` AS `category`,
  101. `#REPLACE_ME#_category`.`id` AS `categoryId`
  102. from ((((`#REPLACE_ME#_link`
  103. left join `#REPLACE_ME#_tagrelation` on((`#REPLACE_ME#_tagrelation`.`linkid` = `#REPLACE_ME#_link`.`id`)))
  104. left join `#REPLACE_ME#_tag` on((`#REPLACE_ME#_tag`.`id` = `#REPLACE_ME#_tagrelation`.`tagid`)))
  105. left join `#REPLACE_ME#_categoryrelation` on((`#REPLACE_ME#_categoryrelation`.`linkid` = `#REPLACE_ME#_link`.`id`)))
  106. left join `#REPLACE_ME#_category` on((`#REPLACE_ME#_category`.`id` = `#REPLACE_ME#_categoryrelation`.`categoryid`))) ;
  107. --
  108. -- Indexes for dumped tables
  109. --
  110. --
  111. -- Indexes for table `#REPLACE_ME#_category`
  112. --
  113. ALTER TABLE `#REPLACE_ME#_category`
  114. ADD PRIMARY KEY (`id`),
  115. ADD KEY `name` (`name`);
  116. --
  117. -- Indexes for table `#REPLACE_ME#_categoryrelation`
  118. --
  119. ALTER TABLE `#REPLACE_ME#_categoryrelation`
  120. ADD UNIQUE KEY `linkid` (`linkid`,`categoryid`),
  121. ADD KEY `categoryid` (`categoryid`);
  122. --
  123. -- Indexes for table `#REPLACE_ME#_link`
  124. --
  125. ALTER TABLE `#REPLACE_ME#_link`
  126. ADD PRIMARY KEY (`id`),
  127. ADD UNIQUE KEY `hash` (`hash`),
  128. ADD KEY `status` (`status`),
  129. ADD KEY `created` (`created`);
  130. ALTER TABLE `#REPLACE_ME#_link` ADD FULLTEXT KEY `search` (`search`);
  131. --
  132. -- Indexes for table `#REPLACE_ME#_tag`
  133. --
  134. ALTER TABLE `#REPLACE_ME#_tag`
  135. ADD PRIMARY KEY (`id`);
  136. --
  137. -- Indexes for table `#REPLACE_ME#_tagrelation`
  138. --
  139. ALTER TABLE `#REPLACE_ME#_tagrelation`
  140. ADD UNIQUE KEY `tagid` (`linkid`,`tagid`),
  141. ADD KEY `linkid` (`linkid`);
  142. --
  143. -- AUTO_INCREMENT for dumped tables
  144. --
  145. --
  146. -- AUTO_INCREMENT for table `#REPLACE_ME#_category`
  147. --
  148. ALTER TABLE `#REPLACE_ME#_category`
  149. MODIFY `id` int NOT NULL AUTO_INCREMENT;
  150. --
  151. -- AUTO_INCREMENT for table `#REPLACE_ME#_link`
  152. --
  153. ALTER TABLE `#REPLACE_ME#_link`
  154. MODIFY `id` int NOT NULL AUTO_INCREMENT;
  155. --
  156. -- AUTO_INCREMENT for table `#REPLACE_ME#_tag`
  157. --
  158. ALTER TABLE `#REPLACE_ME#_tag`
  159. MODIFY `id` int NOT NULL AUTO_INCREMENT;
  160. COMMIT;
  161. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  162. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  163. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;