闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

325 lines
15 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  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: 20170403172249) 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.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
  48. t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", using: :btree
  49. t.index ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree
  50. end
  51. create_table "blocks", force: :cascade do |t|
  52. t.integer "account_id", null: false
  53. t.integer "target_account_id", null: false
  54. t.datetime "created_at", null: false
  55. t.datetime "updated_at", null: false
  56. t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true, using: :btree
  57. end
  58. create_table "domain_blocks", force: :cascade do |t|
  59. t.string "domain", default: "", null: false
  60. t.datetime "created_at", null: false
  61. t.datetime "updated_at", null: false
  62. t.integer "severity", default: 0
  63. t.boolean "reject_media"
  64. t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true, using: :btree
  65. end
  66. create_table "favourites", force: :cascade do |t|
  67. t.integer "account_id", null: false
  68. t.integer "status_id", null: false
  69. t.datetime "created_at", null: false
  70. t.datetime "updated_at", null: false
  71. t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree
  72. end
  73. create_table "follow_requests", force: :cascade do |t|
  74. t.integer "account_id", null: false
  75. t.integer "target_account_id", null: false
  76. t.datetime "created_at", null: false
  77. t.datetime "updated_at", null: false
  78. t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true, using: :btree
  79. end
  80. create_table "follows", force: :cascade do |t|
  81. t.integer "account_id", null: false
  82. t.integer "target_account_id", null: false
  83. t.datetime "created_at", null: false
  84. t.datetime "updated_at", null: false
  85. t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true, using: :btree
  86. end
  87. create_table "imports", force: :cascade do |t|
  88. t.integer "account_id", null: false
  89. t.integer "type", null: false
  90. t.boolean "approved"
  91. t.datetime "created_at", null: false
  92. t.datetime "updated_at", null: false
  93. t.string "data_file_name"
  94. t.string "data_content_type"
  95. t.integer "data_file_size"
  96. t.datetime "data_updated_at"
  97. end
  98. create_table "media_attachments", force: :cascade do |t|
  99. t.bigint "status_id"
  100. t.string "file_file_name"
  101. t.string "file_content_type"
  102. t.integer "file_file_size"
  103. t.datetime "file_updated_at"
  104. t.string "remote_url", default: "", null: false
  105. t.integer "account_id"
  106. t.datetime "created_at", null: false
  107. t.datetime "updated_at", null: false
  108. t.string "shortcode"
  109. t.integer "type", default: 0, null: false
  110. t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true, using: :btree
  111. t.index ["status_id"], name: "index_media_attachments_on_status_id", using: :btree
  112. end
  113. create_table "mentions", force: :cascade do |t|
  114. t.integer "account_id"
  115. t.bigint "status_id"
  116. t.datetime "created_at", null: false
  117. t.datetime "updated_at", null: false
  118. t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
  119. end
  120. create_table "mutes", force: :cascade do |t|
  121. t.integer "account_id", null: false
  122. t.integer "target_account_id", null: false
  123. t.datetime "created_at", null: false
  124. t.datetime "updated_at", null: false
  125. t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true, using: :btree
  126. end
  127. create_table "notifications", force: :cascade do |t|
  128. t.integer "account_id"
  129. t.bigint "activity_id"
  130. t.string "activity_type"
  131. t.datetime "created_at", null: false
  132. t.datetime "updated_at", null: false
  133. t.integer "from_account_id"
  134. t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true, using: :btree
  135. end
  136. create_table "oauth_access_grants", force: :cascade do |t|
  137. t.integer "resource_owner_id", null: false
  138. t.integer "application_id", null: false
  139. t.string "token", null: false
  140. t.integer "expires_in", null: false
  141. t.text "redirect_uri", null: false
  142. t.datetime "created_at", null: false
  143. t.datetime "revoked_at"
  144. t.string "scopes"
  145. t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
  146. end
  147. create_table "oauth_access_tokens", force: :cascade do |t|
  148. t.integer "resource_owner_id"
  149. t.integer "application_id"
  150. t.string "token", null: false
  151. t.string "refresh_token"
  152. t.integer "expires_in"
  153. t.datetime "revoked_at"
  154. t.datetime "created_at", null: false
  155. t.string "scopes"
  156. t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
  157. t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
  158. t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
  159. end
  160. create_table "oauth_applications", force: :cascade do |t|
  161. t.string "name", null: false
  162. t.string "uid", null: false
  163. t.string "secret", null: false
  164. t.text "redirect_uri", null: false
  165. t.string "scopes", default: "", null: false
  166. t.datetime "created_at"
  167. t.datetime "updated_at"
  168. t.boolean "superapp", default: false, null: false
  169. t.string "website"
  170. t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
  171. end
  172. create_table "preview_cards", force: :cascade do |t|
  173. t.bigint "status_id"
  174. t.string "url", default: "", null: false
  175. t.string "title"
  176. t.string "description"
  177. t.string "image_file_name"
  178. t.string "image_content_type"
  179. t.integer "image_file_size"
  180. t.datetime "image_updated_at"
  181. t.datetime "created_at", null: false
  182. t.datetime "updated_at", null: false
  183. t.index ["status_id"], name: "index_preview_cards_on_status_id", unique: true, using: :btree
  184. end
  185. create_table "reports", force: :cascade do |t|
  186. t.integer "account_id", null: false
  187. t.integer "target_account_id", null: false
  188. t.bigint "status_ids", default: [], null: false, array: true
  189. t.text "comment", default: "", null: false
  190. t.boolean "action_taken", default: false, null: false
  191. t.datetime "created_at", null: false
  192. t.datetime "updated_at", null: false
  193. t.integer "action_taken_by_account_id"
  194. end
  195. create_table "settings", force: :cascade do |t|
  196. t.string "var", null: false
  197. t.text "value"
  198. t.string "thing_type"
  199. t.integer "thing_id"
  200. t.datetime "created_at"
  201. t.datetime "updated_at"
  202. t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
  203. end
  204. create_table "statuses", id: :bigserial, force: :cascade do |t|
  205. t.string "uri"
  206. t.integer "account_id", null: false
  207. t.text "text", default: "", null: false
  208. t.datetime "created_at", null: false
  209. t.datetime "updated_at", null: false
  210. t.bigint "in_reply_to_id"
  211. t.bigint "reblog_of_id"
  212. t.string "url"
  213. t.boolean "sensitive", default: false
  214. t.integer "visibility", default: 0, null: false
  215. t.integer "in_reply_to_account_id"
  216. t.integer "application_id"
  217. t.text "spoiler_text", default: "", null: false
  218. t.boolean "reply", default: false
  219. t.integer "favourites_count", default: 0, null: false
  220. t.integer "reblogs_count", default: 0, null: false
  221. t.index ["account_id"], name: "index_statuses_on_account_id", using: :btree
  222. t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree
  223. t.index ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree
  224. t.index ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
  225. end
  226. create_table "statuses_tags", id: false, force: :cascade do |t|
  227. t.bigint "status_id", null: false
  228. t.integer "tag_id", null: false
  229. t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true, using: :btree
  230. end
  231. create_table "stream_entries", force: :cascade do |t|
  232. t.integer "account_id"
  233. t.bigint "activity_id"
  234. t.string "activity_type"
  235. t.datetime "created_at", null: false
  236. t.datetime "updated_at", null: false
  237. t.boolean "hidden", default: false, null: false
  238. t.index ["account_id"], name: "index_stream_entries_on_account_id", using: :btree
  239. t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type", using: :btree
  240. end
  241. create_table "subscriptions", force: :cascade do |t|
  242. t.string "callback_url", default: "", null: false
  243. t.string "secret"
  244. t.datetime "expires_at"
  245. t.boolean "confirmed", default: false, null: false
  246. t.integer "account_id", null: false
  247. t.datetime "created_at", null: false
  248. t.datetime "updated_at", null: false
  249. t.datetime "last_successful_delivery_at"
  250. t.index ["callback_url", "account_id"], name: "index_subscriptions_on_callback_url_and_account_id", unique: true, using: :btree
  251. end
  252. create_table "tags", force: :cascade do |t|
  253. t.string "name", default: "", null: false
  254. t.datetime "created_at", null: false
  255. t.datetime "updated_at", null: false
  256. t.index "to_tsvector('simple'::regconfig, (name)::text)", name: "hashtag_search_index", using: :gin
  257. t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree
  258. end
  259. create_table "users", force: :cascade do |t|
  260. t.string "email", default: "", null: false
  261. t.integer "account_id", null: false
  262. t.datetime "created_at", null: false
  263. t.datetime "updated_at", null: false
  264. t.string "encrypted_password", default: "", null: false
  265. t.string "reset_password_token"
  266. t.datetime "reset_password_sent_at"
  267. t.datetime "remember_created_at"
  268. t.integer "sign_in_count", default: 0, null: false
  269. t.datetime "current_sign_in_at"
  270. t.datetime "last_sign_in_at"
  271. t.inet "current_sign_in_ip"
  272. t.inet "last_sign_in_ip"
  273. t.boolean "admin", default: false
  274. t.string "confirmation_token"
  275. t.datetime "confirmed_at"
  276. t.datetime "confirmation_sent_at"
  277. t.string "unconfirmed_email"
  278. t.string "locale"
  279. t.string "encrypted_otp_secret"
  280. t.string "encrypted_otp_secret_iv"
  281. t.string "encrypted_otp_secret_salt"
  282. t.integer "consumed_timestep"
  283. t.boolean "otp_required_for_login"
  284. t.datetime "last_emailed_at"
  285. t.index ["account_id"], name: "index_users_on_account_id", using: :btree
  286. t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
  287. t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
  288. t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  289. end
  290. create_table "web_settings", force: :cascade do |t|
  291. t.integer "user_id"
  292. t.json "data"
  293. t.datetime "created_at", null: false
  294. t.datetime "updated_at", null: false
  295. t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true, using: :btree
  296. end
  297. add_foreign_key "statuses", "statuses", column: "reblog_of_id", on_delete: :cascade
  298. end