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

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