A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

204 rader
5.8 KiB

  1. --
  2. -- Database: `writefreely`
  3. --
  4. -- --------------------------------------------------------
  5. --
  6. -- Table structure for table `accesstokens`
  7. --
  8. CREATE TABLE IF NOT EXISTS `accesstokens` (
  9. `token` binary(16) NOT NULL,
  10. `user_id` int(6) NOT NULL,
  11. `sudo` tinyint(1) NOT NULL DEFAULT '0',
  12. `one_time` tinyint(1) NOT NULL DEFAULT '0',
  13. `created` datetime NOT NULL,
  14. `expires` datetime DEFAULT NULL,
  15. `user_agent` varchar(255) NOT NULL,
  16. PRIMARY KEY (`token`)
  17. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  18. -- --------------------------------------------------------
  19. --
  20. -- Table structure for table `appcontent`
  21. --
  22. CREATE TABLE IF NOT EXISTS `appcontent` (
  23. `id` varchar(36) NOT NULL,
  24. `content` mediumtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  25. `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  26. PRIMARY KEY (`id`)
  27. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  28. -- --------------------------------------------------------
  29. --
  30. -- Table structure for table `collectionattributes`
  31. --
  32. CREATE TABLE IF NOT EXISTS `collectionattributes` (
  33. `collection_id` int(6) NOT NULL,
  34. `attribute` varchar(128) NOT NULL,
  35. `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  36. PRIMARY KEY (`collection_id`,`attribute`)
  37. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  38. -- --------------------------------------------------------
  39. --
  40. -- Table structure for table `collectionkeys`
  41. --
  42. CREATE TABLE IF NOT EXISTS `collectionkeys` (
  43. `collection_id` int(6) NOT NULL,
  44. `public_key` blob NOT NULL,
  45. `private_key` blob NOT NULL,
  46. PRIMARY KEY (`collection_id`)
  47. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  48. -- --------------------------------------------------------
  49. --
  50. -- Table structure for table `collectionpasswords`
  51. --
  52. CREATE TABLE IF NOT EXISTS `collectionpasswords` (
  53. `collection_id` int(6) NOT NULL,
  54. `password` char(60) NOT NULL,
  55. PRIMARY KEY (`collection_id`)
  56. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  57. -- --------------------------------------------------------
  58. --
  59. -- Table structure for table `collectionredirects`
  60. --
  61. CREATE TABLE IF NOT EXISTS `collectionredirects` (
  62. `prev_alias` varchar(100) NOT NULL,
  63. `new_alias` varchar(100) NOT NULL,
  64. PRIMARY KEY (`prev_alias`)
  65. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  66. -- --------------------------------------------------------
  67. --
  68. -- Table structure for table `collections`
  69. --
  70. CREATE TABLE IF NOT EXISTS `collections` (
  71. `id` int(6) NOT NULL AUTO_INCREMENT,
  72. `alias` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  73. `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  74. `description` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  75. `style_sheet` text,
  76. `script` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
  77. `format` varchar(8) DEFAULT NULL,
  78. `privacy` tinyint(1) NOT NULL,
  79. `owner_id` int(6) NOT NULL,
  80. `view_count` int(6) NOT NULL,
  81. PRIMARY KEY (`id`),
  82. UNIQUE KEY `alias` (`alias`)
  83. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  84. -- --------------------------------------------------------
  85. --
  86. -- Table structure for table `posts`
  87. --
  88. CREATE TABLE IF NOT EXISTS `posts` (
  89. `id` char(16) NOT NULL,
  90. `slug` varchar(100) DEFAULT NULL,
  91. `modify_token` char(32) DEFAULT NULL,
  92. `text_appearance` char(4) NOT NULL DEFAULT 'norm',
  93. `language` char(2) DEFAULT NULL,
  94. `rtl` tinyint(1) DEFAULT NULL,
  95. `privacy` tinyint(1) NOT NULL,
  96. `owner_id` int(6) DEFAULT NULL,
  97. `collection_id` int(6) DEFAULT NULL,
  98. `pinned_position` tinyint(1) UNSIGNED DEFAULT NULL,
  99. `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  100. `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  101. `view_count` int(6) NOT NULL,
  102. `title` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  103. `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  104. PRIMARY KEY (`id`),
  105. UNIQUE KEY `id_slug` (`collection_id`,`slug`),
  106. UNIQUE KEY `owner_id` (`owner_id`,`id`),
  107. KEY `privacy_id` (`privacy`,`id`)
  108. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  109. -- --------------------------------------------------------
  110. --
  111. -- Table structure for table `remotefollows`
  112. --
  113. CREATE TABLE IF NOT EXISTS `remotefollows` (
  114. `collection_id` int(11) NOT NULL,
  115. `remote_user_id` int(11) NOT NULL,
  116. `created` datetime NOT NULL,
  117. PRIMARY KEY (`collection_id`,`remote_user_id`)
  118. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  119. -- --------------------------------------------------------
  120. --
  121. -- Table structure for table `remoteuserkeys`
  122. --
  123. CREATE TABLE IF NOT EXISTS `remoteuserkeys` (
  124. `id` varchar(255) NOT NULL,
  125. `remote_user_id` int(11) NOT NULL,
  126. `public_key` blob NOT NULL,
  127. PRIMARY KEY (`id`),
  128. UNIQUE KEY `follower_id` (`remote_user_id`)
  129. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  130. -- --------------------------------------------------------
  131. --
  132. -- Table structure for table `remoteusers`
  133. --
  134. CREATE TABLE IF NOT EXISTS `remoteusers` (
  135. `id` int(11) NOT NULL AUTO_INCREMENT,
  136. `actor_id` varchar(255) NOT NULL,
  137. `inbox` varchar(255) NOT NULL,
  138. `shared_inbox` varchar(255) NOT NULL,
  139. PRIMARY KEY (`id`),
  140. UNIQUE KEY `collection_id` (`actor_id`)
  141. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  142. -- --------------------------------------------------------
  143. --
  144. -- Table structure for table `userattributes`
  145. --
  146. CREATE TABLE IF NOT EXISTS `userattributes` (
  147. `user_id` int(6) NOT NULL,
  148. `attribute` varchar(64) NOT NULL,
  149. `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  150. PRIMARY KEY (`user_id`,`attribute`)
  151. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  152. -- --------------------------------------------------------
  153. --
  154. -- Table structure for table `users`
  155. --
  156. CREATE TABLE IF NOT EXISTS `users` (
  157. `id` int(6) NOT NULL AUTO_INCREMENT,
  158. `username` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  159. `password` char(60) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  160. `email` varbinary(255) DEFAULT NULL,
  161. `created` datetime NOT NULL,
  162. PRIMARY KEY (`id`),
  163. UNIQUE KEY `username` (`username`)
  164. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;