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

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

  create_table "active_data", force: :cascade do |t|
    t.integer  "operation_id"
    t.integer  "login_id"
    t.datetime "start_time"
    t.datetime "end_time"
    t.float    "duration"
    t.float    "sys_time"
    t.float    "user_time"
    t.integer  "session"
    t.string   "comment"
    t.datetime "created_at",          null: false
    t.datetime "updated_at",          null: false
    t.integer  "operation_server_id"
    t.string   "node"
    t.string   "module"
    t.integer  "main_data_id"
  end

  add_index "active_data", ["login_id"], name: "index_active_data_on_login_id", using: :btree
  add_index "active_data", ["operation_id"], name: "index_active_data_on_operation_id", using: :btree

  create_table "custom_filters", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "email_lists", force: :cascade do |t|
    t.string   "email"
    t.integer  "email_rule_id"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
  end

  create_table "email_login_lists", force: :cascade do |t|
    t.integer  "login_id"
    t.integer  "email_rule_id"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
  end

  create_table "email_office_lists", force: :cascade do |t|
    t.integer  "office_id"
    t.integer  "email_rule_id"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
  end

  create_table "email_operation_lists", force: :cascade do |t|
    t.integer  "operation_id"
    t.integer  "email_rule_id"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
  end

  create_table "email_rules", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "flextera_page_flow_errors", force: :cascade do |t|
    t.string   "message"
    t.datetime "date"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "flextera_proc_cont_errors", force: :cascade do |t|
    t.string   "message"
    t.datetime "date"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "global_filters", force: :cascade do |t|
    t.integer  "user_id"
    t.integer  "operation_server_id"
    t.integer  "operation_source_id"
    t.datetime "created_at",                      null: false
    t.datetime "updated_at",                      null: false
    t.integer  "custom_filter_id",    default: 0
  end

  create_table "ldap_parameters", force: :cascade do |t|
    t.string   "parameter"
    t.string   "value"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "name"
  end

  create_table "ldap_user_groups", force: :cascade do |t|
    t.integer  "user_group_id"
    t.string   "ldap_group_name"
    t.integer  "order_id"
    t.datetime "created_at",      null: false
    t.datetime "updated_at",      null: false
  end

  create_table "login_filters", force: :cascade do |t|
    t.integer  "login_id"
    t.integer  "custom_filter_id"
    t.datetime "created_at",       null: false
    t.datetime "updated_at",       null: false
  end

  create_table "logins", force: :cascade do |t|
    t.string   "name"
    t.string   "full_name"
    t.integer  "office_id"
    t.datetime "created_at",   null: false
    t.datetime "updated_at",   null: false
    t.string   "email"
    t.string   "phone"
    t.string   "mobile_phone"
    t.string   "department"
  end

  create_table "menus", force: :cascade do |t|
    t.string   "ru"
    t.string   "name_eng"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "en"
  end

  create_table "offices", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "operation_filters", force: :cascade do |t|
    t.integer  "operation_id"
    t.integer  "custom_filter_id"
    t.datetime "created_at",       null: false
    t.datetime "updated_at",       null: false
  end

  create_table "operation_servers", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "operation_sources", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "color"
    t.string   "short_name"
  end

  create_table "operation_types", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "operations", force: :cascade do |t|
    t.string   "name"
    t.float    "time_avg"
    t.float    "sys_time_avg"
    t.float    "user_time_avg"
    t.integer  "count_avg"
    t.integer  "operation_type_id"
    t.float    "kpi"
    t.datetime "created_at",          null: false
    t.datetime "updated_at",          null: false
    t.integer  "operation_source_id"
    t.string   "display_name"
  end

  create_table "sub_menus", force: :cascade do |t|
    t.string   "ru"
    t.string   "name_eng"
    t.integer  "menu_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "en"
    t.integer  "visible"
  end

  create_table "user_accesses", force: :cascade do |t|
    t.integer  "menu_id"
    t.integer  "user_group_id"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
  end

  create_table "user_groups", force: :cascade do |t|
    t.string   "name_rus"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "user_logs", force: :cascade do |t|
    t.integer  "user_id"
    t.string   "params"
    t.string   "action"
    t.string   "ip"
    t.string   "action_type"
    t.datetime "created_at",  null: false
    t.datetime "updated_at",  null: false
  end

  create_table "users", force: :cascade do |t|
    t.string   "username"
    t.string   "password"
    t.string   "salt"
    t.integer  "user_group_id"
    t.date     "from_date"
    t.date     "to_date"
    t.datetime "created_at",                                    null: false
    t.datetime "updated_at",                                    null: false
    t.string   "language",      default: "ru"
    t.datetime "last_login",    default: '2016-09-23 10:47:20'
    t.integer  "login_count",   default: 0
    t.string   "session_id",    default: "0"
    t.integer  "ad_user"
  end

end
