# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150325183252) do

  create_table "answers", force: :cascade do |t|
    t.string   "content",     limit: 255
    t.integer  "question_id", limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "answers", ["question_id"], name: "index_answers_on_question_id", using: :btree

  create_table "people", force: :cascade do |t|
    t.string   "email_address", limit: 255
    t.string   "ip_address",    limit: 255
    t.string   "user_agent",    limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "people", ["created_at"], name: "index_people_on_created_at", using: :btree

  create_table "questions", force: :cascade do |t|
    t.string   "content",    limit: 255
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "survey_id",  limit: 4
    t.integer  "year_id",    limit: 4
  end

  add_index "questions", ["created_at"], name: "index_questions_on_created_at", using: :btree

  create_table "surveys", force: :cascade do |t|
    t.string   "name",       limit: 255
    t.string   "slug",       limit: 255
    t.datetime "created_at",             null: false
    t.datetime "updated_at",             null: false
  end

  create_table "votes", force: :cascade do |t|
    t.integer  "question_id", limit: 4
    t.integer  "answer_id",   limit: 4
    t.integer  "person_id",   limit: 4
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "year",        limit: 4
    t.integer  "year_id",     limit: 4
  end

  add_index "votes", ["answer_id"], name: "index_votes_on_answer_id", using: :btree
  add_index "votes", ["created_at"], name: "index_votes_on_created_at", using: :btree
  add_index "votes", ["person_id"], name: "index_votes_on_person_id", using: :btree
  add_index "votes", ["question_id"], name: "index_votes_on_question_id", using: :btree

  create_table "year_summary_answers", force: :cascade do |t|
    t.text     "data",                  limit: 65535
    t.integer  "year_id",               limit: 4
    t.integer  "question_id",           limit: 4
    t.integer  "answer_id",             limit: 4
    t.float    "percentage_this_year",  limit: 24
    t.float    "change_from_last_year", limit: 24
    t.integer  "total_votes",           limit: 4
    t.datetime "created_at",                          null: false
    t.datetime "updated_at",                          null: false
  end

  create_table "years", force: :cascade do |t|
    t.integer  "year",         limit: 4
    t.datetime "starts_at"
    t.datetime "ends_at"
    t.integer  "survey_id",    limit: 4
    t.datetime "created_at",                         null: false
    t.datetime "updated_at",                         null: false
    t.integer  "significance", limit: 4, default: 0
  end

end
