schema.rb 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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: 20170507141759) do
  13. # These are extensions that must be enabled in order to support this database
  14. enable_extension "plpgsql"
  15. create_table "accounts", force: :cascade do |t|
  16. t.string "username", default: "", null: false
  17. t.string "domain"
  18. t.string "secret", default: "", null: false
  19. t.text "private_key"
  20. t.text "public_key", default: "", null: false
  21. t.string "remote_url", default: "", null: false
  22. t.string "salmon_url", default: "", null: false
  23. t.string "hub_url", default: "", null: false
  24. t.datetime "created_at", null: false
  25. t.datetime "updated_at", null: false
  26. t.text "note", default: "", null: false
  27. t.string "display_name", default: "", null: false
  28. t.string "uri", default: "", null: false
  29. t.string "url"
  30. t.string "avatar_file_name"
  31. t.string "avatar_content_type"
  32. t.integer "avatar_file_size"
  33. t.datetime "avatar_updated_at"
  34. t.string "header_file_name"
  35. t.string "header_content_type"
  36. t.integer "header_file_size"
  37. t.datetime "header_updated_at"
  38. t.string "avatar_remote_url"
  39. t.datetime "subscription_expires_at"
  40. t.boolean "silenced", default: false, null: false
  41. t.boolean "suspended", default: false, null: false
  42. t.boolean "locked", default: false, null: false
  43. t.string "header_remote_url", default: "", null: false
  44. t.integer "statuses_count", default: 0, null: false
  45. t.integer "followers_count", default: 0, null: false
  46. t.integer "following_count", default: 0, null: false
  47. t.datetime "last_webfingered_at"
  48. 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
  49. t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", using: :btree
  50. t.index ["url"], name: "index_accounts_on_url", using: :btree
  51. t.index ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree
  52. end
  53. create_table "blocks", force: :cascade do |t|
  54. t.integer "account_id", null: false
  55. t.integer "target_account_id", null: false
  56. t.datetime "created_at", null: false
  57. t.datetime "updated_at", null: false
  58. t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true, using: :btree
  59. end
  60. create_table "domain_blocks", force: :cascade do |t|
  61. t.string "domain", default: "", null: false
  62. t.datetime "created_at", null: false
  63. t.datetime "updated_at", null: false
  64. t.integer "severity", default: 0
  65. t.boolean "reject_media"
  66. t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true, using: :btree
  67. end
  68. create_table "favourites", force: :cascade do |t|
  69. t.integer "account_id", null: false
  70. t.integer "status_id", null: false
  71. t.datetime "created_at", null: false
  72. t.datetime "updated_at", null: false
  73. t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree
  74. t.index ["status_id"], name: "index_favourites_on_status_id", using: :btree
  75. end
  76. create_table "follow_requests", force: :cascade do |t|
  77. t.integer "account_id", null: false
  78. t.integer "target_account_id", null: false
  79. t.datetime "created_at", null: false
  80. t.datetime "updated_at", null: false
  81. t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true, using: :btree
  82. end
  83. create_table "follows", force: :cascade do |t|
  84. t.integer "account_id", null: false
  85. t.integer "target_account_id", null: false
  86. t.datetime "created_at", null: false
  87. t.datetime "updated_at", null: false
  88. t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true, using: :btree
  89. end
  90. create_table "imports", force: :cascade do |t|
  91. t.integer "account_id", null: false
  92. t.integer "type", null: false
  93. t.boolean "approved"
  94. t.datetime "created_at", null: false
  95. t.datetime "updated_at", null: false
  96. t.string "data_file_name"
  97. t.string "data_content_type"
  98. t.integer "data_file_size"
  99. t.datetime "data_updated_at"
  100. end
  101. create_table "media_attachments", force: :cascade do |t|
  102. t.bigint "status_id"
  103. t.string "file_file_name"
  104. t.string "file_content_type"
  105. t.integer "file_file_size"
  106. t.datetime "file_updated_at"
  107. t.string "remote_url", default: "", null: false
  108. t.integer "account_id"
  109. t.datetime "created_at", null: false
  110. t.datetime "updated_at", null: false
  111. t.string "shortcode"
  112. t.integer "type", default: 0, null: false
  113. t.json "file_meta"
  114. t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true, using: :btree
  115. t.index ["status_id"], name: "index_media_attachments_on_status_id", using: :btree
  116. end
  117. create_table "mentions", force: :cascade do |t|
  118. t.integer "account_id"
  119. t.bigint "status_id"
  120. t.datetime "created_at", null: false
  121. t.datetime "updated_at", null: false
  122. t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
  123. t.index ["status_id"], name: "index_mentions_on_status_id", using: :btree
  124. end
  125. create_table "mutes", force: :cascade do |t|
  126. t.integer "account_id", null: false
  127. t.integer "target_account_id", null: false
  128. t.datetime "created_at", null: false
  129. t.datetime "updated_at", null: false
  130. t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true, using: :btree
  131. end
  132. create_table "notifications", force: :cascade do |t|
  133. t.integer "account_id"
  134. t.bigint "activity_id"
  135. t.string "activity_type"
  136. t.datetime "created_at", null: false
  137. t.datetime "updated_at", null: false
  138. t.integer "from_account_id"
  139. t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true, using: :btree
  140. t.index ["activity_id", "activity_type"], name: "index_notifications_on_activity_id_and_activity_type", using: :btree
  141. end
  142. create_table "oauth_access_grants", force: :cascade do |t|
  143. t.integer "resource_owner_id", null: false
  144. t.integer "application_id", null: false
  145. t.string "token", null: false
  146. t.integer "expires_in", null: false
  147. t.text "redirect_uri", null: false
  148. t.datetime "created_at", null: false
  149. t.datetime "revoked_at"
  150. t.string "scopes"
  151. t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
  152. end
  153. create_table "oauth_access_tokens", force: :cascade do |t|
  154. t.integer "resource_owner_id"
  155. t.integer "application_id"
  156. t.string "token", null: false
  157. t.string "refresh_token"
  158. t.integer "expires_in"
  159. t.datetime "revoked_at"
  160. t.datetime "created_at", null: false
  161. t.string "scopes"
  162. t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
  163. t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
  164. t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
  165. end
  166. create_table "oauth_applications", force: :cascade do |t|
  167. t.string "name", null: false
  168. t.string "uid", null: false
  169. t.string "secret", null: false
  170. t.text "redirect_uri", null: false
  171. t.string "scopes", default: "", null: false
  172. t.datetime "created_at"
  173. t.datetime "updated_at"
  174. t.boolean "superapp", default: false, null: false
  175. t.string "website"
  176. t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
  177. end
  178. create_table "preview_cards", force: :cascade do |t|
  179. t.bigint "status_id"
  180. t.string "url", default: "", null: false
  181. t.string "title"
  182. t.string "description"
  183. t.string "image_file_name"
  184. t.string "image_content_type"
  185. t.integer "image_file_size"
  186. t.datetime "image_updated_at"
  187. t.datetime "created_at", null: false
  188. t.datetime "updated_at", null: false
  189. t.integer "type", default: 0, null: false
  190. t.text "html", default: "", null: false
  191. t.string "author_name", default: "", null: false
  192. t.string "author_url", default: "", null: false
  193. t.string "provider_name", default: "", null: false
  194. t.string "provider_url", default: "", null: false
  195. t.integer "width", default: 0, null: false
  196. t.integer "height", default: 0, null: false
  197. t.index ["status_id"], name: "index_preview_cards_on_status_id", unique: true, using: :btree
  198. end
  199. create_table "reports", force: :cascade do |t|
  200. t.integer "account_id", null: false
  201. t.integer "target_account_id", null: false
  202. t.bigint "status_ids", default: [], null: false, array: true
  203. t.text "comment", default: "", null: false
  204. t.boolean "action_taken", default: false, null: false
  205. t.datetime "created_at", null: false
  206. t.datetime "updated_at", null: false
  207. t.integer "action_taken_by_account_id"
  208. t.index ["account_id"], name: "index_reports_on_account_id", using: :btree
  209. t.index ["target_account_id"], name: "index_reports_on_target_account_id", using: :btree
  210. end
  211. create_table "settings", force: :cascade do |t|
  212. t.string "var", null: false
  213. t.text "value"
  214. t.string "thing_type"
  215. t.integer "thing_id"
  216. t.datetime "created_at"
  217. t.datetime "updated_at"
  218. t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
  219. end
  220. create_table "statuses", id: :bigserial, force: :cascade do |t|
  221. t.string "uri"
  222. t.integer "account_id", null: false
  223. t.text "text", default: "", null: false
  224. t.datetime "created_at", null: false
  225. t.datetime "updated_at", null: false
  226. t.bigint "in_reply_to_id"
  227. t.bigint "reblog_of_id"
  228. t.string "url"
  229. t.boolean "sensitive", default: false
  230. t.integer "visibility", default: 0, null: false
  231. t.integer "in_reply_to_account_id"
  232. t.integer "application_id"
  233. t.text "spoiler_text", default: "", null: false
  234. t.boolean "reply", default: false
  235. t.integer "favourites_count", default: 0, null: false
  236. t.integer "reblogs_count", default: 0, null: false
  237. t.string "language", default: "en", null: false
  238. t.index ["account_id"], name: "index_statuses_on_account_id", using: :btree
  239. t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree
  240. t.index ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree
  241. t.index ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
  242. end
  243. create_table "statuses_tags", id: false, force: :cascade do |t|
  244. t.bigint "status_id", null: false
  245. t.integer "tag_id", null: false
  246. t.index ["status_id"], name: "index_statuses_tags_on_status_id", using: :btree
  247. t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true, using: :btree
  248. end
  249. create_table "stream_entries", force: :cascade do |t|
  250. t.integer "account_id"
  251. t.bigint "activity_id"
  252. t.string "activity_type"
  253. t.datetime "created_at", null: false
  254. t.datetime "updated_at", null: false
  255. t.boolean "hidden", default: false, null: false
  256. t.index ["account_id"], name: "index_stream_entries_on_account_id", using: :btree
  257. t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type", using: :btree
  258. end
  259. create_table "subscriptions", force: :cascade do |t|
  260. t.string "callback_url", default: "", null: false
  261. t.string "secret"
  262. t.datetime "expires_at"
  263. t.boolean "confirmed", default: false, null: false
  264. t.integer "account_id", null: false
  265. t.datetime "created_at", null: false
  266. t.datetime "updated_at", null: false
  267. t.datetime "last_successful_delivery_at"
  268. t.index ["account_id", "callback_url"], name: "index_subscriptions_on_account_id_and_callback_url", unique: true, using: :btree
  269. end
  270. create_table "tags", force: :cascade do |t|
  271. t.string "name", default: "", null: false
  272. t.datetime "created_at", null: false
  273. t.datetime "updated_at", null: false
  274. t.index "to_tsvector('simple'::regconfig, (name)::text)", name: "hashtag_search_index", using: :gin
  275. t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree
  276. end
  277. create_table "users", force: :cascade do |t|
  278. t.string "email", default: "", null: false
  279. t.integer "account_id", null: false
  280. t.datetime "created_at", null: false
  281. t.datetime "updated_at", null: false
  282. t.string "encrypted_password", default: "", null: false
  283. t.string "reset_password_token"
  284. t.datetime "reset_password_sent_at"
  285. t.datetime "remember_created_at"
  286. t.integer "sign_in_count", default: 0, null: false
  287. t.datetime "current_sign_in_at"
  288. t.datetime "last_sign_in_at"
  289. t.inet "current_sign_in_ip"
  290. t.inet "last_sign_in_ip"
  291. t.boolean "admin", default: false
  292. t.string "confirmation_token"
  293. t.datetime "confirmed_at"
  294. t.datetime "confirmation_sent_at"
  295. t.string "unconfirmed_email"
  296. t.string "locale"
  297. t.string "encrypted_otp_secret"
  298. t.string "encrypted_otp_secret_iv"
  299. t.string "encrypted_otp_secret_salt"
  300. t.integer "consumed_timestep"
  301. t.boolean "otp_required_for_login"
  302. t.datetime "last_emailed_at"
  303. t.string "otp_backup_codes", array: true
  304. t.string "allowed_languages", default: [], null: false, array: true
  305. t.index ["account_id"], name: "index_users_on_account_id", using: :btree
  306. t.index ["allowed_languages"], name: "index_users_on_allowed_languages", using: :gin
  307. t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
  308. t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
  309. t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  310. end
  311. create_table "web_settings", force: :cascade do |t|
  312. t.integer "user_id"
  313. t.json "data"
  314. t.datetime "created_at", null: false
  315. t.datetime "updated_at", null: false
  316. t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true, using: :btree
  317. end
  318. add_foreign_key "statuses", "statuses", column: "reblog_of_id", on_delete: :cascade
  319. end