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

484 lines
25 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_01_153900) 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_tags", 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.bigint "created_user_id"
  132. t.bigint "deleted_user_id"
  133. t.datetime "created_at", null: false
  134. t.datetime "updated_at", null: false
  135. t.datetime "discarded_at"
  136. t.virtual "is_active", type: :boolean, as: "(`discarded_at` is null)", stored: true
  137. 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
  138. t.index ["active_unique_key"], name: "idx_post_tags_active_unique", unique: true
  139. t.index ["created_user_id"], name: "index_post_tags_on_created_user_id"
  140. t.index ["deleted_user_id"], name: "index_post_tags_on_deleted_user_id"
  141. t.index ["discarded_at"], name: "index_post_tags_on_discarded_at"
  142. t.index ["post_id", "discarded_at"], name: "index_post_tags_on_post_id_and_discarded_at"
  143. t.index ["post_id"], name: "index_post_tags_on_post_id"
  144. t.index ["tag_id", "discarded_at"], name: "index_post_tags_on_tag_id_and_discarded_at"
  145. t.index ["tag_id"], name: "index_post_tags_on_tag_id"
  146. end
  147. create_table "post_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  148. t.bigint "post_id", null: false
  149. t.integer "version_no", null: false
  150. t.string "event_type", null: false
  151. t.string "title"
  152. t.string "url", limit: 768, null: false
  153. t.string "thumbnail_base", limit: 2000
  154. t.text "tags", null: false
  155. t.text "parent_post_ids", null: false
  156. t.datetime "original_created_from"
  157. t.datetime "original_created_before"
  158. t.datetime "created_at", null: false
  159. t.bigint "created_by_user_id"
  160. t.index ["created_by_user_id"], name: "index_post_versions_on_created_by_user_id"
  161. t.index ["post_id", "version_no"], name: "index_post_versions_on_post_id_and_version_no", unique: true
  162. t.index ["post_id"], name: "index_post_versions_on_post_id"
  163. t.check_constraint "`event_type` in (_utf8mb4'create',_utf8mb4'update',_utf8mb4'discard',_utf8mb4'restore')", name: "post_versions_event_type_valid"
  164. t.check_constraint "`version_no` > 0", name: "post_versions_version_no_positive"
  165. end
  166. create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  167. t.string "title"
  168. t.string "url", limit: 768, null: false
  169. t.string "thumbnail_base", limit: 2000
  170. t.bigint "uploaded_user_id"
  171. t.datetime "created_at", null: false
  172. t.datetime "original_created_from"
  173. t.datetime "original_created_before"
  174. t.datetime "updated_at", null: false
  175. t.index ["uploaded_user_id"], name: "index_posts_on_uploaded_user_id"
  176. t.index ["url"], name: "index_posts_on_url", unique: true
  177. end
  178. create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  179. t.bigint "user_id", null: false
  180. t.string "key", null: false
  181. t.json "value", null: false
  182. t.datetime "created_at", null: false
  183. t.datetime "updated_at", null: false
  184. t.index ["user_id"], name: "index_settings_on_user_id"
  185. end
  186. create_table "tag_implications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  187. t.bigint "tag_id", null: false
  188. t.bigint "parent_tag_id", null: false
  189. t.datetime "created_at", null: false
  190. t.datetime "updated_at", null: false
  191. t.index ["parent_tag_id"], name: "index_tag_implications_on_parent_tag_id"
  192. t.index ["tag_id", "parent_tag_id"], name: "index_tag_implications_on_tag_id_and_parent_tag_id", unique: true
  193. t.index ["tag_id"], name: "index_tag_implications_on_tag_id"
  194. end
  195. create_table "tag_name_sanitisation_rules", primary_key: "priority", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  196. t.string "source_pattern", null: false
  197. t.string "replacement", null: false
  198. t.datetime "created_at", null: false
  199. t.datetime "updated_at", null: false
  200. t.datetime "discarded_at"
  201. t.index ["discarded_at"], name: "index_tag_name_sanitisation_rules_on_discarded_at"
  202. t.index ["source_pattern"], name: "index_tag_name_sanitisation_rules_on_source_pattern", unique: true
  203. end
  204. create_table "tag_names", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  205. t.string "name", null: false
  206. t.bigint "canonical_id"
  207. t.datetime "created_at", null: false
  208. t.datetime "updated_at", null: false
  209. t.datetime "discarded_at"
  210. t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
  211. t.index ["discarded_at"], name: "index_tag_names_on_discarded_at"
  212. t.index ["name"], name: "index_tag_names_on_name", unique: true
  213. end
  214. create_table "tag_similarities", primary_key: ["tag_id", "target_tag_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  215. t.bigint "tag_id", null: false
  216. t.bigint "target_tag_id", null: false
  217. t.float "cos", null: false
  218. t.index ["tag_id", "cos"], name: "index_tag_similarities_on_tag_id_and_cos", order: { cos: :desc }
  219. t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
  220. end
  221. create_table "tag_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  222. t.bigint "tag_id", null: false
  223. t.integer "version_no", null: false
  224. t.string "event_type", null: false
  225. t.string "name", null: false
  226. t.string "category", null: false
  227. t.text "aliases", null: false
  228. t.text "parent_tag_ids", null: false
  229. t.datetime "created_at", null: false
  230. t.bigint "created_by_user_id"
  231. t.index ["created_at"], name: "index_tag_versions_on_created_at"
  232. t.index ["created_by_user_id", "created_at"], name: "index_tag_versions_on_created_by_user_id_and_created_at", order: { created_at: :desc }
  233. t.index ["tag_id", "created_at"], name: "index_tag_versions_on_tag_id_and_created_at", order: { created_at: :desc }
  234. t.index ["tag_id", "version_no"], name: "index_tag_versions_on_tag_id_and_version_no", unique: true
  235. t.check_constraint "`version_no` > 0", name: "tag_versions_version_no_positive"
  236. end
  237. create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  238. t.bigint "tag_name_id", null: false
  239. t.string "category", default: "general", null: false
  240. t.datetime "created_at", null: false
  241. t.datetime "updated_at", null: false
  242. t.integer "post_count", default: 0, null: false
  243. t.datetime "discarded_at"
  244. t.index ["discarded_at"], name: "index_tags_on_discarded_at"
  245. t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
  246. end
  247. create_table "theatre_comments", primary_key: ["theatre_id", "no"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  248. t.bigint "theatre_id", null: false
  249. t.integer "no", null: false
  250. t.bigint "user_id"
  251. t.text "content", null: false
  252. t.datetime "created_at", null: false
  253. t.datetime "updated_at", null: false
  254. t.datetime "discarded_at"
  255. t.index ["discarded_at"], name: "index_theatre_comments_on_discarded_at"
  256. t.index ["theatre_id"], name: "index_theatre_comments_on_theatre_id"
  257. t.index ["user_id"], name: "index_theatre_comments_on_user_id"
  258. end
  259. create_table "theatre_watching_users", primary_key: ["theatre_id", "user_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  260. t.bigint "theatre_id", null: false
  261. t.bigint "user_id", null: false
  262. t.datetime "expires_at", null: false
  263. t.datetime "created_at", null: false
  264. t.datetime "updated_at", null: false
  265. t.index ["expires_at"], name: "index_theatre_watching_users_on_expires_at"
  266. t.index ["theatre_id", "expires_at"], name: "index_theatre_watching_users_on_theatre_id_and_expires_at"
  267. t.index ["theatre_id"], name: "index_theatre_watching_users_on_theatre_id"
  268. t.index ["user_id"], name: "index_theatre_watching_users_on_user_id"
  269. end
  270. create_table "theatres", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  271. t.string "name"
  272. t.datetime "opens_at", null: false
  273. t.datetime "closes_at"
  274. t.integer "kind", null: false
  275. t.bigint "current_post_id"
  276. t.datetime "current_post_started_at"
  277. t.integer "next_comment_no", default: 1, null: false
  278. t.bigint "host_user_id"
  279. t.bigint "created_by_user_id", null: false
  280. t.datetime "created_at", null: false
  281. t.datetime "updated_at", null: false
  282. t.datetime "discarded_at"
  283. t.index ["closes_at"], name: "index_theatres_on_closes_at"
  284. t.index ["created_by_user_id"], name: "index_theatres_on_created_by_user_id"
  285. t.index ["current_post_id"], name: "index_theatres_on_current_post_id"
  286. t.index ["discarded_at"], name: "index_theatres_on_discarded_at"
  287. t.index ["host_user_id"], name: "index_theatres_on_host_user_id"
  288. t.index ["kind"], name: "index_theatres_on_kind"
  289. t.index ["opens_at"], name: "index_theatres_on_opens_at"
  290. end
  291. create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  292. t.bigint "user_id", null: false
  293. t.bigint "ip_address_id", null: false
  294. t.datetime "created_at", null: false
  295. t.datetime "updated_at", null: false
  296. t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
  297. end
  298. create_table "user_post_views", primary_key: ["user_id", "post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  299. t.bigint "user_id", null: false
  300. t.bigint "post_id", null: false
  301. t.datetime "created_at", null: false
  302. t.datetime "updated_at", null: false
  303. t.index ["post_id"], name: "index_user_post_views_on_post_id"
  304. end
  305. create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  306. t.string "name"
  307. t.string "inheritance_code", limit: 64, null: false
  308. t.string "role", null: false
  309. t.datetime "banned_at"
  310. t.datetime "created_at", null: false
  311. t.datetime "updated_at", null: false
  312. t.index ["banned_at"], name: "index_users_on_banned_at"
  313. end
  314. create_table "wiki_assets", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  315. t.bigint "wiki_page_id", null: false
  316. t.integer "no", null: false
  317. t.string "alt_text"
  318. t.binary "sha256", limit: 32, null: false
  319. t.bigint "created_by_user_id", null: false
  320. t.datetime "created_at", null: false
  321. t.datetime "updated_at", null: false
  322. t.index ["created_by_user_id"], name: "index_wiki_assets_on_created_by_user_id"
  323. t.index ["wiki_page_id", "no"], name: "index_wiki_assets_on_wiki_page_id_and_no", unique: true
  324. t.index ["wiki_page_id", "sha256"], name: "index_wiki_assets_on_wiki_page_id_and_sha256", unique: true
  325. end
  326. create_table "wiki_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  327. t.string "sha256", limit: 64, null: false
  328. t.text "body", null: false
  329. t.datetime "created_at", null: false
  330. t.datetime "updated_at", null: false
  331. t.index ["sha256"], name: "index_wiki_lines_on_sha256", unique: true
  332. end
  333. create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  334. t.bigint "tag_name_id", null: false
  335. t.text "body", null: false
  336. t.bigint "created_user_id", null: false
  337. t.bigint "updated_user_id", null: false
  338. t.datetime "created_at", null: false
  339. t.datetime "updated_at", null: false
  340. t.datetime "discarded_at"
  341. t.integer "next_asset_no", default: 1, null: false
  342. t.index ["created_user_id"], name: "index_wiki_pages_on_created_user_id"
  343. t.index ["discarded_at"], name: "index_wiki_pages_on_discarded_at"
  344. t.index ["tag_name_id"], name: "index_wiki_pages_on_tag_name_id", unique: true
  345. t.index ["updated_user_id"], name: "index_wiki_pages_on_updated_user_id"
  346. end
  347. create_table "wiki_revision_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  348. t.bigint "wiki_revision_id", null: false
  349. t.integer "position", null: false
  350. t.bigint "wiki_line_id", null: false
  351. t.index ["wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_line_id"
  352. t.index ["wiki_revision_id", "position"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_position", unique: true
  353. t.index ["wiki_revision_id", "wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_wiki_line_id"
  354. t.index ["wiki_revision_id"], name: "index_wiki_revision_lines_on_wiki_revision_id"
  355. end
  356. create_table "wiki_revisions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  357. t.bigint "wiki_page_id", null: false
  358. t.bigint "base_revision_id"
  359. t.bigint "created_user_id", null: false
  360. t.integer "kind", default: 0, null: false
  361. t.bigint "redirect_page_id"
  362. t.string "message"
  363. t.integer "lines_count", default: 0, null: false
  364. t.string "tree_sha256", limit: 64
  365. t.datetime "created_at", null: false
  366. t.datetime "updated_at", null: false
  367. t.index ["base_revision_id"], name: "index_wiki_revisions_on_base_revision_id"
  368. t.index ["created_user_id"], name: "index_wiki_revisions_on_created_user_id"
  369. t.index ["kind"], name: "index_wiki_revisions_on_kind"
  370. t.index ["redirect_page_id"], name: "index_wiki_revisions_on_redirect_page_id"
  371. t.index ["tree_sha256"], name: "index_wiki_revisions_on_tree_sha256"
  372. t.index ["wiki_page_id", "id"], name: "index_wiki_revisions_on_wiki_page_id_and_id"
  373. t.index ["wiki_page_id"], name: "index_wiki_revisions_on_wiki_page_id"
  374. end
  375. create_table "wiki_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  376. t.bigint "wiki_page_id", null: false
  377. t.integer "version_no", null: false
  378. t.string "event_type", null: false
  379. t.string "title", null: false
  380. t.text "body", null: false
  381. t.text "reason"
  382. t.datetime "created_at", null: false
  383. t.bigint "created_by_user_id"
  384. t.index ["created_by_user_id"], name: "index_wiki_versions_on_created_by_user_id"
  385. t.index ["wiki_page_id", "version_no"], name: "index_wiki_versions_on_wiki_page_id_and_version_no", unique: true
  386. t.index ["wiki_page_id"], name: "index_wiki_versions_on_wiki_page_id"
  387. t.check_constraint "`event_type` in (_utf8mb4'create',_utf8mb4'update',_utf8mb4'discard',_utf8mb4'restore')", name: "wiki_versions_event_type_valid"
  388. t.check_constraint "`version_no` > 0", name: "wiki_versions_version_no_positive"
  389. end
  390. add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  391. add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
  392. add_foreign_key "material_versions", "materials"
  393. add_foreign_key "material_versions", "materials", column: "parent_id"
  394. add_foreign_key "material_versions", "tags"
  395. add_foreign_key "material_versions", "users", column: "created_by_user_id"
  396. add_foreign_key "material_versions", "users", column: "updated_by_user_id"
  397. add_foreign_key "materials", "materials", column: "parent_id"
  398. add_foreign_key "materials", "tags"
  399. add_foreign_key "materials", "users", column: "created_by_user_id"
  400. add_foreign_key "materials", "users", column: "updated_by_user_id"
  401. add_foreign_key "nico_tag_relations", "tags"
  402. add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
  403. add_foreign_key "nico_tag_versions", "tags"
  404. add_foreign_key "nico_tag_versions", "users", column: "created_by_user_id"
  405. add_foreign_key "post_implications", "posts"
  406. add_foreign_key "post_implications", "posts", column: "parent_post_id"
  407. add_foreign_key "post_similarities", "posts"
  408. add_foreign_key "post_similarities", "posts", column: "target_post_id"
  409. add_foreign_key "post_tags", "posts"
  410. add_foreign_key "post_tags", "tags"
  411. add_foreign_key "post_tags", "users", column: "created_user_id"
  412. add_foreign_key "post_tags", "users", column: "deleted_user_id"
  413. add_foreign_key "post_versions", "posts"
  414. add_foreign_key "post_versions", "users", column: "created_by_user_id"
  415. add_foreign_key "posts", "users", column: "uploaded_user_id"
  416. add_foreign_key "settings", "users"
  417. add_foreign_key "tag_implications", "tags"
  418. add_foreign_key "tag_implications", "tags", column: "parent_tag_id"
  419. add_foreign_key "tag_names", "tag_names", column: "canonical_id"
  420. add_foreign_key "tag_similarities", "tags"
  421. add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
  422. add_foreign_key "tag_versions", "tags"
  423. add_foreign_key "tag_versions", "users", column: "created_by_user_id"
  424. add_foreign_key "tags", "tag_names"
  425. add_foreign_key "theatre_comments", "theatres"
  426. add_foreign_key "theatre_comments", "users"
  427. add_foreign_key "theatre_watching_users", "theatres"
  428. add_foreign_key "theatre_watching_users", "users"
  429. add_foreign_key "theatres", "posts", column: "current_post_id"
  430. add_foreign_key "theatres", "users", column: "created_by_user_id"
  431. add_foreign_key "theatres", "users", column: "host_user_id"
  432. add_foreign_key "user_ips", "ip_addresses"
  433. add_foreign_key "user_ips", "users"
  434. add_foreign_key "user_post_views", "posts"
  435. add_foreign_key "user_post_views", "users"
  436. add_foreign_key "wiki_assets", "users", column: "created_by_user_id"
  437. add_foreign_key "wiki_assets", "wiki_pages"
  438. add_foreign_key "wiki_pages", "tag_names"
  439. add_foreign_key "wiki_pages", "users", column: "created_user_id"
  440. add_foreign_key "wiki_pages", "users", column: "updated_user_id"
  441. add_foreign_key "wiki_revision_lines", "wiki_lines"
  442. add_foreign_key "wiki_revision_lines", "wiki_revisions"
  443. add_foreign_key "wiki_revisions", "users", column: "created_user_id"
  444. add_foreign_key "wiki_revisions", "wiki_pages"
  445. add_foreign_key "wiki_revisions", "wiki_pages", column: "redirect_page_id"
  446. add_foreign_key "wiki_revisions", "wiki_revisions", column: "base_revision_id"
  447. add_foreign_key "wiki_versions", "users", column: "created_by_user_id"
  448. add_foreign_key "wiki_versions", "wiki_pages"
  449. end