diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 02153a62a8..f73ca8b0a4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2010-01-12 Pablo de la Concepción + + * pandoradb.sql: Added GIS tables, and timezone_offset, + icon, and update_gis_data to tagente. + + * extras/pandoradb_migrate_v3.0_to_v3.1.sql: Added new migration script + + * extras/pandoradb_migrate_v2.x_to_v3.0.sql: Removed old migration script + 2009-12-31 Sancho Lerena * pandoradb.sql: Custom graph weights now can be float. @@ -368,11 +377,11 @@ * include/functions_agents.php, operation/agentes/tactical.php: fix notice undefined var message. -2009-12-07 Pablo de la Concepcipón +2009-12-07 Pablo de la Concepción * Changelog: Changelog with the last changes that I forgot to include in the last commit. -2009-12-07 Pablo de la Concepcipón +2009-12-07 Pablo de la Concepción * include/functions_api.php, include/functions.php, extensions/plugin_registration.php, operation/events/events.php, operation/agentes/exportdata.php, operation/agentes/stat_win.php, @@ -2210,7 +2219,7 @@ * operation/agentes/networkmap.php: Moved network map generation functions to functions_networkmap.php. -2009-07-16 Pablo de la Concepcipón +2009-07-16 Pablo de la Concepción * include/functions_agents.php: fixed repeated empty test and safe_int call diff --git a/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql b/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql deleted file mode 100644 index 60ea33ae5d..0000000000 --- a/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql +++ /dev/null @@ -1,307 +0,0 @@ -ALTER TABLE treport_content_sla_combined CHANGE sla_max `sla_max` double(18,2) NOT NULL default 0; -ALTER TABLE treport_content_sla_combined CHANGE sla_min `sla_min` double(18,2) NOT NULL default 0; -ALTER TABLE treport_content_sla_combined CHANGE sla_limit `sla_limit` double(18,2) NOT NULL default 0; -ALTER TABLE ttrap add `priority` tinyint(4) unsigned NOT NULL default '2'; - -INSERT INTO `tconfig` (`token`, `value`) VALUES ('loginhash_pwd', ''); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('trap2agent', 0); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('prominent_time', 0); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('timesource', 'system'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('event_view_hr', 8); - -ALTER TABLE tagente ADD `custom_id` varchar(255) default ''; -ALTER TABLE tagente_modulo ADD `custom_id` varchar(255) default ''; -ALTER TABLE tgrupo ADD `custom_id` varchar(255) default ''; - -ALTER TABLE `tagente_datos` DROP INDEX `data_index2`; -ALTER TABLE `tagente_datos` DROP `timestamp`, DROP `id_agente`; -ALTER TABLE `tagente_datos_inc` DROP `timestamp`; -ALTER TABLE `tagente_datos_string` DROP `timestamp`, DROP `id_agente`; -ALTER TABLE `tagente_estado` DROP `cambio`; -ALTER TABLE `tagente_estado` ADD `status_changes` TINYINT( 4 ) NOT NULL DEFAULT '0', ADD `last_status` TINYINT( 4 ) NOT NULL DEFAULT '0'; -ALTER TABLE `tagente_estado` ADD INDEX ( `current_interval` ); -ALTER TABLE `tagente_estado` ADD INDEX ( `running_by` ); -ALTER TABLE `tagente_estado` ADD INDEX ( `last_execution_try` ); - -ALTER TABLE `tagente_modulo` ADD `min_warning` double(18,2) default 0; -ALTER TABLE `tagente_modulo` ADD `max_warning` double(18,2) default 0; -ALTER TABLE `tagente_modulo` ADD `min_critical` double(18,2) default 0; -ALTER TABLE `tagente_modulo` ADD `max_critical` double(18,2) default 0; -ALTER TABLE `tagente_modulo` ADD `history_data` tinyint(1) unsigned default '1'; - -ALTER TABLE `tagente_modulo` ADD `min_ff_event` int(4) unsigned default '0'; -ALTER TABLE `tagente_modulo` ADD `delete_pending` int(1) unsigned default 0; - -ALTER TABLE `tagente_modulo` DROP INDEX `tam_plugin`; -ALTER TABLE `tagente_modulo` DROP PRIMARY KEY , ADD PRIMARY KEY -( `id_agente_modulo` ); - -ALTER TABLE `treport_content` ADD FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) - ON UPDATE CASCADE ON DELETE CASCADE; - -ALTER TABLE `tagent_access` DROP `timestamp`; - -ALTER TABLE `tlayout_data` ADD `id_agent` int(10) unsigned NOT NULL default 0; - -CREATE TABLE IF NOT EXISTS `talert_commands` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - `command` varchar(500) default '', - `description` varchar(255) default '', - `internal` tinyint(1) default 0, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `talert_actions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) default '', - `id_alert_command` int(10) unsigned NOT NULL, - `field1` varchar(255) NOT NULL default '', - `field2` varchar(255) default '', - `field3` varchar(255) default '', - PRIMARY KEY (`id`), - FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `talert_templates` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) default '', - `description` mediumtext default '', - `id_alert_action` int(10) unsigned NULL, - `field1` varchar(255) default '', - `field2` varchar(255) default '', - `field3` mediumtext NOT NULL, - `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical'), - `value` varchar(255) default '', - `matches_value` tinyint(1) default 0, - `max_value` double(18,2) default NULL, - `min_value` double(18,2) default NULL, - `time_threshold` int(10) NOT NULL default '0', - `max_alerts` int(4) unsigned NOT NULL default '1', - `min_alerts` int(4) unsigned NOT NULL default '0', - `time_from` time default '00:00:00', - `time_to` time default '00:00:00', - `monday` tinyint(1) default 1, - `tuesday` tinyint(1) default 1, - `wednesday` tinyint(1) default 1, - `thursday` tinyint(1) default 1, - `friday` tinyint(1) default 1, - `saturday` tinyint(1) default 1, - `sunday` tinyint(1) default 1, - `recovery_notify` tinyint(1) default '0', - `field2_recovery` varchar(255) NOT NULL default '', - `field3_recovery` mediumtext NOT NULL, - `priority` tinyint(4) default '0', - PRIMARY KEY (`id`), - FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) - ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `talert_template_modules` ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_agent_module` int(10) unsigned NOT NULL, - `id_alert_template` int(10) unsigned NOT NULL, - `internal_counter` int(4) default '0', - `last_fired` bigint(20) NOT NULL default '0', - `last_reference` bigint(20) NOT NULL default '0', - `times_fired` int(3) NOT NULL default '0', - `disabled` tinyint(1) default '0', - `force_execution` tinyint(1) default '0', - PRIMARY KEY (`id`), - FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`) - ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`) - ON DELETE RESTRICT ON UPDATE CASCADE, - UNIQUE (`id_agent_module`, `id_alert_template`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `talert_template_module_actions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_alert_template_module` int(10) unsigned NOT NULL, - `id_alert_action` int(10) unsigned NOT NULL, - `fires_min` int(3) unsigned default 0, - `fires_max` int(3) unsigned default 0, - PRIMARY KEY (`id`), - FOREIGN KEY (`id_alert_template_module`) REFERENCES -talert_template_modules(`id`) - ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- If you have custom stuff here, please make sure you manually --- migrate it. - --- DROP TABLE `talerta` - -INSERT INTO `talert_commands` VALUES (1,'Compound only', 'Internal -type', 'This alert will not be executed individually', 1); - -INSERT INTO `talert_commands` VALUES (2,'eMail','Internal type', 'This -alert send an email using internal Pandora FMS Server SMTP -capabilities (defined in each server, using:\r\n_field1_ as -destination email address, and\r\n_field2_ as subject for message. \r -\n_field3_ as text of message.', 1); - -INSERT INTO `talert_commands` VALUES (3,'Internal Audit','Internal -type','This alert save alert in Pandora interal audit system. Fields -are static and only _field1_ is used.', 1); -INSERT INTO `talert_commands` VALUES (4,'Pandora FMS Event','Internal -type','This alert create an special event into Pandora FMS event -manager.', 1); - -INSERT INTO `talert_commands` VALUES (5,'Pandora FMS Alertlog','echo -_timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/ -pandora/pandora_alert.log','This is a default alert to write alerts in -a standard ASCII plaintext log file in /var/log/pandora/ -pandora_alert.log\r\n', 0); - -INSERT INTO `talert_commands` VALUES (6,'SNMP Trap','/usr/bin/snmptrap --v 1 -c trap_public 192.168.0.4 1.1.1.1.1.1.1.1 _agent_ -_field1_','Send a SNMPTRAP to 192.168.0.4. Please review config and -adapt to your needs, this is only a sample, not functional itself.', 0); - -INSERT INTO `talert_commands` VALUES (7,'Syslog','logger -p -daemon.alert Pandora Alert _agent_ _data_ _field1_ _field2_','Uses -field1 and field2 to generate Syslog alert in facility daemon with -"alert" level.', 0); - -INSERT INTO `talert_commands` VALUES (8,'Sound Alert','/usr/bin/play / -usr/share/sounds/alarm.wav','', 0); - -INSERT INTO `talert_commands` VALUES (9,'Jabber Alert','echo _field3_ -| sendxmpp -r _field1_ --chatroom _field2_','Send jabber alert to chat -room in a predefined server (configure first .sendxmpprc file). Uses -field3 as text message, field1 as useralias for source message, and -field2 for chatroom name', 0); - -ALTER TABLE `tnetwork_component` ADD `history_data` TINYINT( 1 ) -UNSIGNED NOT NULL DEFAULT '1', ADD `min_warning` DOUBLE( 18, 2 ) NOT -NULL DEFAULT '0', ADD `max_warning` DOUBLE( 18, 2 ) NOT NULL -DEFAULT '0', ADD `min_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT -'0', ADD `max_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT '0', ADD -`min_ff_event` INT( 4 ) UNSIGNED NOT NULL DEFAULT '0', ADD -`id_plugin` integer unsigned default 0; - -ALTER TABLE `tusuario` CHANGE `nombre_real` `fullname` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; -ALTER TABLE `tusuario` CHANGE `comentarios` `comments` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; -ALTER TABLE `tusuario` CHANGE `id_usuario` `id_user` VARCHAR( 60 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0'; -ALTER TABLE `tusuario` CHANGE `fecha_registro` `last_connect` BIGINT( 20 ) NOT NULL DEFAULT '0'; -ALTER TABLE `tusuario` ADD UNIQUE (`id_user`); -ALTER TABLE `tusuario` ADD `registered` BIGINT( 20 ) NOT NULL DEFAULT '0' AFTER `last_connect` ; -ALTER TABLE `tusuario` ADD `firstname` VARCHAR( 255 ) NOT NULL AFTER `fullname`; -ALTER TABLE `tusuario` ADD `lastname` VARCHAR( 255 ) NOT NULL AFTER `firstname`; -ALTER TABLE `tusuario` ADD `middlename` VARCHAR( 255 ) NOT NULL AFTER `lastname`; -ALTER TABLE `tusuario` CHANGE `direccion` `email` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL; -ALTER TABLE `tusuario` CHANGE `telefono` `phone` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL; -ALTER TABLE `tusuario` CHANGE `nivel` `is_admin` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'; - -DROP TABLE IF EXISTS talert_compound; - -CREATE TABLE IF NOT EXISTS `talert_compound` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) default '', - `description` mediumtext, - `id_agent` int(10) unsigned NOT NULL, - `time_threshold` int(10) NOT NULL default '0', - `max_alerts` int(4) unsigned NOT NULL default '1', - `min_alerts` int(4) unsigned NOT NULL default '0', - `time_from` time default '00:00:00', - `time_to` time default '00:00:00', - `monday` tinyint(1) default 1, - `tuesday` tinyint(1) default 1, - `wednesday` tinyint(1) default 1, - `thursday` tinyint(1) default 1, - `friday` tinyint(1) default 1, - `saturday` tinyint(1) default 1, - `sunday` tinyint(1) default 1, - `recovery_notify` tinyint(1) default '0', - `field2_recovery` varchar(255) NOT NULL default '', - `field3_recovery` mediumtext NOT NULL, - `internal_counter` int(4) default '0', - `last_fired` bigint(20) NOT NULL default '0', - `last_reference` bigint(20) NOT NULL default '0', - `times_fired` int(3) NOT NULL default '0', - `disabled` tinyint(1) default '0', - `priority` tinyint(4) default '0', - PRIMARY KEY (`id`), - FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS talert_compound_elements; - -CREATE TABLE IF NOT EXISTS `talert_compound_elements` ( - `id_alert_compound` int(10) unsigned NOT NULL, - `id_alert_template_module` int(10) unsigned NOT NULL, - `operation` enum('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'), - `order` tinyint(2) unsigned default 0, - UNIQUE (`id_alert_compound`, `id_alert_template_module`, `operation`), - FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`) - ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (`id_alert_template_module`) REFERENCES talert_template_modules(`id`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS talert_compound_actions; - -CREATE TABLE IF NOT EXISTS `talert_compound_actions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_alert_compound` int(10) unsigned NOT NULL, - `id_alert_action` int(10) unsigned NOT NULL, - `fires_min` int(3) unsigned default 0, - `fires_max` int(3) unsigned default 0, - PRIMARY KEY (`id`), - FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`) - ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE tplugin ADD `plugin_type` int(2) UNSIGNED NOT NULL default 0; -ALTER TABLE treport_content ADD `description` mediumtext; - -ALTER TABLE treport_content MODIFY `type` varchar(30) default 'simple_graph'; -ALTER TABLE treport_content ADD `id_agent` int(10) unsigned NOT NULL default 0; - -ALTER TABLE `tmensajes` CHANGE `timestamp` `timestamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0'; - -ALTER TABLE `tevento` CHANGE `event_type` `event_type` ENUM( 'unknown', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error', 'new_agent', 'going_up_warning', 'going_up_critical', 'going_down_warning', 'going_down_normal', 'going_down_critical', 'going_up_normal' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'unknown'; - -ALTER TABLE tagente ADD `server_name` varchar(100) default ''; -ALTER TABLE tevento ADD `user_comment` varchar(255) NOT NULL default ''; -ALTER TABLE tusuario ADD `language` varchar(10) default NULL; -ALTER TABLE tserver ADD `server_type` tinyint(3) unsigned NOT NULL default '0'; -ALTER TABLE tserver ADD `queued_modules` int(5) unsigned NOT NULL default '0'; -ALTER TABLE tserver ADD `threads` int(5) unsigned NOT NULL default '0'; - --- August 2009 - -ALTER TABLE trecon_task ADD `recon_ports` varchar(250) NOT NULL default ''; - -ALTER TABLE tagente ADD `cascade_protection` tinyint(2) NOT NULL default '0'; - -ALTER TABLE tagente DROP id_wmi_server; -ALTER TABLE tagente DROP id_network_server; -ALTER TABLE tagente DROP id_plugin_server; -ALTER TABLE tagente DROP id_prediction_server; - --- Sept 2009 - -ALTER TABLE tgraph ADD `id_group` mediumint(8) unsigned NULL default 0; - -ALTER TABLE talert_templates ADD `id_group` mediumint(8) unsigned NULL default 0; -ALTER TABLE talert_actions ADD `id_group` mediumint(8) unsigned NULL default 0; -ALTER TABLE tplanned_downtime ADD `id_group` mediumint(8) unsigned NULL default 0; - --- Oct 2009 - -ALTER TABLE `pandora`.`tagente` MODIFY COLUMN `nombre` VARCHAR(100) BINARY CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT ''; - - --- Dec 2009 - -UPDATE tupdate_settings SET `value` = "/pandoraupdate3/server.php" WHERE `key` = "update_server_path"; - diff --git a/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql b/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql new file mode 100644 index 0000000000..9179e2fed6 --- /dev/null +++ b/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql @@ -0,0 +1,67 @@ +ALTER TABLE tagente ADD `timezone_offset` TINYINT(2) NOT NULL default '0'; +ALTER TABLE tagente ADD `icon_path` VARCHAR(127) NOT NULL default 'images/status_sets/default/agent_no_data_ball.png'; +ALTER TABLE tagente ADD `update_gis_data` TINYINT(1) NOT NULL default '1'; + +-- GIS extension Tables + +CREATE TABLE IF NOT EXISTS `tgis_data` ( + `id_tgis_data` INT NOT NULL AUTO_INCREMENT , + `longitude` DOUBLE NOT NULL , + `latitude` DOUBLE NOT NULL , + `altitude` DOUBLE NULL , + `start_timestamp` TIMESTAMP NOT NULL , + `end_timestamp` TIMESTAMP NULL , + `description` TEXT NULL , + `last_known_postiion` TINYINT(1) NULL , + `tagente_id_agente` INT(10) UNSIGNED NOT NULL , + PRIMARY KEY (`id_tgis_data`) , + INDEX `last_known_position_index` (`last_known_postiion` ASC) , + INDEX `start_timestamp_index` (`start_timestamp` ASC) , + INDEX `end_timestamp_index` (`end_timestamp` ASC) ) +ENGINE = InnoDB +COMMENT = 'Table to store GIS information of the agents'; + +CREATE TABLE IF NOT EXISTS `tgis_map_connection` ( + `id_tmap_connection` INT NOT NULL , + `conection_data` TEXT NULL , + PRIMARY KEY (`id_tmap_connection`) ) +ENGINE = InnoDB +COMMENT = 'Table to store the map connection information'; + +CREATE TABLE IF NOT EXISTS `tgis_map` ( + `id_tgis_map` INT NOT NULL , + `map_name` VARCHAR(63) NOT NULL , + `initial_longitude` DOUBLE NULL , + `initial_latitude` DOUBLE NULL , + `initial_altitude` DOUBLE NULL , + `map_background` VARCHAR(127) NULL , + `tmap_connection_id_tmap_connection` INT NOT NULL , + `default_longitude` DOUBLE NULL , + `default_latitude` DOUBLE NULL , + `default_altitude` DOUBLE NULL , + PRIMARY KEY (`id_tgis_map`) , + INDEX `fk_tgis_map_tmap_connection1` (`tmap_connection_id_tmap_connection` ASC) , + CONSTRAINT `fk_tgis_map_tmap_connection1` + FOREIGN KEY (`tmap_connection_id_tmap_connection` ) + REFERENCES `tgis_map_connection` (`id_tmap_connection` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'Table containing information about a gis map'; + +CREATE TABLE IF NOT EXISTS `tgis_map_layer` ( + `id_tmap_layer` INT NOT NULL , + `layer_name` VARCHAR(45) NOT NULL , + `view_layer` TINYINT(1) NOT NULL DEFAULT TRUE , + `tgis_map_id_tgis_map` INT NOT NULL , + `tgrupo_id_grupo` MEDIUMINT(4) UNSIGNED NOT NULL , + PRIMARY KEY (`id_tmap_layer`, `tgis_map_id_tgis_map`) , + INDEX `fk_tmap_layer_tgis_map1` (`tgis_map_id_tgis_map` ASC) , + CONSTRAINT `fk_tmap_layer_tgis_map1` + FOREIGN KEY (`tgis_map_id_tgis_map` ) + REFERENCES `tgis_map` (`id_tgis_map` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION ) +ENGINE = InnoDB +COMMENT = 'Table containing information about the map layers'; + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index b4e86c8ce4..797443d309 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -56,6 +56,9 @@ CREATE TABLE IF NOT EXISTS `tagente` ( `custom_id` varchar(255) default '', `server_name` varchar(100) default '', `cascade_protection` tinyint(2) NOT NULL default '0', + `timezone_offset` TINYINT(2) NOT NULL default '0', + `icon_path` VARCHAR(127) NOT NULL default 'images/status_sets/default/agent_no_data_ball.png', + `update_gis_data` TINYINT(1) NOT NULL default '1' , PRIMARY KEY (`id_agente`), KEY `nombre` (`nombre`), KEY `direccion` (`direccion`), @@ -851,5 +854,65 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- GIS extension Tables +CREATE TABLE IF NOT EXISTS `tgis_data` ( + `id_tgis_data` INT NOT NULL AUTO_INCREMENT , + `longitude` DOUBLE NOT NULL , + `latitude` DOUBLE NOT NULL , + `altitude` DOUBLE NULL , + `start_timestamp` TIMESTAMP NOT NULL , + `end_timestamp` TIMESTAMP NULL , + `description` TEXT NULL , + `last_known_postiion` TINYINT(1) NULL , + `tagente_id_agente` INT(10) UNSIGNED NOT NULL , + PRIMARY KEY (`id_tgis_data`) , + INDEX `last_known_position_index` (`last_known_postiion` ASC) , + INDEX `start_timestamp_index` (`start_timestamp` ASC) , + INDEX `end_timestamp_index` (`end_timestamp` ASC) ) +ENGINE = InnoDB +COMMENT = 'Table to store GIS information of the agents'; +CREATE TABLE IF NOT EXISTS `tgis_map_connection` ( + `id_tmap_connection` INT NOT NULL , + `conection_data` TEXT NULL , + PRIMARY KEY (`id_tmap_connection`) ) +ENGINE = InnoDB +COMMENT = 'Table to store the map connection information'; + +CREATE TABLE IF NOT EXISTS `tgis_map` ( + `id_tgis_map` INT NOT NULL , + `map_name` VARCHAR(63) NOT NULL , + `initial_longitude` DOUBLE NULL , + `initial_latitude` DOUBLE NULL , + `initial_altitude` DOUBLE NULL , + `map_background` VARCHAR(127) NULL , + `tmap_connection_id_tmap_connection` INT NOT NULL , + `default_longitude` DOUBLE NULL , + `default_latitude` DOUBLE NULL , + `default_altitude` DOUBLE NULL , + PRIMARY KEY (`id_tgis_map`) , + INDEX `fk_tgis_map_tmap_connection1` (`tmap_connection_id_tmap_connection` ASC) , + CONSTRAINT `fk_tgis_map_tmap_connection1` + FOREIGN KEY (`tmap_connection_id_tmap_connection` ) + REFERENCES `tgis_map_connection` (`id_tmap_connection` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'Table containing information about a gis map'; + +CREATE TABLE IF NOT EXISTS `tgis_map_layer` ( + `id_tmap_layer` INT NOT NULL , + `layer_name` VARCHAR(45) NOT NULL , + `view_layer` TINYINT(1) NOT NULL DEFAULT TRUE , + `tgis_map_id_tgis_map` INT NOT NULL , + `tgrupo_id_grupo` MEDIUMINT(4) UNSIGNED NOT NULL , + PRIMARY KEY (`id_tmap_layer`, `tgis_map_id_tgis_map`) , + INDEX `fk_tmap_layer_tgis_map1` (`tgis_map_id_tgis_map` ASC) , + CONSTRAINT `fk_tmap_layer_tgis_map1` + FOREIGN KEY (`tgis_map_id_tgis_map` ) + REFERENCES `tgis_map` (`id_tgis_map` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION ) +ENGINE = InnoDB +COMMENT = 'Table containing information about the map layers';