schema.rb 38 KB

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