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

314 lines
16 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_16_083500) 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_name_sanitisation_rules", primary_key: "priority", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  119. t.string "source_pattern", null: false
  120. t.string "replacement", null: false
  121. t.datetime "created_at", null: false
  122. t.datetime "updated_at", null: false
  123. t.datetime "discarded_at"
  124. t.index ["discarded_at"], name: "index_tag_name_sanitisation_rules_on_discarded_at"
  125. t.index ["source_pattern"], name: "index_tag_name_sanitisation_rules_on_source_pattern", unique: true
  126. end
  127. create_table "tag_names", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  128. t.string "name", null: false
  129. t.bigint "canonical_id"
  130. t.datetime "created_at", null: false
  131. t.datetime "updated_at", null: false
  132. t.datetime "discarded_at"
  133. t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
  134. t.index ["discarded_at"], name: "index_tag_names_on_discarded_at"
  135. t.index ["name"], name: "index_tag_names_on_name", unique: true
  136. end
  137. create_table "tag_similarities", primary_key: ["tag_id", "target_tag_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  138. t.bigint "tag_id", null: false
  139. t.bigint "target_tag_id", null: false
  140. t.float "cos", null: false
  141. t.index ["tag_id", "cos"], name: "index_tag_similarities_on_tag_id_and_cos", order: { cos: :desc }
  142. t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
  143. end
  144. create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  145. t.bigint "tag_name_id", null: false
  146. t.string "category", default: "general", null: false
  147. t.datetime "created_at", null: false
  148. t.datetime "updated_at", null: false
  149. t.integer "post_count", default: 0, null: false
  150. t.datetime "discarded_at"
  151. t.index ["discarded_at"], name: "index_tags_on_discarded_at"
  152. t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
  153. end
  154. create_table "theatre_comments", primary_key: ["theatre_id", "no"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  155. t.bigint "theatre_id", null: false
  156. t.integer "no", null: false
  157. t.bigint "user_id"
  158. t.text "content", null: false
  159. t.datetime "created_at", null: false
  160. t.datetime "updated_at", null: false
  161. t.datetime "discarded_at"
  162. t.index ["discarded_at"], name: "index_theatre_comments_on_discarded_at"
  163. t.index ["theatre_id"], name: "index_theatre_comments_on_theatre_id"
  164. t.index ["user_id"], name: "index_theatre_comments_on_user_id"
  165. end
  166. create_table "theatres", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  167. t.string "name"
  168. t.datetime "opens_at", null: false
  169. t.datetime "closes_at"
  170. t.bigint "current_post_id"
  171. t.datetime "current_post_started_at"
  172. t.integer "next_comment_no", default: 1, null: false
  173. t.bigint "created_by_user_id", null: false
  174. t.datetime "created_at", null: false
  175. t.datetime "updated_at", null: false
  176. t.datetime "discarded_at"
  177. t.index ["closes_at"], name: "index_theatres_on_closes_at"
  178. t.index ["created_by_user_id"], name: "index_theatres_on_created_by_user_id"
  179. t.index ["current_post_id"], name: "index_theatres_on_current_post_id"
  180. t.index ["discarded_at"], name: "index_theatres_on_discarded_at"
  181. t.index ["opens_at"], name: "index_theatres_on_opens_at"
  182. end
  183. create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  184. t.bigint "user_id", null: false
  185. t.bigint "ip_address_id", null: false
  186. t.datetime "created_at", null: false
  187. t.datetime "updated_at", null: false
  188. t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
  189. end
  190. create_table "user_post_views", primary_key: ["user_id", "post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  191. t.bigint "user_id", null: false
  192. t.bigint "post_id", null: false
  193. t.datetime "created_at", null: false
  194. t.datetime "updated_at", null: false
  195. t.index ["post_id"], name: "index_user_post_views_on_post_id"
  196. end
  197. create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  198. t.string "name"
  199. t.string "inheritance_code", limit: 64, null: false
  200. t.string "role", null: false
  201. t.boolean "banned", default: false, null: false
  202. t.datetime "created_at", null: false
  203. t.datetime "updated_at", null: false
  204. end
  205. create_table "wiki_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  206. t.string "sha256", limit: 64, null: false
  207. t.text "body", null: false
  208. t.datetime "created_at", null: false
  209. t.datetime "updated_at", null: false
  210. t.index ["sha256"], name: "index_wiki_lines_on_sha256", unique: true
  211. end
  212. create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  213. t.bigint "tag_name_id", null: false
  214. t.bigint "created_user_id", null: false
  215. t.bigint "updated_user_id", null: false
  216. t.datetime "created_at", null: false
  217. t.datetime "updated_at", null: false
  218. t.datetime "discarded_at"
  219. t.index ["created_user_id"], name: "index_wiki_pages_on_created_user_id"
  220. t.index ["discarded_at"], name: "index_wiki_pages_on_discarded_at"
  221. t.index ["tag_name_id"], name: "index_wiki_pages_on_tag_name_id", unique: true
  222. t.index ["updated_user_id"], name: "index_wiki_pages_on_updated_user_id"
  223. end
  224. create_table "wiki_revision_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  225. t.bigint "wiki_revision_id", null: false
  226. t.integer "position", null: false
  227. t.bigint "wiki_line_id", null: false
  228. t.index ["wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_line_id"
  229. t.index ["wiki_revision_id", "position"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_position", unique: true
  230. t.index ["wiki_revision_id", "wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_wiki_line_id"
  231. t.index ["wiki_revision_id"], name: "index_wiki_revision_lines_on_wiki_revision_id"
  232. end
  233. create_table "wiki_revisions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  234. t.bigint "wiki_page_id", null: false
  235. t.bigint "base_revision_id"
  236. t.bigint "created_user_id", null: false
  237. t.integer "kind", default: 0, null: false
  238. t.bigint "redirect_page_id"
  239. t.string "message"
  240. t.integer "lines_count", default: 0, null: false
  241. t.string "tree_sha256", limit: 64
  242. t.datetime "created_at", null: false
  243. t.datetime "updated_at", null: false
  244. t.index ["base_revision_id"], name: "index_wiki_revisions_on_base_revision_id"
  245. t.index ["created_user_id"], name: "index_wiki_revisions_on_created_user_id"
  246. t.index ["kind"], name: "index_wiki_revisions_on_kind"
  247. t.index ["redirect_page_id"], name: "index_wiki_revisions_on_redirect_page_id"
  248. t.index ["tree_sha256"], name: "index_wiki_revisions_on_tree_sha256"
  249. t.index ["wiki_page_id", "id"], name: "index_wiki_revisions_on_wiki_page_id_and_id"
  250. t.index ["wiki_page_id"], name: "index_wiki_revisions_on_wiki_page_id"
  251. end
  252. add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  253. add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
  254. add_foreign_key "nico_tag_relations", "tags"
  255. add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
  256. add_foreign_key "post_similarities", "posts"
  257. add_foreign_key "post_similarities", "posts", column: "target_post_id"
  258. add_foreign_key "post_tags", "posts"
  259. add_foreign_key "post_tags", "tags"
  260. add_foreign_key "post_tags", "users", column: "created_user_id"
  261. add_foreign_key "post_tags", "users", column: "deleted_user_id"
  262. add_foreign_key "posts", "posts", column: "parent_id"
  263. add_foreign_key "posts", "users", column: "uploaded_user_id"
  264. add_foreign_key "settings", "users"
  265. add_foreign_key "tag_implications", "tags"
  266. add_foreign_key "tag_implications", "tags", column: "parent_tag_id"
  267. add_foreign_key "tag_names", "tag_names", column: "canonical_id"
  268. add_foreign_key "tag_similarities", "tags"
  269. add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
  270. add_foreign_key "tags", "tag_names"
  271. add_foreign_key "theatre_comments", "theatres"
  272. add_foreign_key "theatre_comments", "users"
  273. add_foreign_key "theatres", "posts", column: "current_post_id"
  274. add_foreign_key "theatres", "users", column: "created_by_user_id"
  275. add_foreign_key "user_ips", "ip_addresses"
  276. add_foreign_key "user_ips", "users"
  277. add_foreign_key "user_post_views", "posts"
  278. add_foreign_key "user_post_views", "users"
  279. add_foreign_key "wiki_pages", "tag_names"
  280. add_foreign_key "wiki_pages", "users", column: "created_user_id"
  281. add_foreign_key "wiki_pages", "users", column: "updated_user_id"
  282. add_foreign_key "wiki_revision_lines", "wiki_lines"
  283. add_foreign_key "wiki_revision_lines", "wiki_revisions"
  284. add_foreign_key "wiki_revisions", "users", column: "created_user_id"
  285. add_foreign_key "wiki_revisions", "wiki_pages"
  286. add_foreign_key "wiki_revisions", "wiki_pages", column: "redirect_page_id"
  287. add_foreign_key "wiki_revisions", "wiki_revisions", column: "base_revision_id"
  288. end