# 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: 20140905130333) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "apps", force: true do |t|
    t.string   "name"
    t.string   "api_key"
    t.string   "asset_host"
    t.string   "repository_branch"
    t.boolean  "resolve_errs_on_deploy",    default: false
    t.boolean  "notify_all_users",          default: false
    t.boolean  "notify_on_errs",            default: true
    t.boolean  "notify_on_deploys",         default: false
    t.text     "email_at_notices"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "repo_url"
    t.integer  "unresolved_problems_count", default: 0,     null: false
  end

  create_table "backtrace_lines", force: true do |t|
    t.integer  "backtrace_id"
    t.integer  "column"
    t.integer  "number"
    t.text     "file"
    t.text     "method"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "backtrace_lines", ["backtrace_id"], name: "index_backtrace_lines_on_backtrace_id", using: :btree

  create_table "backtraces", force: true do |t|
    t.string   "fingerprint"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "backtraces", ["fingerprint"], name: "index_backtraces_on_fingerprint", using: :btree

  create_table "comments", force: true do |t|
    t.integer  "user_id"
    t.integer  "problem_id"
    t.text     "body"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "comments", ["problem_id"], name: "index_comments_on_problem_id", using: :btree
  add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree

  create_table "deploys", force: true do |t|
    t.string   "username"
    t.string   "repository"
    t.string   "environment"
    t.string   "revision"
    t.string   "message"
    t.integer  "app_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text     "vcs_changes"
    t.string   "notice_state"
  end

  add_index "deploys", ["app_id"], name: "index_deploys_on_app_id", using: :btree

  create_table "issue_trackers", force: true do |t|
    t.integer  "app_id"
    t.string   "project_id"
    t.string   "alt_project_id"
    t.string   "api_token"
    t.string   "type"
    t.string   "account"
    t.string   "username"
    t.string   "password"
    t.string   "ticket_properties"
    t.string   "subdomain"
    t.string   "milestone_id"
    t.string   "base_url"
    t.string   "context_path"
    t.string   "issue_type"
    t.string   "issue_component"
    t.string   "issue_priority"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text     "payload"
  end

  add_index "issue_trackers", ["app_id"], name: "index_issue_trackers_on_app_id", using: :btree

  create_table "notices", force: true do |t|
    t.integer  "backtrace_id"
    t.text     "message"
    t.text     "server_environment"
    t.text     "request"
    t.text     "notifier"
    t.text     "user_attributes"
    t.string   "framework"
    t.text     "current_user"
    t.text     "error_class"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "problem_id"
  end

  add_index "notices", ["backtrace_id"], name: "index_notices_on_backtrace_id", using: :btree
  add_index "notices", ["problem_id", "id"], name: "index_notices_on_problem_id_and_id", using: :btree

  create_table "notification_services", force: true do |t|
    t.integer  "app_id"
    t.string   "room_id"
    t.string   "user_id"
    t.string   "service_url"
    t.string   "service"
    t.string   "api_token"
    t.string   "subdomain"
    t.string   "sender_name"
    t.string   "type"
    t.text     "notify_at_notices"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "notification_services", ["app_id"], name: "index_notification_services_on_app_id", using: :btree

  create_table "problems", force: true do |t|
    t.integer  "app_id"
    t.datetime "last_notice_at"
    t.datetime "first_notice_at"
    t.datetime "last_deploy_at"
    t.datetime "resolved_at"
    t.string   "issue_link"
    t.string   "issue_type"
    t.integer  "notices_count",                  default: 0, null: false
    t.integer  "comments_count",                 default: 0, null: false
    t.text     "message"
    t.string   "environment"
    t.text     "error_class"
    t.string   "where"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "state"
    t.integer  "notices_count_before_unresolve", default: 0
    t.string   "fingerprint"
  end

  add_index "problems", ["app_id", "fingerprint"], name: "index_problems_on_app_id_and_fingerprint", using: :btree
  add_index "problems", ["app_id"], name: "index_problems_on_app_id", using: :btree
  add_index "problems", ["comments_count"], name: "index_problems_on_comments_count", using: :btree
  add_index "problems", ["first_notice_at"], name: "index_problems_on_first_notice_at", using: :btree
  add_index "problems", ["last_notice_at"], name: "index_problems_on_last_notice_at", using: :btree
  add_index "problems", ["message"], name: "index_problems_on_message", using: :btree
  add_index "problems", ["notices_count"], name: "index_problems_on_notices_count", using: :btree
  add_index "problems", ["resolved_at"], name: "index_problems_on_resolved_at", using: :btree

  create_table "users", force: true do |t|
    t.string   "github_login"
    t.string   "github_oauth_token"
    t.string   "name"
    t.string   "username"
    t.boolean  "admin"
    t.integer  "per_page"
    t.string   "time_zone"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "email",                  default: "", null: false
    t.string   "encrypted_password",     default: "", null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_ip"
    t.string   "authentication_token"
  end

  add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree
  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree

  create_table "watchers", force: true do |t|
    t.integer  "app_id"
    t.integer  "user_id"
    t.string   "email"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "watching_errors"
    t.boolean  "watching_deploys"
  end

  add_index "watchers", ["app_id"], name: "index_watchers_on_app_id", using: :btree
  add_index "watchers", ["user_id"], name: "index_watchers_on_user_id", using: :btree

end
