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

421 lines
21 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_04_09_123700) 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 "material_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  54. t.bigint "material_id", null: false
  55. t.integer "version_no", null: false
  56. t.string "url"
  57. t.bigint "parent_id"
  58. t.bigint "tag_id"
  59. t.bigint "created_by_user_id"
  60. t.bigint "updated_by_user_id"
  61. t.datetime "created_at", null: false
  62. t.datetime "updated_at", null: false
  63. t.datetime "discarded_at"
  64. t.index ["created_by_user_id"], name: "index_material_versions_on_created_by_user_id"
  65. t.index ["discarded_at"], name: "index_material_versions_on_discarded_at"
  66. t.index ["material_id", "version_no"], name: "index_material_versions_on_material_id_and_version_no", unique: true
  67. t.index ["material_id"], name: "index_material_versions_on_material_id"
  68. t.index ["parent_id"], name: "index_material_versions_on_parent_id"
  69. t.index ["tag_id"], name: "index_material_versions_on_tag_id"
  70. t.index ["updated_by_user_id"], name: "index_material_versions_on_updated_by_user_id"
  71. t.index ["url"], name: "index_material_versions_on_url"
  72. end
  73. create_table "materials", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  74. t.string "url"
  75. t.bigint "parent_id"
  76. t.bigint "tag_id"
  77. t.bigint "created_by_user_id"
  78. t.bigint "updated_by_user_id"
  79. t.datetime "created_at", null: false
  80. t.datetime "updated_at", null: false
  81. t.datetime "discarded_at"
  82. t.virtual "active_url", type: :string, as: "if((`discarded_at` is null),`url`,NULL)"
  83. t.index ["active_url"], name: "index_materials_on_active_url", unique: true
  84. t.index ["created_by_user_id"], name: "index_materials_on_created_by_user_id"
  85. t.index ["discarded_at"], name: "index_materials_on_discarded_at"
  86. t.index ["parent_id"], name: "index_materials_on_parent_id"
  87. t.index ["tag_id"], name: "index_materials_on_tag_id"
  88. t.index ["updated_by_user_id"], name: "index_materials_on_updated_by_user_id"
  89. end
  90. create_table "nico_tag_relations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  91. t.bigint "nico_tag_id", null: false
  92. t.bigint "tag_id", null: false
  93. t.datetime "created_at", null: false
  94. t.datetime "updated_at", null: false
  95. t.index ["nico_tag_id"], name: "index_nico_tag_relations_on_nico_tag_id"
  96. t.index ["tag_id"], name: "index_nico_tag_relations_on_tag_id"
  97. end
  98. create_table "post_similarities", primary_key: ["post_id", "target_post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  99. t.bigint "post_id", null: false
  100. t.bigint "target_post_id", null: false
  101. t.float "cos", null: false
  102. t.index ["post_id", "cos"], name: "index_post_similarities_on_post_id_and_cos", order: { cos: :desc }
  103. t.index ["target_post_id"], name: "index_post_similarities_on_target_post_id"
  104. end
  105. create_table "post_tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  106. t.bigint "post_id", null: false
  107. t.bigint "tag_id", null: false
  108. t.bigint "created_user_id"
  109. t.bigint "deleted_user_id"
  110. t.datetime "created_at", null: false
  111. t.datetime "updated_at", null: false
  112. t.datetime "discarded_at"
  113. t.virtual "is_active", type: :boolean, as: "(`discarded_at` is null)", stored: true
  114. 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
  115. t.index ["active_unique_key"], name: "idx_post_tags_active_unique", unique: true
  116. t.index ["created_user_id"], name: "index_post_tags_on_created_user_id"
  117. t.index ["deleted_user_id"], name: "index_post_tags_on_deleted_user_id"
  118. t.index ["discarded_at"], name: "index_post_tags_on_discarded_at"
  119. t.index ["post_id", "discarded_at"], name: "index_post_tags_on_post_id_and_discarded_at"
  120. t.index ["post_id"], name: "index_post_tags_on_post_id"
  121. t.index ["tag_id", "discarded_at"], name: "index_post_tags_on_tag_id_and_discarded_at"
  122. t.index ["tag_id"], name: "index_post_tags_on_tag_id"
  123. end
  124. create_table "post_versions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  125. t.bigint "post_id", null: false
  126. t.integer "version_no", null: false
  127. t.string "event_type", null: false
  128. t.string "title"
  129. t.string "url", limit: 768, null: false
  130. t.string "thumbnail_base", limit: 2000
  131. t.text "tags", null: false
  132. t.bigint "parent_id"
  133. t.datetime "original_created_from"
  134. t.datetime "original_created_before"
  135. t.datetime "created_at", null: false
  136. t.bigint "created_by_user_id"
  137. t.index ["created_by_user_id"], name: "index_post_versions_on_created_by_user_id"
  138. t.index ["parent_id"], name: "index_post_versions_on_parent_id"
  139. t.index ["post_id", "version_no"], name: "index_post_versions_on_post_id_and_version_no", unique: true
  140. t.index ["post_id"], name: "index_post_versions_on_post_id"
  141. t.check_constraint "`event_type` in (_utf8mb4'create',_utf8mb4'update',_utf8mb4'discard',_utf8mb4'restore')"
  142. t.check_constraint "`version_no` > 0"
  143. end
  144. create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  145. t.string "title"
  146. t.string "url", limit: 768, null: false
  147. t.string "thumbnail_base", limit: 2000
  148. t.bigint "parent_id"
  149. t.bigint "uploaded_user_id"
  150. t.datetime "created_at", null: false
  151. t.datetime "original_created_from"
  152. t.datetime "original_created_before"
  153. t.datetime "updated_at", null: false
  154. t.index ["parent_id"], name: "index_posts_on_parent_id"
  155. t.index ["uploaded_user_id"], name: "index_posts_on_uploaded_user_id"
  156. t.index ["url"], name: "index_posts_on_url", unique: true
  157. end
  158. create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  159. t.bigint "user_id", null: false
  160. t.string "key", null: false
  161. t.json "value", null: false
  162. t.datetime "created_at", null: false
  163. t.datetime "updated_at", null: false
  164. t.index ["user_id"], name: "index_settings_on_user_id"
  165. end
  166. create_table "tag_implications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  167. t.bigint "tag_id", null: false
  168. t.bigint "parent_tag_id", null: false
  169. t.datetime "created_at", null: false
  170. t.datetime "updated_at", null: false
  171. t.index ["parent_tag_id"], name: "index_tag_implications_on_parent_tag_id"
  172. t.index ["tag_id", "parent_tag_id"], name: "index_tag_implications_on_tag_id_and_parent_tag_id", unique: true
  173. t.index ["tag_id"], name: "index_tag_implications_on_tag_id"
  174. end
  175. create_table "tag_name_sanitisation_rules", primary_key: "priority", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  176. t.string "source_pattern", null: false
  177. t.string "replacement", null: false
  178. t.datetime "created_at", null: false
  179. t.datetime "updated_at", null: false
  180. t.datetime "discarded_at"
  181. t.index ["discarded_at"], name: "index_tag_name_sanitisation_rules_on_discarded_at"
  182. t.index ["source_pattern"], name: "index_tag_name_sanitisation_rules_on_source_pattern", unique: true
  183. end
  184. create_table "tag_names", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  185. t.string "name", null: false
  186. t.bigint "canonical_id"
  187. t.datetime "created_at", null: false
  188. t.datetime "updated_at", null: false
  189. t.datetime "discarded_at"
  190. t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
  191. t.index ["discarded_at"], name: "index_tag_names_on_discarded_at"
  192. t.index ["name"], name: "index_tag_names_on_name", unique: true
  193. end
  194. create_table "tag_similarities", primary_key: ["tag_id", "target_tag_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  195. t.bigint "tag_id", null: false
  196. t.bigint "target_tag_id", null: false
  197. t.float "cos", null: false
  198. t.index ["tag_id", "cos"], name: "index_tag_similarities_on_tag_id_and_cos", order: { cos: :desc }
  199. t.index ["target_tag_id"], name: "index_tag_similarities_on_target_tag_id"
  200. end
  201. create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  202. t.bigint "tag_name_id", null: false
  203. t.string "category", default: "general", null: false
  204. t.datetime "created_at", null: false
  205. t.datetime "updated_at", null: false
  206. t.integer "post_count", default: 0, null: false
  207. t.datetime "discarded_at"
  208. t.index ["discarded_at"], name: "index_tags_on_discarded_at"
  209. t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
  210. end
  211. create_table "theatre_comments", primary_key: ["theatre_id", "no"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  212. t.bigint "theatre_id", null: false
  213. t.integer "no", null: false
  214. t.bigint "user_id"
  215. t.text "content", null: false
  216. t.datetime "created_at", null: false
  217. t.datetime "updated_at", null: false
  218. t.datetime "discarded_at"
  219. t.index ["discarded_at"], name: "index_theatre_comments_on_discarded_at"
  220. t.index ["theatre_id"], name: "index_theatre_comments_on_theatre_id"
  221. t.index ["user_id"], name: "index_theatre_comments_on_user_id"
  222. end
  223. create_table "theatre_watching_users", primary_key: ["theatre_id", "user_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  224. t.bigint "theatre_id", null: false
  225. t.bigint "user_id", null: false
  226. t.datetime "expires_at", null: false
  227. t.datetime "created_at", null: false
  228. t.datetime "updated_at", null: false
  229. t.index ["expires_at"], name: "index_theatre_watching_users_on_expires_at"
  230. t.index ["theatre_id", "expires_at"], name: "index_theatre_watching_users_on_theatre_id_and_expires_at"
  231. t.index ["theatre_id"], name: "index_theatre_watching_users_on_theatre_id"
  232. t.index ["user_id"], name: "index_theatre_watching_users_on_user_id"
  233. end
  234. create_table "theatres", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  235. t.string "name"
  236. t.datetime "opens_at", null: false
  237. t.datetime "closes_at"
  238. t.integer "kind", null: false
  239. t.bigint "current_post_id"
  240. t.datetime "current_post_started_at"
  241. t.integer "next_comment_no", default: 1, null: false
  242. t.bigint "host_user_id"
  243. t.bigint "created_by_user_id", null: false
  244. t.datetime "created_at", null: false
  245. t.datetime "updated_at", null: false
  246. t.datetime "discarded_at"
  247. t.index ["closes_at"], name: "index_theatres_on_closes_at"
  248. t.index ["created_by_user_id"], name: "index_theatres_on_created_by_user_id"
  249. t.index ["current_post_id"], name: "index_theatres_on_current_post_id"
  250. t.index ["discarded_at"], name: "index_theatres_on_discarded_at"
  251. t.index ["host_user_id"], name: "index_theatres_on_host_user_id"
  252. t.index ["kind"], name: "index_theatres_on_kind"
  253. t.index ["opens_at"], name: "index_theatres_on_opens_at"
  254. end
  255. create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  256. t.bigint "user_id", null: false
  257. t.bigint "ip_address_id", null: false
  258. t.datetime "created_at", null: false
  259. t.datetime "updated_at", null: false
  260. t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
  261. end
  262. create_table "user_post_views", primary_key: ["user_id", "post_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  263. t.bigint "user_id", null: false
  264. t.bigint "post_id", null: false
  265. t.datetime "created_at", null: false
  266. t.datetime "updated_at", null: false
  267. t.index ["post_id"], name: "index_user_post_views_on_post_id"
  268. end
  269. create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  270. t.string "name"
  271. t.string "inheritance_code", limit: 64, null: false
  272. t.string "role", null: false
  273. t.boolean "banned", default: false, null: false
  274. t.datetime "created_at", null: false
  275. t.datetime "updated_at", null: false
  276. end
  277. create_table "wiki_assets", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  278. t.bigint "wiki_page_id", null: false
  279. t.integer "no", null: false
  280. t.string "alt_text"
  281. t.binary "sha256", limit: 32, null: false
  282. t.bigint "created_by_user_id", null: false
  283. t.datetime "created_at", null: false
  284. t.datetime "updated_at", null: false
  285. t.index ["created_by_user_id"], name: "index_wiki_assets_on_created_by_user_id"
  286. t.index ["wiki_page_id", "no"], name: "index_wiki_assets_on_wiki_page_id_and_no", unique: true
  287. t.index ["wiki_page_id", "sha256"], name: "index_wiki_assets_on_wiki_page_id_and_sha256", unique: true
  288. end
  289. create_table "wiki_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  290. t.string "sha256", limit: 64, null: false
  291. t.text "body", null: false
  292. t.datetime "created_at", null: false
  293. t.datetime "updated_at", null: false
  294. t.index ["sha256"], name: "index_wiki_lines_on_sha256", unique: true
  295. end
  296. create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  297. t.bigint "tag_name_id", null: false
  298. t.bigint "created_user_id", null: false
  299. t.bigint "updated_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.integer "next_asset_no", default: 1, null: false
  304. t.index ["created_user_id"], name: "index_wiki_pages_on_created_user_id"
  305. t.index ["discarded_at"], name: "index_wiki_pages_on_discarded_at"
  306. t.index ["tag_name_id"], name: "index_wiki_pages_on_tag_name_id", unique: true
  307. t.index ["updated_user_id"], name: "index_wiki_pages_on_updated_user_id"
  308. end
  309. create_table "wiki_revision_lines", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  310. t.bigint "wiki_revision_id", null: false
  311. t.integer "position", null: false
  312. t.bigint "wiki_line_id", null: false
  313. t.index ["wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_line_id"
  314. t.index ["wiki_revision_id", "position"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_position", unique: true
  315. t.index ["wiki_revision_id", "wiki_line_id"], name: "index_wiki_revision_lines_on_wiki_revision_id_and_wiki_line_id"
  316. t.index ["wiki_revision_id"], name: "index_wiki_revision_lines_on_wiki_revision_id"
  317. end
  318. create_table "wiki_revisions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
  319. t.bigint "wiki_page_id", null: false
  320. t.bigint "base_revision_id"
  321. t.bigint "created_user_id", null: false
  322. t.integer "kind", default: 0, null: false
  323. t.bigint "redirect_page_id"
  324. t.string "message"
  325. t.integer "lines_count", default: 0, null: false
  326. t.string "tree_sha256", limit: 64
  327. t.datetime "created_at", null: false
  328. t.datetime "updated_at", null: false
  329. t.index ["base_revision_id"], name: "index_wiki_revisions_on_base_revision_id"
  330. t.index ["created_user_id"], name: "index_wiki_revisions_on_created_user_id"
  331. t.index ["kind"], name: "index_wiki_revisions_on_kind"
  332. t.index ["redirect_page_id"], name: "index_wiki_revisions_on_redirect_page_id"
  333. t.index ["tree_sha256"], name: "index_wiki_revisions_on_tree_sha256"
  334. t.index ["wiki_page_id", "id"], name: "index_wiki_revisions_on_wiki_page_id_and_id"
  335. t.index ["wiki_page_id"], name: "index_wiki_revisions_on_wiki_page_id"
  336. end
  337. add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  338. add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
  339. add_foreign_key "material_versions", "materials"
  340. add_foreign_key "material_versions", "materials", column: "parent_id"
  341. add_foreign_key "material_versions", "tags"
  342. add_foreign_key "material_versions", "users", column: "created_by_user_id"
  343. add_foreign_key "material_versions", "users", column: "updated_by_user_id"
  344. add_foreign_key "materials", "materials", column: "parent_id"
  345. add_foreign_key "materials", "tags"
  346. add_foreign_key "materials", "users", column: "created_by_user_id"
  347. add_foreign_key "materials", "users", column: "updated_by_user_id"
  348. add_foreign_key "nico_tag_relations", "tags"
  349. add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
  350. add_foreign_key "post_similarities", "posts"
  351. add_foreign_key "post_similarities", "posts", column: "target_post_id"
  352. add_foreign_key "post_tags", "posts"
  353. add_foreign_key "post_tags", "tags"
  354. add_foreign_key "post_tags", "users", column: "created_user_id"
  355. add_foreign_key "post_tags", "users", column: "deleted_user_id"
  356. add_foreign_key "post_versions", "posts"
  357. add_foreign_key "post_versions", "posts", column: "parent_id"
  358. add_foreign_key "post_versions", "users", column: "created_by_user_id"
  359. add_foreign_key "posts", "posts", column: "parent_id"
  360. add_foreign_key "posts", "users", column: "uploaded_user_id"
  361. add_foreign_key "settings", "users"
  362. add_foreign_key "tag_implications", "tags"
  363. add_foreign_key "tag_implications", "tags", column: "parent_tag_id"
  364. add_foreign_key "tag_names", "tag_names", column: "canonical_id"
  365. add_foreign_key "tag_similarities", "tags"
  366. add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
  367. add_foreign_key "tags", "tag_names"
  368. add_foreign_key "theatre_comments", "theatres"
  369. add_foreign_key "theatre_comments", "users"
  370. add_foreign_key "theatre_watching_users", "theatres"
  371. add_foreign_key "theatre_watching_users", "users"
  372. add_foreign_key "theatres", "posts", column: "current_post_id"
  373. add_foreign_key "theatres", "users", column: "created_by_user_id"
  374. add_foreign_key "theatres", "users", column: "host_user_id"
  375. add_foreign_key "user_ips", "ip_addresses"
  376. add_foreign_key "user_ips", "users"
  377. add_foreign_key "user_post_views", "posts"
  378. add_foreign_key "user_post_views", "users"
  379. add_foreign_key "wiki_assets", "users", column: "created_by_user_id"
  380. add_foreign_key "wiki_assets", "wiki_pages"
  381. add_foreign_key "wiki_pages", "tag_names"
  382. add_foreign_key "wiki_pages", "users", column: "created_user_id"
  383. add_foreign_key "wiki_pages", "users", column: "updated_user_id"
  384. add_foreign_key "wiki_revision_lines", "wiki_lines"
  385. add_foreign_key "wiki_revision_lines", "wiki_revisions"
  386. add_foreign_key "wiki_revisions", "users", column: "created_user_id"
  387. add_foreign_key "wiki_revisions", "wiki_pages"
  388. add_foreign_key "wiki_revisions", "wiki_pages", column: "redirect_page_id"
  389. add_foreign_key "wiki_revisions", "wiki_revisions", column: "base_revision_id"
  390. end