CREATE INDEX "name" on "access_points" ("name", "radio_number");
CREATE INDEX "access_points_deleted_index" on "access_points" ("deleted");
CREATE TABLE IF NOT EXISTS "alert_device_map" ("id" integer not null primary key autoincrement, "rule_id" integer not null, "device_id" integer not null);
CREATE UNIQUE INDEX "alert_device_map_rule_id_device_id_unique" on "alert_device_map" ("rule_id", "device_id");
CREATE TABLE IF NOT EXISTS "alert_group_map" ("id" integer not null primary key autoincrement, "rule_id" integer not null, "group_id" integer not null);
CREATE UNIQUE INDEX "alert_group_map_rule_id_group_id_unique" on "alert_group_map" ("rule_id", "group_id");
CREATE TABLE IF NOT EXISTS "alert_log" ("id" integer not null primary key autoincrement, "rule_id" integer not null, "device_id" integer not null, "state" integer not null, "details" blob, "time_logged" datetime default CURRENT_TIMESTAMP not null);
CREATE TABLE IF NOT EXISTS "alert_rules" ("id" integer not null primary key autoincrement, "rule" text not null, "severity" varchar check ("severity" in ('ok', 'warning', 'critical')) not null, "extra" varchar not null, "disabled" tinyint(1) not null, "name" varchar not null, "query" text not null, "builder" text not null, "proc" varchar, "invert_map" tinyint(1) not null default '0');
CREATE UNIQUE INDEX "alert_rules_name_unique" on "alert_rules" ("name");
CREATE TABLE IF NOT EXISTS "alert_schedulables" ("item_id" integer not null primary key autoincrement, "schedule_id" integer not null, "alert_schedulable_id" integer not null, "alert_schedulable_type" varchar not null);
CREATE INDEX "schedulable_morph_index" on "alert_schedulables" ("alert_schedulable_type", "alert_schedulable_id");
CREATE INDEX "alert_schedulables_schedule_id_index" on "alert_schedulables" ("schedule_id");
CREATE TABLE IF NOT EXISTS "alert_template_map" ("id" integer not null primary key autoincrement, "alert_templates_id" integer not null, "alert_rule_id" integer not null);
CREATE INDEX "alert_templates_id" on "alert_template_map" ("alert_templates_id", "alert_rule_id");
CREATE TABLE IF NOT EXISTS "alert_templates" ("id" integer not null primary key autoincrement, "name" varchar not null, "template" text not null, "title" varchar, "title_rec" varchar);
CREATE TABLE IF NOT EXISTS "alert_transport_groups" ("transport_group_id" integer not null primary key autoincrement, "transport_group_name" varchar not null);
CREATE TABLE IF NOT EXISTS "alert_transport_map" ("id" integer not null primary key autoincrement, "rule_id" integer not null, "transport_or_group_id" integer not null, "target_type" varchar not null);
CREATE TABLE IF NOT EXISTS "alert_transports" ("transport_id" integer not null primary key autoincrement, "transport_name" varchar not null, "transport_type" varchar not null default 'mail', "is_default" tinyint(1) not null default '0', "transport_config" text);
CREATE TABLE IF NOT EXISTS "alerts" ("id" integer not null primary key autoincrement, "device_id" integer not null, "rule_id" integer not null, "state" integer not null, "alerted" integer not null, "open" integer not null, "note" text, "timestamp" datetime default CURRENT_TIMESTAMP not null, "info" text not null);
CREATE TABLE IF NOT EXISTS "api_tokens" ("id" integer not null primary key autoincrement, "user_id" integer not null, "token_hash" varchar, "description" varchar not null, "disabled" tinyint(1) not null default '0');
CREATE UNIQUE INDEX "api_tokens_token_hash_unique" on "api_tokens" ("token_hash");
CREATE TABLE IF NOT EXISTS "authlog" ("id" integer not null primary key autoincrement, "datetime" datetime default CURRENT_TIMESTAMP not null, "user" text not null, "address" text not null, "result" text not null);
CREATE TABLE IF NOT EXISTS "bgpPeers_cbgp" ("device_id" integer not null, "bgpPeerIdentifier" varchar not null, "afi" varchar not null, "safi" varchar not null, "AcceptedPrefixes" integer not null, "DeniedPrefixes" integer not null, "PrefixAdminLimit" integer not null, "PrefixThreshold" integer not null, "PrefixClearThreshold" integer not null, "AdvertisedPrefixes" integer not null, "SuppressedPrefixes" integer not null, "WithdrawnPrefixes" integer not null, "AcceptedPrefixes_delta" integer not null, "AcceptedPrefixes_prev" integer not null, "DeniedPrefixes_delta" integer not null, "DeniedPrefixes_prev" integer not null, "AdvertisedPrefixes_delta" integer not null, "AdvertisedPrefixes_prev" integer not null, "SuppressedPrefixes_delta" integer not null, "SuppressedPrefixes_prev" integer not null, "WithdrawnPrefixes_delta" integer not null, "WithdrawnPrefixes_prev" integer not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "bgpPeers" ("bgpPeer_id" integer not null primary key autoincrement, "device_id" integer not null, "astext" varchar not null, "bgpPeerIdentifier" text not null, "bgpPeerRemoteAs" integer not null, "bgpPeerState" text not null, "bgpPeerAdminStatus" text not null, "bgpLocalAddr" text not null, "bgpPeerRemoteAddr" text not null, "bgpPeerDescr" varchar not null default '', "bgpPeerInUpdates" integer not null, "bgpPeerOutUpdates" integer not null, "bgpPeerInTotalMessages" integer not null, "bgpPeerOutTotalMessages" integer not null, "bgpPeerFsmEstablishedTime" integer not null, "bgpPeerInUpdateElapsedTime" integer not null, "context_name" varchar, "vrf_id" integer, "bgpPeerLastErrorCode" integer, "bgpPeerLastErrorSubCode" integer, "bgpPeerLastErrorText" varchar, "bgpPeerIface" integer);
CREATE INDEX "bgppeers_device_id_context_name_index" on "bgpPeers" ("device_id", "context_name");
CREATE TABLE IF NOT EXISTS "bill_data" ("bill_id" integer not null, "timestamp" datetime not null, "period" integer not null, "delta" integer not null, "in_delta" integer not null, "out_delta" integer not null, primary key ("bill_id", "timestamp"));
CREATE INDEX "bill_data_bill_id_index" on "bill_data" ("bill_id");
CREATE TABLE IF NOT EXISTS "bill_history" ("bill_hist_id" integer not null primary key autoincrement, "bill_id" integer not null, "updated" datetime default CURRENT_TIMESTAMP not null, "bill_datefrom" datetime not null, "bill_dateto" datetime not null, "bill_type" text not null, "bill_allowed" integer not null, "bill_used" integer not null, "bill_overuse" integer not null, "bill_percent" numeric not null, "rate_95th_in" integer not null, "rate_95th_out" integer not null, "rate_95th" integer not null, "dir_95th" varchar not null, "rate_average" integer not null, "rate_average_in" integer not null, "rate_average_out" integer not null, "traf_in" integer not null, "traf_out" integer not null, "traf_total" integer not null, "pdf" blob, "bill_peak_out" integer, "bill_peak_in" integer);
CREATE TABLE IF NOT EXISTS "bill_ports" ("id" integer not null primary key autoincrement, "bill_id" integer not null, "port_id" integer not null, "bill_port_autoadded" tinyint(1) not null default '0');
CREATE TABLE IF NOT EXISTS "bills" ("bill_id" integer not null primary key autoincrement, "bill_name" text not null, "bill_type" text not null, "bill_cdr" integer, "bill_day" integer not null default '1', "bill_quota" integer, "rate_95th_in" integer not null, "rate_95th_out" integer not null, "rate_95th" integer not null, "dir_95th" varchar not null, "total_data" integer not null, "total_data_in" integer not null, "total_data_out" integer not null, "rate_average_in" integer not null, "rate_average_out" integer not null, "rate_average" integer not null, "bill_last_calc" datetime not null, "bill_custid" varchar not null, "bill_ref" varchar not null, "bill_notes" varchar not null, "bill_autoadded" tinyint(1) not null);
CREATE TABLE IF NOT EXISTS "callback" ("callback_id" integer not null primary key autoincrement, "name" varchar not null, "value" varchar not null);
CREATE TABLE IF NOT EXISTS "cef_switching" ("cef_switching_id" integer not null primary key autoincrement, "device_id" integer not null, "entPhysicalIndex" integer not null, "afi" varchar not null, "cef_index" integer not null, "cef_path" varchar not null, "drop" integer not null, "punt" integer not null, "punt2host" integer not null, "drop_prev" integer not null, "punt_prev" integer not null, "punt2host_prev" integer not null, "updated" integer not null, "updated_prev" integer not null);
CREATE UNIQUE INDEX "cef_switching_device_id_entphysicalindex_afi_cef_index_unique" on "cef_switching" ("device_id", "entPhysicalIndex", "afi", "cef_index");
CREATE TABLE IF NOT EXISTS "ciscoASA" ("ciscoASA_id" integer not null primary key autoincrement, "device_id" integer not null, "oid" varchar not null, "data" integer not null, "high_alert" integer not null, "low_alert" integer not null, "disabled" integer not null default '0');
CREATE INDEX "ciscoasa_device_id_index" on "ciscoASA" ("device_id");
CREATE TABLE IF NOT EXISTS "component_prefs" ("id" integer not null primary key autoincrement, "component" integer not null, "attribute" varchar not null, "value" text not null);
CREATE INDEX "component_prefs_component_index" on "component_prefs" ("component");
CREATE INDEX "component_device_id_index" on "component" ("device_id");
CREATE INDEX "component_type_index" on "component" ("type");
CREATE TABLE IF NOT EXISTS "customers" ("customer_id" integer not null primary key autoincrement, "username" varchar not null, "password" varchar not null, "string" varchar not null, "level" integer not null default '0');
CREATE UNIQUE INDEX "customers_username_unique" on "customers" ("username");
CREATE TABLE IF NOT EXISTS "dashboards" ("dashboard_id" integer not null primary key autoincrement, "user_id" integer not null default '0', "dashboard_name" varchar not null, "access" tinyint(1) not null default '0');
CREATE TABLE IF NOT EXISTS "dbSchema" ("version" integer not null default '0', primary key ("version"));
CREATE INDEX "device_graphs_device_id_index" on "device_graphs" ("device_id");
CREATE TABLE IF NOT EXISTS "device_group_device" ("device_group_id" integer not null, "device_id" integer not null, primary key ("device_group_id", "device_id"));
CREATE INDEX "device_group_device_device_group_id_index" on "device_group_device" ("device_group_id");
CREATE INDEX "device_group_device_device_id_index" on "device_group_device" ("device_id");
CREATE TABLE IF NOT EXISTS "device_perf" ("id" integer not null primary key autoincrement, "device_id" integer not null, "timestamp" datetime not null, "xmt" integer not null, "rcv" integer not null, "loss" integer not null, "min" float not null, "max" float not null, "avg" float not null, "debug" text);
CREATE INDEX "device_perf_device_id_index" on "device_perf" ("device_id");
CREATE TABLE IF NOT EXISTS "device_relationships" ("parent_device_id" integer not null default '0', "child_device_id" integer not null, primary key ("parent_device_id", "child_device_id"));
CREATE INDEX "device_relationships_child_device_id_index" on "device_relationships" ("child_device_id");
CREATE TABLE IF NOT EXISTS "devices_perms" ("id" integer not null primary key autoincrement, "user_id" integer not null, "device_id" integer not null);
CREATE INDEX "devices_perms_user_id_index" on "devices_perms" ("user_id");
CREATE TABLE IF NOT EXISTS "entPhysical_state" ("id" integer not null primary key autoincrement, "device_id" integer not null, "entPhysicalIndex" varchar not null, "subindex" varchar, "group" varchar not null, "key" varchar not null, "value" varchar not null);
CREATE TABLE IF NOT EXISTS "entPhysical" ("entPhysical_id" integer not null primary key autoincrement, "device_id" integer not null, "entPhysicalIndex" integer not null, "entPhysicalDescr" text not null, "entPhysicalClass" text not null, "entPhysicalName" text not null, "entPhysicalHardwareRev" varchar, "entPhysicalFirmwareRev" varchar, "entPhysicalSoftwareRev" varchar, "entPhysicalAlias" varchar, "entPhysicalAssetID" varchar, "entPhysicalIsFRU" varchar, "entPhysicalModelName" text not null, "entPhysicalVendorType" text, "entPhysicalSerialNum" text not null, "entPhysicalContainedIn" integer not null, "entPhysicalParentRelPos" integer not null, "entPhysicalMfgName" text not null, "ifIndex" integer);
CREATE TABLE IF NOT EXISTS "graph_types" ("graph_type" varchar not null, "graph_subtype" varchar not null, "graph_section" varchar not null, "graph_descr" varchar, "graph_order" integer not null, primary key ("graph_type", "graph_subtype", "graph_section"));
CREATE TABLE IF NOT EXISTS "hrDevice" ("hrDevice_id" integer not null primary key autoincrement, "device_id" integer not null, "hrDeviceIndex" integer not null, "hrDeviceDescr" text not null, "hrDeviceType" text not null, "hrDeviceErrors" integer not null default '0', "hrDeviceStatus" text not null, "hrProcessorLoad" integer);
CREATE INDEX "hrdevice_device_id_index" on "hrDevice" ("device_id");
CREATE TABLE IF NOT EXISTS "ipsec_tunnels" ("tunnel_id" integer not null primary key autoincrement, "device_id" integer not null, "peer_port" integer not null, "peer_addr" varchar not null, "local_addr" varchar not null, "local_port" integer not null, "tunnel_name" varchar not null, "tunnel_status" varchar not null);
CREATE UNIQUE INDEX "ipsec_tunnels_device_id_peer_addr_unique" on "ipsec_tunnels" ("device_id", "peer_addr");
CREATE TABLE IF NOT EXISTS "ipv4_addresses" ("ipv4_address_id" integer not null primary key autoincrement, "ipv4_address" varchar not null, "ipv4_prefixlen" integer not null, "ipv4_network_id" varchar not null, "port_id" integer not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "ipv4_mac" ("id" integer not null primary key autoincrement, "port_id" integer not null, "device_id" integer, "mac_address" varchar not null, "ipv4_address" varchar not null, "context_name" varchar not null);
CREATE TABLE IF NOT EXISTS "ipv4_networks" ("ipv4_network_id" integer not null primary key autoincrement, "ipv4_network" varchar not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "ipv6_addresses" ("ipv6_address_id" integer not null primary key autoincrement, "ipv6_address" varchar not null, "ipv6_compressed" varchar not null, "ipv6_prefixlen" integer not null, "ipv6_origin" varchar not null, "ipv6_network_id" varchar not null, "port_id" integer not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "ipv6_networks" ("ipv6_network_id" integer not null primary key autoincrement, "ipv6_network" varchar not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "juniAtmVp" ("id" integer not null primary key autoincrement, "juniAtmVp_id" integer not null, "port_id" integer not null, "vp_id" integer not null, "vp_descr" varchar not null);
CREATE INDEX "juniatmvp_port_id_index" on "juniAtmVp" ("port_id");
CREATE INDEX "local_device_id" on "links" ("local_device_id", "remote_device_id");
CREATE INDEX "links_local_port_id_index" on "links" ("local_port_id");
CREATE INDEX "links_remote_port_id_index" on "links" ("remote_port_id");
CREATE TABLE IF NOT EXISTS "loadbalancer_rservers" ("rserver_id" integer not null primary key autoincrement, "farm_id" varchar not null, "device_id" integer not null, "StateDescr" varchar not null);
CREATE TABLE IF NOT EXISTS "loadbalancer_vservers" ("id" integer not null primary key autoincrement, "classmap_id" integer not null, "classmap" varchar not null, "serverstate" varchar not null, "device_id" integer not null);
CREATE INDEX "loadbalancer_vservers_device_id_index" on "loadbalancer_vservers" ("device_id");
CREATE INDEX "mac_accounting_port_id_index" on "mac_accounting" ("port_id");
CREATE TABLE IF NOT EXISTS "mefinfo" ("id" integer not null primary key autoincrement, "device_id" integer not null, "mefID" integer not null, "mefType" varchar not null, "mefIdent" varchar not null, "mefMTU" integer not null default '1500', "mefAdmState" varchar not null, "mefRowState" varchar not null);
CREATE INDEX "mefinfo_device_id_index" on "mefinfo" ("device_id");
CREATE INDEX "mefinfo_mefid_index" on "mefinfo" ("mefID");
CREATE TABLE IF NOT EXISTS "munin_plugins_ds" ("mplug_id" integer not null, "ds_name" varchar not null, "ds_type" varchar check ("ds_type" in ('COUNTER', 'ABSOLUTE', 'DERIVE', 'GAUGE')) not null default 'GAUGE', "ds_label" varchar not null, "ds_cdef" varchar not null, "ds_draw" varchar not null, "ds_graph" varchar check ("ds_graph" in ('no', 'yes')) not null default 'yes', "ds_info" varchar not null, "ds_extinfo" text not null, "ds_max" varchar not null, "ds_min" varchar not null, "ds_negative" varchar not null, "ds_warning" varchar not null, "ds_critical" varchar not null, "ds_colour" varchar not null, "ds_sum" text not null, "ds_stack" text not null, "ds_line" varchar not null);
CREATE UNIQUE INDEX "munin_plugins_ds_mplug_id_ds_name_unique" on "munin_plugins_ds" ("mplug_id", "ds_name");
CREATE UNIQUE INDEX "munin_plugins_device_id_mplug_type_unique" on "munin_plugins" ("device_id", "mplug_type");
CREATE INDEX "munin_plugins_device_id_index" on "munin_plugins" ("device_id");
CREATE TABLE IF NOT EXISTS "netscaler_vservers" ("vsvr_id" integer not null primary key autoincrement, "device_id" integer not null, "vsvr_name" varchar not null, "vsvr_ip" varchar not null, "vsvr_port" integer not null, "vsvr_type" varchar not null, "vsvr_state" varchar not null, "vsvr_clients" integer not null, "vsvr_server" integer not null, "vsvr_req_rate" integer not null, "vsvr_bps_in" integer not null, "vsvr_bps_out" integer not null);
CREATE TABLE IF NOT EXISTS "notifications_attribs" ("attrib_id" integer not null primary key autoincrement, "notifications_id" integer not null, "user_id" integer not null, "key" varchar not null default '', "value" varchar not null default '');
CREATE TABLE IF NOT EXISTS "notifications" ("notifications_id" integer not null primary key autoincrement, "title" varchar not null default '', "body" text not null, "severity" integer default '0', "source" varchar not null default '', "checksum" varchar not null, "datetime" datetime not null default '1970-01-02 00:00:00');
CREATE TABLE IF NOT EXISTS "ospf_instances" ("id" integer not null primary key autoincrement, "device_id" integer not null, "ospf_instance_id" integer not null, "ospfRouterId" varchar not null, "ospfAdminStat" varchar not null, "ospfVersionNumber" varchar not null, "ospfAreaBdrRtrStatus" varchar not null, "ospfASBdrRtrStatus" varchar not null, "ospfExternLsaCount" integer not null, "ospfExternLsaCksumSum" integer not null, "ospfTOSSupport" varchar not null, "ospfOriginateNewLsas" integer not null, "ospfRxNewLsas" integer not null, "ospfExtLsdbLimit" integer, "ospfMulticastExtensions" integer, "ospfExitOverflowInterval" integer, "ospfDemandExtensions" varchar, "context_name" varchar);
CREATE UNIQUE INDEX "ospf_instances_device_id_ospf_instance_id_context_name_unique" on "ospf_instances" ("device_id", "ospf_instance_id", "context_name");
CREATE TABLE IF NOT EXISTS "ospf_nbrs" ("id" integer not null primary key autoincrement, "device_id" integer not null, "port_id" integer, "ospf_nbr_id" varchar not null, "ospfNbrIpAddr" varchar not null, "ospfNbrAddressLessIndex" integer not null, "ospfNbrRtrId" varchar not null, "ospfNbrOptions" integer not null, "ospfNbrPriority" integer not null, "ospfNbrState" varchar not null, "ospfNbrEvents" integer not null, "ospfNbrLsRetransQLen" integer not null, "ospfNbmaNbrStatus" varchar not null, "ospfNbmaNbrPermanence" varchar not null, "ospfNbrHelloSuppressed" varchar not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "packages" ("pkg_id" integer not null primary key autoincrement, "device_id" integer not null, "name" varchar not null, "manager" varchar not null default '1', "status" tinyint(1) not null, "version" varchar not null, "build" varchar not null, "arch" varchar not null, "size" integer);
CREATE TABLE IF NOT EXISTS "pdb_ix" ("pdb_ix_id" integer not null primary key autoincrement, "ix_id" integer not null, "name" varchar not null, "asn" integer not null, "timestamp" integer not null);
CREATE TABLE IF NOT EXISTS "plugins" ("plugin_id" integer not null primary key autoincrement, "plugin_name" varchar not null, "plugin_active" integer not null, "version" integer not null default '1', "settings" text);
CREATE TABLE IF NOT EXISTS "poller_cluster_stats" ("id" integer not null primary key autoincrement, "parent_poller" integer not null default '0', "poller_type" varchar not null default '', "depth" integer not null, "devices" integer not null, "worker_seconds" float not null, "workers" integer not null, "frequency" integer not null);
CREATE UNIQUE INDEX "poller_cluster_stats_parent_poller_poller_type_unique" on "poller_cluster_stats" ("parent_poller", "poller_type");
CREATE UNIQUE INDEX "poller_cluster_node_id_unique" on "poller_cluster" ("node_id");
CREATE TABLE IF NOT EXISTS "poller_groups" ("id" integer not null primary key autoincrement, "group_name" varchar not null, "descr" varchar not null);
CREATE TABLE IF NOT EXISTS "pollers" ("id" integer not null primary key autoincrement, "poller_name" varchar not null, "last_polled" datetime not null, "devices" integer not null, "time_taken" float not null);
CREATE UNIQUE INDEX "pollers_poller_name_unique" on "pollers" ("poller_name");
CREATE TABLE IF NOT EXISTS "ports_fdb" ("ports_fdb_id" integer not null primary key autoincrement, "port_id" integer not null, "mac_address" varchar not null, "vlan_id" integer not null, "device_id" integer not null, "created_at" datetime, "updated_at" datetime);
CREATE INDEX "ports_fdb_port_id_index" on "ports_fdb" ("port_id");
CREATE INDEX "ports_fdb_mac_address_index" on "ports_fdb" ("mac_address");
CREATE INDEX "ports_fdb_vlan_id_index" on "ports_fdb" ("vlan_id");
CREATE INDEX "ports_fdb_device_id_index" on "ports_fdb" ("device_id");
CREATE TABLE IF NOT EXISTS "ports_perms" ("id" integer not null primary key autoincrement, "user_id" integer not null, "port_id" integer not null);
CREATE TABLE IF NOT EXISTS "ports_stack" ("device_id" integer not null, "port_id_high" integer not null, "port_id_low" integer not null, "ifStackStatus" varchar not null);
CREATE UNIQUE INDEX "ports_stack_device_id_port_id_high_port_id_low_unique" on "ports_stack" ("device_id", "port_id_high", "port_id_low");
CREATE TABLE IF NOT EXISTS "ports_vlans" ("port_vlan_id" integer not null primary key autoincrement, "device_id" integer not null, "port_id" integer not null, "vlan" integer not null, "baseport" integer not null, "priority" integer not null, "state" varchar not null, "cost" integer not null, "untagged" tinyint(1) not null default '0');
CREATE UNIQUE INDEX "ports_vlans_device_id_port_id_vlan_unique" on "ports_vlans" ("device_id", "port_id", "vlan");
CREATE TABLE IF NOT EXISTS "processes" ("id" integer not null primary key autoincrement, "device_id" integer not null, "pid" integer not null, "vsz" integer not null, "rss" integer not null, "cputime" varchar not null, "user" varchar not null, "command" text not null);
CREATE INDEX "processes_device_id_index" on "processes" ("device_id");
CREATE TABLE IF NOT EXISTS "processors" ("processor_id" integer not null primary key autoincrement, "entPhysicalIndex" integer not null default '0', "hrDeviceIndex" integer, "device_id" integer not null, "processor_oid" varchar not null, "processor_index" varchar not null, "processor_type" varchar not null, "processor_usage" integer not null, "processor_descr" varchar not null, "processor_precision" integer not null default '1', "processor_perc_warn" integer default '75');
CREATE INDEX "processors_device_id_index" on "processors" ("device_id");
CREATE TABLE IF NOT EXISTS "proxmox_ports" ("id" integer not null primary key autoincrement, "vm_id" integer not null, "port" varchar not null, "last_seen" datetime default CURRENT_TIMESTAMP not null);
CREATE UNIQUE INDEX "proxmox_ports_vm_id_port_unique" on "proxmox_ports" ("vm_id", "port");
CREATE TABLE IF NOT EXISTS "proxmox" ("id" integer not null primary key autoincrement, "device_id" integer not null default '0', "vmid" integer not null, "cluster" varchar not null, "description" varchar, "last_seen" datetime default CURRENT_TIMESTAMP not null);
CREATE INDEX "sensors_sensor_class_index" on "sensors" ("sensor_class");
CREATE INDEX "sensors_device_id_index" on "sensors" ("device_id");
CREATE INDEX "sensors_sensor_type_index" on "sensors" ("sensor_type");
CREATE TABLE IF NOT EXISTS "sensors_to_state_indexes" ("sensors_to_state_translations_id" integer not null primary key autoincrement, "sensor_id" integer not null, "state_index_id" integer not null);
CREATE UNIQUE INDEX "sensors_to_state_indexes_sensor_id_state_index_id_unique" on "sensors_to_state_indexes" ("sensor_id", "state_index_id");
CREATE INDEX "sensors_to_state_indexes_state_index_id_index" on "sensors_to_state_indexes" ("state_index_id");
CREATE TABLE IF NOT EXISTS "session" ("session_id" integer not null primary key autoincrement, "session_username" varchar not null, "session_value" varchar not null, "session_token" varchar not null, "session_auth" varchar not null, "session_expiry" integer not null);
CREATE UNIQUE INDEX "session_session_value_unique" on "session" ("session_value");
CREATE TABLE IF NOT EXISTS "state_indexes" ("state_index_id" integer not null primary key autoincrement, "state_name" varchar not null);
CREATE UNIQUE INDEX "state_indexes_state_name_unique" on "state_indexes" ("state_name");
CREATE TABLE IF NOT EXISTS "state_translations" ("state_translation_id" integer not null primary key autoincrement, "state_index_id" integer not null, "state_descr" varchar not null, "state_draw_graph" tinyint(1) not null, "state_value" integer not null default '0', "state_generic_value" tinyint(1) not null, "state_lastupdated" datetime default CURRENT_TIMESTAMP not null);
CREATE UNIQUE INDEX "state_translations_state_index_id_state_value_unique" on "state_translations" ("state_index_id", "state_value");
CREATE TABLE IF NOT EXISTS "storage" ("storage_id" integer not null primary key autoincrement, "device_id" integer not null, "storage_mib" varchar not null, "storage_index" varchar, "storage_type" varchar, "storage_descr" text not null, "storage_size" integer not null, "storage_units" integer not null, "storage_used" integer not null default '0', "storage_free" integer not null default '0', "storage_perc" integer not null default '0', "storage_perc_warn" integer default '60', "storage_deleted" tinyint(1) not null default '0');
CREATE TABLE IF NOT EXISTS "stp" ("stp_id" integer not null primary key autoincrement, "device_id" integer not null, "rootBridge" tinyint(1) not null, "bridgeAddress" varchar not null, "protocolSpecification" varchar not null, "priority" integer not null, "timeSinceTopologyChange" varchar not null, "topChanges" integer not null, "designatedRoot" varchar not null, "rootCost" integer not null, "rootPort" integer, "maxAge" integer not null, "helloTime" integer not null, "holdTime" integer not null, "forwardDelay" integer not null, "bridgeMaxAge" integer not null, "bridgeHelloTime" integer not null, "bridgeForwardDelay" integer not null, "vlan" integer);
CREATE INDEX "syslog_priority_level_index" on "syslog" ("priority", "level");
CREATE INDEX "syslog_device_id_timestamp_index" on "syslog" ("device_id", "timestamp");
CREATE INDEX "syslog_device_id_index" on "syslog" ("device_id");
CREATE INDEX "syslog_timestamp_index" on "syslog" ("timestamp");
CREATE INDEX "syslog_program_index" on "syslog" ("program");
CREATE TABLE IF NOT EXISTS "tnmsneinfo" ("id" integer not null primary key autoincrement, "device_id" integer not null, "neID" integer not null, "neType" varchar not null, "neName" varchar not null, "neLocation" varchar not null, "neAlarm" varchar not null, "neOpMode" varchar not null, "neOpState" varchar not null);
CREATE INDEX "tnmsneinfo_device_id_index" on "tnmsneinfo" ("device_id");
CREATE INDEX "tnmsneinfo_neid_index" on "tnmsneinfo" ("neID");
CREATE TABLE IF NOT EXISTS "transport_group_transport" ("id" integer not null primary key autoincrement, "transport_group_id" integer not null, "transport_id" integer not null);
CREATE TABLE IF NOT EXISTS "ucd_diskio" ("diskio_id" integer not null primary key autoincrement, "device_id" integer not null, "diskio_index" integer not null, "diskio_descr" varchar not null);
CREATE INDEX "ucd_diskio_device_id_index" on "ucd_diskio" ("device_id");
CREATE TABLE IF NOT EXISTS "users_prefs" ("user_id" integer not null, "pref" varchar not null, "value" varchar not null);
CREATE UNIQUE INDEX "users_prefs_user_id_pref_unique" on "users_prefs" ("user_id", "pref");
CREATE TABLE IF NOT EXISTS "vrfs" ("vrf_id" integer not null primary key autoincrement, "vrf_oid" varchar not null, "vrf_name" varchar, "mplsVpnVrfRouteDistinguisher" varchar, "mplsVpnVrfDescription" text not null, "device_id" integer not null, "bgpLocalAs" integer);
CREATE TABLE IF NOT EXISTS "route" ("route_id" integer not null primary key autoincrement, "created_at" datetime, "updated_at" datetime, "device_id" integer not null, "port_id" integer not null, "context_name" varchar, "inetCidrRouteIfIndex" integer not null, "inetCidrRouteType" integer not null, "inetCidrRouteProto" integer not null, "inetCidrRouteNextHopAS" integer not null, "inetCidrRouteMetric1" integer not null, "inetCidrRouteDestType" varchar not null, "inetCidrRouteDest" varchar not null, "inetCidrRouteNextHopType" varchar not null, "inetCidrRouteNextHop" varchar not null, "inetCidrRoutePolicy" varchar not null, "inetCidrRoutePfxLen" integer not null);
CREATE TABLE IF NOT EXISTS "mpls_lsps" ("lsp_id" integer not null primary key autoincrement, "vrf_oid" integer not null, "lsp_oid" integer not null, "device_id" integer not null, "mplsLspRowStatus" varchar check ("mplsLspRowStatus" in ('active', 'notInService', 'notReady', 'createAndGo', 'createAndWait', 'destroy')) not null, "mplsLspLastChange" integer, "mplsLspName" varchar not null, "mplsLspAdminState" varchar check ("mplsLspAdminState" in ('noop', 'inService', 'outOfService')) not null, "mplsLspOperState" varchar check ("mplsLspOperState" in ('unknown', 'inService', 'outOfService', 'transition')) not null, "mplsLspFromAddr" varchar not null, "mplsLspToAddr" varchar not null, "mplsLspType" varchar check ("mplsLspType" in ('unknown', 'dynamic', 'static', 'bypassOnly', 'p2mpLsp', 'p2mpAuto', 'mplsTp', 'meshP2p', 'oneHopP2p', 'srTe', 'meshP2pSrTe', 'oneHopP2pSrTe')) not null, "mplsLspFastReroute" varchar check ("mplsLspFastReroute" in ('true', 'false')) not null, "mplsLspAge" integer, "mplsLspTimeUp" integer, "mplsLspTimeDown" integer, "mplsLspPrimaryTimeUp" integer, "mplsLspTransitions" integer, "mplsLspLastTransition" integer, "mplsLspConfiguredPaths" integer, "mplsLspStandbyPaths" integer, "mplsLspOperationalPaths" integer);
CREATE INDEX "mpls_saps_device_id_index" on "mpls_saps" ("device_id");
CREATE INDEX "notifications_attribs_notifications_id_user_id_index" on "notifications_attribs" ("notifications_id", "user_id");
CREATE TABLE IF NOT EXISTS "devices_group_perms" ("user_id" integer not null, "device_group_id" integer not null, primary key ("device_group_id", "user_id"));
CREATE INDEX "devices_group_perms_user_id_index" on "devices_group_perms" ("user_id");
CREATE INDEX "devices_group_perms_device_group_id_index" on "devices_group_perms" ("device_group_id");
CREATE TABLE mpls_lsp_paths (lsp_path_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, lsp_id INTEGER NOT NULL, path_oid INTEGER NOT NULL, device_id INTEGER NOT NULL, mplsLspPathRowStatus VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathLastChange INTEGER NOT NULL, mplsLspPathType VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathBandwidth INTEGER NOT NULL, mplsLspPathOperBandwidth INTEGER NOT NULL, mplsLspPathAdminState VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathOperState VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathState VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathFailCode VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathFailNodeAddr VARCHAR(255) NOT NULL COLLATE BINARY, mplsLspPathMetric INTEGER NOT NULL, mplsLspPathOperMetric INTEGER UNSIGNED DEFAULT NULL, mplsLspPathTimeUp INTEGER DEFAULT NULL, mplsLspPathTimeDown INTEGER DEFAULT NULL, mplsLspPathTransitionCount INTEGER DEFAULT NULL, mplsLspPathTunnelARHopListIndex INTEGER DEFAULT NULL, mplsLspPathTunnelCHopListIndex INTEGER DEFAULT NULL);
CREATE INDEX mpls_lsp_paths_device_id_index ON mpls_lsp_paths (device_id);
CREATE TABLE IF NOT EXISTS "alert_location_map" ("id" integer not null primary key autoincrement, "rule_id" integer not null, "location_id" integer not null);
CREATE UNIQUE INDEX "alert_location_map_rule_id_location_id_uindex" on "alert_location_map" ("rule_id", "location_id");
CREATE TABLE alert_schedule (schedule_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, recurring BOOLEAN DEFAULT '0' NOT NULL, start DATETIME DEFAULT '1970-01-02 00:00:01' NOT NULL, "end" DATETIME DEFAULT '1970-01-02 00:00:01' NOT NULL, recurring_day VARCHAR(255) DEFAULT NULL COLLATE BINARY, title VARCHAR(255) NOT NULL COLLATE BINARY, notes CLOB NOT NULL COLLATE BINARY);
CREATE TABLE application_metrics (app_id INTEGER NOT NULL, value DOUBLE PRECISION DEFAULT NULL, value_prev DOUBLE PRECISION DEFAULT NULL, metric VARCHAR(64) NOT NULL COLLATE BINARY);
CREATE UNIQUE INDEX application_metrics_app_id_metric_unique ON application_metrics (app_id, metric);
CREATE TABLE availability (availability_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, duration INTEGER NOT NULL, availability_perc NUMERIC(9, 6) DEFAULT '0' NOT NULL);
CREATE INDEX availability_device_id_index ON availability (device_id);
CREATE UNIQUE INDEX availability_device_id_duration_unique ON availability (device_id, duration);
CREATE TABLE IF NOT EXISTS "service_templates_device_group" ("service_template_id" integer not null, "device_group_id" integer not null, primary key ("service_template_id", "device_group_id"));
CREATE INDEX "service_templates_device_group_service_template_id_index" on "service_templates_device_group" ("service_template_id");
CREATE INDEX "service_templates_device_group_device_group_id_index" on "service_templates_device_group" ("device_group_id");
CREATE TABLE IF NOT EXISTS "service_templates_device" ("service_template_id" integer not null, "device_id" integer not null, primary key ("service_template_id", "device_id"));
CREATE INDEX "service_templates_device_service_template_id_index" on "service_templates_device" ("service_template_id");
CREATE INDEX "service_templates_device_device_id_index" on "service_templates_device" ("device_id");
CREATE TABLE IF NOT EXISTS "port_group_port" ("port_group_id" integer not null, "port_id" integer not null, primary key ("port_group_id", "port_id"));
CREATE INDEX "port_group_port_port_group_id_index" on "port_group_port" ("port_group_id");
CREATE INDEX "port_group_port_port_id_index" on "port_group_port" ("port_id");
CREATE TABLE IF NOT EXISTS "port_groups" ("id" integer not null primary key autoincrement, "name" varchar not null, "desc" varchar);
CREATE UNIQUE INDEX "port_groups_name_unique" on "port_groups" ("name");
CREATE TABLE printer_supplies (supply_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER DEFAULT 0 NOT NULL, supply_index INTEGER NOT NULL, supply_type VARCHAR(255) NOT NULL COLLATE BINARY, supply_oid VARCHAR(255) NOT NULL COLLATE BINARY, supply_capacity INTEGER DEFAULT 0 NOT NULL, supply_current INTEGER DEFAULT 0 NOT NULL, supply_capacity_oid VARCHAR(255) DEFAULT NULL COLLATE BINARY, supply_descr VARCHAR(255) DEFAULT '' NOT NULL COLLATE BINARY);
CREATE INDEX toner_device_id_index ON printer_supplies (device_id);
CREATE TABLE service_templates (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ip CLOB DEFAULT NULL COLLATE BINARY, "desc" CLOB DEFAULT NULL COLLATE BINARY, param CLOB DEFAULT NULL COLLATE BINARY, "ignore" BOOLEAN DEFAULT '0' NOT NULL, changed DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, disabled BOOLEAN DEFAULT '0' NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY, "check" VARCHAR(255) NOT NULL COLLATE BINARY, type VARCHAR(255) DEFAULT 'static' NOT NULL COLLATE BINARY, rules CLOB DEFAULT NULL);
CREATE TABLE cache ("key" VARCHAR(255) NOT NULL COLLATE BINARY, expiration INTEGER NOT NULL, value CLOB NOT NULL COLLATE BINARY);
CREATE UNIQUE INDEX cache_key_unique ON cache ("key");
CREATE TABLE IF NOT EXISTS "sessions" ("id" varchar not null, "user_id" integer, "ip_address" varchar, "user_agent" text, "payload" text not null, "last_activity" integer not null, primary key ("id"));
CREATE INDEX "sessions_user_id_index" on "sessions" ("user_id");
CREATE INDEX "sessions_last_activity_index" on "sessions" ("last_activity");
CREATE TABLE slas (sla_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, owner VARCHAR(255) NOT NULL COLLATE BINARY, tag VARCHAR(255) NOT NULL COLLATE BINARY, rtt_type VARCHAR(255) NOT NULL COLLATE BINARY, status BOOLEAN NOT NULL, opstatus BOOLEAN DEFAULT '0' NOT NULL, deleted BOOLEAN DEFAULT '0' NOT NULL, sla_nr INTEGER UNSIGNED NOT NULL, "rtt" float);
CREATE INDEX slas_device_id_index ON slas (device_id);
CREATE UNIQUE INDEX slas_device_id_sla_nr_unique ON slas (device_id, sla_nr);
CREATE INDEX "syslog_device_id_program_index" on "syslog" ("device_id", "program");
CREATE INDEX "syslog_device_id_priority_index" on "syslog" ("device_id", "priority");
CREATE TABLE config (config_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, config_name VARCHAR(255) NOT NULL COLLATE BINARY, config_value CLOB NOT NULL COLLATE BINARY);
CREATE UNIQUE INDEX config_config_name_unique ON config (config_name);
CREATE TABLE IF NOT EXISTS "push_subscriptions" ("id" integer not null primary key autoincrement, "subscribable_type" varchar not null, "subscribable_id" integer not null, "endpoint" varchar not null, "public_key" varchar, "auth_token" varchar, "content_encoding" varchar, "description" varchar, "created_at" datetime, "updated_at" datetime);
CREATE INDEX "push_subscriptions_subscribable_type_subscribable_id_index" on "push_subscriptions" ("subscribable_type", "subscribable_id");
CREATE UNIQUE INDEX "push_subscriptions_endpoint_unique" on "push_subscriptions" ("endpoint");
CREATE INDEX isis_adjacencies_ifindex_index ON isis_adjacencies (ifIndex);
CREATE INDEX isis_adjacencies_port_id_index ON isis_adjacencies (port_id);
CREATE INDEX isis_adjacencies_device_id_index ON isis_adjacencies (device_id);
CREATE TABLE users (user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, auth_type VARCHAR(255) DEFAULT NULL COLLATE BINARY, username VARCHAR(255) NOT NULL COLLATE BINARY, password VARCHAR(255) DEFAULT NULL COLLATE BINARY, realname VARCHAR(255) NOT NULL COLLATE BINARY, email VARCHAR(255) NOT NULL COLLATE BINARY, descr VARCHAR(255) NOT NULL COLLATE BINARY, level INTEGER DEFAULT 0 NOT NULL, can_modify_passwd BOOLEAN DEFAULT '1' NOT NULL, created_at DATETIME DEFAULT '1970-01-02 00:00:01' NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, remember_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, enabled BOOLEAN DEFAULT '1' NOT NULL, auth_id VARCHAR(255) DEFAULT NULL);
CREATE UNIQUE INDEX users_auth_type_username_unique ON users (auth_type, username);
CREATE TABLE users_widgets (user_widget_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER NOT NULL, col INTEGER NOT NULL, "row" INTEGER NOT NULL, size_x INTEGER NOT NULL, size_y INTEGER NOT NULL, title VARCHAR(255) NOT NULL COLLATE BINARY, refresh INTEGER DEFAULT 60 NOT NULL, settings CLOB NOT NULL COLLATE BINARY, dashboard_id INTEGER NOT NULL, widget VARCHAR(32) NOT NULL COLLATE BINARY);
CREATE TABLE applications (app_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, app_type VARCHAR(255) NOT NULL COLLATE BINARY, app_state VARCHAR(255) DEFAULT 'UNKNOWN' NOT NULL COLLATE BINARY, discovered INTEGER DEFAULT 0 NOT NULL, app_state_prev VARCHAR(255) DEFAULT NULL COLLATE BINARY, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, app_instance VARCHAR(255) NOT NULL COLLATE BINARY, app_status VARCHAR(1024) NOT NULL COLLATE BINARY, "data" text);
CREATE UNIQUE INDEX applications_device_id_app_type_unique ON applications (device_id, app_type);
CREATE UNIQUE INDEX "plugins_version_plugin_name_unique" on "plugins" ("version", "plugin_name");
CREATE TABLE IF NOT EXISTS "ports_vdsl" ("port_id" integer not null, "port_vdsl_updated" datetime default CURRENT_TIMESTAMP not null, "xdsl2LineStatusAttainableRateDs" integer not null default '0', "xdsl2LineStatusAttainableRateUs" integer not null default '0', "xdsl2ChStatusActDataRateXtur" integer not null default '0', "xdsl2ChStatusActDataRateXtuc" integer not null default '0', "xdsl2LineStatusActAtpDs" numeric not null default '0', "xdsl2LineStatusActAtpUs" numeric not null default '0');
CREATE UNIQUE INDEX "ports_vdsl_port_id_unique" on "ports_vdsl" ("port_id");
CREATE TABLE ports_adsl (port_id INTEGER NOT NULL, port_adsl_updated DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, adslLineCoding VARCHAR(8) DEFAULT '' NOT NULL COLLATE BINARY, adslLineType VARCHAR(16) DEFAULT '' NOT NULL COLLATE BINARY, adslAtucInvVendorID VARCHAR(16) DEFAULT '' NOT NULL COLLATE BINARY, adslAtucInvVersionNumber VARCHAR(16) DEFAULT '' NOT NULL COLLATE BINARY, adslAtucCurrSnrMgn NUMERIC(5, 1) DEFAULT '0' NOT NULL, adslAtucCurrAtn NUMERIC(5, 1) DEFAULT '0' NOT NULL, adslAtucCurrOutputPwr NUMERIC(5, 1) DEFAULT '0' NOT NULL, adslAtucCurrAttainableRate INTEGER DEFAULT 0 NOT NULL, adslAtucChanCurrTxRate INTEGER DEFAULT 0 NOT NULL, adslAturInvSerialNumber VARCHAR(32) DEFAULT '' NOT NULL COLLATE BINARY, adslAturInvVendorID VARCHAR(16) DEFAULT '' NOT NULL COLLATE BINARY, adslAturInvVersionNumber VARCHAR(16) DEFAULT '' NOT NULL COLLATE BINARY, adslAturChanCurrTxRate INTEGER DEFAULT 0 NOT NULL, adslAturCurrSnrMgn NUMERIC(5, 1) DEFAULT '0' NOT NULL, adslAturCurrAtn NUMERIC(5, 1) DEFAULT '0' NOT NULL, adslAturCurrOutputPwr NUMERIC(5, 1) DEFAULT '0' NOT NULL, adslAturCurrAttainableRate INTEGER DEFAULT 0 NOT NULL);
CREATE UNIQUE INDEX ports_adsl_port_id_unique ON ports_adsl (port_id);