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 primary key autoincrement not null, "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 primary key autoincrement not null, "user_id" integer not null, "device_id" integer not null);
CREATE TABLE IF NOT EXISTS "entPhysical_state" ("id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "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 INDEX "eventlog_device_id_index" on "eventlog" ("device_id");
CREATE INDEX "eventlog_datetime_index" on "eventlog" ("datetime");
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 INDEX "graph_types_graph_type_index" on "graph_types" ("graph_type");
CREATE INDEX "graph_types_graph_subtype_index" on "graph_types" ("graph_subtype");
CREATE INDEX "graph_types_graph_section_index" on "graph_types" ("graph_section");
CREATE TABLE IF NOT EXISTS "hrDevice" ("hrDevice_id" integer primary key autoincrement not null, "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 TABLE IF NOT EXISTS "ipsec_tunnels" ("tunnel_id" integer primary key autoincrement not null, "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 TABLE IF NOT EXISTS "ipv4_addresses" ("ipv4_address_id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "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 primary key autoincrement not null, "ipv4_network" varchar not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "ipv6_addresses" ("ipv6_address_id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "ipv6_network" varchar not null, "context_name" varchar);
CREATE TABLE IF NOT EXISTS "juniAtmVp" ("id" integer primary key autoincrement not null, "juniAtmVp_id" integer not null, "port_id" integer not null, "vp_id" integer not null, "vp_descr" varchar not null);
CREATE TABLE IF NOT EXISTS "loadbalancer_rservers" ("rserver_id" integer primary key autoincrement not null, "farm_id" varchar not null, "device_id" integer not null, "StateDescr" varchar not null);
CREATE TABLE IF NOT EXISTS "loadbalancer_vservers" ("id" integer primary key autoincrement not null, "classmap_id" integer not null, "classmap" varchar not null, "serverstate" varchar not null, "device_id" integer not null);
CREATE TABLE IF NOT EXISTS "mefinfo" ("id" integer primary key autoincrement not null, "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 TABLE IF NOT EXISTS "netscaler_vservers" ("vsvr_id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "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 primary key autoincrement not null, "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 primary key autoincrement not null, "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 primary key autoincrement not null, "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 primary key autoincrement not null, "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_peers" ("pdb_ix_peers_id" integer primary key autoincrement not null, "ix_id" integer not null, "peer_id" integer not null, "remote_asn" integer not null, "remote_ipaddr4" varchar, "remote_ipaddr6" varchar, "name" varchar, "timestamp" integer);
CREATE TABLE IF NOT EXISTS "pdb_ix" ("pdb_ix_id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "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 primary key autoincrement not null, "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 TABLE IF NOT EXISTS "poller_groups" ("id" integer primary key autoincrement not null, "group_name" varchar not null, "descr" varchar not null);
CREATE TABLE IF NOT EXISTS "pollers" ("id" integer primary key autoincrement not null, "poller_name" varchar not null, "last_polled" datetime not null, "devices" integer not null, "time_taken" float not null);
CREATE TABLE IF NOT EXISTS "ports_fdb" ("ports_fdb_id" integer primary key autoincrement not null, "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 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 primary key autoincrement not null, "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 TABLE IF NOT EXISTS "processors" ("processor_id" integer primary key autoincrement not null, "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 TABLE IF NOT EXISTS "proxmox_ports" ("id" integer primary key autoincrement not null, "vm_id" integer not null, "port" varchar not null, "last_seen" datetime not null default CURRENT_TIMESTAMP);
CREATE TABLE IF NOT EXISTS "proxmox" ("id" integer primary key autoincrement not null, "device_id" integer not null default '0', "vmid" integer not null, "cluster" varchar not null, "description" varchar, "last_seen" datetime not null default CURRENT_TIMESTAMP);
CREATE TABLE IF NOT EXISTS "sensors_to_state_indexes" ("sensors_to_state_translations_id" integer primary key autoincrement not null, "sensor_id" integer not null, "state_index_id" integer not null);
CREATE TABLE IF NOT EXISTS "session" ("session_id" integer primary key autoincrement not null, "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 TABLE IF NOT EXISTS "state_translations" ("state_translation_id" integer primary key autoincrement not null, "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 not null default CURRENT_TIMESTAMP);
CREATE TABLE IF NOT EXISTS "storage" ("storage_id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "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 TABLE IF NOT EXISTS "tnmsneinfo" ("id" integer primary key autoincrement not null, "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 TABLE IF NOT EXISTS "transport_group_transport" ("id" integer primary key autoincrement not null, "transport_group_id" integer not null, "transport_id" integer not null);
CREATE TABLE IF NOT EXISTS "ucd_diskio" ("diskio_id" integer primary key autoincrement not null, "device_id" integer not null, "diskio_index" integer not null, "diskio_descr" varchar not null);
CREATE TABLE IF NOT EXISTS "vrfs" ("vrf_id" integer primary key autoincrement not null, "vrf_oid" varchar not null, "vrf_name" varchar, "mplsVpnVrfRouteDistinguisher" varchar, "mplsVpnVrfDescription" text not null, "device_id" integer not null, "bgpLocalAs" integer);
CREATE TABLE ports_nac (ports_nac_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, auth_id VARCHAR(255) NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER NOT NULL, domain VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, mac_address VARCHAR(255) NOT NULL, ip_address VARCHAR(255) NOT NULL, host_mode VARCHAR(255) NOT NULL, authz_status VARCHAR(255) NOT NULL, authz_by VARCHAR(255) NOT NULL, authc_status VARCHAR(255) NOT NULL, method VARCHAR(255) NOT NULL, timeout VARCHAR(255) NOT NULL, time_left VARCHAR(50) DEFAULT NULL, "vlan" integer, "time_elapsed" varchar);
CREATE TABLE IF NOT EXISTS "route" ("route_id" integer primary key autoincrement not null, "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 primary key autoincrement not null, "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 IF NOT EXISTS "alert_location_map" ("id" integer primary key autoincrement not null, "rule_id" integer not null, "location_id" integer not null);
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 ospf_areas (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, ospfAreaId VARCHAR(255) NOT NULL, ospfAuthType VARCHAR(64) DEFAULT NULL, ospfImportAsExtern VARCHAR(255) NOT NULL, ospfSpfRuns INTEGER NOT NULL, ospfAreaBdrRtrCount INTEGER NOT NULL, ospfAsBdrRtrCount INTEGER NOT NULL, ospfAreaLsaCount INTEGER NOT NULL, ospfAreaLsaCksumSum INTEGER NOT NULL, ospfAreaSummary VARCHAR(255) NOT NULL, ospfAreaStatus VARCHAR(255) NOT NULL, context_name VARCHAR(255) DEFAULT NULL);
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 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 pseudowires (pseudowire_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER NOT NULL, peer_device_id INTEGER NOT NULL, peer_ldp_id INTEGER NOT NULL, cpwVcID INTEGER UNSIGNED NOT NULL, cpwOid INTEGER NOT NULL, pw_type VARCHAR(255) NOT NULL, pw_psntype VARCHAR(255) NOT NULL, pw_local_mtu INTEGER NOT NULL, pw_peer_mtu INTEGER NOT NULL, pw_descr VARCHAR(255) NOT NULL);
CREATE TABLE ports_stp (port_stp_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER NOT NULL, priority INTEGER NOT NULL, state VARCHAR(255) NOT NULL, enable VARCHAR(255) NOT NULL, pathCost INTEGER NOT NULL, designatedRoot VARCHAR(255) NOT NULL, designatedCost INTEGER UNSIGNED NOT NULL, designatedBridge VARCHAR(255) NOT NULL, designatedPort INTEGER NOT NULL, forwardTransitions INTEGER NOT NULL, vlan INTEGER DEFAULT NULL, port_index INTEGER DEFAULT 0 NOT NULL);
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 INDEX ports_ifdescr_ifname_index ON ports (ifDescr, ifName);
CREATE INDEX ports_ifalias_port_descr_descr_portname_index ON ports (ifAlias, port_descr_descr, portName);
CREATE UNIQUE INDEX ports_device_id_ifindex_unique ON ports (device_id, ifIndex);
CREATE TABLE vminfo (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, vm_type VARCHAR(255) DEFAULT 'vmware' NOT NULL, vmwVmVMID INTEGER NOT NULL, vmwVmDisplayName VARCHAR(255) NOT NULL, vmwVmGuestOS VARCHAR(128) DEFAULT NULL, vmwVmMemSize INTEGER NOT NULL, vmwVmCpus INTEGER NOT NULL, vmwVmState SMALLINT UNSIGNED NOT NULL);
CREATE INDEX vminfo_device_id_index ON vminfo (device_id);
CREATE INDEX vminfo_vmwvmvmid_index ON vminfo (vmwVmVMID);
CREATE TABLE slas (sla_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, sla_nr INTEGER UNSIGNED 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, deleted BOOLEAN DEFAULT 0 NOT NULL, rtt DOUBLE PRECISION DEFAULT NULL, opstatus INTEGER DEFAULT 0 NOT NULL);
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 TABLE IF NOT EXISTS "abilities" ("id" integer primary key autoincrement not null, "name" varchar not null, "title" varchar, "entity_id" integer, "entity_type" varchar, "only_owned" tinyint(1) not null default '0', "options" text, "scope" integer, "created_at" datetime, "updated_at" datetime);
CREATE INDEX "abilities_scope_index" on "abilities" ("scope");
CREATE TABLE IF NOT EXISTS "roles" ("id" integer primary key autoincrement not null, "name" varchar not null, "title" varchar, "scope" integer, "created_at" datetime, "updated_at" datetime);
CREATE UNIQUE INDEX "roles_name_unique" on "roles" ("name", "scope");
CREATE INDEX "roles_scope_index" on "roles" ("scope");
CREATE TABLE IF NOT EXISTS "assigned_roles" ("id" integer primary key autoincrement not null, "role_id" integer not null, "entity_id" integer not null, "entity_type" varchar not null, "restricted_to_id" integer, "restricted_to_type" varchar, "scope" integer, foreign key("role_id") references "roles"("id") on delete cascade on update cascade);
CREATE INDEX "assigned_roles_entity_index" on "assigned_roles" ("entity_id", "entity_type", "scope");
CREATE INDEX "assigned_roles_role_id_index" on "assigned_roles" ("role_id");
CREATE INDEX "assigned_roles_scope_index" on "assigned_roles" ("scope");
CREATE TABLE IF NOT EXISTS "permissions" ("id" integer primary key autoincrement not null, "ability_id" integer not null, "entity_id" integer, "entity_type" varchar, "forbidden" tinyint(1) not null default '0', "scope" integer, foreign key("ability_id") references "abilities"("id") on delete cascade on update cascade);
CREATE INDEX "permissions_entity_index" on "permissions" ("entity_id", "entity_type", "scope");
CREATE INDEX "permissions_ability_id_index" on "permissions" ("ability_id");
CREATE INDEX "permissions_scope_index" on "permissions" ("scope");
CREATE TABLE users (user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, auth_type VARCHAR(255) DEFAULT NULL COLLATE "BINARY", auth_id 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", 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);
CREATE UNIQUE INDEX users_auth_type_username_unique ON users (auth_type, username);
CREATE TABLE vendor_ouis (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, vendor VARCHAR(255) NOT NULL, oui VARCHAR(12) NOT NULL);
CREATE UNIQUE INDEX "vendor_ouis_oui_unique" on "vendor_ouis" ("oui");
CREATE TABLE applications (app_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, app_type VARCHAR(255) NOT NULL, app_state VARCHAR(255) DEFAULT 'UNKNOWN' NOT NULL, discovered INTEGER DEFAULT 0 NOT NULL, app_state_prev VARCHAR(255) DEFAULT NULL, app_status VARCHAR(1024) DEFAULT '' NOT NULL, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, app_instance VARCHAR(255) DEFAULT '' NOT NULL, data CLOB DEFAULT NULL, deleted_at DATETIME DEFAULT NULL);
CREATE UNIQUE INDEX applications_device_id_app_type_unique ON applications (device_id, app_type);
CREATE TABLE processes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, pid INTEGER NOT NULL, vsz INTEGER NOT NULL, rss INTEGER NOT NULL, cputime VARCHAR(14) NOT NULL, user VARCHAR(255) NOT NULL, command CLOB NOT NULL);
CREATE INDEX processes_device_id_index ON processes (device_id);