schema.rb 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900
  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. # Note that this schema.rb definition is the authoritative source for your
  6. # database schema. If you need to create the application database on another
  7. # system, you should be using db:schema:load, not running all the migrations
  8. # from scratch. The latter is a flawed and unsustainable approach (the more migrations
  9. # you'll amass, the slower it'll run and the greater likelihood for issues).
  10. #
  11. # It's strongly recommended that you check this file into your version control system.
  12. ActiveRecord::Schema.define(version: 2019_10_07_013357) do
  13. # These are extensions that must be enabled in order to support this database
  14. enable_extension "plpgsql"
  15. create_table "account_aliases", force: :cascade do |t|
  16. t.bigint "account_id"
  17. t.string "acct", default: "", null: false
  18. t.string "uri", default: "", null: false
  19. t.datetime "created_at", null: false
  20. t.datetime "updated_at", null: false
  21. t.index ["account_id"], name: "index_account_aliases_on_account_id"
  22. end
  23. create_table "account_conversations", force: :cascade do |t|
  24. t.bigint "account_id"
  25. t.bigint "conversation_id"
  26. t.bigint "participant_account_ids", default: [], null: false, array: true
  27. t.bigint "status_ids", default: [], null: false, array: true
  28. t.bigint "last_status_id"
  29. t.integer "lock_version", default: 0, null: false
  30. t.boolean "unread", default: false, null: false
  31. t.index ["account_id", "conversation_id", "participant_account_ids"], name: "index_unique_conversations", unique: true
  32. t.index ["account_id"], name: "index_account_conversations_on_account_id"
  33. t.index ["conversation_id"], name: "index_account_conversations_on_conversation_id"
  34. end
  35. create_table "account_domain_blocks", force: :cascade do |t|
  36. t.string "domain"
  37. t.datetime "created_at", null: false
  38. t.datetime "updated_at", null: false
  39. t.bigint "account_id"
  40. t.index ["account_id", "domain"], name: "index_account_domain_blocks_on_account_id_and_domain", unique: true
  41. end
  42. create_table "account_identity_proofs", force: :cascade do |t|
  43. t.bigint "account_id"
  44. t.string "provider", default: "", null: false
  45. t.string "provider_username", default: "", null: false
  46. t.text "token", default: "", null: false
  47. t.boolean "verified", default: false, null: false
  48. t.boolean "live", default: false, null: false
  49. t.datetime "created_at", null: false
  50. t.datetime "updated_at", null: false
  51. t.index ["account_id", "provider", "provider_username"], name: "index_account_proofs_on_account_and_provider_and_username", unique: true
  52. t.index ["account_id"], name: "index_account_identity_proofs_on_account_id"
  53. end
  54. create_table "account_migrations", force: :cascade do |t|
  55. t.bigint "account_id"
  56. t.string "acct", default: "", null: false
  57. t.bigint "followers_count", default: 0, null: false
  58. t.bigint "target_account_id"
  59. t.datetime "created_at", null: false
  60. t.datetime "updated_at", null: false
  61. t.index ["account_id"], name: "index_account_migrations_on_account_id"
  62. t.index ["target_account_id"], name: "index_account_migrations_on_target_account_id"
  63. end
  64. create_table "account_moderation_notes", force: :cascade do |t|
  65. t.text "content", null: false
  66. t.bigint "account_id", null: false
  67. t.bigint "target_account_id", null: false
  68. t.datetime "created_at", null: false
  69. t.datetime "updated_at", null: false
  70. t.index ["account_id"], name: "index_account_moderation_notes_on_account_id"
  71. t.index ["target_account_id"], name: "index_account_moderation_notes_on_target_account_id"
  72. end
  73. create_table "account_pins", force: :cascade do |t|
  74. t.bigint "account_id"
  75. t.bigint "target_account_id"
  76. t.datetime "created_at", null: false
  77. t.datetime "updated_at", null: false
  78. t.index ["account_id", "target_account_id"], name: "index_account_pins_on_account_id_and_target_account_id", unique: true
  79. t.index ["account_id"], name: "index_account_pins_on_account_id"
  80. t.index ["target_account_id"], name: "index_account_pins_on_target_account_id"
  81. end
  82. create_table "account_stats", force: :cascade do |t|
  83. t.bigint "account_id", null: false
  84. t.bigint "statuses_count", default: 0, null: false
  85. t.bigint "following_count", default: 0, null: false
  86. t.bigint "followers_count", default: 0, null: false
  87. t.datetime "created_at", null: false
  88. t.datetime "updated_at", null: false
  89. t.datetime "last_status_at"
  90. t.integer "lock_version", default: 0, null: false
  91. t.index ["account_id"], name: "index_account_stats_on_account_id", unique: true
  92. end
  93. create_table "account_tag_stats", force: :cascade do |t|
  94. t.bigint "tag_id", null: false
  95. t.bigint "accounts_count", default: 0, null: false
  96. t.boolean "hidden", default: false, null: false
  97. t.datetime "created_at", null: false
  98. t.datetime "updated_at", null: false
  99. t.index ["tag_id"], name: "index_account_tag_stats_on_tag_id", unique: true
  100. end
  101. create_table "account_warning_presets", force: :cascade do |t|
  102. t.text "text", default: "", null: false
  103. t.datetime "created_at", null: false
  104. t.datetime "updated_at", null: false
  105. end
  106. create_table "account_warnings", force: :cascade do |t|
  107. t.bigint "account_id"
  108. t.bigint "target_account_id"
  109. t.integer "action", default: 0, null: false
  110. t.text "text", default: "", null: false
  111. t.datetime "created_at", null: false
  112. t.datetime "updated_at", null: false
  113. t.index ["account_id"], name: "index_account_warnings_on_account_id"
  114. t.index ["target_account_id"], name: "index_account_warnings_on_target_account_id"
  115. end
  116. create_table "accounts", force: :cascade do |t|
  117. t.string "username", default: "", null: false
  118. t.string "domain"
  119. t.string "secret", default: "", null: false
  120. t.text "private_key"
  121. t.text "public_key", default: "", null: false
  122. t.string "remote_url", default: "", null: false
  123. t.string "salmon_url", default: "", null: false
  124. t.string "hub_url", default: "", null: false
  125. t.datetime "created_at", null: false
  126. t.datetime "updated_at", null: false
  127. t.text "note", default: "", null: false
  128. t.string "display_name", default: "", null: false
  129. t.string "uri", default: "", null: false
  130. t.string "url"
  131. t.string "avatar_file_name"
  132. t.string "avatar_content_type"
  133. t.integer "avatar_file_size"
  134. t.datetime "avatar_updated_at"
  135. t.string "header_file_name"
  136. t.string "header_content_type"
  137. t.integer "header_file_size"
  138. t.datetime "header_updated_at"
  139. t.string "avatar_remote_url"
  140. t.datetime "subscription_expires_at"
  141. t.boolean "locked", default: false, null: false
  142. t.string "header_remote_url", default: "", null: false
  143. t.datetime "last_webfingered_at"
  144. t.string "inbox_url", default: "", null: false
  145. t.string "outbox_url", default: "", null: false
  146. t.string "shared_inbox_url", default: "", null: false
  147. t.string "followers_url", default: "", null: false
  148. t.integer "protocol", default: 0, null: false
  149. t.boolean "memorial", default: false, null: false
  150. t.bigint "moved_to_account_id"
  151. t.string "featured_collection_url"
  152. t.jsonb "fields"
  153. t.string "actor_type"
  154. t.boolean "discoverable"
  155. t.string "also_known_as", array: true
  156. t.datetime "silenced_at"
  157. t.datetime "suspended_at"
  158. t.integer "trust_level"
  159. t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
  160. t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
  161. t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
  162. t.index ["uri"], name: "index_accounts_on_uri"
  163. t.index ["url"], name: "index_accounts_on_url"
  164. end
  165. create_table "accounts_tags", id: false, force: :cascade do |t|
  166. t.bigint "account_id", null: false
  167. t.bigint "tag_id", null: false
  168. t.index ["account_id", "tag_id"], name: "index_accounts_tags_on_account_id_and_tag_id"
  169. t.index ["tag_id", "account_id"], name: "index_accounts_tags_on_tag_id_and_account_id", unique: true
  170. end
  171. create_table "admin_action_logs", force: :cascade do |t|
  172. t.bigint "account_id"
  173. t.string "action", default: "", null: false
  174. t.string "target_type"
  175. t.bigint "target_id"
  176. t.text "recorded_changes", default: "", null: false
  177. t.datetime "created_at", null: false
  178. t.datetime "updated_at", null: false
  179. t.index ["account_id"], name: "index_admin_action_logs_on_account_id"
  180. t.index ["target_type", "target_id"], name: "index_admin_action_logs_on_target_type_and_target_id"
  181. end
  182. create_table "backups", force: :cascade do |t|
  183. t.bigint "user_id"
  184. t.string "dump_file_name"
  185. t.string "dump_content_type"
  186. t.integer "dump_file_size"
  187. t.datetime "dump_updated_at"
  188. t.boolean "processed", default: false, null: false
  189. t.datetime "created_at", null: false
  190. t.datetime "updated_at", null: false
  191. end
  192. create_table "blocks", force: :cascade do |t|
  193. t.datetime "created_at", null: false
  194. t.datetime "updated_at", null: false
  195. t.bigint "account_id", null: false
  196. t.bigint "target_account_id", null: false
  197. t.string "uri"
  198. t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true
  199. t.index ["target_account_id"], name: "index_blocks_on_target_account_id"
  200. end
  201. create_table "conversation_mutes", force: :cascade do |t|
  202. t.bigint "conversation_id", null: false
  203. t.bigint "account_id", null: false
  204. t.index ["account_id", "conversation_id"], name: "index_conversation_mutes_on_account_id_and_conversation_id", unique: true
  205. end
  206. create_table "conversations", force: :cascade do |t|
  207. t.string "uri"
  208. t.datetime "created_at", null: false
  209. t.datetime "updated_at", null: false
  210. t.index ["uri"], name: "index_conversations_on_uri", unique: true
  211. end
  212. create_table "custom_emoji_categories", force: :cascade do |t|
  213. t.string "name"
  214. t.datetime "created_at", null: false
  215. t.datetime "updated_at", null: false
  216. t.index ["name"], name: "index_custom_emoji_categories_on_name", unique: true
  217. end
  218. create_table "custom_emojis", force: :cascade do |t|
  219. t.string "shortcode", default: "", null: false
  220. t.string "domain"
  221. t.string "image_file_name"
  222. t.string "image_content_type"
  223. t.integer "image_file_size"
  224. t.datetime "image_updated_at"
  225. t.datetime "created_at", null: false
  226. t.datetime "updated_at", null: false
  227. t.boolean "disabled", default: false, null: false
  228. t.string "uri"
  229. t.string "image_remote_url"
  230. t.boolean "visible_in_picker", default: true, null: false
  231. t.bigint "category_id"
  232. t.index ["shortcode", "domain"], name: "index_custom_emojis_on_shortcode_and_domain", unique: true
  233. end
  234. create_table "custom_filters", force: :cascade do |t|
  235. t.bigint "account_id"
  236. t.datetime "expires_at"
  237. t.text "phrase", default: "", null: false
  238. t.string "context", default: [], null: false, array: true
  239. t.boolean "irreversible", default: false, null: false
  240. t.datetime "created_at", null: false
  241. t.datetime "updated_at", null: false
  242. t.boolean "whole_word", default: true, null: false
  243. t.index ["account_id"], name: "index_custom_filters_on_account_id"
  244. end
  245. create_table "domain_allows", force: :cascade do |t|
  246. t.string "domain", default: "", null: false
  247. t.datetime "created_at", null: false
  248. t.datetime "updated_at", null: false
  249. t.index ["domain"], name: "index_domain_allows_on_domain", unique: true
  250. end
  251. create_table "domain_blocks", force: :cascade do |t|
  252. t.string "domain", default: "", null: false
  253. t.datetime "created_at", null: false
  254. t.datetime "updated_at", null: false
  255. t.integer "severity", default: 0
  256. t.boolean "reject_media", default: false, null: false
  257. t.boolean "reject_reports", default: false, null: false
  258. t.text "private_comment"
  259. t.text "public_comment"
  260. t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true
  261. end
  262. create_table "email_domain_blocks", force: :cascade do |t|
  263. t.string "domain", default: "", null: false
  264. t.datetime "created_at", null: false
  265. t.datetime "updated_at", null: false
  266. t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
  267. end
  268. create_table "favourites", force: :cascade do |t|
  269. t.datetime "created_at", null: false
  270. t.datetime "updated_at", null: false
  271. t.bigint "account_id", null: false
  272. t.bigint "status_id", null: false
  273. t.index ["account_id", "id"], name: "index_favourites_on_account_id_and_id"
  274. t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true
  275. t.index ["status_id"], name: "index_favourites_on_status_id"
  276. end
  277. create_table "featured_tags", force: :cascade do |t|
  278. t.bigint "account_id"
  279. t.bigint "tag_id"
  280. t.bigint "statuses_count", default: 0, null: false
  281. t.datetime "last_status_at"
  282. t.datetime "created_at", null: false
  283. t.datetime "updated_at", null: false
  284. t.index ["account_id"], name: "index_featured_tags_on_account_id"
  285. t.index ["tag_id"], name: "index_featured_tags_on_tag_id"
  286. end
  287. create_table "follow_requests", force: :cascade do |t|
  288. t.datetime "created_at", null: false
  289. t.datetime "updated_at", null: false
  290. t.bigint "account_id", null: false
  291. t.bigint "target_account_id", null: false
  292. t.boolean "show_reblogs", default: true, null: false
  293. t.string "uri"
  294. t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true
  295. end
  296. create_table "follows", force: :cascade do |t|
  297. t.datetime "created_at", null: false
  298. t.datetime "updated_at", null: false
  299. t.bigint "account_id", null: false
  300. t.bigint "target_account_id", null: false
  301. t.boolean "show_reblogs", default: true, null: false
  302. t.string "uri"
  303. t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true
  304. t.index ["target_account_id"], name: "index_follows_on_target_account_id"
  305. end
  306. create_table "identities", force: :cascade do |t|
  307. t.string "provider", default: "", null: false
  308. t.string "uid", default: "", null: false
  309. t.datetime "created_at", null: false
  310. t.datetime "updated_at", null: false
  311. t.bigint "user_id"
  312. t.index ["user_id"], name: "index_identities_on_user_id"
  313. end
  314. create_table "imports", force: :cascade do |t|
  315. t.integer "type", null: false
  316. t.boolean "approved", default: false, null: false
  317. t.datetime "created_at", null: false
  318. t.datetime "updated_at", null: false
  319. t.string "data_file_name"
  320. t.string "data_content_type"
  321. t.integer "data_file_size"
  322. t.datetime "data_updated_at"
  323. t.bigint "account_id", null: false
  324. t.boolean "overwrite", default: false, null: false
  325. end
  326. create_table "invites", force: :cascade do |t|
  327. t.bigint "user_id", null: false
  328. t.string "code", default: "", null: false
  329. t.datetime "expires_at"
  330. t.integer "max_uses"
  331. t.integer "uses", default: 0, null: false
  332. t.datetime "created_at", null: false
  333. t.datetime "updated_at", null: false
  334. t.boolean "autofollow", default: false, null: false
  335. t.text "comment"
  336. t.index ["code"], name: "index_invites_on_code", unique: true
  337. t.index ["user_id"], name: "index_invites_on_user_id"
  338. end
  339. create_table "list_accounts", force: :cascade do |t|
  340. t.bigint "list_id", null: false
  341. t.bigint "account_id", null: false
  342. t.bigint "follow_id", null: false
  343. t.index ["account_id", "list_id"], name: "index_list_accounts_on_account_id_and_list_id", unique: true
  344. t.index ["follow_id"], name: "index_list_accounts_on_follow_id"
  345. t.index ["list_id", "account_id"], name: "index_list_accounts_on_list_id_and_account_id"
  346. end
  347. create_table "lists", force: :cascade do |t|
  348. t.bigint "account_id", null: false
  349. t.string "title", default: "", null: false
  350. t.datetime "created_at", null: false
  351. t.datetime "updated_at", null: false
  352. t.index ["account_id"], name: "index_lists_on_account_id"
  353. end
  354. create_table "markers", force: :cascade do |t|
  355. t.bigint "user_id"
  356. t.string "timeline", default: "", null: false
  357. t.bigint "last_read_id", default: 0, null: false
  358. t.integer "lock_version", default: 0, null: false
  359. t.datetime "created_at", null: false
  360. t.datetime "updated_at", null: false
  361. t.index ["user_id", "timeline"], name: "index_markers_on_user_id_and_timeline", unique: true
  362. t.index ["user_id"], name: "index_markers_on_user_id"
  363. end
  364. create_table "media_attachments", force: :cascade do |t|
  365. t.bigint "status_id"
  366. t.string "file_file_name"
  367. t.string "file_content_type"
  368. t.integer "file_file_size"
  369. t.datetime "file_updated_at"
  370. t.string "remote_url", default: "", null: false
  371. t.datetime "created_at", null: false
  372. t.datetime "updated_at", null: false
  373. t.string "shortcode"
  374. t.integer "type", default: 0, null: false
  375. t.json "file_meta"
  376. t.bigint "account_id"
  377. t.text "description"
  378. t.bigint "scheduled_status_id"
  379. t.string "blurhash"
  380. t.index ["account_id"], name: "index_media_attachments_on_account_id"
  381. t.index ["scheduled_status_id"], name: "index_media_attachments_on_scheduled_status_id"
  382. t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true
  383. t.index ["status_id"], name: "index_media_attachments_on_status_id"
  384. end
  385. create_table "mentions", force: :cascade do |t|
  386. t.bigint "status_id"
  387. t.datetime "created_at", null: false
  388. t.datetime "updated_at", null: false
  389. t.bigint "account_id"
  390. t.boolean "silent", default: false, null: false
  391. t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true
  392. t.index ["status_id"], name: "index_mentions_on_status_id"
  393. end
  394. create_table "mutes", force: :cascade do |t|
  395. t.datetime "created_at", null: false
  396. t.datetime "updated_at", null: false
  397. t.boolean "hide_notifications", default: true, null: false
  398. t.bigint "account_id", null: false
  399. t.bigint "target_account_id", null: false
  400. t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true
  401. t.index ["target_account_id"], name: "index_mutes_on_target_account_id"
  402. end
  403. create_table "notifications", force: :cascade do |t|
  404. t.bigint "activity_id", null: false
  405. t.string "activity_type", null: false
  406. t.datetime "created_at", null: false
  407. t.datetime "updated_at", null: false
  408. t.bigint "account_id", null: false
  409. t.bigint "from_account_id", null: false
  410. t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true
  411. t.index ["account_id", "id"], name: "index_notifications_on_account_id_and_id", order: { id: :desc }
  412. t.index ["activity_id", "activity_type"], name: "index_notifications_on_activity_id_and_activity_type"
  413. t.index ["from_account_id"], name: "index_notifications_on_from_account_id"
  414. end
  415. create_table "oauth_access_grants", force: :cascade do |t|
  416. t.string "token", null: false
  417. t.integer "expires_in", null: false
  418. t.text "redirect_uri", null: false
  419. t.datetime "created_at", null: false
  420. t.datetime "revoked_at"
  421. t.string "scopes"
  422. t.bigint "application_id", null: false
  423. t.bigint "resource_owner_id", null: false
  424. t.index ["resource_owner_id"], name: "index_oauth_access_grants_on_resource_owner_id"
  425. t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
  426. end
  427. create_table "oauth_access_tokens", force: :cascade do |t|
  428. t.string "token", null: false
  429. t.string "refresh_token"
  430. t.integer "expires_in"
  431. t.datetime "revoked_at"
  432. t.datetime "created_at", null: false
  433. t.string "scopes"
  434. t.bigint "application_id"
  435. t.bigint "resource_owner_id"
  436. t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true
  437. t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id"
  438. t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true
  439. end
  440. create_table "oauth_applications", force: :cascade do |t|
  441. t.string "name", null: false
  442. t.string "uid", null: false
  443. t.string "secret", null: false
  444. t.text "redirect_uri", null: false
  445. t.string "scopes", default: "", null: false
  446. t.datetime "created_at"
  447. t.datetime "updated_at"
  448. t.boolean "superapp", default: false, null: false
  449. t.string "website"
  450. t.string "owner_type"
  451. t.bigint "owner_id"
  452. t.boolean "confidential", default: true, null: false
  453. t.index ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type"
  454. t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true
  455. end
  456. create_table "pghero_space_stats", force: :cascade do |t|
  457. t.text "database"
  458. t.text "schema"
  459. t.text "relation"
  460. t.bigint "size"
  461. t.datetime "captured_at"
  462. t.index ["database", "captured_at"], name: "index_pghero_space_stats_on_database_and_captured_at"
  463. end
  464. create_table "poll_votes", force: :cascade do |t|
  465. t.bigint "account_id"
  466. t.bigint "poll_id"
  467. t.integer "choice", default: 0, null: false
  468. t.datetime "created_at", null: false
  469. t.datetime "updated_at", null: false
  470. t.string "uri"
  471. t.index ["account_id"], name: "index_poll_votes_on_account_id"
  472. t.index ["poll_id"], name: "index_poll_votes_on_poll_id"
  473. end
  474. create_table "polls", force: :cascade do |t|
  475. t.bigint "account_id"
  476. t.bigint "status_id"
  477. t.datetime "expires_at"
  478. t.string "options", default: [], null: false, array: true
  479. t.bigint "cached_tallies", default: [], null: false, array: true
  480. t.boolean "multiple", default: false, null: false
  481. t.boolean "hide_totals", default: false, null: false
  482. t.bigint "votes_count", default: 0, null: false
  483. t.datetime "last_fetched_at"
  484. t.datetime "created_at", null: false
  485. t.datetime "updated_at", null: false
  486. t.integer "lock_version", default: 0, null: false
  487. t.bigint "voters_count"
  488. t.index ["account_id"], name: "index_polls_on_account_id"
  489. t.index ["status_id"], name: "index_polls_on_status_id"
  490. end
  491. create_table "preview_cards", force: :cascade do |t|
  492. t.string "url", default: "", null: false
  493. t.string "title", default: "", null: false
  494. t.string "description", default: "", null: false
  495. t.string "image_file_name"
  496. t.string "image_content_type"
  497. t.integer "image_file_size"
  498. t.datetime "image_updated_at"
  499. t.integer "type", default: 0, null: false
  500. t.text "html", default: "", null: false
  501. t.string "author_name", default: "", null: false
  502. t.string "author_url", default: "", null: false
  503. t.string "provider_name", default: "", null: false
  504. t.string "provider_url", default: "", null: false
  505. t.integer "width", default: 0, null: false
  506. t.integer "height", default: 0, null: false
  507. t.datetime "created_at", null: false
  508. t.datetime "updated_at", null: false
  509. t.string "embed_url", default: "", null: false
  510. t.index ["url"], name: "index_preview_cards_on_url", unique: true
  511. end
  512. create_table "preview_cards_statuses", id: false, force: :cascade do |t|
  513. t.bigint "preview_card_id", null: false
  514. t.bigint "status_id", null: false
  515. t.index ["status_id", "preview_card_id"], name: "index_preview_cards_statuses_on_status_id_and_preview_card_id"
  516. end
  517. create_table "relays", force: :cascade do |t|
  518. t.string "inbox_url", default: "", null: false
  519. t.string "follow_activity_id"
  520. t.datetime "created_at", null: false
  521. t.datetime "updated_at", null: false
  522. t.integer "state", default: 0, null: false
  523. end
  524. create_table "report_notes", force: :cascade do |t|
  525. t.text "content", null: false
  526. t.bigint "report_id", null: false
  527. t.bigint "account_id", null: false
  528. t.datetime "created_at", null: false
  529. t.datetime "updated_at", null: false
  530. t.index ["account_id"], name: "index_report_notes_on_account_id"
  531. t.index ["report_id"], name: "index_report_notes_on_report_id"
  532. end
  533. create_table "reports", force: :cascade do |t|
  534. t.bigint "status_ids", default: [], null: false, array: true
  535. t.text "comment", default: "", null: false
  536. t.boolean "action_taken", default: false, null: false
  537. t.datetime "created_at", null: false
  538. t.datetime "updated_at", null: false
  539. t.bigint "account_id", null: false
  540. t.bigint "action_taken_by_account_id"
  541. t.bigint "target_account_id", null: false
  542. t.bigint "assigned_account_id"
  543. t.string "uri"
  544. t.index ["account_id"], name: "index_reports_on_account_id"
  545. t.index ["target_account_id"], name: "index_reports_on_target_account_id"
  546. end
  547. create_table "scheduled_statuses", force: :cascade do |t|
  548. t.bigint "account_id"
  549. t.datetime "scheduled_at"
  550. t.jsonb "params"
  551. t.index ["account_id"], name: "index_scheduled_statuses_on_account_id"
  552. t.index ["scheduled_at"], name: "index_scheduled_statuses_on_scheduled_at"
  553. end
  554. create_table "session_activations", force: :cascade do |t|
  555. t.string "session_id", null: false
  556. t.datetime "created_at", null: false
  557. t.datetime "updated_at", null: false
  558. t.string "user_agent", default: "", null: false
  559. t.inet "ip"
  560. t.bigint "access_token_id"
  561. t.bigint "user_id", null: false
  562. t.bigint "web_push_subscription_id"
  563. t.index ["access_token_id"], name: "index_session_activations_on_access_token_id"
  564. t.index ["session_id"], name: "index_session_activations_on_session_id", unique: true
  565. t.index ["user_id"], name: "index_session_activations_on_user_id"
  566. end
  567. create_table "settings", force: :cascade do |t|
  568. t.string "var", null: false
  569. t.text "value"
  570. t.string "thing_type"
  571. t.datetime "created_at"
  572. t.datetime "updated_at"
  573. t.bigint "thing_id"
  574. t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true
  575. end
  576. create_table "site_uploads", force: :cascade do |t|
  577. t.string "var", default: "", null: false
  578. t.string "file_file_name"
  579. t.string "file_content_type"
  580. t.integer "file_file_size"
  581. t.datetime "file_updated_at"
  582. t.json "meta"
  583. t.datetime "created_at", null: false
  584. t.datetime "updated_at", null: false
  585. t.index ["var"], name: "index_site_uploads_on_var", unique: true
  586. end
  587. create_table "status_pins", force: :cascade do |t|
  588. t.bigint "account_id", null: false
  589. t.bigint "status_id", null: false
  590. t.datetime "created_at", default: -> { "now()" }, null: false
  591. t.datetime "updated_at", default: -> { "now()" }, null: false
  592. t.index ["account_id", "status_id"], name: "index_status_pins_on_account_id_and_status_id", unique: true
  593. end
  594. create_table "status_stats", force: :cascade do |t|
  595. t.bigint "status_id", null: false
  596. t.bigint "replies_count", default: 0, null: false
  597. t.bigint "reblogs_count", default: 0, null: false
  598. t.bigint "favourites_count", default: 0, null: false
  599. t.datetime "created_at", null: false
  600. t.datetime "updated_at", null: false
  601. t.index ["status_id"], name: "index_status_stats_on_status_id", unique: true
  602. end
  603. create_table "statuses", id: :bigint, default: -> { "timestamp_id('statuses'::text)" }, force: :cascade do |t|
  604. t.string "uri"
  605. t.text "text", default: "", null: false
  606. t.datetime "created_at", null: false
  607. t.datetime "updated_at", null: false
  608. t.bigint "in_reply_to_id"
  609. t.bigint "reblog_of_id"
  610. t.string "url"
  611. t.boolean "sensitive", default: false, null: false
  612. t.integer "visibility", default: 0, null: false
  613. t.text "spoiler_text", default: "", null: false
  614. t.boolean "reply", default: false, null: false
  615. t.string "language"
  616. t.bigint "conversation_id"
  617. t.boolean "local"
  618. t.bigint "account_id", null: false
  619. t.bigint "application_id"
  620. t.bigint "in_reply_to_account_id"
  621. t.bigint "poll_id"
  622. t.datetime "deleted_at"
  623. t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
  624. t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"
  625. t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id"
  626. t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id"
  627. t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id"
  628. t.index ["uri"], name: "index_statuses_on_uri", unique: true
  629. end
  630. create_table "statuses_tags", id: false, force: :cascade do |t|
  631. t.bigint "status_id", null: false
  632. t.bigint "tag_id", null: false
  633. t.index ["status_id"], name: "index_statuses_tags_on_status_id"
  634. t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true
  635. end
  636. create_table "stream_entries", force: :cascade do |t|
  637. t.bigint "activity_id"
  638. t.string "activity_type"
  639. t.datetime "created_at", null: false
  640. t.datetime "updated_at", null: false
  641. t.boolean "hidden", default: false, null: false
  642. t.bigint "account_id"
  643. t.index ["account_id", "activity_type", "id"], name: "index_stream_entries_on_account_id_and_activity_type_and_id"
  644. t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type"
  645. end
  646. create_table "subscriptions", force: :cascade do |t|
  647. t.string "callback_url", default: "", null: false
  648. t.string "secret"
  649. t.datetime "expires_at"
  650. t.boolean "confirmed", default: false, null: false
  651. t.datetime "created_at", null: false
  652. t.datetime "updated_at", null: false
  653. t.datetime "last_successful_delivery_at"
  654. t.string "domain"
  655. t.bigint "account_id", null: false
  656. t.index ["account_id", "callback_url"], name: "index_subscriptions_on_account_id_and_callback_url", unique: true
  657. end
  658. create_table "tags", force: :cascade do |t|
  659. t.string "name", default: "", null: false
  660. t.datetime "created_at", null: false
  661. t.datetime "updated_at", null: false
  662. t.boolean "usable"
  663. t.boolean "trendable"
  664. t.boolean "listable"
  665. t.datetime "reviewed_at"
  666. t.datetime "requested_review_at"
  667. t.datetime "last_status_at"
  668. t.float "max_score"
  669. t.datetime "max_score_at"
  670. t.index "lower((name)::text)", name: "index_tags_on_name_lower", unique: true
  671. end
  672. create_table "tombstones", force: :cascade do |t|
  673. t.bigint "account_id"
  674. t.string "uri", null: false
  675. t.datetime "created_at", null: false
  676. t.datetime "updated_at", null: false
  677. t.boolean "by_moderator"
  678. t.index ["account_id"], name: "index_tombstones_on_account_id"
  679. t.index ["uri"], name: "index_tombstones_on_uri"
  680. end
  681. create_table "user_invite_requests", force: :cascade do |t|
  682. t.bigint "user_id"
  683. t.text "text"
  684. t.datetime "created_at", null: false
  685. t.datetime "updated_at", null: false
  686. t.index ["user_id"], name: "index_user_invite_requests_on_user_id"
  687. end
  688. create_table "users", force: :cascade do |t|
  689. t.string "email", default: "", null: false
  690. t.datetime "created_at", null: false
  691. t.datetime "updated_at", null: false
  692. t.string "encrypted_password", default: "", null: false
  693. t.string "reset_password_token"
  694. t.datetime "reset_password_sent_at"
  695. t.datetime "remember_created_at"
  696. t.integer "sign_in_count", default: 0, null: false
  697. t.datetime "current_sign_in_at"
  698. t.datetime "last_sign_in_at"
  699. t.inet "current_sign_in_ip"
  700. t.inet "last_sign_in_ip"
  701. t.boolean "admin", default: false, null: false
  702. t.string "confirmation_token"
  703. t.datetime "confirmed_at"
  704. t.datetime "confirmation_sent_at"
  705. t.string "unconfirmed_email"
  706. t.string "locale"
  707. t.string "encrypted_otp_secret"
  708. t.string "encrypted_otp_secret_iv"
  709. t.string "encrypted_otp_secret_salt"
  710. t.integer "consumed_timestep"
  711. t.boolean "otp_required_for_login", default: false, null: false
  712. t.datetime "last_emailed_at"
  713. t.string "otp_backup_codes", array: true
  714. t.string "filtered_languages", default: [], null: false, array: true
  715. t.bigint "account_id", null: false
  716. t.boolean "disabled", default: false, null: false
  717. t.boolean "moderator", default: false, null: false
  718. t.bigint "invite_id"
  719. t.string "remember_token"
  720. t.string "chosen_languages", array: true
  721. t.bigint "created_by_application_id"
  722. t.boolean "approved", default: true, null: false
  723. t.index ["account_id"], name: "index_users_on_account_id"
  724. t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
  725. t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id"
  726. t.index ["email"], name: "index_users_on_email", unique: true
  727. t.index ["remember_token"], name: "index_users_on_remember_token", unique: true
  728. t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
  729. end
  730. create_table "web_push_subscriptions", force: :cascade do |t|
  731. t.string "endpoint", null: false
  732. t.string "key_p256dh", null: false
  733. t.string "key_auth", null: false
  734. t.json "data"
  735. t.datetime "created_at", null: false
  736. t.datetime "updated_at", null: false
  737. t.bigint "access_token_id"
  738. t.bigint "user_id"
  739. t.index ["access_token_id"], name: "index_web_push_subscriptions_on_access_token_id"
  740. t.index ["user_id"], name: "index_web_push_subscriptions_on_user_id"
  741. end
  742. create_table "web_settings", force: :cascade do |t|
  743. t.json "data"
  744. t.datetime "created_at", null: false
  745. t.datetime "updated_at", null: false
  746. t.bigint "user_id", null: false
  747. t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true
  748. end
  749. add_foreign_key "account_aliases", "accounts", on_delete: :cascade
  750. add_foreign_key "account_conversations", "accounts", on_delete: :cascade
  751. add_foreign_key "account_conversations", "conversations", on_delete: :cascade
  752. add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade
  753. add_foreign_key "account_identity_proofs", "accounts", on_delete: :cascade
  754. add_foreign_key "account_migrations", "accounts", column: "target_account_id", on_delete: :nullify
  755. add_foreign_key "account_migrations", "accounts", on_delete: :cascade
  756. add_foreign_key "account_moderation_notes", "accounts"
  757. add_foreign_key "account_moderation_notes", "accounts", column: "target_account_id"
  758. add_foreign_key "account_pins", "accounts", column: "target_account_id", on_delete: :cascade
  759. add_foreign_key "account_pins", "accounts", on_delete: :cascade
  760. add_foreign_key "account_stats", "accounts", on_delete: :cascade
  761. add_foreign_key "account_tag_stats", "tags", on_delete: :cascade
  762. add_foreign_key "account_warnings", "accounts", column: "target_account_id", on_delete: :cascade
  763. add_foreign_key "account_warnings", "accounts", on_delete: :nullify
  764. add_foreign_key "accounts", "accounts", column: "moved_to_account_id", on_delete: :nullify
  765. add_foreign_key "admin_action_logs", "accounts", on_delete: :cascade
  766. add_foreign_key "backups", "users", on_delete: :nullify
  767. add_foreign_key "blocks", "accounts", column: "target_account_id", name: "fk_9571bfabc1", on_delete: :cascade
  768. add_foreign_key "blocks", "accounts", name: "fk_4269e03e65", on_delete: :cascade
  769. add_foreign_key "conversation_mutes", "accounts", name: "fk_225b4212bb", on_delete: :cascade
  770. add_foreign_key "conversation_mutes", "conversations", on_delete: :cascade
  771. add_foreign_key "custom_filters", "accounts", on_delete: :cascade
  772. add_foreign_key "favourites", "accounts", name: "fk_5eb6c2b873", on_delete: :cascade
  773. add_foreign_key "favourites", "statuses", name: "fk_b0e856845e", on_delete: :cascade
  774. add_foreign_key "featured_tags", "accounts", on_delete: :cascade
  775. add_foreign_key "featured_tags", "tags", on_delete: :cascade
  776. add_foreign_key "follow_requests", "accounts", column: "target_account_id", name: "fk_9291ec025d", on_delete: :cascade
  777. add_foreign_key "follow_requests", "accounts", name: "fk_76d644b0e7", on_delete: :cascade
  778. add_foreign_key "follows", "accounts", column: "target_account_id", name: "fk_745ca29eac", on_delete: :cascade
  779. add_foreign_key "follows", "accounts", name: "fk_32ed1b5560", on_delete: :cascade
  780. add_foreign_key "identities", "users", name: "fk_bea040f377", on_delete: :cascade
  781. add_foreign_key "imports", "accounts", name: "fk_6db1b6e408", on_delete: :cascade
  782. add_foreign_key "invites", "users", on_delete: :cascade
  783. add_foreign_key "list_accounts", "accounts", on_delete: :cascade
  784. add_foreign_key "list_accounts", "follows", on_delete: :cascade
  785. add_foreign_key "list_accounts", "lists", on_delete: :cascade
  786. add_foreign_key "lists", "accounts", on_delete: :cascade
  787. add_foreign_key "markers", "users", on_delete: :cascade
  788. add_foreign_key "media_attachments", "accounts", name: "fk_96dd81e81b", on_delete: :nullify
  789. add_foreign_key "media_attachments", "scheduled_statuses", on_delete: :nullify
  790. add_foreign_key "media_attachments", "statuses", on_delete: :nullify
  791. add_foreign_key "mentions", "accounts", name: "fk_970d43f9d1", on_delete: :cascade
  792. add_foreign_key "mentions", "statuses", on_delete: :cascade
  793. add_foreign_key "mutes", "accounts", column: "target_account_id", name: "fk_eecff219ea", on_delete: :cascade
  794. add_foreign_key "mutes", "accounts", name: "fk_b8d8daf315", on_delete: :cascade
  795. add_foreign_key "notifications", "accounts", column: "from_account_id", name: "fk_fbd6b0bf9e", on_delete: :cascade
  796. add_foreign_key "notifications", "accounts", name: "fk_c141c8ee55", on_delete: :cascade
  797. add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id", name: "fk_34d54b0a33", on_delete: :cascade
  798. add_foreign_key "oauth_access_grants", "users", column: "resource_owner_id", name: "fk_63b044929b", on_delete: :cascade
  799. add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id", name: "fk_f5fc4c1ee3", on_delete: :cascade
  800. add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id", name: "fk_e84df68546", on_delete: :cascade
  801. add_foreign_key "oauth_applications", "users", column: "owner_id", name: "fk_b0988c7c0a", on_delete: :cascade
  802. add_foreign_key "poll_votes", "accounts", on_delete: :cascade
  803. add_foreign_key "poll_votes", "polls", on_delete: :cascade
  804. add_foreign_key "polls", "accounts", on_delete: :cascade
  805. add_foreign_key "polls", "statuses", on_delete: :cascade
  806. add_foreign_key "report_notes", "accounts", on_delete: :cascade
  807. add_foreign_key "report_notes", "reports", on_delete: :cascade
  808. add_foreign_key "reports", "accounts", column: "action_taken_by_account_id", name: "fk_bca45b75fd", on_delete: :nullify
  809. add_foreign_key "reports", "accounts", column: "assigned_account_id", on_delete: :nullify
  810. add_foreign_key "reports", "accounts", column: "target_account_id", name: "fk_eb37af34f0", on_delete: :cascade
  811. add_foreign_key "reports", "accounts", name: "fk_4b81f7522c", on_delete: :cascade
  812. add_foreign_key "scheduled_statuses", "accounts", on_delete: :cascade
  813. add_foreign_key "session_activations", "oauth_access_tokens", column: "access_token_id", name: "fk_957e5bda89", on_delete: :cascade
  814. add_foreign_key "session_activations", "users", name: "fk_e5fda67334", on_delete: :cascade
  815. add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade
  816. add_foreign_key "status_pins", "statuses", on_delete: :cascade
  817. add_foreign_key "status_stats", "statuses", on_delete: :cascade
  818. add_foreign_key "statuses", "accounts", column: "in_reply_to_account_id", name: "fk_c7fa917661", on_delete: :nullify
  819. add_foreign_key "statuses", "accounts", name: "fk_9bda1543f7", on_delete: :cascade
  820. add_foreign_key "statuses", "statuses", column: "in_reply_to_id", on_delete: :nullify
  821. add_foreign_key "statuses", "statuses", column: "reblog_of_id", on_delete: :cascade
  822. add_foreign_key "statuses_tags", "statuses", on_delete: :cascade
  823. add_foreign_key "statuses_tags", "tags", name: "fk_3081861e21", on_delete: :cascade
  824. add_foreign_key "tombstones", "accounts", on_delete: :cascade
  825. add_foreign_key "user_invite_requests", "users", on_delete: :cascade
  826. add_foreign_key "users", "accounts", name: "fk_50500f500d", on_delete: :cascade
  827. add_foreign_key "users", "invites", on_delete: :nullify
  828. add_foreign_key "users", "oauth_applications", column: "created_by_application_id", on_delete: :nullify
  829. add_foreign_key "web_push_subscriptions", "oauth_access_tokens", column: "access_token_id", on_delete: :cascade
  830. add_foreign_key "web_push_subscriptions", "users", on_delete: :cascade
  831. add_foreign_key "web_settings", "users", name: "fk_11910667b2", on_delete: :cascade
  832. end