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

  create_table "PRADEEP", id: false, force: true do |t|
    t.string  "FIRST_NAME", limit: 50
    t.integer "AGE"
    t.float   "INCOME"
  end

  create_table "access_control_lists", force: true do |t|
    t.string   "policy"
    t.string   "protocol"
    t.string   "src_ip"
    t.string   "scr_bitmask"
    t.string   "src_port"
    t.integer  "acl_group_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "dst_ip"
    t.string   "dst_bitmask"
    t.string   "dst_port"
  end

  create_table "acl_groups", force: true do |t|
    t.string   "group_name"
    t.integer  "organisation_id"
    t.integer  "router_inventory_id"
    t.integer  "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text     "tagging_lists"
  end

  create_table "acl_inventories", force: true do |t|
    t.integer  "acl_group_id"
    t.integer  "router_inventory_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "activities", force: true do |t|
    t.integer  "trackable_id"
    t.string   "trackable_type"
    t.integer  "owner_id"
    t.string   "owner_type"
    t.string   "key"
    t.text     "parameters"
    t.integer  "recipient_id"
    t.string   "recipient_type"
    t.integer  "organisation_id"
    t.integer  "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "custom_field",        default: "1"
  end

  add_index "activities", ["owner_id", "owner_type"], name: "index_activities_on_owner_id_and_owner_type", using: :btree
  add_index "activities", ["trackable_id", "trackable_type"], name: "index_activities_on_trackable_id_and_trackable_type", using: :btree

  create_table "air_quality_configs", force: true do |t|
    t.integer  "organisation_id"
    t.boolean  "is_enabled"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "alert_rules", force: true do |t|
    t.string   "alert_on"
    t.string   "condition"
    t.string   "value"
    t.integer  "alert_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "alerts", force: true do |t|
    t.string   "name"
    t.text     "message"
    t.string   "category"
    t.string   "severity_color"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "location_network_id"
    t.text     "actions"
  end

  create_table "alerts_notification_groups", force: true do |t|
    t.integer "alert_id"
    t.integer "notification_group_id"
  end

  create_table "ap_metadata", force: true do |t|
    t.string   "project_name"
    t.string   "location_name"
    t.text     "notes"
    t.integer  "router_inventory_id"
    t.string   "latitude"
    t.string   "longitude"
    t.text     "scanned_data"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "client_communications", force: true do |t|
    t.string   "source_interface"
    t.string   "destination_interface"
    t.string   "policy"
    t.integer  "firewall_config_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "priority"
  end

  create_table "commands", force: true do |t|
    t.text     "aps"
    t.string   "commands"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "status"
    t.text     "result"
  end

  create_table "commands_router_inventories", id: false, force: true do |t|
    t.integer "command_id"
    t.integer "router_inventory_id"
  end

  create_table "config_mappings", force: true do |t|
    t.integer  "configurable_id"
    t.string   "configurable_type"
    t.integer  "resourceable_id"
    t.string   "resourceable_type"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "del_data_fm_monitorings", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "firewall_configs", force: true do |t|
    t.string   "name"
    t.string   "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "firewall_rules", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "gateway_configs", force: true do |t|
    t.integer  "organisation_id"
    t.string   "gateway_type"
    t.string   "gateway"
    t.string   "config_hash"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "is_enabled"
  end

  create_table "hardware_parts", force: true do |t|
    t.string   "name"
    t.string   "part_number"
    t.string   "internal_name"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "wifi_uplink",   default: false
    t.boolean  "usb",           default: false
  end

  create_table "location_networks", force: true do |t|
    t.string   "network_name"
    t.string   "network_type"
    t.string   "network_configuration"
    t.integer  "cloned_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "organisation_id"
    t.string   "timezone"
    t.boolean  "aggregation_flag"
    t.integer  "hb_freq",               default: 5
  end

  create_table "loggings", force: true do |t|
    t.string   "name"
    t.string   "logging_type"
    t.string   "is_enabled"
    t.string   "upload_type"
    t.integer  "location_network_id"
    t.string   "extra_data"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "media", force: true do |t|
    t.integer  "attachable_id"
    t.string   "attachable_type"
    t.string   "media_file_name"
    t.string   "media_content_type"
    t.integer  "media_file_size"
    t.datetime "media_updated_at"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "monitoring_data", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "network_ssids", force: true do |t|
    t.string   "ssid_name"
    t.string   "ssid_mode"
    t.string   "nat"
    t.boolean  "is_enabled"
    t.boolean  "is_hidden"
    t.boolean  "is_isolate"
    t.string   "security_mode"
    t.string   "wpa_algorithm"
    t.string   "key_renewal_interval"
    t.string   "wpa_key"
    t.integer  "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "acl_mac"
    t.string   "mac_filter_policy"
    t.text     "acl_mac_list"
    t.integer  "vlan_id"
    t.string   "captive_portal"
    t.text     "splash_url"
    t.string   "wallgarden"
    t.text     "walled_garden_range"
    t.string   "overwrite_success_url"
    t.text     "success_url"
    t.string   "dhcp_range_start"
    t.string   "dhcp_range_end"
    t.string   "dhcp_relay_server"
    t.string   "dhcp_lease_time"
    t.string   "auth_radius_id"
    t.string   "acc_radius_id"
    t.string   "acc_radius_enabled"
    t.string   "ip_address"
    t.string   "subnet_mask"
    t.string   "ssid_qos"
    t.boolean  "enable_ssid_qos"
    t.string   "per_user_qos"
    t.string   "radio_band",                               default: "2.4"
    t.integer  "max_association",                          default: 0
    t.boolean  "wds_enabled",                              default: false
    t.string   "dns_mode",                                 default: "1"
    t.string   "dns_primary"
    t.string   "dns_secondary"
    t.string   "wna",                                      default: "1"
    t.text     "dhcp_mappings",         limit: 2147483647
    t.string   "default_interim_time",                     default: "300"
    t.string   "default_idle_timeout",                     default: "1800"
    t.string   "dhcp_ranges"
    t.string   "uplink_priority",                          default: "1"
  end

  create_table "notification_groups", force: true do |t|
    t.string   "name"
    t.string   "notification_type"
    t.string   "mobile"
    t.string   "email"
    t.integer  "organisation_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "ntp_servers", force: true do |t|
    t.boolean  "is_enabled"
    t.text     "urls"
    t.integer  "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "organisations", force: true do |t|
    t.string   "organisation_name"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "no_of_aps",         default: 200
    t.text     "sms_config"
  end

  create_table "pf_inventories", force: true do |t|
    t.integer  "portforwarding_group_id"
    t.integer  "router_inventory_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "port_forwardings", force: true do |t|
    t.string   "rule_name"
    t.string   "protocol"
    t.string   "external_port"
    t.string   "ip_address"
    t.string   "internal_port"
    t.integer  "portforwarding_group_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "portforwarding_groups", force: true do |t|
    t.string   "group_name"
    t.integer  "organisation_id"
    t.integer  "router_inventory_id"
    t.integer  "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text     "tagging_lists"
  end

  create_table "radio_profiles", force: true do |t|
    t.string   "name"
    t.string   "country_code"
    t.integer  "organisation_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "location_network_id"
  end

  create_table "radio_settings", force: true do |t|
    t.string   "band"
    t.integer  "channel"
    t.integer  "power"
    t.integer  "radio_profile_id"
    t.boolean  "is_disable",       default: false
    t.boolean  "country_ie",       default: true
    t.string   "require_mode"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "radius", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "radius_accountings", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "radius_configurations", force: true do |t|
    t.string   "radius_name"
    t.string   "radius_ip"
    t.string   "radius_port"
    t.string   "radius_secret"
    t.string   "type"
    t.integer  "organisation_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "reports", force: true do |t|
    t.string   "title"
    t.datetime "from_time"
    t.datetime "to_time"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "location_network_id"
    t.integer  "flag"
    t.string   "path"
    t.integer  "scheduled_report_id"
  end

  create_table "roles", force: true do |t|
    t.string   "name"
    t.integer  "resource_id"
    t.string   "resource_type"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree
  add_index "roles", ["name"], name: "index_roles_on_name", using: :btree

  create_table "router_inventories", force: true do |t|
    t.string   "mac_id"
    t.string   "router_serial_number"
    t.integer  "location_network_id"
    t.integer  "user_id"
    t.integer  "organisation_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "name"
    t.text     "notes"
    t.text     "address"
    t.string   "gre"
    t.string   "dhcp_relay"
    t.string   "ip_type"
    t.string   "ip"
    t.string   "subnet_mask"
    t.string   "gateway"
    t.string   "primary_dns"
    t.string   "secondary_dns"
    t.string   "channel"
    t.string   "enable_gre_on_lan"
    t.string   "enable_dhcp_on_lan"
    t.integer  "snmp_config_id"
    t.string   "power"
    t.string   "dhcp_start_range"
    t.string   "dhcp_end_range"
    t.string   "city"
    t.string   "country"
    t.string   "zipcode"
    t.string   "latitude"
    t.string   "longitude"
    t.string   "region_name"
    t.boolean  "presence",             default: false
    t.string   "wl_association"
    t.string   "wl_wpa_key"
    t.string   "wl_band"
    t.string   "wl_ssid_name"
    t.boolean  "wds_enabled",          default: false
    t.string   "uplink_type",          default: "1"
    t.integer  "wl_ssid_uniqe_id"
    t.integer  "hardware_part_id"
    t.string   "state"
    t.string   "address2"
    t.string   "mo_service"
    t.string   "mo_apn"
    t.string   "mo_device"
    t.string   "mo_username"
    t.string   "mo_password"
    t.boolean  "enable_lb",            default: false
    t.integer  "retry_count",          default: 5
    t.integer  "retry_interval",       default: 10
    t.string   "retry_ip1"
    t.string   "retry_ip2"
    t.string   "sim_iccid"
    t.string   "sim_imei"
  end

  create_table "scheduled_reports", force: true do |t|
    t.string   "title"
    t.datetime "from_time"
    t.datetime "to_time"
    t.integer  "location_network_id"
    t.string   "scheduled_on"
    t.datetime "last_generated"
    t.string   "flag"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "scheduled_reports_notification_groups", force: true do |t|
    t.integer "scheduled_report_id"
    t.integer "notification_group_id"
  end

  create_table "sim_managements", force: true do |t|
    t.boolean  "is_active",           default: false
    t.string   "mac_id"
    t.string   "plan_type"
    t.string   "invoice_number"
    t.datetime "purchased_on"
    t.datetime "activated_on"
    t.string   "iccid"
    t.string   "imei"
    t.integer  "organisation_id"
    t.integer  "router_inventory_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "sim_rate_plans", force: true do |t|
    t.string   "start_date"
    t.string   "end_date"
    t.string   "plan_type"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "snmp_configs", force: true do |t|
    t.integer  "router_inventory_id"
    t.integer  "location_network_id"
    t.integer  "organisation_id"
    t.string   "server_ip"
    t.string   "server_port"
    t.string   "server_community"
    t.string   "ro_community"
    t.string   "rw_community"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text     "tagging_lists"
  end

  create_table "static_routes", force: true do |t|
    t.string   "routing_name"
    t.integer  "organisation_id"
    t.integer  "router_inventory_id"
    t.integer  "location_network_id"
    t.string   "tagging_lists"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "static_routing_lists", force: true do |t|
    t.string   "network"
    t.string   "bitmask"
    t.string   "gateway"
    t.integer  "static_route_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "taggings", force: true do |t|
    t.integer  "tag_id"
    t.integer  "taggable_id"
    t.string   "taggable_type"
    t.integer  "tagger_id"
    t.string   "tagger_type"
    t.string   "context",       limit: 128
    t.datetime "created_at"
  end

  add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree

  create_table "tags", force: true do |t|
    t.string  "name"
    t.integer "taggings_count", default: 0
  end

  add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree

  create_table "unities", force: true do |t|
    t.integer  "role_id"
    t.integer  "user_id"
    t.integer  "location_network_id"
    t.string   "current_network"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "permission"
  end

  create_table "upgrade_data", force: true do |t|
    t.string   "version"
    t.text     "url"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "upload_time"
  end

  create_table "upgrades", force: true do |t|
    t.string   "version"
    t.text     "aps"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "organisation_id"
    t.integer  "router_inventory_id"
    t.string   "status"
    t.string   "upgrade_type"
    t.string   "schedule_type"
    t.datetime "schedule_at"
    t.string   "time_zone"
    t.string   "worker_job_id"
    t.boolean  "save_prev_config",    default: true
  end

  create_table "uplinks", force: true do |t|
    t.integer  "router_inventory_id"
    t.string   "wl_association"
    t.boolean  "wds_enabled",             default: false
    t.string   "wl_wpa_key"
    t.string   "wl_band"
    t.string   "wl_ssid_name"
    t.integer  "wl_ssid_uniqe_id"
    t.string   "mo_service"
    t.string   "mo_apn"
    t.string   "mo_device"
    t.string   "mo_username"
    t.string   "mo_password"
    t.string   "ip_type"
    t.string   "ip"
    t.string   "subnet_mask"
    t.string   "gateway"
    t.string   "uplink_type",             default: "1"
    t.string   "primary_dns"
    t.string   "secondary_dns"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "load_balance_percentage", default: 0
    t.boolean  "is_primary",              default: false
    t.string   "uplink_name"
    t.string   "mo_proto_key"
    t.boolean  "mo_is_advanced",          default: false
    t.string   "pppoe_username"
    t.string   "pppoe_password"
    t.string   "dns_mode"
  end

  create_table "users", force: true do |t|
    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,     null: false
    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.datetime "created_at"
    t.datetime "updated_at"
    t.string   "full_name"
    t.string   "phone_number"
    t.string   "company_name"
    t.string   "is_admin"
    t.integer  "organisation_id"
    t.string   "organisation_access"
    t.string   "confirmation_token"
    t.datetime "confirmed_at"
    t.datetime "confirmation_sent_at"
    t.string   "unconfirmed_email"
    t.integer  "role_id"
    t.boolean  "approved",               default: false, null: false
    t.boolean  "is_super_admin",         default: false
  end

  add_index "users", ["approved"], name: "index_users_on_approved", using: :btree
  add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_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 "users_notification_groups", force: true do |t|
    t.integer "user_id"
    t.integer "notification_group_id"
  end

  create_table "users_roles", id: false, force: true do |t|
    t.integer "user_id"
    t.integer "role_id"
  end

  add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree

  create_table "v_lans", force: true do |t|
    t.integer  "organisation_id"
    t.integer  "network_ssid_id"
    t.string   "v_lan_id"
    t.string   "ip_type"
    t.string   "ip_address"
    t.string   "net_mask"
    t.string   "dhcp_start_range"
    t.string   "dhcp_end_range"
    t.string   "dns1"
    t.string   "dns2"
    t.string   "gateway"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "enable_gre_on_v_lan"
    t.string   "enable_dhcp_on_v_lan"
    t.string   "name"
    t.string   "dns_mode"
    t.string   "dhcp_relay_server"
    t.text     "dhcp_mappings",         limit: 2147483647
    t.text     "dhcp_ranges",           limit: 2147483647
    t.string   "dhcp_lease_time"
    t.string   "nat",                                      default: "1"
    t.string   "wna",                                      default: "1"
    t.string   "captive_portal"
    t.text     "splash_url"
    t.string   "wallgarden"
    t.text     "walled_garden_range"
    t.string   "overwrite_success_url",                    default: "false"
    t.text     "success_url"
    t.string   "auth_radius_id"
    t.string   "acc_radius_id"
    t.string   "acc_radius_enabled"
    t.string   "per_user_qos"
    t.string   "default_interim_time",                     default: "300"
    t.string   "default_idle_timeout",                     default: "1800"
    t.integer  "location_network_id"
  end

  create_table "vpn_configs", force: true do |t|
    t.string   "name"
    t.string   "ike_time"
    t.string   "l_subnet"
    t.string   "remote_ip"
    t.string   "remote_nw_ip"
    t.string   "remote_nw_subnet"
    t.string   "pre_shared_key"
    t.string   "ike"
    t.string   "esp"
    t.string   "is_enabled"
    t.integer  "location_network_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "is_server",            default: true
    t.boolean  "enable_server_client", default: false
  end

  create_table "wired_configs", force: true do |t|
    t.string   "name"
    t.string   "mode",                                     default: "0"
    t.string   "nat",                                      default: "1"
    t.boolean  "is_enabled",                               default: true
    t.integer  "location_network_id"
    t.string   "acl_mac"
    t.string   "mac_filter_policy"
    t.text     "acl_mac_list"
    t.string   "captive_portal"
    t.text     "splash_url"
    t.string   "wallgarden"
    t.text     "walled_garden_range"
    t.string   "overwrite_success_url",                    default: "false"
    t.text     "success_url"
    t.string   "dhcp_range_start"
    t.string   "dhcp_range_end"
    t.string   "dhcp_relay_server"
    t.string   "dhcp_lease_time"
    t.string   "auth_radius_id"
    t.string   "acc_radius_id"
    t.string   "acc_radius_enabled"
    t.string   "ip_address"
    t.string   "subnet_mask"
    t.string   "ssid_qos"
    t.boolean  "enable_ssid_qos"
    t.string   "per_user_qos"
    t.integer  "max_association",                          default: 0
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "dns_mode",                                 default: "1"
    t.string   "dns_primary"
    t.string   "dns_secondary"
    t.string   "wna",                                      default: "0"
    t.text     "dhcp_mappings",         limit: 2147483647
    t.string   "default_interim_time",                     default: "300"
    t.string   "default_idle_timeout",                     default: "1800"
    t.text     "port_configs",          limit: 2147483647
    t.string   "custom_port"
    t.string   "enabled",                                  default: "1"
    t.string   "dhcp_ranges"
  end

  create_table "wired_configs_v_lans", force: true do |t|
    t.integer "wired_config_id"
    t.integer "v_lan_id"
  end

end
