From e042c58e74abf5b6bd0422d272c8a2e20ac3b15c Mon Sep 17 00:00:00 2001 From: darode Date: Tue, 2 Oct 2012 11:51:46 +0000 Subject: [PATCH] 2012-10-02 Dario Rodriguez * extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql: Fixed several errors in mysql migration script to 5.0 version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7028 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 + .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 103 +++++++++--------- 2 files changed, 57 insertions(+), 51 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 18b0de17ab..3f64f6be26 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-10-02 Dario Rodriguez + + * extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql: Fixed + several errors in mysql migration script to 5.0 version. + 2012-10-02 Sergio Martin * include/functions_menu.php: Fix another screen diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index e33e132ac8..0bda50caba 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -73,9 +73,9 @@ CREATE TABLE IF NOT EXISTS `talert_special_days` ( -- --------------------------------------------------------------------- ALTER TABLE `talert_templates` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tplanned_downtime` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tplanned_downtime` ADD COLUMN `monday` tinyint(1) default 0; ALTER TABLE `tplanned_downtime` ADD COLUMN `tuesday` tinyint(1) default 0; ALTER TABLE `tplanned_downtime` ADD COLUMN `wednesday` tinyint(1) default 0; @@ -91,19 +91,20 @@ ALTER TABLE `tplanned_downtime` ADD COLUMN `type_downtime` varchar(100) NOT NULL ALTER TABLE `tplanned_downtime` ADD COLUMN `type_execution` varchar(100) NOT NULL default 'once'; ALTER TABLE `tplanned_downtime` ADD COLUMN `type_periodicity` varchar(100) NOT NULL default 'weekly'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tplanned_downtime_agents` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- DELETE FROM tplanned_downtime_agents WHERE id_downtime NOT IN (SELECT id FROM tplanned_downtime); +ALTER TABLE tplanned_downtime_agents MODIFY `id_downtime` mediumint(8) NOT NULL; ALTER TABLE tplanned_downtime_agents ADD FOREIGN KEY(`id_downtime`) REFERENCES tplanned_downtime(`id`) ON DELETE CASCADE; ALTER TABLE `tplanned_downtime_agents` ADD COLUMN `all_modules` tinyint(1) default 1; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tplanned_downtime_modules` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tplanned_downtime_modules` ( `id` int(20) unsigned NOT NULL auto_increment, `id_agent` mediumint(8) unsigned NOT NULL default '0', @@ -114,9 +115,9 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_modules` ( ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tevento` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL, `id_extra` tinytext NOT NULL); ALTER TABLE `tevento` MODIFY COLUMN `event_type` ENUM('going_unknown','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','configuration_change') CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'unknown'; ALTER TABLE `tevento` ADD COLUMN `critical_instructions` TEXT NOT NULL DEFAULT ''; @@ -125,21 +126,21 @@ ALTER TABLE `tevento` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEFAULT '' ALTER TABLE `tevento` ADD COLUMN `owner_user` VARCHAR(100) NOT NULL DEFAULT ''; ALTER TABLE `tevento` ADD COLUMN `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tgrupo` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tgrupo` ADD COLUMN `description` text; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `talert_snmp` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `talert_snmp` ADD COLUMN (`_snmp_f1_` text, `_snmp_f2_` text, `_snmp_f3_` text, `_snmp_f4_` text, `_snmp_f5_` text, `_snmp_f6_` text, `trap_type` int(11) NOT NULL default '-1', `single_value` varchar(255) DEFAULT ''); ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tagente_modulo` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tagente_modulo` ADD COLUMN `module_ff_interval` int(4) unsigned DEFAULT '0'; ALTER TABLE `tagente_modulo` CHANGE COLUMN `post_process` `post_process` double(18,5) DEFAULT NULL; ALTER TABLE `tagente_modulo` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') DEFAULT 'nowizard'; @@ -151,9 +152,9 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEF ALTER TABLE `tagente_modulo` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0'; ALTER TABLE `tagente_modulo` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tnetwork_component` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tnetwork_component` CHANGE COLUMN `post_process` `post_process` double(18,5) default NULL; ALTER TABLE `tnetwork_component` ADD COLUMN `unit` TEXT NOT NULL AFTER `post_process`; ALTER TABLE tnetwork_component ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard'; @@ -165,14 +166,14 @@ ALTER TABLE tnetwork_component ADD `unknown_instructions` TEXT NOT NULL default ALTER TABLE `tnetwork_component` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tgraph_source` Alter table to allow negative values in weight ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE tgraph_source MODIFY weight FLOAT(5,3) NOT NULL DEFAULT '0.000'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tevent_filter` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tevent_filter` ( `id_filter` int(10) unsigned NOT NULL auto_increment, `id_group_filter` int(10) NOT NULL default 0, @@ -192,11 +193,11 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tconfig` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE tconfig MODIFY value TEXT NOT NULL; ---Join the all ips of "list_ACL_IPs_for_API_%" in one row (now We have a field "value" with hudge size) +-- Join the all ips of "list_ACL_IPs_for_API_%" in one row (now We have a field "value" with hudge size) INSERT INTO tconfig (token, `value`) SELECT 'list_ACL_IPs_for_API', GROUP_CONCAT(`value` SEPARATOR ';') AS `value` FROM tconfig WHERE token LIKE "list_ACL_IPs_for_API%"; INSERT INTO `tconfig` (`token`, `value`) VALUES ('event_fields', 'evento,id_agente,estado,timestamp'); DELETE FROM tconfig WHERE token LIKE "list_ACL_IPs_for_API_%"; @@ -216,29 +217,29 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('enable_refr', 0); UPDATE tconfig SET `value`='comparation' WHERE `token`= 'prominent_time'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `treport_content_item` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE treport_content_item ADD FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE `treport_content_item` ADD COLUMN `operation` TEXT; ALTER TABLE treport ADD COLUMN `id_template` INTEGER UNSIGNED DEFAULT 0; ALTER TABLE treport ADD COLUMN `id_group_edit` mediumint(8) unsigned NULL DEFAULT 0; ALTER TABLE treport ADD COLUMN `metaconsole` tinyint(1) DEFAULT 0; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tgraph` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tgraph` ADD COLUMN `id_graph_template` int(11) NOT NULL DEFAULT 0; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `ttipo_modulo` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1; UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tusuario` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tusuario` ADD COLUMN `section` TEXT NOT NULL; INSERT INTO `tusuario` (`section`) VALUES ('Default'); ALTER TABLE `tusuario` ADD COLUMN `data_section` TEXT NOT NULL; @@ -253,24 +254,24 @@ ALTER TABLE `tusuario` ADD COLUMN `failed_attempt` int(4) NOT NULL DEFAULT 0; ALTER TABLE `tusuario` ADD COLUMN `login_blocked` tinyint(1) DEFAULT 0; ALTER TABLE `tusuario` ADD COLUMN `metaconsole_access` enum('basic','advanced','custom','all','only_console') DEFAULT 'only_console'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tmensajes` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tmensajes` MODIFY COLUMN `mensaje` TEXT NOT NULL; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `talert_compound` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `talert_compound` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `talert_commands` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`) VALUES ('Validate Event','Internal type','This alert validate the events matched with a module given the agent name (_field1_) and module name (_field2_)', 1); ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tpassword_history` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tpassword_history` ( `id_pass` int(10) unsigned NOT NULL auto_increment, `id_user` varchar(60) NOT NULL, @@ -280,36 +281,36 @@ CREATE TABLE IF NOT EXISTS `tpassword_history` ( PRIMARY KEY (`id_pass`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tplugin` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE tplugin ADD `macros` text; ALTER TABLE tplugin ADD `parameters` text; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `trecon_script` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- UPDATE trecon_script SET `description`='This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * custom_field1 = network. i.e.: 192.168.100.0/24 * custom_field2 = several communities separated by comma. For example: snmp_community,public,private * custom_field3 = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.' WHERE id_recon_script = 1; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `trecon_task ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE trecon_task MODIFY subnet TEXT NOT NULL DEFAULT ''; ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT ''; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tlayout_data ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL default 1; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tnetwork_map` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE tnetwork_map ADD `text_filter` VARCHAR(100) NOT NULL DEFAULT ""; ALTER TABLE tnetwork_map ADD `dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- -- Table `tagente_estado` ------------------------------------------------------------------------- +-- ---------------------------------------------------------------------- ALTER TABLE `tagente_estado` ADD COLUMN `last_known_status` tinyint(4) NOT NULL DEFAULT 0;