A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

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