schema.rb 37 KB

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