mysql_db.sql 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. -- phpMyAdmin SQL Dump
  2. -- version 3.4.10.1deb1
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Host: localhost
  6. -- Generation Time: Jan 18, 2014 at 05:17 PM
  7. -- Server version: 5.5.34
  8. -- PHP Version: 5.3.10-1ubuntu3.9
  9. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  10. SET time_zone = "+00:00";
  11. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  12. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  13. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  14. /*!40101 SET NAMES utf8 */;
  15. --
  16. -- User: `doxen`
  17. --
  18. CREATE USER `doxen`@`localhost` IDENTIFIED BY 'doxenpassword';
  19. -- --------------------------------------------------------
  20. --
  21. -- Database: `doxen`
  22. --
  23. DROP DATABASE IF EXISTS `doxen`;
  24. CREATE DATABASE `doxen` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
  25. USE `doxen`;
  26. -- --------------------------------------------------------
  27. --
  28. -- Table structure for table `comments`
  29. --
  30. CREATE TABLE IF NOT EXISTS `comments` (
  31. `comment_id` int(11) NOT NULL AUTO_INCREMENT,
  32. `content` text NOT NULL,
  33. `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  34. `url_name` varchar(256) NOT NULL,
  35. `is_edited` tinyint(1) NOT NULL DEFAULT '0',
  36. PRIMARY KEY (`comment_id`)
  37. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  38. -- --------------------------------------------------------
  39. --
  40. -- Table structure for table `comment_comment_associations`
  41. --
  42. CREATE TABLE IF NOT EXISTS `comment_comment_associations` (
  43. `comment_id` int(11) NOT NULL,
  44. `parent_comment_id` int(11) NOT NULL,
  45. UNIQUE KEY `comment_id` (`comment_id`,`parent_comment_id`)
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  47. -- --------------------------------------------------------
  48. --
  49. -- Table structure for table `comment_file_associations`
  50. --
  51. CREATE TABLE IF NOT EXISTS `comment_file_associations` (
  52. `comment_id` int(11) NOT NULL,
  53. `file_id` int(11) NOT NULL,
  54. UNIQUE KEY `comment_id` (`comment_id`,`file_id`)
  55. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  56. -- --------------------------------------------------------
  57. --
  58. -- Table structure for table `comment_post_associations`
  59. --
  60. CREATE TABLE IF NOT EXISTS `comment_post_associations` (
  61. `comment_id` int(11) NOT NULL,
  62. `post_id` int(11) NOT NULL,
  63. UNIQUE KEY `comment_id` (`comment_id`,`post_id`)
  64. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  65. -- --------------------------------------------------------
  66. --
  67. -- Table structure for table `comment_user_associations`
  68. --
  69. CREATE TABLE IF NOT EXISTS `comment_user_associations` (
  70. `comment_id` int(11) NOT NULL,
  71. `user_id` int(11) NOT NULL,
  72. UNIQUE KEY `comment_id` (`comment_id`,`user_id`)
  73. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  74. -- --------------------------------------------------------
  75. --
  76. -- Table structure for table `default_topics`
  77. --
  78. CREATE TABLE IF NOT EXISTS `default_topics` (
  79. `topic_id` int(11) NOT NULL,
  80. `sort_order` int(3) NOT NULL,
  81. UNIQUE KEY `UNIQUE` (`topic_id`)
  82. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  83. -- --------------------------------------------------------
  84. --
  85. -- Table structure for table `files`
  86. --
  87. CREATE TABLE IF NOT EXISTS `files` (
  88. `file_id` int(11) NOT NULL AUTO_INCREMENT,
  89. `file_hash` varchar(255) NOT NULL,
  90. `name` varchar(255) NOT NULL,
  91. `size` int(11) NOT NULL,
  92. `type` varchar(255) NOT NULL,
  93. PRIMARY KEY (`file_id`)
  94. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  95. -- --------------------------------------------------------
  96. --
  97. -- Table structure for table `posts`
  98. --
  99. CREATE TABLE IF NOT EXISTS `posts` (
  100. `post_id` int(11) NOT NULL AUTO_INCREMENT,
  101. `poster_user_id` int(11) NOT NULL,
  102. `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  103. `name` varchar(256) NOT NULL,
  104. `url_name` varchar(256) NOT NULL,
  105. `content` text NOT NULL,
  106. PRIMARY KEY (`post_id`)
  107. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  108. -- --------------------------------------------------------
  109. --
  110. -- Table structure for table `post_file_associations`
  111. --
  112. CREATE TABLE IF NOT EXISTS `post_file_associations` (
  113. `post_id` int(11) NOT NULL,
  114. `file_id` int(11) NOT NULL,
  115. UNIQUE KEY `post_id` (`post_id`,`file_id`)
  116. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  117. -- --------------------------------------------------------
  118. --
  119. -- Table structure for table `post_last_updated`
  120. --
  121. CREATE TABLE IF NOT EXISTS `post_last_updated` (
  122. `post_id` int(11) NOT NULL,
  123. `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  124. UNIQUE KEY `post_id` (`post_id`)
  125. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  126. -- --------------------------------------------------------
  127. --
  128. -- Table structure for table `post_tags`
  129. --
  130. CREATE TABLE IF NOT EXISTS `post_tags` (
  131. `post_id` int(11) NOT NULL,
  132. `tag_id` int(11) NOT NULL,
  133. UNIQUE KEY `post_id` (`post_id`,`tag_id`)
  134. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  135. -- --------------------------------------------------------
  136. --
  137. -- Table structure for table `post_topic_associations`
  138. --
  139. CREATE TABLE IF NOT EXISTS `post_topic_associations` (
  140. `post_id` int(11) NOT NULL,
  141. `topic_id` int(11) NOT NULL,
  142. UNIQUE KEY `post_id` (`post_id`,`topic_id`)
  143. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  144. -- --------------------------------------------------------
  145. --
  146. -- Table structure for table `ranks`
  147. --
  148. CREATE TABLE IF NOT EXISTS `ranks` (
  149. `rank_id` int(11) NOT NULL AUTO_INCREMENT,
  150. `name` varchar(255) NOT NULL,
  151. PRIMARY KEY (`rank_id`)
  152. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  153. --
  154. -- Dumping data for table `ranks`
  155. --
  156. INSERT INTO `ranks` (`rank_id`, `name`) VALUES
  157. (1, 'Administrator'),
  158. (2, 'Owner'),
  159. (3, 'Moderator');
  160. -- --------------------------------------------------------
  161. --
  162. -- Table structure for table `topics`
  163. --
  164. CREATE TABLE IF NOT EXISTS `topics` (
  165. `topic_id` int(11) NOT NULL AUTO_INCREMENT,
  166. `display_name` varchar(64) NOT NULL,
  167. `url_name` varchar(64) NOT NULL,
  168. `description` text NOT NULL,
  169. `sidebar` text NOT NULL,
  170. PRIMARY KEY (`topic_id`)
  171. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  172. -- --------------------------------------------------------
  173. --
  174. -- Table structure for table `topic_topic_associations`
  175. --
  176. CREATE TABLE IF NOT EXISTS `topic_topic_associations` (
  177. `topic_id` int(11) NOT NULL,
  178. `subtopic_id` int(11) NOT NULL,
  179. UNIQUE KEY `topic_id` (`topic_id`,`subtopic_id`)
  180. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  181. -- --------------------------------------------------------
  182. --
  183. -- Table structure for table `users`
  184. --
  185. CREATE TABLE IF NOT EXISTS `users` (
  186. `user_id` int(11) NOT NULL AUTO_INCREMENT,
  187. `email` varchar(255) NOT NULL,
  188. `username` varchar(256) NOT NULL,
  189. `display_name` varchar(256) NOT NULL,
  190. PRIMARY KEY (`user_id`),
  191. UNIQUE KEY `email` (`email`),
  192. UNIQUE KEY `username` (`username`)
  193. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  194. --
  195. -- Dumping data for table `users`
  196. --
  197. INSERT INTO `users` (`user_id`, `email`, `username`, `display_name`) VALUES
  198. (1, 'admin@localhost', 'admin', 'Administrator');
  199. -- --------------------------------------------------------
  200. --
  201. -- Table structure for table `users_auth`
  202. --
  203. CREATE TABLE IF NOT EXISTS `users_auth` (
  204. `user_id` int(11) NOT NULL,
  205. `passwordhash` varchar(255) NOT NULL,
  206. PRIMARY KEY (`user_id`)
  207. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  208. --
  209. -- Dumping data for table `users_auth`
  210. --
  211. INSERT INTO `users_auth` (`user_id`, `passwordhash`) VALUES
  212. (1, 'd033e22ae348aeb5660fc2140aec35850c4da997');
  213. -- --------------------------------------------------------
  214. --
  215. -- Table structure for table `user_file_associations`
  216. --
  217. CREATE TABLE IF NOT EXISTS `user_file_associations` (
  218. `user_id` int(11) NOT NULL,
  219. `file_id` int(11) NOT NULL,
  220. UNIQUE KEY `user_id` (`user_id`,`file_id`)
  221. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  222. -- --------------------------------------------------------
  223. --
  224. -- Table structure for table `user_post_viewed`
  225. --
  226. CREATE TABLE IF NOT EXISTS `user_post_viewed` (
  227. `user_id` int(11) NOT NULL,
  228. `post_id` int(11) NOT NULL,
  229. `last_viewed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  230. UNIQUE KEY `user_id` (`user_id`,`post_id`)
  231. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  232. -- --------------------------------------------------------
  233. --
  234. -- Table structure for table `user_tags`
  235. --
  236. CREATE TABLE IF NOT EXISTS `user_tags` (
  237. `tag_id` int(11) NOT NULL AUTO_INCREMENT,
  238. `user_id` int(11) NOT NULL,
  239. `is_seen` tinyint(1) NOT NULL,
  240. `tagged_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  241. PRIMARY KEY (`tag_id`)
  242. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  243. -- --------------------------------------------------------
  244. --
  245. -- Table structure for table `user_topic_acl`
  246. --
  247. CREATE TABLE IF NOT EXISTS `user_topic_acl` (
  248. `user_id` int(11) NOT NULL,
  249. `topic_id` int(11) NOT NULL,
  250. `rank_id` int(11) NOT NULL,
  251. UNIQUE KEY `user_id` (`user_id`,`topic_id`)
  252. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  253. -- --------------------------------------------------------
  254. --
  255. -- Table structure for table `user_topic_subscription`
  256. --
  257. CREATE TABLE IF NOT EXISTS `user_topic_subscription` (
  258. `user_id` int(11) NOT NULL,
  259. `topic_id` int(11) NOT NULL,
  260. UNIQUE KEY `user_id` (`user_id`,`topic_id`)
  261. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  262. -- --------------------------------------------------------
  263. --
  264. -- User permissions: `doxen`
  265. --
  266. GRANT INSERT ON `doxen`.* TO `doxen`@`localhost`;
  267. GRANT SELECT ON `doxen`.* TO `doxen`@`localhost`;
  268. GRANT UPDATE ON `doxen`.* TO `doxen`@`localhost`;
  269. GRANT DELETE ON `doxen`.`user_topic_subscription` TO 'doxen'@'localhost';
  270. FLUSH PRIVILEGES;
  271. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  272. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  273. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;