ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

255 lines
12 KiB

  1. # This file is auto-generated from the current state of the database. Instead
  2. # of editing this file, please use the migrations feature of Active Record to
  3. # incrementally modify your database, and then regenerate this schema definition.
  4. #
  5. # This file is the source Rails uses to define your schema when running `bin/rails
  6. # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
  7. # be faster and is potentially less error prone than running all of your
  8. # migrations from scratch. Old migrations may fail to apply correctly if those
  9. # migrations use external dependencies or application code.
  10. #
  11. # It's strongly recommended that you check this file into your version control system.
  12. ActiveRecord::Schema[8.0].define(version: 2026_01_21_024800) do
  13. create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  14. t.string "name", null: false
  15. t.string "record_type", null: false
  16. t.bigint "record_id", null: false
  17. t.bigint "blob_id", null: false
  18. t.datetime "created_at", null: false
  19. t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
  20. t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
  21. end
  22. create_table "active_storage_blobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  23. t.string "key", null: false
  24. t.string "filename", null: false
  25. t.string "content_type"
  26. t.text "metadata"
  27. t.string "service_name", null: false
  28. t.bigint "byte_size", null: false
  29. t.string "checksum"
  30. t.datetime "created_at", null: false
  31. t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
  32. end
  33. create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  34. t.bigint "blob_id", null: false
  35. t.string "variation_digest", null: false
  36. t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
  37. end
  38. create_table "ip_addresses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  39. t.binary "ip_address", limit: 16, null: false
  40. t.boolean "banned", default: false, null: false
  41. t.datetime "created_at", null: false
  42. t.datetime "updated_at", null: false
  43. end
  44. create_table "nico_tag_relations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  45. t.bigint "nico_tag_id", null: false
  46. t.bigint "tag_id", null: false
  47. t.datetime "created_at", null: false
  48. t.datetime "updated_at", null: false
  49. t.index ["nico_tag_id"], name: "index_nico_tag_relations_on_nico_tag_id"
  50. t.index ["tag_id"], name: "index_nico_tag_relations_on_tag_id"
  51. end
  52. create_table "post_similarities", primary_key: ["post_id", "target_post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  53. t.bigint "post_id", null: false
  54. t.bigint "target_post_id", null: false
  55. t.float "cos", null: false
  56. t.index ["post_id"], name: "index_post_similarities_on_post_id"
  57. t.index ["target_post_id"], name: "index_post_similarities_on_target_post_id"
  58. end
  59. create_table "post_tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  60. t.bigint "post_id", null: false
  61. t.bigint "tag_id", null: false
  62. t.bigint "created_user_id"
  63. t.bigint "deleted_user_id"
  64. t.datetime "created_at", null: false
  65. t.datetime "updated_at", null: false
  66. t.datetime "discarded_at"
  67. t.virtual "is_active", type: :boolean, as: "(`discarded_at` is null)", stored: true
  68. t.virtual "active_unique_key", type: :string, as: "(case when (`discarded_at` is null) then concat(`post_id`,_utf8mb4':',`tag_id`) else NULL end)", stored: true
  69. t.index ["active_unique_key"], name: "idx_post_tags_active_unique", unique: true
  70. t.index ["created_user_id"], name: "index_post_tags_on_created_user_id"
  71. t.index ["deleted_user_id"], name: "index_post_tags_on_deleted_user_id"
  72. t.index ["discarded_at"], name: "index_post_tags_on_discarded_at"
  73. t.index ["post_id", "discarded_at"], name: "index_post_tags_on_post_id_and_discarded_at"
  74. t.index ["post_id"], name: "index_post_tags_on_post_id"
  75. t.index ["tag_id", "discarded_at"], name: "index_post_tags_on_tag_id_and_discarded_at"
  76. t.index ["tag_id"], name: "index_post_tags_on_tag_id"
  77. end
  78. create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  79. t.string "title"
  80. t.string "url", limit: 768, null: false
  81. t.string "thumbnail_base", limit: 2000
  82. t.bigint "parent_id"
  83. t.bigint "uploaded_user_id"
  84. t.datetime "created_at", null: false
  85. t.datetime "original_created_from"
  86. t.datetime "original_created_before"
  87. t.datetime "updated_at", null: false
  88. t.index ["parent_id"], name: "index_posts_on_parent_id"
  89. t.index ["uploaded_user_id"], name: "index_posts_on_uploaded_user_id"
  90. t.index ["url"], name: "index_posts_on_url", unique: true
  91. end
  92. create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  93. t.bigint "user_id", null: false
  94. t.string "key", null: false
  95. t.json "value", null: false
  96. t.datetime "created_at", null: false
  97. t.datetime "updated_at", null: false
  98. t.index ["user_id"], name: "index_settings_on_user_id"
  99. end
  100. create_table "tag_implications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  101. t.bigint "tag_id", null: false
  102. t.bigint "parent_tag_id", null: false
  103. t.datetime "created_at", null: false
  104. t.datetime "updated_at", null: false
  105. t.index ["parent_tag_id"], name: "index_tag_implications_on_parent_tag_id"
  106. t.index ["tag_id", "parent_tag_id"], name: "index_tag_implications_on_tag_id_and_parent_tag_id", unique: true
  107. t.index ["tag_id"], name: "index_tag_implications_on_tag_id"
  108. end
  109. create_table "tag_names", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  110. t.string "name", null: false
  111. t.bigint "canonical_id"
  112. t.datetime "created_at", null: false
  113. t.datetime "updated_at", null: false
  114. t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
  115. t.index ["name"], name: "index_tag_names_on_name", unique: true
  116. end
  117. create_table "tag_similarities", primary_key: ["tag_id", "target_tag_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  118. t.bigint "tag_id", null: false
  119. t.bigint "target_tag_id", null: false
  120. t.float "cos", null: false
  121. t.index ["tag_id"], name: "index_tag_similarities_on_tag_id"
  122. t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
  123. end
  124. create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  125. t.bigint "tag_name_id", null: false
  126. t.string "category", default: "general", null: false
  127. t.datetime "created_at", null: false
  128. t.datetime "updated_at", null: false
  129. t.integer "post_count", default: 0, null: false
  130. t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
  131. end
  132. create_table "user_ips", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  133. t.bigint "user_id", null: false
  134. t.bigint "ip_address_id", null: false
  135. t.datetime "created_at", null: false
  136. t.datetime "updated_at", null: false
  137. t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
  138. t.index ["user_id"], name: "index_user_ips_on_user_id"
  139. end
  140. create_table "user_post_views", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  141. t.bigint "user_id", null: false
  142. t.bigint "post_id", null: false
  143. t.datetime "created_at", null: false
  144. t.datetime "updated_at", null: false
  145. t.index ["post_id"], name: "index_user_post_views_on_post_id"
  146. t.index ["user_id"], name: "index_user_post_views_on_user_id"
  147. end
  148. create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  149. t.string "name"
  150. t.string "inheritance_code", limit: 64, null: false
  151. t.string "role", null: false
  152. t.boolean "banned", default: false, null: false
  153. t.datetime "created_at", null: false
  154. t.datetime "updated_at", null: false
  155. end
  156. create_table "wiki_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  157. t.string "sha256", limit: 64, null: false
  158. t.text "body", null: false
  159. t.datetime "created_at", null: false
  160. t.datetime "updated_at", null: false
  161. t.index ["sha256"], name: "index_wiki_lines_on_sha256", unique: true
  162. end
  163. create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  164. t.bigint "tag_name_id", null: false
  165. t.bigint "created_user_id", null: false
  166. t.bigint "updated_user_id", null: false
  167. t.datetime "created_at", null: false
  168. t.datetime "updated_at", null: false
  169. t.index ["created_user_id"], name: "index_wiki_pages_on_created_user_id"
  170. t.index ["tag_name_id"], name: "index_wiki_pages_on_tag_name_id", unique: true
  171. t.index ["updated_user_id"], name: "index_wiki_pages_on_updated_user_id"
  172. end
  173. create_table "wiki_revision_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  174. t.bigint "wiki_revision_id", null: false
  175. t.integer "position", null: false
  176. t.bigint "wiki_line_id", null: false
  177. t.index ["wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_line_id"
  178. t.index ["wiki_revision_id", "position"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_position", unique: true
  179. t.index ["wiki_revision_id", "wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_wiki_line_id"
  180. t.index ["wiki_revision_id"], name: "index_wiki_revision_lines_on_wiki_revision_id"
  181. end
  182. create_table "wiki_revisions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  183. t.bigint "wiki_page_id", null: false
  184. t.bigint "base_revision_id"
  185. t.bigint "created_user_id", null: false
  186. t.integer "kind", default: 0, null: false
  187. t.bigint "redirect_page_id"
  188. t.string "message"
  189. t.integer "lines_count", default: 0, null: false
  190. t.string "tree_sha256", limit: 64
  191. t.datetime "created_at", null: false
  192. t.datetime "updated_at", null: false
  193. t.index ["base_revision_id"], name: "index_wiki_revisions_on_base_revision_id"
  194. t.index ["created_user_id"], name: "index_wiki_revisions_on_created_user_id"
  195. t.index ["kind"], name: "index_wiki_revisions_on_kind"
  196. t.index ["redirect_page_id"], name: "index_wiki_revisions_on_redirect_page_id"
  197. t.index ["tree_sha256"], name: "index_wiki_revisions_on_tree_sha256"
  198. t.index ["wiki_page_id", "id"], name: "index_wiki_revisions_on_wiki_page_id_and_id"
  199. t.index ["wiki_page_id"], name: "index_wiki_revisions_on_wiki_page_id"
  200. end
  201. add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  202. add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
  203. add_foreign_key "nico_tag_relations", "tags"
  204. add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
  205. add_foreign_key "post_similarities", "posts"
  206. add_foreign_key "post_similarities", "posts", column: "target_post_id"
  207. add_foreign_key "post_tags", "posts"
  208. add_foreign_key "post_tags", "tags"
  209. add_foreign_key "post_tags", "users", column: "created_user_id"
  210. add_foreign_key "post_tags", "users", column: "deleted_user_id"
  211. add_foreign_key "posts", "posts", column: "parent_id"
  212. add_foreign_key "posts", "users", column: "uploaded_user_id"
  213. add_foreign_key "settings", "users"
  214. add_foreign_key "tag_implications", "tags"
  215. add_foreign_key "tag_implications", "tags", column: "parent_tag_id"
  216. add_foreign_key "tag_names", "tag_names", column: "canonical_id"
  217. add_foreign_key "tag_similarities", "tags"
  218. add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
  219. add_foreign_key "tags", "tag_names"
  220. add_foreign_key "user_ips", "ip_addresses"
  221. add_foreign_key "user_ips", "users"
  222. add_foreign_key "user_post_views", "posts"
  223. add_foreign_key "user_post_views", "users"
  224. add_foreign_key "wiki_pages", "tag_names"
  225. add_foreign_key "wiki_pages", "users", column: "created_user_id"
  226. add_foreign_key "wiki_pages", "users", column: "updated_user_id"
  227. add_foreign_key "wiki_revision_lines", "wiki_lines"
  228. add_foreign_key "wiki_revision_lines", "wiki_revisions"
  229. add_foreign_key "wiki_revisions", "users", column: "created_user_id"
  230. add_foreign_key "wiki_revisions", "wiki_pages"
  231. add_foreign_key "wiki_revisions", "wiki_pages", column: "redirect_page_id"
  232. add_foreign_key "wiki_revisions", "wiki_revisions", column: "base_revision_id"
  233. end