schema.rb 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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: 20180516215539) do
  14. # These are extensions that must be enabled in order to support this database
  15. enable_extension "plpgsql"
  16. enable_extension "uuid-ossp"
  17. create_table "action_institutions", force: :cascade do |t|
  18. t.integer "action_page_id"
  19. t.integer "institution_id"
  20. t.datetime "created_at", null: false
  21. t.datetime "updated_at", null: false
  22. end
  23. add_index "action_institutions", ["action_page_id"], name: "index_action_institutions_on_action_page_id", using: :btree
  24. add_index "action_institutions", ["institution_id"], name: "index_action_institutions_on_institution_id", using: :btree
  25. create_table "action_pages", force: :cascade do |t|
  26. t.string "title"
  27. t.text "description"
  28. t.datetime "created_at"
  29. t.datetime "updated_at"
  30. t.integer "petition_id"
  31. t.string "photo_url"
  32. t.boolean "enable_call", default: false
  33. t.boolean "enable_petition", default: false
  34. t.boolean "enable_email", default: false
  35. t.boolean "enable_tweet", default: false
  36. t.string "slug"
  37. t.string "share_message"
  38. t.integer "tweet_id"
  39. t.boolean "published", default: false
  40. t.string "featured_image_file_name"
  41. t.string "featured_image_content_type"
  42. t.integer "featured_image_file_size"
  43. t.datetime "featured_image_updated_at"
  44. t.text "what_to_say"
  45. t.integer "email_campaign_id"
  46. t.integer "call_campaign_id"
  47. t.text "summary"
  48. t.string "background_image_file_name"
  49. t.string "background_image_content_type"
  50. t.integer "background_image_file_size"
  51. t.datetime "background_image_updated_at"
  52. t.string "template"
  53. t.string "layout"
  54. t.string "og_title"
  55. t.string "og_image_file_name"
  56. t.string "og_image_content_type"
  57. t.integer "og_image_file_size"
  58. t.datetime "og_image_updated_at"
  59. t.boolean "enable_redirect", default: false
  60. t.string "redirect_url"
  61. t.text "email_text"
  62. t.boolean "victory", default: false
  63. t.text "victory_message"
  64. t.boolean "archived", default: false
  65. t.integer "archived_redirect_action_page_id"
  66. t.integer "category_id"
  67. t.boolean "enable_congress_message", default: false, null: false
  68. t.integer "congress_message_campaign_id"
  69. end
  70. add_index "action_pages", ["archived"], name: "index_action_pages_on_archived", using: :btree
  71. add_index "action_pages", ["call_campaign_id"], name: "index_action_pages_on_call_campaign_id", using: :btree
  72. add_index "action_pages", ["email_campaign_id"], name: "index_action_pages_on_email_campaign_id", using: :btree
  73. add_index "action_pages", ["petition_id"], name: "index_action_pages_on_petition_id", using: :btree
  74. add_index "action_pages", ["slug"], name: "index_action_pages_on_slug", using: :btree
  75. add_index "action_pages", ["tweet_id"], name: "index_action_pages_on_tweet_id", using: :btree
  76. create_table "affiliation_types", force: :cascade do |t|
  77. t.string "name"
  78. t.integer "action_page_id"
  79. t.datetime "created_at", null: false
  80. t.datetime "updated_at", null: false
  81. end
  82. add_index "affiliation_types", ["action_page_id"], name: "index_affiliation_types_on_action_page_id", using: :btree
  83. create_table "affiliations", force: :cascade do |t|
  84. t.datetime "created_at", null: false
  85. t.datetime "updated_at", null: false
  86. t.integer "signature_id"
  87. t.integer "institution_id"
  88. t.integer "affiliation_type_id"
  89. end
  90. add_index "affiliations", ["affiliation_type_id"], name: "index_affiliations_on_affiliation_type_id", using: :btree
  91. add_index "affiliations", ["institution_id"], name: "index_affiliations_on_institution_id", using: :btree
  92. add_index "affiliations", ["signature_id"], name: "index_affiliations_on_signature_id", using: :btree
  93. create_table "ahoy_events", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
  94. t.uuid "visit_id"
  95. t.integer "user_id"
  96. t.string "name"
  97. t.json "properties"
  98. t.datetime "time"
  99. t.integer "action_page_id"
  100. end
  101. add_index "ahoy_events", ["action_page_id"], name: "index_ahoy_events_on_action_page_id", using: :btree
  102. add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree
  103. add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree
  104. add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree
  105. create_table "bounces", force: :cascade do |t|
  106. t.string "email"
  107. end
  108. create_table "call_campaigns", force: :cascade do |t|
  109. t.datetime "created_at"
  110. t.datetime "updated_at"
  111. t.string "title"
  112. t.text "message"
  113. t.string "call_campaign_id"
  114. end
  115. create_table "categories", force: :cascade do |t|
  116. t.string "title", null: false
  117. t.datetime "created_at"
  118. t.datetime "updated_at"
  119. end
  120. create_table "complaints", force: :cascade do |t|
  121. t.string "email"
  122. t.string "feedback_type"
  123. t.string "user_agent"
  124. t.json "body"
  125. t.datetime "created_at", null: false
  126. t.datetime "updated_at", null: false
  127. end
  128. create_table "congress_members", force: :cascade do |t|
  129. t.string "full_name", null: false
  130. t.string "first_name", null: false
  131. t.string "last_name", null: false
  132. t.string "bioguide_id", null: false
  133. t.string "twitter_id"
  134. t.string "phone"
  135. t.date "term_end", null: false
  136. t.string "chamber", null: false
  137. t.string "state", null: false
  138. t.integer "district"
  139. t.datetime "created_at"
  140. t.datetime "updated_at"
  141. end
  142. create_table "congress_message_campaigns", force: :cascade do |t|
  143. t.string "subject", null: false
  144. t.text "message", null: false
  145. t.string "campaign_tag", null: false
  146. t.boolean "target_house", default: true, null: false
  147. t.boolean "target_senate", default: true, null: false
  148. t.string "target_bioguide_ids"
  149. t.integer "topic_category_id"
  150. t.string "alt_text_email_your_rep"
  151. t.string "alt_text_look_up_your_rep"
  152. t.string "alt_text_extra_fields_explain"
  153. t.string "alt_text_look_up_helper"
  154. t.string "alt_text_customize_message_helper"
  155. t.datetime "created_at", null: false
  156. t.datetime "updated_at", null: false
  157. end
  158. create_table "congress_scorecards", force: :cascade do |t|
  159. t.string "bioguide_id"
  160. t.integer "action_page_id"
  161. t.integer "counter", default: 0
  162. end
  163. add_index "congress_scorecards", ["action_page_id", "bioguide_id"], name: "index_congress_scorecards_on_action_page_id_and_bioguide_id", using: :btree
  164. create_table "delayed_jobs", force: :cascade do |t|
  165. t.integer "priority", default: 0, null: false
  166. t.integer "attempts", default: 0, null: false
  167. t.text "handler", null: false
  168. t.text "last_error"
  169. t.datetime "run_at"
  170. t.datetime "locked_at"
  171. t.datetime "failed_at"
  172. t.string "locked_by"
  173. t.string "queue"
  174. t.datetime "created_at"
  175. t.datetime "updated_at"
  176. end
  177. add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
  178. create_table "email_campaigns", force: :cascade do |t|
  179. t.text "message"
  180. t.datetime "created_at"
  181. t.datetime "updated_at"
  182. t.string "subject"
  183. t.string "campaign_tag"
  184. t.string "email_addresses"
  185. end
  186. create_table "featured_action_pages", force: :cascade do |t|
  187. t.integer "action_page_id"
  188. t.integer "weight"
  189. end
  190. add_index "featured_action_pages", ["action_page_id"], name: "index_featured_action_pages_on_action_page_id", using: :btree
  191. create_table "friendly_id_slugs", force: :cascade do |t|
  192. t.string "slug", null: false
  193. t.integer "sluggable_id", null: false
  194. t.string "sluggable_type", limit: 50
  195. t.string "scope"
  196. t.datetime "created_at"
  197. end
  198. add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree
  199. add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree
  200. add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree
  201. add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
  202. create_table "institutions", force: :cascade do |t|
  203. t.string "name"
  204. t.datetime "created_at", null: false
  205. t.datetime "updated_at", null: false
  206. t.string "slug"
  207. end
  208. add_index "institutions", ["slug"], name: "index_institutions_on_slug", unique: true, using: :btree
  209. create_table "partners", force: :cascade do |t|
  210. t.string "code"
  211. t.string "name"
  212. t.string "privacy_url"
  213. t.datetime "created_at"
  214. t.datetime "updated_at"
  215. t.time "deleted_at"
  216. t.integer "subscriptions_count", default: 0, null: false
  217. end
  218. create_table "partnerships", force: :cascade do |t|
  219. t.integer "action_page_id"
  220. t.integer "partner_id"
  221. end
  222. add_index "partnerships", ["action_page_id"], name: "index_partnerships_on_action_page_id", using: :btree
  223. add_index "partnerships", ["partner_id"], name: "index_partnerships_on_partner_id", using: :btree
  224. create_table "petitions", force: :cascade do |t|
  225. t.string "title"
  226. t.text "description"
  227. t.datetime "created_at"
  228. t.datetime "updated_at"
  229. t.integer "goal"
  230. t.boolean "enable_affiliations", default: false
  231. end
  232. create_table "sessions", force: :cascade do |t|
  233. t.string "session_id", null: false
  234. t.text "data"
  235. t.datetime "created_at"
  236. t.datetime "updated_at"
  237. end
  238. add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", unique: true, using: :btree
  239. add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
  240. create_table "signatures", force: :cascade do |t|
  241. t.integer "petition_id"
  242. t.integer "user_id"
  243. t.datetime "created_at"
  244. t.datetime "updated_at"
  245. t.string "first_name"
  246. t.string "last_name"
  247. t.string "email"
  248. t.string "country_code"
  249. t.string "zipcode"
  250. t.string "street_address"
  251. t.string "city"
  252. t.string "state"
  253. t.boolean "anonymous", default: false
  254. end
  255. add_index "signatures", ["petition_id"], name: "index_signatures_on_petition_id", using: :btree
  256. add_index "signatures", ["user_id"], name: "index_signatures_on_user_id", using: :btree
  257. create_table "source_files", force: :cascade do |t|
  258. t.string "file_name"
  259. t.string "file_content_type"
  260. t.integer "file_size"
  261. t.string "key"
  262. t.string "bucket"
  263. t.datetime "created_at"
  264. t.datetime "updated_at"
  265. end
  266. create_table "subscriptions", force: :cascade do |t|
  267. t.string "first_name"
  268. t.string "last_name"
  269. t.string "email"
  270. t.integer "partner_id"
  271. t.datetime "created_at"
  272. t.datetime "updated_at"
  273. end
  274. create_table "topic_categories", force: :cascade do |t|
  275. t.string "name"
  276. end
  277. create_table "topic_sets", force: :cascade do |t|
  278. t.integer "tier"
  279. t.integer "topic_category_id"
  280. end
  281. create_table "topics", force: :cascade do |t|
  282. t.string "name"
  283. t.integer "topic_set_id"
  284. end
  285. create_table "tweet_targets", force: :cascade do |t|
  286. t.integer "tweet_id", null: false
  287. t.string "twitter_id", null: false
  288. t.string "bioguide_id"
  289. t.string "image_file_name"
  290. t.string "image_content_type"
  291. t.integer "image_file_size"
  292. t.datetime "image_updated_at"
  293. end
  294. add_index "tweet_targets", ["tweet_id"], name: "index_tweet_targets_on_tweet_id", using: :btree
  295. create_table "tweets", force: :cascade do |t|
  296. t.string "target"
  297. t.string "message"
  298. t.string "cta"
  299. t.string "bioguide_id"
  300. t.boolean "target_house", default: true
  301. t.boolean "target_senate", default: true
  302. end
  303. create_table "user_preferences", force: :cascade do |t|
  304. t.integer "user_id", null: false
  305. t.string "name", null: false
  306. t.string "value"
  307. t.datetime "created_at"
  308. t.datetime "updated_at"
  309. end
  310. add_index "user_preferences", ["user_id"], name: "index_user_preferences_on_user_id", using: :btree
  311. create_table "users", force: :cascade do |t|
  312. t.string "email", default: "", null: false
  313. t.string "encrypted_password", default: "", null: false
  314. t.string "reset_password_token"
  315. t.datetime "reset_password_sent_at"
  316. t.datetime "remember_created_at"
  317. t.integer "sign_in_count", default: 0, null: false
  318. t.datetime "current_sign_in_at"
  319. t.datetime "last_sign_in_at"
  320. t.string "current_sign_in_ip"
  321. t.string "last_sign_in_ip"
  322. t.datetime "created_at"
  323. t.datetime "updated_at"
  324. t.string "first_name"
  325. t.string "last_name"
  326. t.string "location"
  327. t.boolean "admin", default: false
  328. t.string "street_address"
  329. t.string "city"
  330. t.string "state"
  331. t.string "country_code"
  332. t.string "zipcode"
  333. t.string "phone"
  334. t.boolean "record_activity", default: false
  335. t.string "confirmation_token"
  336. t.datetime "confirmed_at"
  337. t.datetime "confirmation_sent_at"
  338. t.integer "contact_id"
  339. t.boolean "subscribe", default: false
  340. t.integer "partner_id"
  341. t.string "unconfirmed_email"
  342. t.integer "failed_attempts", default: 0
  343. t.string "unlock_token"
  344. t.datetime "locked_at"
  345. t.boolean "password_expired"
  346. t.boolean "collaborator", default: false, null: false
  347. end
  348. add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
  349. add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
  350. add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  351. add_index "users", ["unlock_token"], name: "index_users_on_unlock_token", unique: true, using: :btree
  352. create_table "visits", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
  353. t.uuid "visitor_id"
  354. t.string "ip"
  355. t.text "user_agent"
  356. t.text "referrer"
  357. t.text "landing_page"
  358. t.integer "user_id"
  359. t.string "referring_domain"
  360. t.string "search_keyword"
  361. t.string "browser"
  362. t.string "os"
  363. t.string "device_type"
  364. t.string "country"
  365. t.string "region"
  366. t.string "city"
  367. t.string "utm_source"
  368. t.string "utm_medium"
  369. t.string "utm_term"
  370. t.string "utm_content"
  371. t.string "utm_campaign"
  372. t.datetime "started_at"
  373. end
  374. add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree
  375. end