Advertisement
nBiker77

Tablas de la base de datos para el BLOG

Mar 28th, 2024 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.81 KB | None | 0 0
  1. ::posts::
  2. +----+-----------+--------------+------------+
  3. | | field | type | specs |
  4. +----+-----------+--------------+------------+
  5. | |id | INT(11) | |
  6. | |user_id | INT(11) | |
  7. | |title | VARCHAR(255) | |
  8. | |slug | VARCHAR(255) | UNIQUE |
  9. | |views | INT(11) | DEFAULT 0 |
  10. | |image | VARCHAR(255) | | -> LONBLOB
  11. | |body | TEXT | |
  12. | |published | boolean | |
  13. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  14. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  15. +----+-----------+--------------+------------+
  16.  
  17. ::users::
  18. +----+-----------+--------------+------------+
  19. | | field | type | specs |
  20. +----+-----------+--------------+------------+
  21. | |id | INT(11) | |
  22. | |username | VARCHAR(255) | UNIQUE |
  23. | |email | VARCHAR(255) | UNIQUE |
  24. | |moderator | boolean | |
  25. | |password | VARCHAR(255) | |
  26. | |avatar | LONGBLOB | |
  27. | |role | ENUM() | | ("Administrador","Author","Lector")
  28. | |active | boolean | | -> usuario activo
  29. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  30. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  31. +----+-----------+--------------+------------+
  32.  
  33. ::categories::
  34. +----+-----------+--------------+------------+
  35. | | field | type | specs |
  36. +----+-----------+--------------+------------+
  37. | |id | INT(11) | |
  38. | |name | VARCHAR(55) | UNIQUE |
  39. | |slug | VARCHAR(55) | UNIQUE |
  40. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  41. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  42. +----+-----------+--------------+------------+
  43.  
  44. ::tags::
  45. +----+-----------+--------------+------------+
  46. | | field | type | specs |
  47. +----+-----------+--------------+------------+
  48. | |id | INT(11) | |
  49. | |name | VARCHAR(55) | UNIQUE |
  50. | |slug | VARCHAR(55) | UNIQUE |
  51. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  52. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  53. +----+-----------+--------------+------------+
  54.  
  55. ::posts_tags::
  56. +----+-----------+--------------+------------+
  57. | | field | type | specs |
  58. +----+-----------+--------------+------------+
  59. | |id | INT(11) | |
  60. | |post_id | INT(11) | |
  61. | |tags_id | INT(11) | |
  62. +----+-----------+--------------+------------+
  63.  
  64. ::posts_category::
  65. +----+-----------+--------------+------------+
  66. | | field | type | specs |
  67. +----+-----------+--------------+------------+
  68. | |id | INT(11) | |
  69. | |post_id | INT(11) | |
  70. | |tag_id | INT(11) | |
  71. +----+-----------+--------------+------------+
  72.  
  73. ::comments::
  74. +----+-----------+--------------+------------+
  75. | | field | type | specs |
  76. +----+-----------+--------------+------------+
  77. | |id | INT(11) | |
  78. | |contenido | VARCHAR(255) | |
  79. | |user_id | INT(11) | |
  80. | |post_id | INT(11) | |
  81. | |status | INT(11) | | -> "Publicado", "Pendiente de aprovacion", "Eliminado"
  82. | |moderate | bolean | |
  83. | |votes_pos | INT(11) | DEFAULT 0 |
  84. | |votes_neg | INT(11) | DEFAULT 0 |
  85. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  86. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  87. | |edited_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  88. | |edited_by | INT(11) | |
  89. +----+-----------+--------------+------------+
  90.  
  91. ::replies:: -> respuestas a los comentarios
  92. +----+-----------+--------------+------------+
  93. | | field | type | specs |
  94. +----+-----------+--------------+------------+
  95. | |id | INT(11) | |
  96. | |contenido | VARCHAR(255) | |
  97. | |user_id | INT(11) | |
  98. | |comment_id | INT(11) | |
  99. | |status | INT(11) | | -> "Publicado", "Pendiente de aprovacion", "Eliminado"
  100. | |moderate | bolean | |
  101. | |votes_pos | INT(11) | |
  102. | |votes_neg | INT(11) | |
  103. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  104. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  105. | |edited_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  106. | |edited_by | INT(11) | |
  107. +----+-----------+--------------+------------+
  108.  
  109. ::posts_comments::
  110. +----+-----------+--------------+------------+
  111. | | field | type | specs |
  112. +----+-----------+--------------+------------+
  113. | |id | INT(11) | |
  114. | |post_id | INT(11) | |
  115. | |comment_id | INT(11) | |
  116. +----+-----------+--------------+------------+
  117.  
  118. ::comments_replies::
  119. +----+-----------+--------------+------------+
  120. | | field | type | specs |
  121. +----+-----------+--------------+------------+
  122. | |id | INT(11) | |
  123. | |comment_id | INT(11) | |
  124. | |replies_id | INT(11) | |
  125. +----+-----------+--------------+------------+
  126.  
  127. ::votes::
  128. +----+-----------+--------------+------------+
  129. | | field | type | specs |
  130. +----+-----------+--------------+------------+
  131. | |id | INT(11) | |
  132. | |user_id | INT(11) | |
  133. | |vote | INT(11) | | -> valor poitivo o negativo
  134. | |post_id | INT(11) | |
  135. | |comment_id | INT(11) | |
  136. | |replies_id | INT(11) | |
  137. +----+-----------+--------------+------------+
  138.  
  139. ::images::
  140. +----+--------------+--------------+------------+
  141. | | field | type | specs |
  142. +----+--------------+--------------+------------+
  143. | |id | INT(11) | |
  144. | |url | VARCHAR(255) | UNIQUE |
  145. | |imageable_id | INT(11) | UNIQUE |
  146. | |imageable_type| VARCHAR(55) | UNIQUE |
  147. | |created_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  148. | |updated_at | TIMESTAMP | | -> DEFAULT CURRENT_TIMESTAMP
  149. +----+--------------+--------------+------------+
  150.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement