# 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 to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20110811120138) do

  create_table "V_PEOPLE", :id => false, :force => true do |t|
    t.integer "id",               :default => 0, :null => false
    t.integer "login",            :default => 0, :null => false
    t.integer "lastname",         :default => 0, :null => false
    t.integer "firstname",        :default => 0, :null => false
    t.integer "secondname",       :default => 0, :null => false
    t.integer "gender_code",      :default => 0, :null => false
    t.integer "gender",           :default => 0, :null => false
    t.integer "birthday",         :default => 0, :null => false
    t.integer "position",         :default => 0, :null => false
    t.integer "position_comment", :default => 0, :null => false
    t.integer "division_id",      :default => 0, :null => false
    t.integer "work_status",      :default => 0, :null => false
    t.integer "active",           :default => 0, :null => false
    t.integer "office",           :default => 0, :null => false
  end

  create_table "access", :force => true do |t|
    t.string  "date"
    t.integer "empl_id"
    t.string  "empl_name",                         :null => false
    t.integer "empl_department_id", :default => 0, :null => false
    t.string  "department"
    t.integer "department_id",      :default => 0, :null => false
    t.string  "access"
    t.integer "access_admin",       :default => 0, :null => false
    t.integer "access_superuser",   :default => 0, :null => false
    t.integer "access_read",        :default => 0, :null => false
    t.integer "access_write",       :default => 0, :null => false
    t.integer "access_delete",      :default => 0, :null => false
    t.string  "who_set"
  end

  create_table "alp_reports", :force => true do |t|
    t.string   "type"
    t.datetime "date_from"
    t.datetime "date_to"
    t.decimal  "downtime",        :precision => 5, :scale => 2, :default => 0.0
    t.decimal  "adm_downtime",    :precision => 5, :scale => 2, :default => 0.0
    t.integer  "category"
    t.boolean  "w_rain"
    t.boolean  "w_temp"
    t.boolean  "w_wind"
    t.text     "other_materials"
    t.text     "downtime_desc"
    t.text     "conflicts"
    t.text     "error_desc"
    t.string   "all_desc"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "audits", :force => true do |t|
    t.text     "comment"
    t.text     "old_value"
    t.text     "new_value"
    t.integer  "report_id"
    t.integer  "employee_id"
    t.datetime "created_at"
  end

  create_table "category", :force => true do |t|
    t.string  "name"
    t.text    "description"
    t.string  "price"
    t.string  "bonus"
    t.string  "department",                                                                   :null => false
    t.integer "sort",           :limit => 8, :precision => 8, :scale => 0, :default => 500
    t.integer "show",                                                      :default => 1
    t.integer "contract_id"
    t.integer "process_id"
    t.decimal "master_percent",              :precision => 5, :scale => 2, :default => 0.0
    t.integer "income_id",                                                 :default => 78
    t.boolean "login",                                                     :default => true
    t.boolean "loginroot",                                                 :default => true
    t.boolean "mat_inst",                                                  :default => true
    t.boolean "mat_sale",                                                  :default => true
    t.boolean "mat_rent",                                                  :default => true
    t.boolean "mat_rent_rate",                                             :default => true
    t.boolean "inst",                                                      :default => true
    t.boolean "demounting",                                                :default => true
    t.boolean "change",                                                    :default => true
    t.integer "quest_bonus"
    t.decimal "disp_wage",                   :precision => 8, :scale => 2, :default => 0.0
    t.boolean "mat_test",                                                  :default => false
  end

  create_table "cfg", :force => true do |t|
    t.string "name"
    t.text   "description"
    t.string "val"
    t.string "department",  :null => false
  end

  create_table "contracts", :force => true do |t|
    t.integer "finn_id"
    t.string  "name"
    t.text    "description"
  end

  create_table "divisions", :force => true do |t|
    t.string  "name"
    t.string  "expense_name"
    t.boolean "show",              :default => true
    t.integer "parent_id"
    t.integer "lft"
    t.integer "rgt"
    t.integer "intranet_id"
    t.integer "account_id"
    t.integer "place",             :default => 1
    t.integer "analytic_group_id"
  end

  add_index "divisions", ["lft"], :name => "index_divisions_on_lft"

  create_table "done_employees", :id => false, :force => true do |t|
    t.integer "id",                                                                :null => false
    t.string  "name"
    t.integer "empl_id"
    t.string  "empl_name"
    t.integer "report_id",                                        :default => 0,   :null => false
    t.string  "date_create_report"
    t.integer "role"
    t.string  "time_work",                                        :default => "0"
    t.string  "time_stopwork",                                    :default => "0"
    t.string  "time_addwork",                                     :default => "0"
    t.string  "sum",                                              :default => "0"
    t.string  "hand",                                             :default => "0"
    t.string  "department",                                       :default => "0"
    t.decimal "ented_intime",       :precision => 3, :scale => 1, :default => 0.0, :null => false
    t.integer "finn_zp_id"
  end

  add_index "done_employees", ["empl_id"], :name => "employee"
  add_index "done_employees", ["report_id", "empl_id"], :name => "index_done_employees_on_report_id_and_empl_id"
  add_index "done_employees", ["report_id"], :name => "report"

  create_table "done_materials", :id => false, :force => true do |t|
    t.integer "id",                                                                               :null => false
    t.string  "date",                                                                             :null => false
    t.integer "employee_id",                                                     :default => 0,   :null => false
    t.string  "employee_name"
    t.integer "store_employee_id",                                               :default => 0,   :null => false
    t.string  "material_id"
    t.string  "material_name",                                                   :default => "0", :null => false
    t.string  "count"
    t.integer "report_id",                                                       :default => 0,   :null => false
    t.string  "date_create_report"
    t.string  "last_request"
    t.string  "measure"
    t.string  "when_add"
    t.string  "department"
    t.string  "price",                                                           :default => "0"
    t.string  "serial"
    t.integer "store_complete",                                                  :default => 0
    t.integer "store_id"
    t.decimal "bonus_sale",                       :precision => 10, :scale => 2
    t.integer "inst_type",                                                       :default => 1
    t.decimal "purchase_price",                   :precision => 10, :scale => 2
    t.integer "price_from_store",   :limit => 10, :precision => 10, :scale => 0
    t.integer "pay_type"
    t.boolean "preowned"
    t.string  "ens_code"
  end

  add_index "done_materials", ["date"], :name => "index_done_materials_on_date"
  add_index "done_materials", ["report_id", "employee_id"], :name => "index_done_materials_on_report_id_and_employee_id"
  add_index "done_materials", ["report_id"], :name => "REPORT"

  create_table "done_objects", :force => true do |t|
    t.string  "name"
    t.integer "report_id"
    t.string  "date_create_report"
    t.string  "department"
    t.string  "chains",             :limit => 9, :default => "0"
  end

  create_table "done_serials", :force => true do |t|
    t.string  "date"
    t.string  "serial"
    t.integer "report_id"
    t.integer "material_id"
    t.integer "employee_id",                       :null => false
    t.integer "store_employee_id",  :default => 0, :null => false
    t.string  "employee_name",                     :null => false
    t.string  "date_create_report"
    t.string  "department"
  end

  add_index "done_serials", ["report_id"], :name => "REPORT"

  create_table "done_works", :force => true do |t|
    t.integer "work_id"
    t.integer "report_id"
    t.string  "date_create_report"
    t.string  "count"
    t.string  "department"
    t.integer "pricelist",          :default => 0
    t.string  "rate",               :default => "0"
    t.integer "get_money",          :default => 0,   :null => false
    t.string  "comment"
  end

  add_index "done_works", ["report_id"], :name => "REPORT"

  create_table "employees", :force => true do |t|
    t.integer "empl_id"
    t.string  "login"
    t.string  "full_name"
    t.string  "department"
    t.integer "department_id"
    t.string  "email"
    t.integer "quitted"
  end

  create_table "factors", :force => true do |t|
    t.string   "name"
    t.string   "description"
    t.integer  "percent",     :limit => 10, :precision => 10, :scale => 0
    t.boolean  "active"
    t.datetime "created_at"
    t.datetime "update_at"
  end

  create_table "family_mails", :force => true do |t|
    t.string   "email"
    t.string   "department"
    t.string   "ticket_url"
    t.integer  "service_id"
    t.integer  "report_id"
    t.integer  "login_id"
    t.datetime "created_at"
  end

  create_table "material_details", :force => true do |t|
    t.integer "section"
    t.integer "number"
    t.decimal "sum",     :precision => 10, :scale => 2
    t.string  "name"
    t.boolean "show",                                   :default => true
  end

  create_table "measures", :force => true do |t|
    t.string "name"
    t.string "link"
    t.string "sort"
    t.string "department"
    t.string "description"
  end

  add_index "measures", ["department"], :name => "DEPARTMENT"

  create_table "news", :force => true do |t|
    t.string "title"
    t.text   "description"
    t.string "image_url"
  end

  create_table "object", :force => true do |t|
    t.integer "conntype"
    t.string  "house",        :limit => 8
    t.string  "building",     :limit => 8
    t.integer "stage"
    t.binary  "commstage"
    t.integer "admin"
    t.string  "map"
    t.string  "objaccess"
    t.string  "loginroot",    :limit => 32
    t.string  "alias",        :limit => 16
    t.integer "district",                   :default => 0, :null => false
    t.date    "objdate"
    t.integer "noffices"
    t.integer "flag16"
    t.integer "nbtype",                     :default => 0, :null => false
    t.integer "metro"
    t.integer "visible",                    :default => 1
    t.integer "telhrdw"
    t.string  "advert",       :limit => 32
    t.integer "useradmin"
    t.integer "iptv",                       :default => 0
    t.string  "shortcomm"
    t.integer "substage",                   :default => 0
    t.integer "otherprov"
    t.integer "micdistr"
    t.integer "topoobj"
    t.integer "objclass",                   :default => 3
    t.integer "dgs",                        :default => 0
    t.integer "coloflag",                   :default => 0
    t.integer "mgts",                       :default => 0
    t.string  "block",        :limit => 8
    t.string  "fraction",     :limit => 8
    t.string  "housecomment", :limit => 16
    t.integer "estate",                     :default => 0
    t.string  "stroi",        :limit => 16
    t.integer "city",                       :default => 1
  end

  add_index "object", ["advert"], :name => "advert"
  add_index "object", ["alias"], :name => "alias"
  add_index "object", ["building"], :name => "building"
  add_index "object", ["district"], :name => "district"
  add_index "object", ["house"], :name => "house"
  add_index "object", ["loginroot"], :name => "loginroot", :unique => true
  add_index "object", ["nbtype"], :name => "nbtype"
  add_index "object", ["stage"], :name => "stage"

  create_table "of_works", :force => true do |t|
    t.string  "name"
    t.text    "description"
    t.decimal "sum",         :precision => 10, :scale => 2
    t.integer "number"
  end

  create_table "organization", :force => true do |t|
    t.string  "rusname",   :limit => 32
    t.string  "engname",   :limit => 32
    t.string  "shortname", :limit => 2
    t.integer "prov",                    :default => 0
  end

  create_table "payments", :force => true do |t|
    t.integer  "period_zp_id"
    t.integer  "author_id"
    t.integer  "employee_id"
    t.text     "description",    :limit => 16777215
    t.datetime "operation_date",                                                    :null => false
    t.datetime "created_at",                                                        :null => false
    t.integer  "sum",            :limit => 10,       :precision => 10, :scale => 0
  end

  create_table "payrolls", :force => true do |t|
    t.integer "employee_id"
    t.integer "period_zp_id"
    t.integer "zp_type_id"
    t.boolean "finn_closed",                                 :default => false
    t.decimal "sum",          :precision => 10, :scale => 2
    t.text    "description"
    t.text    "done_ids"
  end

  create_table "people", :force => true do |t|
    t.string   "name"
    t.string   "nic"
    t.integer  "division_id"
    t.integer  "position_id"
    t.boolean  "quitted"
    t.string   "email"
    t.string   "phone"
    t.boolean  "show",                                                                :default => true
    t.integer  "legal_entity_id"
    t.date     "birthday"
    t.boolean  "car",                                                                 :default => false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.decimal  "salary",                               :precision => 15, :scale => 2, :default => 0.0
    t.string   "inn",                    :limit => 12
    t.string   "password"
    t.string   "crypted_password"
    t.string   "password_salt"
    t.string   "persistence_token"
    t.string   "auth_token"
    t.string   "password_reset_token"
    t.datetime "password_reset_sent_at"
    t.integer  "snils"
    t.integer  "doc_type"
    t.string   "doc_number"
    t.string   "doc_when"
    t.string   "doc_whom"
    t.string   "surname"
    t.string   "middle_name"
  end

  add_index "people", ["nic"], :name => "index_people_on_nic"

  create_table "period_zps", :force => true do |t|
    t.integer  "period_id"
    t.integer  "employee_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "payroll_sum", :limit => 10, :precision => 10, :scale => 0
    t.integer  "payment_sum", :limit => 10, :precision => 10, :scale => 0
  end

  create_table "periods", :force => true do |t|
    t.date    "month"
    t.string  "department"
    t.boolean "closed"
  end

  create_table "pl_items", :id => false, :force => true do |t|
    t.integer "id",            :default => 0, :null => false
    t.integer "name",          :default => 0, :null => false
    t.integer "price",         :default => 0, :null => false
    t.integer "rate",          :default => 0, :null => false
    t.integer "date_in",       :default => 0, :null => false
    t.integer "date_start",    :default => 0, :null => false
    t.integer "date_end",      :default => 0, :null => false
    t.integer "position_type", :default => 0, :null => false
    t.integer "usr",           :default => 0, :null => false
    t.integer "section_id",    :default => 0, :null => false
    t.integer "client_type",   :default => 0, :null => false
    t.integer "hidden",        :default => 0, :null => false
  end

  create_table "positions", :force => true do |t|
    t.string "name"
  end

  create_table "regular_shifts", :force => true do |t|
    t.time     "time_from"
    t.time     "time_to"
    t.string   "department"
    t.string   "type"
    t.integer  "employee_id"
    t.integer  "day_of_week"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "rep_employees", :force => true do |t|
    t.integer  "employee_id"
    t.integer  "report_id"
    t.float    "wage",        :default => 0.0
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "rep_logins", :force => true do |t|
    t.integer  "report_id"
    t.integer  "from_id"
    t.integer  "to_id"
    t.integer  "cable_length"
    t.integer  "attic_length"
    t.integer  "material_id"
    t.integer  "done_material_id"
    t.decimal  "sum",              :precision => 10, :scale => 2
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "rep_materials", :force => true do |t|
    t.integer  "report_id"
    t.integer  "material_id"
    t.integer  "amount",      :limit => 10, :precision => 10, :scale => 0
    t.integer  "price",       :limit => 10, :precision => 10, :scale => 0
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "rep_works", :force => true do |t|
    t.integer  "report_id"
    t.integer  "work_id"
    t.float    "amount"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "report_factors", :force => true do |t|
    t.integer "report_id"
    t.integer "factor_id"
    t.integer "percent",   :limit => 10, :precision => 10, :scale => 0
  end

  create_table "reports", :id => false, :force => true do |t|
    t.integer  "id",                                                                                          :null => false
    t.string   "name"
    t.float    "sum",                                                                      :default => 0.0
    t.integer  "status"
    t.integer  "category"
    t.string   "style"
    t.text     "com_other_materials"
    t.text     "com_request_materials"
    t.text     "com_imperfection"
    t.text     "com_stay_work"
    t.text     "com_get_money"
    t.string   "department",                                                               :default => "",    :null => false
    t.text     "com_conflicts"
    t.string   "date",                                                                     :default => "",    :null => false
    t.string   "date_stop"
    t.string   "work_time",                   :limit => 5,                                 :default => "0",   :null => false
    t.string   "work_time_addwork",           :limit => 5,                                 :default => "0",   :null => false
    t.string   "work_time_staywork",          :limit => 5,                                 :default => "0",   :null => false
    t.integer  "work_count_type",                                                          :default => 0
    t.integer  "tracker_id",                                                               :default => 0
    t.string   "serial_new",                                                               :default => "0"
    t.string   "serial_old",                                                               :default => "0"
    t.integer  "electro",                                                                  :default => 0
    t.integer  "weld",                                                                     :default => 0
    t.string   "dhcp_login"
    t.string   "get_money",                                                                :default => "0"
    t.string   "get_money_sum",                                                            :default => "0"
    t.string   "close",                       :limit => 10
    t.integer  "diagnosis",                                                                :default => 0
    t.integer  "global_reasons",                                                           :default => 0
    t.string   "total_sum_get_money",                                                      :default => "0"
    t.string   "total_sum_works",                                                          :default => "0"
    t.string   "total_sum_materials",                                                      :default => "0"
    t.string   "total_sum_comment"
    t.string   "check_hash",                                                               :default => "0"
    t.integer  "weather_temp",                                                             :default => 0
    t.integer  "weather_rain",                                                             :default => 0
    t.integer  "weather_wind",                                                             :default => 0
    t.integer  "client_type",                                                              :default => 0
    t.integer  "client_price_type",                                                        :default => 0
    t.string   "marge",                                                                    :default => "0"
    t.string   "discount_works",                                                           :default => "0"
    t.string   "discount_materials",                                                       :default => "0"
    t.boolean  "finn_closed",                                                              :default => false
    t.decimal  "finn_money",                                :precision => 15, :scale => 2, :default => 0.0
    t.string   "finn_comment"
    t.decimal  "disp_wage",                                 :precision => 10, :scale => 2
    t.decimal  "bonus_manager",                             :precision => 10, :scale => 2
    t.integer  "manager_id"
    t.decimal  "bonus_sale",                                :precision => 10, :scale => 2
    t.boolean  "clearing"
    t.integer  "update_user_id"
    t.decimal  "total_acc_sum",                             :precision => 10, :scale => 2
    t.decimal  "request_acc_sum",                           :precision => 10, :scale => 2
    t.string   "pay_doc_number"
    t.string   "inn"
    t.integer  "finn_zp_id"
    t.integer  "payment_detail"
    t.text     "problem_description"
    t.integer  "problem_tracker_id"
    t.integer  "request_id"
    t.boolean  "request_closed",                                                           :default => false
    t.decimal  "request_bonus_sum",                         :precision => 10, :scale => 2, :default => 0.0
    t.boolean  "topology_map",                                                             :default => false
    t.decimal  "zp_fine_sum",                               :precision => 10, :scale => 2, :default => 0.0
    t.boolean  "get_docs_from_master",                                                     :default => false
    t.integer  "get_docs",                                                                 :default => 0
    t.integer  "get_money_status",                                                         :default => 0
    t.string   "com_buh"
    t.decimal  "zp_fine_disp_sum",                          :precision => 10, :scale => 2, :default => 0.0
    t.datetime "date_from_tracker"
    t.text     "problem_tags"
    t.string   "downtime_ids"
    t.text     "downtime_tags"
    t.decimal  "sum_info",                                  :precision => 15, :scale => 2
    t.integer  "topology_problem_tracker_id"
    t.integer  "loginroot_id"
    t.integer  "login_id"
    t.integer  "store_id"
    t.string   "pay_name"
    t.integer  "money_problem_tracker_id"
    t.integer  "status_false_tracker_id"
    t.string   "login_from"
    t.decimal  "transport_sum",                             :precision => 8,  :scale => 2, :default => 0.0
    t.text     "com_trouble"
    t.decimal  "discount_works_2",                          :precision => 8,  :scale => 2, :default => 0.0
    t.decimal  "discount_materials_2",                      :precision => 8,  :scale => 2, :default => 0.0
    t.datetime "closed_at"
    t.boolean  "employee_bonus",                                                           :default => true
    t.integer  "money_type",                                                               :default => 0
    t.integer  "from_division_id"
    t.integer  "client_pay_type"
    t.integer  "tel"
    t.text     "tel_comment"
    t.integer  "video"
    t.text     "video_comment"
    t.integer  "agent_id",                                                                 :default => 1
    t.integer  "for_whom_id",                                                              :default => 1
    t.datetime "tracker_created_at"
    t.datetime "tracker_date_works"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.datetime "tracker_closed_at"
    t.string   "loginroot_name"
    t.decimal  "bonus_leadgen",                             :precision => 8,  :scale => 2, :default => 0.0
    t.integer  "leadgen_id"
    t.string   "trello_id"
  end

  add_index "reports", ["date", "department", "name"], :name => "index_reports_on_date_and_department_and_name"
  add_index "reports", ["date"], :name => "DATE"
  add_index "reports", ["date"], :name => "index_reports_on_date"
  add_index "reports", ["department"], :name => "SECONDERY"

  create_table "requestbase", :force => true do |t|
    t.date    "dateaccept"
    t.string  "receptionist", :limit => 16
    t.integer "source",                      :default => 0,  :null => false
    t.string  "fio"
    t.string  "addcontact"
    t.string  "homephone",    :limit => 64
    t.string  "mobile",       :limit => 128
    t.string  "street",       :limit => 32
    t.string  "house",        :limit => 8
    t.string  "building",     :limit => 8
    t.string  "apartment"
    t.string  "floor",        :limit => 4
    t.integer "loginroot",                   :default => 0,  :null => false
    t.string  "accessinfo"
    t.string  "ulogin",       :limit => 24
    t.string  "password",     :limit => 32
    t.string  "linecode",     :limit => 128
    t.string  "tariff",       :limit => 32
    t.string  "email",        :limit => 128
    t.date    "connection"
    t.integer "status"
    t.string  "entrance",     :limit => 8
    t.binary  "gencomment"
    t.integer "ipnum"
    t.string  "installer",    :limit => 16
    t.string  "manager",      :limit => 16,  :default => "", :null => false
    t.integer "payment",                     :default => 0,  :null => false
    t.integer "ltype"
    t.integer "connected",                   :default => 0,  :null => false
    t.integer "vip",                         :default => 0,  :null => false
    t.string  "vipcomm",      :limit => 64
    t.string  "astatus",      :limit => 0
    t.integer "useroff"
    t.float   "numtariff"
    t.integer "journal"
    t.integer "install",                     :default => 0,  :null => false
    t.integer "bsb",                         :default => 0
    t.integer "pri",                         :default => 0,  :null => false
    t.integer "bonus",                       :default => 0
    t.integer "tbonus",                      :default => 0,  :null => false
    t.string  "blogin",       :limit => 24
    t.integer "factur",                      :default => 0
    t.integer "privjur"
    t.integer "freedrweb",                   :default => 0,  :null => false
    t.date    "bonuslost"
    t.integer "service",                     :default => 1
    t.integer "ipneed",                      :default => 0,  :null => false
    t.string  "mnemo",        :limit => 16
    t.integer "userdev",                     :default => 0,  :null => false
    t.integer "port"
    t.date    "hrdwdate"
    t.string  "hrdwcomm"
    t.string  "accesscode",   :limit => 64
    t.integer "org",                         :default => 1
    t.integer "uloginassoc"
    t.string  "shaper",       :limit => 24
    t.integer "netnum",                      :default => 0
    t.string  "emailmain",    :limit => 64,  :default => ""
    t.string  "emailadd",                    :default => ""
    t.integer "gflag",                       :default => 0
    t.integer "mailfwd",                     :default => 0
    t.integer "ownerstat",                   :default => 0
    t.integer "sms",                         :default => 1,  :null => false
    t.integer "userdead",                    :default => 0
    t.string  "alias",        :limit => 12
    t.string  "dlogin",       :limit => 10
    t.string  "salt",         :limit => 8
    t.integer "megastat"
    t.integer "istatus",                     :default => 0
    t.integer "hydra"
    t.integer "pincode"
    t.string  "cable_name",   :limit => 128
    t.integer "pair"
    t.integer "cable_entr"
    t.string  "lcstat",       :limit => 1,   :default => ""
    t.string  "block",        :limit => 8
  end

  add_index "requestbase", ["astatus"], :name => "requestbase_astatus"
  add_index "requestbase", ["blogin"], :name => "blogin"
  add_index "requestbase", ["cable_entr"], :name => "cable_entr"
  add_index "requestbase", ["connected"], :name => "connected"
  add_index "requestbase", ["dlogin"], :name => "dlogin", :unique => true
  add_index "requestbase", ["fio"], :name => "fio"
  add_index "requestbase", ["installer"], :name => "installer"
  add_index "requestbase", ["journal"], :name => "journal"
  add_index "requestbase", ["lcstat"], :name => "lcstat"
  add_index "requestbase", ["linecode"], :name => "linecode"
  add_index "requestbase", ["loginroot"], :name => "loginroot"
  add_index "requestbase", ["ltype"], :name => "ltype"
  add_index "requestbase", ["manager"], :name => "manager"
  add_index "requestbase", ["megastat"], :name => "megastat"
  add_index "requestbase", ["pair"], :name => "pair"
  add_index "requestbase", ["payment"], :name => "payment"
  add_index "requestbase", ["port"], :name => "port"
  add_index "requestbase", ["pri"], :name => "pri"
  add_index "requestbase", ["shaper"], :name => "shaper"
  add_index "requestbase", ["tariff"], :name => "tariff"
  add_index "requestbase", ["ulogin"], :name => "rb_ulogin"
  add_index "requestbase", ["ulogin"], :name => "ulogin", :unique => true
  add_index "requestbase", ["uloginassoc"], :name => "uloginassoc"
  add_index "requestbase", ["useroff"], :name => "requestbase_useroff"

  create_table "rq_login_works", :id => false, :force => true do |t|
    t.integer "login", :default => 0, :null => false
    t.integer "name",  :default => 0, :null => false
    t.integer "count", :default => 0, :null => false
    t.integer "cost",  :default => 0, :null => false
    t.integer "nick",  :default => 0, :null => false
    t.integer "dt",    :default => 0, :null => false
  end

  create_table "salaries", :force => true do |t|
    t.integer "division_id"
    t.string  "position_id"
    t.decimal "sum",         :precision => 10, :scale => 2
    t.date    "date_from"
    t.boolean "static_sum",                                 :default => false
  end

  create_table "sessions", :force => true do |t|
    t.string   "session_id", :null => false
    t.text     "data"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
  add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"

  create_table "shifts", :force => true do |t|
    t.date     "shift_date"
    t.time     "time_from"
    t.time     "time_to"
    t.string   "department"
    t.string   "type"
    t.integer  "regular_shift_id"
    t.integer  "employee_id"
    t.integer  "status"
    t.decimal  "nighttime",        :precision => 3, :scale => 1
    t.decimal  "evening_time",     :precision => 3, :scale => 1
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "finn_zp_id"
    t.string   "description"
  end

  create_table "street", :primary_key => "alias", :force => true do |t|
    t.string "name", :limit => 32
    t.string "pre",  :limit => 16
    t.string "post", :limit => 16
    t.string "npre", :limit => 4
  end

  create_table "topology_files", :force => true do |t|
    t.string   "doc_file_name"
    t.string   "doc_content_type"
    t.string   "login_type"
    t.string   "login_name"
    t.integer  "doc_file_size"
    t.integer  "report_id"
    t.integer  "employee_id"
    t.integer  "login_id"
    t.datetime "created_at"
  end

  create_table "v_people", :id => false, :force => true do |t|
    t.integer "id",               :default => 0, :null => false
    t.integer "login",            :default => 0, :null => false
    t.integer "lastname",         :default => 0, :null => false
    t.integer "firstname",        :default => 0, :null => false
    t.integer "secondname",       :default => 0, :null => false
    t.integer "gender_code",      :default => 0, :null => false
    t.integer "gender",           :default => 0, :null => false
    t.integer "birthday",         :default => 0, :null => false
    t.integer "position",         :default => 0, :null => false
    t.integer "position_comment", :default => 0, :null => false
    t.integer "division_id",      :default => 0, :null => false
    t.integer "work_status",      :default => 0, :null => false
    t.integer "active",           :default => 0, :null => false
    t.integer "office",           :default => 0, :null => false
  end

  create_table "working_days", :force => true do |t|
    t.date    "month"
    t.integer "working_days"
    t.string  "weekends"
  end

  create_table "works", :force => true do |t|
    t.string   "name"
    t.text     "description"
    t.string   "section"
    t.string   "price"
    t.string   "measure"
    t.string   "step_button"
    t.string   "department",                                                                  :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "sort",            :limit => 8, :precision => 8, :scale => 0, :default => 500
    t.integer  "show",                                                       :default => 0
    t.string   "rate",                                                       :default => "0"
    t.string   "addrate",                                                    :default => "0"
    t.string   "category"
    t.integer  "of_work_id"
    t.boolean  "free"
    t.integer  "legal_entity_id"
  end

  add_index "works", ["department"], :name => "DEPARTMENT"

  create_table "xxx_backup_done_materials", :force => true do |t|
    t.string  "date",                                :null => false
    t.integer "employee_id",        :default => 0,   :null => false
    t.string  "employee_name"
    t.integer "store_employee_id",  :default => 0,   :null => false
    t.string  "material_id"
    t.string  "material_name",      :default => "0", :null => false
    t.string  "count"
    t.string  "report_id",          :default => "",  :null => false
    t.string  "date_create_report"
    t.string  "last_request"
    t.string  "measure"
    t.string  "when_add"
    t.string  "department"
    t.string  "price",              :default => "0"
    t.string  "serial"
    t.integer "store_complete",     :default => 0
    t.integer "store_id"
  end

  create_table "xxx_employee_backup", :force => true do |t|
    t.string "login", :null => false
  end

end
