From 3c0ea8b08a66069edecccfd282fd1215324334a4 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 10 Aug 2020 15:10:17 +0200 Subject: [PATCH] Solved issues with DB --- pandora_console/extras/mr/40.sql | 7 +--- pandora_console/extras/mr/41.sql | 8 +++- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 6 +-- pandora_console/pandoradb.sql | 7 ++-- pandora_console/pandoradb_data.sql | 42 +++++++++---------- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/pandora_console/extras/mr/40.sql b/pandora_console/extras/mr/40.sql index 4714f0d023..fece05576f 100644 --- a/pandora_console/extras/mr/40.sql +++ b/pandora_console/extras/mr/40.sql @@ -1,11 +1,5 @@ START TRANSACTION; -ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text; -ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text; -ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text; -ALTER TABLE `ttag` ADD COLUMN `previous_name` text default ''; -ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text default ''; - UPDATE `talert_commands` SET name='Monitoring Event' WHERE name='Pandora FMS Event'; ALTER TABLE `tservice_element` ADD COLUMN `rules` text; @@ -13,6 +7,7 @@ ALTER TABLE `tservice` ADD COLUMN `unknown_as_critical` tinyint(1) NOT NULL defa ALTER TABLE `tserver` MODIFY COLUMN `version` varchar(25) NOT NULL DEFAULT ''; UPDATE `tservice` SET `auto_calculate`=0; + UPDATE `tservice` SET `cps`= `cps` - 1 WHERE `cps` > 0; UPDATE `tagente` SET `cps`= `cps` - 1 WHERE `cps` > 0; UPDATE `tagente_modulo` SET `cps`= `cps` - 1 WHERE `cps` > 0; diff --git a/pandora_console/extras/mr/41.sql b/pandora_console/extras/mr/41.sql index 8db5f53380..58cf54f69f 100644 --- a/pandora_console/extras/mr/41.sql +++ b/pandora_console/extras/mr/41.sql @@ -1,5 +1,9 @@ +START TRANSACTION; + ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text; ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text; ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text; -ALTER TABLE `ttag` ADD COLUMN `previous_name` text default ''; -ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text default ''; \ No newline at end of file +ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL; +ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 1297d5fa9b..d741afb9ae 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1343,7 +1343,7 @@ ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT ''; -- --------------------------------------------------------------------- -- Table `ttag` -- --------------------------------------------------------------------- -ALTER TABLE `ttag` ADD COLUMN `previous_name` text default ''; +ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL; -- --------------------------------------------------------------------- -- Table `tconfig` @@ -1389,9 +1389,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', ''); -- Table `tconfig_os` -- --------------------------------------------------------------------- -ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text default ''; +ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL; -INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png'); +INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png', ''); UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster'); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 336d66c55c..011e8e513f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -374,7 +374,6 @@ CREATE TABLE IF NOT EXISTS `talert_snmp` ( CREATE TABLE IF NOT EXISTS `talert_commands` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(100) NOT NULL default '', - `previous_name` text, `command` text, `id_group` mediumint(8) unsigned NULL default 0, `description` text, @@ -382,6 +381,7 @@ CREATE TABLE IF NOT EXISTS `talert_commands` ( `fields_descriptions` TEXT, `fields_values` TEXT, `fields_hidden` TEXT, + `previous_name` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -391,7 +391,6 @@ CREATE TABLE IF NOT EXISTS `talert_commands` ( CREATE TABLE IF NOT EXISTS `talert_actions` ( `id` int(10) unsigned NOT NULL auto_increment, `name` text, - `previous_name` text, `id_alert_command` int(10) unsigned NULL default 0, `field1` text NOT NULL, `field2` text NOT NULL, @@ -425,6 +424,7 @@ CREATE TABLE IF NOT EXISTS `talert_actions` ( `field13_recovery` text NOT NULL, `field14_recovery` text NOT NULL, `field15_recovery` text NOT NULL, + `previous_name` text, PRIMARY KEY (`id`), FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -436,7 +436,6 @@ CREATE TABLE IF NOT EXISTS `talert_actions` ( CREATE TABLE IF NOT EXISTS `talert_templates` ( `id` int(10) unsigned NOT NULL auto_increment, `name` text, - `previous_name` text, `description` mediumtext, `id_alert_action` int(10) unsigned NULL, `field1` text NOT NULL, @@ -493,6 +492,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` ( `wizard_level` enum('basic','advanced','nowizard') default 'nowizard', `min_alerts_reset_counter` tinyint(1) default 0, `disable_event` tinyint(1) default 0, + `previous_name` text, PRIMARY KEY (`id`), KEY `idx_template_action` (`id_alert_action`), FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) @@ -586,6 +586,7 @@ CREATE TABLE IF NOT EXISTS `tconfig_os` ( `name` varchar(100) NOT NULL default '', `description` varchar(250) default '', `icon_name` varchar(100) default '', + `previous_name` text NULL, PRIMARY KEY (`id_os`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 79c82802ec..46c878b19f 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -150,27 +150,27 @@ UNLOCK TABLES; -- LOCK TABLES `tconfig_os` WRITE; -INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES -(1,'Linux','Linux: All versions','so_linux.png'), -(2,'Solaris','Sun Solaris','so_solaris.png'), -(3,'AIX','IBM AIX','so_aix.png'), -(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'), -(5,'HP-UX','HP-UX Unix OS','so_hpux.png'), -(7,'Cisco','CISCO IOS','so_cisco.png'), -(8,'MacOS','MAC OS','so_mac.png'), -(9,'Windows','Microsoft Windows OS','so_win.png'), -(10,'Other','Other SO','so_other.png'), -(11,'Network','Network Agent','network.png'), -(12,'Web Server','Web Server/Application','network.png'), -(13,'Sensor','Hardware Agent (Sensor)','network.png'), -(14,'Embedded','Embedded device running an agent','embedded.png'), -(15,'Android','Android agent','android.png'), -(16, 'VMware', 'VMware Architecture', 'so_vmware.png'), -(17, 'Router', 'Generic router', 'so_router.png'), -(18, 'Switch', 'Generic switch', 'so_switch.png'), -(19, 'Satellite', 'Satellite agent', 'satellite.png'), -(20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png'), -(100, 'Cluster', 'Cluster agent', 'so_cluster.png'); +INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`, `previous_name`) VALUES +(1,'Linux','Linux: All versions','so_linux.png', ''), +(2,'Solaris','Sun Solaris','so_solaris.png', ''), +(3,'AIX','IBM AIX','so_aix.png', ''), +(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png', ''), +(5,'HP-UX','HP-UX Unix OS','so_hpux.png', ''), +(7,'Cisco','CISCO IOS','so_cisco.png', ''), +(8,'MacOS','MAC OS','so_mac.png', ''), +(9,'Windows','Microsoft Windows OS','so_win.png', ''), +(10,'Other','Other SO','so_other.png', ''), +(11,'Network','Network Agent','network.png', ''), +(12,'Web Server','Web Server/Application','network.png', ''), +(13,'Sensor','Hardware Agent (Sensor)','network.png', ''), +(14,'Embedded','Embedded device running an agent','embedded.png', ''), +(15,'Android','Android agent','android.png', ''), +(16, 'VMware', 'VMware Architecture', 'so_vmware.png', ''), +(17, 'Router', 'Generic router', 'so_router.png', ''), +(18, 'Switch', 'Generic switch', 'so_switch.png', ''), +(19, 'Satellite', 'Satellite agent', 'satellite.png', ''), +(20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png', ''), +(100, 'Cluster', 'Cluster agent', 'so_cluster.png', ''); UNLOCK TABLES;