闭社主体 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.

338 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: 20170112154826) 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.index ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree
  44. end
  45. create_table "blocks", force: :cascade do |t|
  46. t.integer "account_id", null: false
  47. t.integer "target_account_id", null: false
  48. t.datetime "created_at", null: false
  49. t.datetime "updated_at", null: false
  50. t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true, using: :btree
  51. end
  52. create_table "domain_blocks", force: :cascade do |t|
  53. t.string "domain", default: "", null: false
  54. t.datetime "created_at", null: false
  55. t.datetime "updated_at", null: false
  56. t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true, using: :btree
  57. end
  58. create_table "favourites", force: :cascade do |t|
  59. t.integer "account_id", null: false
  60. t.integer "status_id", null: false
  61. t.datetime "created_at", null: false
  62. t.datetime "updated_at", null: false
  63. t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree
  64. end
  65. create_table "follow_requests", force: :cascade do |t|
  66. t.integer "account_id", null: false
  67. t.integer "target_account_id", null: false
  68. t.datetime "created_at", null: false
  69. t.datetime "updated_at", null: false
  70. t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true, using: :btree
  71. end
  72. create_table "follows", force: :cascade do |t|
  73. t.integer "account_id", null: false
  74. t.integer "target_account_id", null: false
  75. t.datetime "created_at", null: false
  76. t.datetime "updated_at", null: false
  77. t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true, using: :btree
  78. end
  79. create_table "media_attachments", force: :cascade do |t|
  80. t.integer "status_id"
  81. t.string "file_file_name"
  82. t.string "file_content_type"
  83. t.integer "file_file_size"
  84. t.datetime "file_updated_at"
  85. t.string "remote_url", default: "", null: false
  86. t.integer "account_id"
  87. t.datetime "created_at", null: false
  88. t.datetime "updated_at", null: false
  89. t.string "shortcode"
  90. t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true, using: :btree
  91. t.index ["status_id"], name: "index_media_attachments_on_status_id", using: :btree
  92. end
  93. create_table "mentions", force: :cascade do |t|
  94. t.integer "account_id"
  95. t.integer "status_id"
  96. t.datetime "created_at", null: false
  97. t.datetime "updated_at", null: false
  98. t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
  99. end
  100. create_table "notifications", force: :cascade do |t|
  101. t.integer "account_id"
  102. t.integer "activity_id"
  103. t.string "activity_type"
  104. t.datetime "created_at", null: false
  105. t.datetime "updated_at", null: false
  106. t.integer "from_account_id"
  107. t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true, using: :btree
  108. end
  109. create_table "oauth_access_grants", force: :cascade do |t|
  110. t.integer "resource_owner_id", null: false
  111. t.integer "application_id", null: false
  112. t.string "token", null: false
  113. t.integer "expires_in", null: false
  114. t.text "redirect_uri", null: false
  115. t.datetime "created_at", null: false
  116. t.datetime "revoked_at"
  117. t.string "scopes"
  118. t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
  119. end
  120. create_table "oauth_access_tokens", force: :cascade do |t|
  121. t.integer "resource_owner_id"
  122. t.integer "application_id"
  123. t.string "token", null: false
  124. t.string "refresh_token"
  125. t.integer "expires_in"
  126. t.datetime "revoked_at"
  127. t.datetime "created_at", null: false
  128. t.string "scopes"
  129. t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
  130. t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
  131. t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
  132. end
  133. create_table "oauth_applications", force: :cascade do |t|
  134. t.string "name", null: false
  135. t.string "uid", null: false
  136. t.string "secret", null: false
  137. t.text "redirect_uri", null: false
  138. t.string "scopes", default: "", null: false
  139. t.datetime "created_at"
  140. t.datetime "updated_at"
  141. t.boolean "superapp", default: false, null: false
  142. t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
  143. end
  144. create_table "pubsubhubbub_subscriptions", force: :cascade do |t|
  145. t.string "topic", default: "", null: false
  146. t.string "callback", default: "", null: false
  147. t.string "mode", default: "", null: false
  148. t.string "challenge", default: "", null: false
  149. t.string "secret"
  150. t.boolean "confirmed", default: false, null: false
  151. t.datetime "expires_at", null: false
  152. t.datetime "created_at", null: false
  153. t.datetime "updated_at", null: false
  154. t.index ["topic", "callback"], name: "index_pubsubhubbub_subscriptions_on_topic_and_callback", unique: true, using: :btree
  155. end
  156. create_table "push_devices", force: :cascade do |t|
  157. t.string "service", default: "", null: false
  158. t.string "token", default: "", null: false
  159. t.integer "account", null: false
  160. t.datetime "created_at", null: false
  161. t.datetime "updated_at", null: false
  162. t.index ["service", "token"], name: "index_push_devices_on_service_and_token", unique: true, using: :btree
  163. end
  164. create_table "rpush_apps", force: :cascade do |t|
  165. t.string "name", null: false
  166. t.string "environment"
  167. t.text "certificate"
  168. t.string "password"
  169. t.integer "connections", default: 1, null: false
  170. t.datetime "created_at", null: false
  171. t.datetime "updated_at", null: false
  172. t.string "type", null: false
  173. t.string "auth_key"
  174. t.string "client_id"
  175. t.string "client_secret"
  176. t.string "access_token"
  177. t.datetime "access_token_expiration"
  178. end
  179. create_table "rpush_feedback", force: :cascade do |t|
  180. t.string "device_token", limit: 64, null: false
  181. t.datetime "failed_at", null: false
  182. t.datetime "created_at", null: false
  183. t.datetime "updated_at", null: false
  184. t.integer "app_id"
  185. t.index ["device_token"], name: "index_rpush_feedback_on_device_token", using: :btree
  186. end
  187. create_table "rpush_notifications", force: :cascade do |t|
  188. t.integer "badge"
  189. t.string "device_token", limit: 64
  190. t.string "sound", default: "default"
  191. t.text "alert"
  192. t.text "data"
  193. t.integer "expiry", default: 86400
  194. t.boolean "delivered", default: false, null: false
  195. t.datetime "delivered_at"
  196. t.boolean "failed", default: false, null: false
  197. t.datetime "failed_at"
  198. t.integer "error_code"
  199. t.text "error_description"
  200. t.datetime "deliver_after"
  201. t.datetime "created_at", null: false
  202. t.datetime "updated_at", null: false
  203. t.boolean "alert_is_json", default: false
  204. t.string "type", null: false
  205. t.string "collapse_key"
  206. t.boolean "delay_while_idle", default: false, null: false
  207. t.text "registration_ids"
  208. t.integer "app_id", null: false
  209. t.integer "retries", default: 0
  210. t.string "uri"
  211. t.datetime "fail_after"
  212. t.boolean "processing", default: false, null: false
  213. t.integer "priority"
  214. t.text "url_args"
  215. t.string "category"
  216. t.boolean "content_available", default: false
  217. t.text "notification"
  218. t.index ["delivered", "failed"], name: "index_rpush_notifications_multi", where: "((NOT delivered) AND (NOT failed))", using: :btree
  219. end
  220. create_table "settings", force: :cascade do |t|
  221. t.string "var", null: false
  222. t.text "value"
  223. t.string "thing_type"
  224. t.integer "thing_id"
  225. t.datetime "created_at"
  226. t.datetime "updated_at"
  227. t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
  228. end
  229. create_table "statuses", force: :cascade do |t|
  230. t.string "uri"
  231. t.integer "account_id", null: false
  232. t.text "text", default: "", null: false
  233. t.datetime "created_at", null: false
  234. t.datetime "updated_at", null: false
  235. t.integer "in_reply_to_id"
  236. t.integer "reblog_of_id"
  237. t.string "url"
  238. t.boolean "sensitive", default: false
  239. t.integer "visibility", default: 0, null: false
  240. t.integer "in_reply_to_account_id"
  241. t.index ["account_id"], name: "index_statuses_on_account_id", using: :btree
  242. t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree
  243. t.index ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree
  244. t.index ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
  245. end
  246. create_table "statuses_tags", id: false, force: :cascade do |t|
  247. t.integer "status_id", null: false
  248. t.integer "tag_id", null: false
  249. t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true, using: :btree
  250. end
  251. create_table "stream_entries", force: :cascade do |t|
  252. t.integer "account_id"
  253. t.integer "activity_id"
  254. t.string "activity_type"
  255. t.datetime "created_at", null: false
  256. t.datetime "updated_at", null: false
  257. t.boolean "hidden", default: false, null: false
  258. t.index ["account_id"], name: "index_stream_entries_on_account_id", using: :btree
  259. t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type", using: :btree
  260. end
  261. create_table "subscriptions", force: :cascade do |t|
  262. t.string "callback_url", default: "", null: false
  263. t.string "secret"
  264. t.datetime "expires_at"
  265. t.boolean "confirmed", default: false, null: false
  266. t.integer "account_id", null: false
  267. t.datetime "created_at", null: false
  268. t.datetime "updated_at", null: false
  269. t.datetime "last_successful_delivery_at"
  270. t.index ["callback_url", "account_id"], name: "index_subscriptions_on_callback_url_and_account_id", unique: true, using: :btree
  271. end
  272. create_table "tags", force: :cascade do |t|
  273. t.string "name", default: "", null: false
  274. t.datetime "created_at", null: false
  275. t.datetime "updated_at", null: false
  276. t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree
  277. end
  278. create_table "users", force: :cascade do |t|
  279. t.string "email", default: "", null: false
  280. t.integer "account_id", null: false
  281. t.datetime "created_at", null: false
  282. t.datetime "updated_at", null: false
  283. t.string "encrypted_password", default: "", null: false
  284. t.string "reset_password_token"
  285. t.datetime "reset_password_sent_at"
  286. t.datetime "remember_created_at"
  287. t.integer "sign_in_count", default: 0, null: false
  288. t.datetime "current_sign_in_at"
  289. t.datetime "last_sign_in_at"
  290. t.inet "current_sign_in_ip"
  291. t.inet "last_sign_in_ip"
  292. t.boolean "admin", default: false
  293. t.string "confirmation_token"
  294. t.datetime "confirmed_at"
  295. t.datetime "confirmation_sent_at"
  296. t.string "unconfirmed_email"
  297. t.string "locale"
  298. t.index ["account_id"], name: "index_users_on_account_id", using: :btree
  299. t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
  300. t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
  301. t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  302. end
  303. create_table "web_settings", force: :cascade do |t|
  304. t.integer "user_id"
  305. t.json "data"
  306. t.datetime "created_at", null: false
  307. t.datetime "updated_at", null: false
  308. t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true, using: :btree
  309. end
  310. end