1
0

schema.rb 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. # encoding: UTF-8
  2. # This file is auto-generated from the current state of the database. Instead
  3. # of editing this file, please use the migrations feature of Active Record to
  4. # incrementally modify your database, and then regenerate this schema definition.
  5. #
  6. # Note that this schema.rb definition is the authoritative source for your
  7. # database schema. If you need to create the application database on another
  8. # system, you should be using db:schema:load, not running all the migrations
  9. # from scratch. The latter is a flawed and unsustainable approach (the more migrations
  10. # you'll amass, the slower it'll run and the greater likelihood for issues).
  11. #
  12. # It's strongly recommended that you check this file into your version control system.
  13. ActiveRecord::Schema.define(version: 20150808115436) do
  14. create_table "agent_logs", force: :cascade do |t|
  15. t.integer "agent_id", limit: 4, null: false
  16. t.text "message", limit: 65535, null: false, charset: "utf8mb4", collation: "utf8mb4_bin"
  17. t.integer "level", limit: 4, default: 3, null: false
  18. t.integer "inbound_event_id", limit: 4
  19. t.integer "outbound_event_id", limit: 4
  20. t.datetime "created_at"
  21. t.datetime "updated_at"
  22. end
  23. create_table "agents", force: :cascade do |t|
  24. t.integer "user_id", limit: 4
  25. t.text "options", limit: 65535, charset: "utf8mb4", collation: "utf8mb4_bin"
  26. t.string "type", limit: 255, collation: "utf8_bin"
  27. t.string "name", limit: 255, charset: "utf8mb4", collation: "utf8mb4_bin"
  28. t.string "schedule", limit: 255, collation: "utf8_bin"
  29. t.integer "events_count", limit: 4, default: 0, null: false
  30. t.datetime "last_check_at"
  31. t.datetime "last_receive_at"
  32. t.integer "last_checked_event_id", limit: 4
  33. t.datetime "created_at"
  34. t.datetime "updated_at"
  35. t.text "memory", limit: 4294967295, charset: "utf8mb4", collation: "utf8mb4_bin"
  36. t.datetime "last_web_request_at"
  37. t.integer "keep_events_for", limit: 4, default: 0, null: false
  38. t.datetime "last_event_at"
  39. t.datetime "last_error_log_at"
  40. t.boolean "propagate_immediately", limit: 1, default: false, null: false
  41. t.boolean "disabled", limit: 1, default: false, null: false
  42. t.string "guid", limit: 255, null: false, charset: "ascii", collation: "ascii_bin"
  43. t.integer "service_id", limit: 4
  44. end
  45. add_index "agents", ["guid"], name: "index_agents_on_guid", using: :btree
  46. add_index "agents", ["schedule"], name: "index_agents_on_schedule", using: :btree
  47. add_index "agents", ["type"], name: "index_agents_on_type", using: :btree
  48. add_index "agents", ["user_id", "created_at"], name: "index_agents_on_user_id_and_created_at", using: :btree
  49. create_table "control_links", force: :cascade do |t|
  50. t.integer "controller_id", limit: 4, null: false
  51. t.integer "control_target_id", limit: 4, null: false
  52. t.datetime "created_at"
  53. t.datetime "updated_at"
  54. end
  55. add_index "control_links", ["control_target_id"], name: "index_control_links_on_control_target_id", using: :btree
  56. add_index "control_links", ["controller_id", "control_target_id"], name: "index_control_links_on_controller_id_and_control_target_id", unique: true, using: :btree
  57. create_table "delayed_jobs", force: :cascade do |t|
  58. t.integer "priority", limit: 4, default: 0
  59. t.integer "attempts", limit: 4, default: 0
  60. t.text "handler", limit: 16777215, charset: "utf8mb4", collation: "utf8mb4_bin"
  61. t.text "last_error", limit: 65535, charset: "utf8mb4", collation: "utf8mb4_bin"
  62. t.datetime "run_at"
  63. t.datetime "locked_at"
  64. t.datetime "failed_at"
  65. t.string "locked_by", limit: 255
  66. t.string "queue", limit: 255
  67. t.datetime "created_at"
  68. t.datetime "updated_at"
  69. end
  70. add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
  71. create_table "events", force: :cascade do |t|
  72. t.integer "user_id", limit: 4
  73. t.integer "agent_id", limit: 4
  74. t.decimal "lat", precision: 15, scale: 10
  75. t.decimal "lng", precision: 15, scale: 10
  76. t.text "payload", limit: 16777215, charset: "utf8mb4", collation: "utf8mb4_bin"
  77. t.datetime "created_at"
  78. t.datetime "updated_at"
  79. t.datetime "expires_at"
  80. end
  81. add_index "events", ["agent_id", "created_at"], name: "index_events_on_agent_id_and_created_at", using: :btree
  82. add_index "events", ["expires_at"], name: "index_events_on_expires_at", using: :btree
  83. add_index "events", ["user_id", "created_at"], name: "index_events_on_user_id_and_created_at", using: :btree
  84. create_table "links", force: :cascade do |t|
  85. t.integer "source_id", limit: 4
  86. t.integer "receiver_id", limit: 4
  87. t.datetime "created_at"
  88. t.datetime "updated_at"
  89. t.integer "event_id_at_creation", limit: 4, default: 0, null: false
  90. end
  91. add_index "links", ["receiver_id", "source_id"], name: "index_links_on_receiver_id_and_source_id", using: :btree
  92. add_index "links", ["source_id", "receiver_id"], name: "index_links_on_source_id_and_receiver_id", using: :btree
  93. create_table "scenario_memberships", force: :cascade do |t|
  94. t.integer "agent_id", limit: 4, null: false
  95. t.integer "scenario_id", limit: 4, null: false
  96. t.datetime "created_at"
  97. t.datetime "updated_at"
  98. end
  99. add_index "scenario_memberships", ["agent_id"], name: "index_scenario_memberships_on_agent_id", using: :btree
  100. add_index "scenario_memberships", ["scenario_id"], name: "index_scenario_memberships_on_scenario_id", using: :btree
  101. create_table "scenarios", force: :cascade do |t|
  102. t.string "name", limit: 255, null: false, charset: "utf8mb4", collation: "utf8mb4_bin"
  103. t.integer "user_id", limit: 4, null: false
  104. t.datetime "created_at"
  105. t.datetime "updated_at"
  106. t.text "description", limit: 65535, charset: "utf8mb4", collation: "utf8mb4_bin"
  107. t.boolean "public", limit: 1, default: false, null: false
  108. t.string "guid", limit: 255, null: false, charset: "ascii", collation: "ascii_bin"
  109. t.string "source_url", limit: 255
  110. t.string "tag_bg_color", limit: 255
  111. t.string "tag_fg_color", limit: 255
  112. end
  113. add_index "scenarios", ["user_id", "guid"], name: "index_scenarios_on_user_id_and_guid", unique: true, using: :btree
  114. create_table "services", force: :cascade do |t|
  115. t.integer "user_id", limit: 4, null: false
  116. t.string "provider", limit: 255, null: false, collation: "utf8_general_ci"
  117. t.string "name", limit: 255, null: false, collation: "utf8_general_ci"
  118. t.text "token", limit: 65535, null: false, collation: "utf8_general_ci"
  119. t.text "secret", limit: 65535, collation: "utf8_general_ci"
  120. t.text "refresh_token", limit: 65535, collation: "utf8_general_ci"
  121. t.datetime "expires_at"
  122. t.boolean "global", limit: 1, default: false
  123. t.text "options", limit: 65535, collation: "utf8_general_ci"
  124. t.datetime "created_at"
  125. t.datetime "updated_at"
  126. t.string "uid", limit: 255, collation: "utf8_general_ci"
  127. end
  128. add_index "services", ["provider"], name: "index_services_on_provider", using: :btree
  129. add_index "services", ["uid"], name: "index_services_on_uid", using: :btree
  130. add_index "services", ["user_id", "global"], name: "index_services_on_user_id_and_global", using: :btree
  131. create_table "user_credentials", force: :cascade do |t|
  132. t.integer "user_id", limit: 4, null: false
  133. t.string "credential_name", limit: 255, null: false
  134. t.text "credential_value", limit: 65535, null: false
  135. t.datetime "created_at"
  136. t.datetime "updated_at"
  137. t.string "mode", limit: 255, default: "text", null: false, collation: "utf8_bin"
  138. end
  139. add_index "user_credentials", ["user_id", "credential_name"], name: "index_user_credentials_on_user_id_and_credential_name", unique: true, using: :btree
  140. create_table "users", force: :cascade do |t|
  141. t.string "email", limit: 255, default: "", null: false, collation: "utf8_bin"
  142. t.string "encrypted_password", limit: 255, default: "", null: false, charset: "ascii", collation: "ascii_bin"
  143. t.string "reset_password_token", limit: 255, collation: "utf8_bin"
  144. t.datetime "reset_password_sent_at"
  145. t.datetime "remember_created_at"
  146. t.integer "sign_in_count", limit: 4, default: 0
  147. t.datetime "current_sign_in_at"
  148. t.datetime "last_sign_in_at"
  149. t.string "current_sign_in_ip", limit: 255
  150. t.string "last_sign_in_ip", limit: 255
  151. t.datetime "created_at"
  152. t.datetime "updated_at"
  153. t.boolean "admin", limit: 1, default: false, null: false
  154. t.integer "failed_attempts", limit: 4, default: 0
  155. t.string "unlock_token", limit: 255
  156. t.datetime "locked_at"
  157. t.string "username", limit: 191, null: false, charset: "utf8mb4", collation: "utf8mb4_unicode_ci"
  158. t.string "invitation_code", limit: 255, collation: "utf8_bin"
  159. t.integer "scenario_count", limit: 4, default: 0, null: false
  160. end
  161. add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
  162. add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  163. add_index "users", ["unlock_token"], name: "index_users_on_unlock_token", unique: true, using: :btree
  164. add_index "users", ["username"], name: "index_users_on_username", unique: true, using: :btree
  165. end