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

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