ぼざクリタグ広場 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.
 
 
 
 
 
 

263 lines
13 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_03_03_122700) 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 "deerjikists", primary_key: ["platform", "code"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  39. t.string "platform", limit: 16, null: false
  40. t.string "code", null: false
  41. t.bigint "tag_id", null: false
  42. t.datetime "created_at", null: false
  43. t.datetime "updated_at", null: false
  44. t.index ["tag_id"], name: "index_deerjikists_on_tag_id"
  45. end
  46. create_table "ip_addresses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  47. t.binary "ip_address", limit: 16, null: false
  48. t.boolean "banned", default: false, null: false
  49. t.datetime "created_at", null: false
  50. t.datetime "updated_at", null: false
  51. t.index ["ip_address"], name: "index_ip_addresses_on_ip_address", unique: true
  52. end
  53. create_table "nico_tag_relations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  54. t.bigint "nico_tag_id", null: false
  55. t.bigint "tag_id", null: false
  56. t.datetime "created_at", null: false
  57. t.datetime "updated_at", null: false
  58. t.index ["nico_tag_id"], name: "index_nico_tag_relations_on_nico_tag_id"
  59. t.index ["tag_id"], name: "index_nico_tag_relations_on_tag_id"
  60. end
  61. create_table "post_similarities", primary_key: ["post_id", "target_post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  62. t.bigint "post_id", null: false
  63. t.bigint "target_post_id", null: false
  64. t.float "cos", null: false
  65. t.index ["post_id", "cos"], name: "index_post_similarities_on_post_id_and_cos", order: { cos: :desc }
  66. t.index ["target_post_id"], name: "index_post_similarities_on_target_post_id"
  67. end
  68. create_table "post_tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  69. t.bigint "post_id", null: false
  70. t.bigint "tag_id", null: false
  71. t.bigint "created_user_id"
  72. t.bigint "deleted_user_id"
  73. t.datetime "created_at", null: false
  74. t.datetime "updated_at", null: false
  75. t.datetime "discarded_at"
  76. t.virtual "is_active", type: :boolean, as: "(`discarded_at` is null)", stored: true
  77. 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
  78. t.index ["active_unique_key"], name: "idx_post_tags_active_unique", unique: true
  79. t.index ["created_user_id"], name: "index_post_tags_on_created_user_id"
  80. t.index ["deleted_user_id"], name: "index_post_tags_on_deleted_user_id"
  81. t.index ["discarded_at"], name: "index_post_tags_on_discarded_at"
  82. t.index ["post_id", "discarded_at"], name: "index_post_tags_on_post_id_and_discarded_at"
  83. t.index ["post_id"], name: "index_post_tags_on_post_id"
  84. t.index ["tag_id", "discarded_at"], name: "index_post_tags_on_tag_id_and_discarded_at"
  85. t.index ["tag_id"], name: "index_post_tags_on_tag_id"
  86. end
  87. create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  88. t.string "title"
  89. t.string "url", limit: 768, null: false
  90. t.string "thumbnail_base", limit: 2000
  91. t.bigint "parent_id"
  92. t.bigint "uploaded_user_id"
  93. t.datetime "created_at", null: false
  94. t.datetime "original_created_from"
  95. t.datetime "original_created_before"
  96. t.datetime "updated_at", null: false
  97. t.index ["parent_id"], name: "index_posts_on_parent_id"
  98. t.index ["uploaded_user_id"], name: "index_posts_on_uploaded_user_id"
  99. t.index ["url"], name: "index_posts_on_url", unique: true
  100. end
  101. create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  102. t.bigint "user_id", null: false
  103. t.string "key", null: false
  104. t.json "value", null: false
  105. t.datetime "created_at", null: false
  106. t.datetime "updated_at", null: false
  107. t.index ["user_id"], name: "index_settings_on_user_id"
  108. end
  109. create_table "tag_implications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  110. t.bigint "tag_id", null: false
  111. t.bigint "parent_tag_id", null: false
  112. t.datetime "created_at", null: false
  113. t.datetime "updated_at", null: false
  114. t.index ["parent_tag_id"], name: "index_tag_implications_on_parent_tag_id"
  115. t.index ["tag_id", "parent_tag_id"], name: "index_tag_implications_on_tag_id_and_parent_tag_id", unique: true
  116. t.index ["tag_id"], name: "index_tag_implications_on_tag_id"
  117. end
  118. create_table "tag_names", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  119. t.string "name", null: false
  120. t.bigint "canonical_id"
  121. t.datetime "created_at", null: false
  122. t.datetime "updated_at", null: false
  123. t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
  124. t.index ["name"], name: "index_tag_names_on_name", unique: true
  125. end
  126. create_table "tag_similarities", primary_key: ["tag_id", "target_tag_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  127. t.bigint "tag_id", null: false
  128. t.bigint "target_tag_id", null: false
  129. t.float "cos", null: false
  130. t.index ["tag_id", "cos"], name: "index_tag_similarities_on_tag_id_and_cos", order: { cos: :desc }
  131. t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
  132. end
  133. create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  134. t.bigint "tag_name_id", null: false
  135. t.string "category", default: "general", null: false
  136. t.datetime "created_at", null: false
  137. t.datetime "updated_at", null: false
  138. t.integer "post_count", default: 0, null: false
  139. t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
  140. end
  141. create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  142. t.bigint "user_id", null: false
  143. t.bigint "ip_address_id", null: false
  144. t.datetime "created_at", null: false
  145. t.datetime "updated_at", null: false
  146. t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
  147. end
  148. create_table "user_post_views", primary_key: ["user_id", "post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  149. t.bigint "user_id", null: false
  150. t.bigint "post_id", null: false
  151. t.datetime "created_at", null: false
  152. t.datetime "updated_at", null: false
  153. t.index ["post_id"], name: "index_user_post_views_on_post_id"
  154. end
  155. create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  156. t.string "name"
  157. t.string "inheritance_code", limit: 64, null: false
  158. t.string "role", null: false
  159. t.boolean "banned", default: false, null: false
  160. t.datetime "created_at", null: false
  161. t.datetime "updated_at", null: false
  162. end
  163. create_table "wiki_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  164. t.string "sha256", limit: 64, null: false
  165. t.text "body", null: false
  166. t.datetime "created_at", null: false
  167. t.datetime "updated_at", null: false
  168. t.index ["sha256"], name: "index_wiki_lines_on_sha256", unique: true
  169. end
  170. create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  171. t.bigint "tag_name_id", null: false
  172. t.bigint "created_user_id", null: false
  173. t.bigint "updated_user_id", null: false
  174. t.datetime "created_at", null: false
  175. t.datetime "updated_at", null: false
  176. t.index ["created_user_id"], name: "index_wiki_pages_on_created_user_id"
  177. t.index ["tag_name_id"], name: "index_wiki_pages_on_tag_name_id", unique: true
  178. t.index ["updated_user_id"], name: "index_wiki_pages_on_updated_user_id"
  179. end
  180. create_table "wiki_revision_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  181. t.bigint "wiki_revision_id", null: false
  182. t.integer "position", null: false
  183. t.bigint "wiki_line_id", null: false
  184. t.index ["wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_line_id"
  185. t.index ["wiki_revision_id", "position"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_position", unique: true
  186. t.index ["wiki_revision_id", "wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_wiki_line_id"
  187. t.index ["wiki_revision_id"], name: "index_wiki_revision_lines_on_wiki_revision_id"
  188. end
  189. create_table "wiki_revisions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  190. t.bigint "wiki_page_id", null: false
  191. t.bigint "base_revision_id"
  192. t.bigint "created_user_id", null: false
  193. t.integer "kind", default: 0, null: false
  194. t.bigint "redirect_page_id"
  195. t.string "message"
  196. t.integer "lines_count", default: 0, null: false
  197. t.string "tree_sha256", limit: 64
  198. t.datetime "created_at", null: false
  199. t.datetime "updated_at", null: false
  200. t.index ["base_revision_id"], name: "index_wiki_revisions_on_base_revision_id"
  201. t.index ["created_user_id"], name: "index_wiki_revisions_on_created_user_id"
  202. t.index ["kind"], name: "index_wiki_revisions_on_kind"
  203. t.index ["redirect_page_id"], name: "index_wiki_revisions_on_redirect_page_id"
  204. t.index ["tree_sha256"], name: "index_wiki_revisions_on_tree_sha256"
  205. t.index ["wiki_page_id", "id"], name: "index_wiki_revisions_on_wiki_page_id_and_id"
  206. t.index ["wiki_page_id"], name: "index_wiki_revisions_on_wiki_page_id"
  207. end
  208. add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  209. add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
  210. add_foreign_key "nico_tag_relations", "tags"
  211. add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
  212. add_foreign_key "post_similarities", "posts"
  213. add_foreign_key "post_similarities", "posts", column: "target_post_id"
  214. add_foreign_key "post_tags", "posts"
  215. add_foreign_key "post_tags", "tags"
  216. add_foreign_key "post_tags", "users", column: "created_user_id"
  217. add_foreign_key "post_tags", "users", column: "deleted_user_id"
  218. add_foreign_key "posts", "posts", column: "parent_id"
  219. add_foreign_key "posts", "users", column: "uploaded_user_id"
  220. add_foreign_key "settings", "users"
  221. add_foreign_key "tag_implications", "tags"
  222. add_foreign_key "tag_implications", "tags", column: "parent_tag_id"
  223. add_foreign_key "tag_names", "tag_names", column: "canonical_id"
  224. add_foreign_key "tag_similarities", "tags"
  225. add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
  226. add_foreign_key "tags", "tag_names"
  227. add_foreign_key "user_ips", "ip_addresses"
  228. add_foreign_key "user_ips", "users"
  229. add_foreign_key "user_post_views", "posts"
  230. add_foreign_key "user_post_views", "users"
  231. add_foreign_key "wiki_pages", "tag_names"
  232. add_foreign_key "wiki_pages", "users", column: "created_user_id"
  233. add_foreign_key "wiki_pages", "users", column: "updated_user_id"
  234. add_foreign_key "wiki_revision_lines", "wiki_lines"
  235. add_foreign_key "wiki_revision_lines", "wiki_revisions"
  236. add_foreign_key "wiki_revisions", "users", column: "created_user_id"
  237. add_foreign_key "wiki_revisions", "wiki_pages"
  238. add_foreign_key "wiki_revisions", "wiki_pages", column: "redirect_page_id"
  239. add_foreign_key "wiki_revisions", "wiki_revisions", column: "base_revision_id"
  240. end