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

509 lines
26 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_05_19_013100) 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.datetime "banned_at"
  49. t.datetime "created_at", null: false
  50. t.datetime "updated_at", null: false
  51. t.index ["banned_at"], name: "index_ip_addresses_on_banned_at"
  52. t.index ["ip_address"], name: "index_ip_addresses_on_ip_address", unique: true
  53. end
  54. create_table "material_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  55. t.bigint "material_id", null: false
  56. t.integer "version_no", null: false
  57. t.string "url"
  58. t.bigint "parent_id"
  59. t.bigint "tag_id"
  60. t.bigint "created_by_user_id"
  61. t.bigint "updated_by_user_id"
  62. t.datetime "created_at", null: false
  63. t.datetime "updated_at", null: false
  64. t.datetime "discarded_at"
  65. t.index ["created_by_user_id"], name: "index_material_versions_on_created_by_user_id"
  66. t.index ["discarded_at"], name: "index_material_versions_on_discarded_at"
  67. t.index ["material_id", "version_no"], name: "index_material_versions_on_material_id_and_version_no", unique: true
  68. t.index ["material_id"], name: "index_material_versions_on_material_id"
  69. t.index ["parent_id"], name: "index_material_versions_on_parent_id"
  70. t.index ["tag_id"], name: "index_material_versions_on_tag_id"
  71. t.index ["updated_by_user_id"], name: "index_material_versions_on_updated_by_user_id"
  72. t.index ["url"], name: "index_material_versions_on_url"
  73. end
  74. create_table "materials", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  75. t.string "url"
  76. t.bigint "parent_id"
  77. t.bigint "tag_id"
  78. t.bigint "created_by_user_id"
  79. t.bigint "updated_by_user_id"
  80. t.datetime "created_at", null: false
  81. t.datetime "updated_at", null: false
  82. t.datetime "discarded_at"
  83. t.virtual "active_url", type: :string, as: "if((`discarded_at` is null),`url`,NULL)"
  84. t.index ["active_url"], name: "index_materials_on_active_url", unique: true
  85. t.index ["created_by_user_id"], name: "index_materials_on_created_by_user_id"
  86. t.index ["discarded_at"], name: "index_materials_on_discarded_at"
  87. t.index ["parent_id"], name: "index_materials_on_parent_id"
  88. t.index ["tag_id"], name: "index_materials_on_tag_id"
  89. t.index ["updated_by_user_id"], name: "index_materials_on_updated_by_user_id"
  90. end
  91. create_table "nico_tag_relations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  92. t.bigint "nico_tag_id", null: false
  93. t.bigint "tag_id", null: false
  94. t.datetime "created_at", null: false
  95. t.datetime "updated_at", null: false
  96. t.index ["nico_tag_id"], name: "index_nico_tag_relations_on_nico_tag_id"
  97. t.index ["tag_id"], name: "index_nico_tag_relations_on_tag_id"
  98. end
  99. create_table "nico_tag_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  100. t.bigint "tag_id", null: false
  101. t.integer "version_no", null: false
  102. t.string "event_type", null: false
  103. t.string "name", null: false
  104. t.text "linked_tags", null: false
  105. t.datetime "created_at", null: false
  106. t.bigint "created_by_user_id"
  107. t.index ["created_at"], name: "index_nico_tag_versions_on_created_at"
  108. t.index ["created_by_user_id", "created_at"], name: "index_nico_tag_versions_on_created_by_user_id_and_created_at", order: { created_at: :desc }
  109. t.index ["tag_id", "created_at"], name: "index_nico_tag_versions_on_tag_id_and_created_at", order: { created_at: :desc }
  110. t.index ["tag_id", "version_no"], name: "index_nico_tag_versions_on_tag_id_and_version_no", unique: true
  111. t.check_constraint "`version_no` > 0", name: "nico_tag_versions_version_no_positive"
  112. end
  113. create_table "post_implications", primary_key: ["post_id", "parent_post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  114. t.bigint "post_id", null: false
  115. t.bigint "parent_post_id", null: false
  116. t.datetime "created_at", null: false
  117. t.datetime "updated_at", null: false
  118. t.index ["parent_post_id"], name: "index_post_implications_on_parent_post_id"
  119. t.check_constraint "`post_id` <> `parent_post_id`", name: "chk_post_implications_no_self"
  120. end
  121. create_table "post_similarities", primary_key: ["post_id", "target_post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  122. t.bigint "post_id", null: false
  123. t.bigint "target_post_id", null: false
  124. t.float "cos", null: false
  125. t.index ["post_id", "cos"], name: "index_post_similarities_on_post_id_and_cos", order: { cos: :desc }
  126. t.index ["target_post_id"], name: "index_post_similarities_on_target_post_id"
  127. end
  128. create_table "post_tag_sections", primary_key: ["post_id", "tag_id", "begin_ms"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  129. t.bigint "post_id", null: false
  130. t.bigint "tag_id", null: false
  131. t.integer "begin_ms", null: false
  132. t.integer "end_ms", null: false
  133. t.datetime "created_at", null: false
  134. t.datetime "updated_at", null: false
  135. t.index ["post_id", "begin_ms"], name: "idx_post_tag_sections_post_id_begin_ms"
  136. t.index ["tag_id"], name: "fk_rails_8be3847903"
  137. t.check_constraint "`begin_ms` < `end_ms`", name: "chk_post_tag_sections_end_ms_after_begin_ms"
  138. t.check_constraint "`begin_ms` >= 0", name: "chk_post_tag_sections_begin_ms_natural"
  139. end
  140. create_table "post_tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  141. t.bigint "post_id", null: false
  142. t.bigint "tag_id", null: false
  143. t.bigint "created_user_id"
  144. t.bigint "deleted_user_id"
  145. t.datetime "created_at", null: false
  146. t.datetime "updated_at", null: false
  147. t.datetime "discarded_at"
  148. t.virtual "is_active", type: :boolean, as: "(`discarded_at` is null)", stored: true
  149. 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
  150. t.index ["active_unique_key"], name: "idx_post_tags_active_unique", unique: true
  151. t.index ["created_user_id"], name: "index_post_tags_on_created_user_id"
  152. t.index ["deleted_user_id"], name: "index_post_tags_on_deleted_user_id"
  153. t.index ["discarded_at"], name: "index_post_tags_on_discarded_at"
  154. t.index ["post_id", "discarded_at"], name: "index_post_tags_on_post_id_and_discarded_at"
  155. t.index ["post_id"], name: "index_post_tags_on_post_id"
  156. t.index ["tag_id", "discarded_at"], name: "index_post_tags_on_tag_id_and_discarded_at"
  157. t.index ["tag_id"], name: "index_post_tags_on_tag_id"
  158. end
  159. create_table "post_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  160. t.bigint "post_id", null: false
  161. t.integer "version_no", null: false
  162. t.string "event_type", null: false
  163. t.string "title"
  164. t.string "url", limit: 768, null: false
  165. t.string "thumbnail_base", limit: 2000
  166. t.text "tags", null: false
  167. t.text "parent_post_ids", null: false
  168. t.datetime "original_created_from"
  169. t.datetime "original_created_before"
  170. t.datetime "created_at", null: false
  171. t.bigint "created_by_user_id"
  172. t.index ["created_by_user_id"], name: "index_post_versions_on_created_by_user_id"
  173. t.index ["post_id", "version_no"], name: "index_post_versions_on_post_id_and_version_no", unique: true
  174. t.index ["post_id"], name: "index_post_versions_on_post_id"
  175. t.check_constraint "`event_type` in (_utf8mb4'create',_utf8mb4'update',_utf8mb4'discard',_utf8mb4'restore')", name: "post_versions_event_type_valid"
  176. t.check_constraint "`version_no` > 0", name: "post_versions_version_no_positive"
  177. end
  178. create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  179. t.string "title"
  180. t.string "url", limit: 768, null: false
  181. t.string "thumbnail_base", limit: 2000
  182. t.bigint "uploaded_user_id"
  183. t.datetime "created_at", null: false
  184. t.datetime "original_created_from"
  185. t.datetime "original_created_before"
  186. t.datetime "updated_at", null: false
  187. t.integer "version_no", null: false
  188. t.integer "video_ms"
  189. t.index ["uploaded_user_id"], name: "index_posts_on_uploaded_user_id"
  190. t.index ["url"], name: "index_posts_on_url", unique: true
  191. t.index ["video_ms", "id"], name: "idx_posts_video_ms_id"
  192. t.check_constraint "(`video_ms` is null) or (`video_ms` > 0)", name: "chk_posts_video_ms_positive"
  193. t.check_constraint "`version_no` > 0", name: "chk_posts_version_no_positive"
  194. end
  195. create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  196. t.bigint "user_id", null: false
  197. t.string "key", null: false
  198. t.json "value", null: false
  199. t.datetime "created_at", null: false
  200. t.datetime "updated_at", null: false
  201. t.index ["user_id"], name: "index_settings_on_user_id"
  202. end
  203. create_table "tag_implications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  204. t.bigint "tag_id", null: false
  205. t.bigint "parent_tag_id", null: false
  206. t.datetime "created_at", null: false
  207. t.datetime "updated_at", null: false
  208. t.index ["parent_tag_id"], name: "index_tag_implications_on_parent_tag_id"
  209. t.index ["tag_id", "parent_tag_id"], name: "index_tag_implications_on_tag_id_and_parent_tag_id", unique: true
  210. t.index ["tag_id"], name: "index_tag_implications_on_tag_id"
  211. end
  212. create_table "tag_name_sanitisation_rules", primary_key: "priority", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  213. t.string "source_pattern", null: false
  214. t.string "replacement", null: false
  215. t.datetime "created_at", null: false
  216. t.datetime "updated_at", null: false
  217. t.datetime "discarded_at"
  218. t.index ["discarded_at"], name: "index_tag_name_sanitisation_rules_on_discarded_at"
  219. t.index ["source_pattern"], name: "index_tag_name_sanitisation_rules_on_source_pattern", unique: true
  220. end
  221. create_table "tag_names", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  222. t.string "name", null: false
  223. t.bigint "canonical_id"
  224. t.datetime "created_at", null: false
  225. t.datetime "updated_at", null: false
  226. t.datetime "discarded_at"
  227. t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
  228. t.index ["discarded_at"], name: "index_tag_names_on_discarded_at"
  229. t.index ["name"], name: "index_tag_names_on_name", unique: true
  230. end
  231. create_table "tag_similarities", primary_key: ["tag_id", "target_tag_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  232. t.bigint "tag_id", null: false
  233. t.bigint "target_tag_id", null: false
  234. t.float "cos", null: false
  235. t.index ["tag_id", "cos"], name: "index_tag_similarities_on_tag_id_and_cos", order: { cos: :desc }
  236. t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
  237. end
  238. create_table "tag_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  239. t.bigint "tag_id", null: false
  240. t.integer "version_no", null: false
  241. t.string "event_type", null: false
  242. t.string "name", null: false
  243. t.string "category", null: false
  244. t.text "aliases", null: false
  245. t.text "parent_tag_ids", null: false
  246. t.datetime "created_at", null: false
  247. t.bigint "created_by_user_id"
  248. t.index ["created_at"], name: "index_tag_versions_on_created_at"
  249. t.index ["created_by_user_id", "created_at"], name: "index_tag_versions_on_created_by_user_id_and_created_at", order: { created_at: :desc }
  250. t.index ["tag_id", "created_at"], name: "index_tag_versions_on_tag_id_and_created_at", order: { created_at: :desc }
  251. t.index ["tag_id", "version_no"], name: "index_tag_versions_on_tag_id_and_version_no", unique: true
  252. t.check_constraint "`version_no` > 0", name: "tag_versions_version_no_positive"
  253. end
  254. create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  255. t.bigint "tag_name_id", null: false
  256. t.string "category", default: "general", null: false
  257. t.datetime "created_at", null: false
  258. t.datetime "updated_at", null: false
  259. t.integer "post_count", default: 0, null: false
  260. t.datetime "discarded_at"
  261. t.integer "version_no", null: false
  262. t.index ["discarded_at"], name: "index_tags_on_discarded_at"
  263. t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
  264. t.check_constraint "`version_no` > 0", name: "chk_tags_version_no_positive"
  265. end
  266. create_table "theatre_comments", primary_key: ["theatre_id", "no"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  267. t.bigint "theatre_id", null: false
  268. t.integer "no", null: false
  269. t.bigint "user_id"
  270. t.text "content", null: false
  271. t.datetime "created_at", null: false
  272. t.datetime "updated_at", null: false
  273. t.datetime "discarded_at"
  274. t.index ["discarded_at"], name: "index_theatre_comments_on_discarded_at"
  275. t.index ["theatre_id"], name: "index_theatre_comments_on_theatre_id"
  276. t.index ["user_id"], name: "index_theatre_comments_on_user_id"
  277. end
  278. create_table "theatre_watching_users", primary_key: ["theatre_id", "user_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  279. t.bigint "theatre_id", null: false
  280. t.bigint "user_id", null: false
  281. t.datetime "expires_at", null: false
  282. t.datetime "created_at", null: false
  283. t.datetime "updated_at", null: false
  284. t.index ["expires_at"], name: "index_theatre_watching_users_on_expires_at"
  285. t.index ["theatre_id", "expires_at"], name: "idx_on_theatre_id_skip_expires_at_4c8de1dd42"
  286. t.index ["theatre_id", "expires_at"], name: "index_theatre_watching_users_on_theatre_id_and_expires_at"
  287. t.index ["theatre_id"], name: "index_theatre_watching_users_on_theatre_id"
  288. t.index ["user_id"], name: "index_theatre_watching_users_on_user_id"
  289. end
  290. create_table "theatres", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  291. t.string "name"
  292. t.datetime "opens_at", null: false
  293. t.datetime "closes_at"
  294. t.integer "kind", null: false
  295. t.bigint "current_post_id"
  296. t.datetime "current_post_started_at"
  297. t.integer "next_comment_no", default: 1, null: false
  298. t.bigint "host_user_id"
  299. t.bigint "created_by_user_id", null: false
  300. t.datetime "created_at", null: false
  301. t.datetime "updated_at", null: false
  302. t.datetime "discarded_at"
  303. t.index ["closes_at"], name: "index_theatres_on_closes_at"
  304. t.index ["created_by_user_id"], name: "index_theatres_on_created_by_user_id"
  305. t.index ["current_post_id"], name: "index_theatres_on_current_post_id"
  306. t.index ["discarded_at"], name: "index_theatres_on_discarded_at"
  307. t.index ["host_user_id"], name: "index_theatres_on_host_user_id"
  308. t.index ["kind"], name: "index_theatres_on_kind"
  309. t.index ["opens_at"], name: "index_theatres_on_opens_at"
  310. end
  311. create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  312. t.bigint "user_id", null: false
  313. t.bigint "ip_address_id", null: false
  314. t.datetime "created_at", null: false
  315. t.datetime "updated_at", null: false
  316. t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
  317. end
  318. create_table "user_post_views", primary_key: ["user_id", "post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  319. t.bigint "user_id", null: false
  320. t.bigint "post_id", null: false
  321. t.datetime "created_at", null: false
  322. t.datetime "updated_at", null: false
  323. t.index ["post_id"], name: "index_user_post_views_on_post_id"
  324. end
  325. create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  326. t.string "name"
  327. t.string "inheritance_code", limit: 64, null: false
  328. t.string "role", null: false
  329. t.datetime "banned_at"
  330. t.datetime "created_at", null: false
  331. t.datetime "updated_at", null: false
  332. t.index ["banned_at"], name: "index_users_on_banned_at"
  333. end
  334. create_table "wiki_assets", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  335. t.bigint "wiki_page_id", null: false
  336. t.integer "no", null: false
  337. t.string "alt_text"
  338. t.binary "sha256", limit: 32, null: false
  339. t.bigint "created_by_user_id", null: false
  340. t.datetime "created_at", null: false
  341. t.datetime "updated_at", null: false
  342. t.index ["created_by_user_id"], name: "index_wiki_assets_on_created_by_user_id"
  343. t.index ["wiki_page_id", "no"], name: "index_wiki_assets_on_wiki_page_id_and_no", unique: true
  344. t.index ["wiki_page_id", "sha256"], name: "index_wiki_assets_on_wiki_page_id_and_sha256", unique: true
  345. end
  346. create_table "wiki_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  347. t.string "sha256", limit: 64, null: false
  348. t.text "body", null: false
  349. t.datetime "created_at", null: false
  350. t.datetime "updated_at", null: false
  351. t.index ["sha256"], name: "index_wiki_lines_on_sha256", unique: true
  352. end
  353. create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  354. t.bigint "tag_name_id", null: false
  355. t.text "body", null: false
  356. t.bigint "created_user_id", null: false
  357. t.bigint "updated_user_id", null: false
  358. t.datetime "created_at", null: false
  359. t.datetime "updated_at", null: false
  360. t.datetime "discarded_at"
  361. t.integer "next_asset_no", default: 1, null: false
  362. t.integer "version_no", null: false
  363. t.index ["created_user_id"], name: "index_wiki_pages_on_created_user_id"
  364. t.index ["discarded_at"], name: "index_wiki_pages_on_discarded_at"
  365. t.index ["tag_name_id"], name: "index_wiki_pages_on_tag_name_id", unique: true
  366. t.index ["updated_user_id"], name: "index_wiki_pages_on_updated_user_id"
  367. t.check_constraint "`version_no` > 0", name: "chk_wiki_pages_version_no_positive"
  368. end
  369. create_table "wiki_revision_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  370. t.bigint "wiki_revision_id", null: false
  371. t.integer "position", null: false
  372. t.bigint "wiki_line_id", null: false
  373. t.index ["wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_line_id"
  374. t.index ["wiki_revision_id", "position"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_position", unique: true
  375. t.index ["wiki_revision_id", "wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_wiki_line_id"
  376. t.index ["wiki_revision_id"], name: "index_wiki_revision_lines_on_wiki_revision_id"
  377. end
  378. create_table "wiki_revisions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  379. t.bigint "wiki_page_id", null: false
  380. t.bigint "base_revision_id"
  381. t.bigint "created_user_id", null: false
  382. t.integer "kind", default: 0, null: false
  383. t.bigint "redirect_page_id"
  384. t.string "message"
  385. t.integer "lines_count", default: 0, null: false
  386. t.string "tree_sha256", limit: 64
  387. t.datetime "created_at", null: false
  388. t.datetime "updated_at", null: false
  389. t.index ["base_revision_id"], name: "index_wiki_revisions_on_base_revision_id"
  390. t.index ["created_user_id"], name: "index_wiki_revisions_on_created_user_id"
  391. t.index ["kind"], name: "index_wiki_revisions_on_kind"
  392. t.index ["redirect_page_id"], name: "index_wiki_revisions_on_redirect_page_id"
  393. t.index ["tree_sha256"], name: "index_wiki_revisions_on_tree_sha256"
  394. t.index ["wiki_page_id", "id"], name: "index_wiki_revisions_on_wiki_page_id_and_id"
  395. t.index ["wiki_page_id"], name: "index_wiki_revisions_on_wiki_page_id"
  396. end
  397. create_table "wiki_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  398. t.bigint "wiki_page_id", null: false
  399. t.integer "version_no", null: false
  400. t.string "event_type", null: false
  401. t.string "title", null: false
  402. t.text "body", null: false
  403. t.text "reason"
  404. t.datetime "created_at", null: false
  405. t.bigint "created_by_user_id"
  406. t.index ["created_by_user_id"], name: "index_wiki_versions_on_created_by_user_id"
  407. t.index ["wiki_page_id", "version_no"], name: "index_wiki_versions_on_wiki_page_id_and_version_no", unique: true
  408. t.index ["wiki_page_id"], name: "index_wiki_versions_on_wiki_page_id"
  409. t.check_constraint "`event_type` in (_utf8mb4'create',_utf8mb4'update',_utf8mb4'discard',_utf8mb4'restore')", name: "wiki_versions_event_type_valid"
  410. t.check_constraint "`version_no` > 0", name: "wiki_versions_version_no_positive"
  411. end
  412. add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  413. add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
  414. add_foreign_key "material_versions", "materials"
  415. add_foreign_key "material_versions", "materials", column: "parent_id"
  416. add_foreign_key "material_versions", "tags"
  417. add_foreign_key "material_versions", "users", column: "created_by_user_id"
  418. add_foreign_key "material_versions", "users", column: "updated_by_user_id"
  419. add_foreign_key "materials", "materials", column: "parent_id"
  420. add_foreign_key "materials", "tags"
  421. add_foreign_key "materials", "users", column: "created_by_user_id"
  422. add_foreign_key "materials", "users", column: "updated_by_user_id"
  423. add_foreign_key "nico_tag_relations", "tags"
  424. add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
  425. add_foreign_key "nico_tag_versions", "tags"
  426. add_foreign_key "nico_tag_versions", "users", column: "created_by_user_id"
  427. add_foreign_key "post_implications", "posts"
  428. add_foreign_key "post_implications", "posts", column: "parent_post_id"
  429. add_foreign_key "post_similarities", "posts"
  430. add_foreign_key "post_similarities", "posts", column: "target_post_id"
  431. add_foreign_key "post_tag_sections", "posts"
  432. add_foreign_key "post_tag_sections", "tags"
  433. add_foreign_key "post_tags", "posts"
  434. add_foreign_key "post_tags", "tags"
  435. add_foreign_key "post_tags", "users", column: "created_user_id"
  436. add_foreign_key "post_tags", "users", column: "deleted_user_id"
  437. add_foreign_key "post_versions", "posts"
  438. add_foreign_key "post_versions", "users", column: "created_by_user_id"
  439. add_foreign_key "posts", "users", column: "uploaded_user_id"
  440. add_foreign_key "settings", "users"
  441. add_foreign_key "tag_implications", "tags"
  442. add_foreign_key "tag_implications", "tags", column: "parent_tag_id"
  443. add_foreign_key "tag_names", "tag_names", column: "canonical_id"
  444. add_foreign_key "tag_similarities", "tags"
  445. add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
  446. add_foreign_key "tag_versions", "tags"
  447. add_foreign_key "tag_versions", "users", column: "created_by_user_id"
  448. add_foreign_key "tags", "tag_names"
  449. add_foreign_key "theatre_comments", "theatres"
  450. add_foreign_key "theatre_comments", "users"
  451. add_foreign_key "theatre_watching_users", "theatres"
  452. add_foreign_key "theatre_watching_users", "users"
  453. add_foreign_key "theatres", "posts", column: "current_post_id"
  454. add_foreign_key "theatres", "users", column: "created_by_user_id"
  455. add_foreign_key "theatres", "users", column: "host_user_id"
  456. add_foreign_key "user_ips", "ip_addresses"
  457. add_foreign_key "user_ips", "users"
  458. add_foreign_key "user_post_views", "posts"
  459. add_foreign_key "user_post_views", "users"
  460. add_foreign_key "wiki_assets", "users", column: "created_by_user_id"
  461. add_foreign_key "wiki_assets", "wiki_pages"
  462. add_foreign_key "wiki_pages", "tag_names"
  463. add_foreign_key "wiki_pages", "users", column: "created_user_id"
  464. add_foreign_key "wiki_pages", "users", column: "updated_user_id"
  465. add_foreign_key "wiki_revision_lines", "wiki_lines"
  466. add_foreign_key "wiki_revision_lines", "wiki_revisions"
  467. add_foreign_key "wiki_revisions", "users", column: "created_user_id"
  468. add_foreign_key "wiki_revisions", "wiki_pages"
  469. add_foreign_key "wiki_revisions", "wiki_pages", column: "redirect_page_id"
  470. add_foreign_key "wiki_revisions", "wiki_revisions", column: "base_revision_id"
  471. add_foreign_key "wiki_versions", "users", column: "created_by_user_id"
  472. add_foreign_key "wiki_versions", "wiki_pages"
  473. end