2012-10-02 Dario Rodriguez <dario.rodriguez@artica.es>

* 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
This commit is contained in:
darode 2012-10-02 11:51:46 +00:00
parent 3658b5d02c
commit 5e3fab5a6b
2 changed files with 57 additions and 51 deletions

View File

@ -1,3 +1,8 @@
2012-10-02 Dario Rodriguez <dario.rodriguez@artica.es>
* 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 <sergio.martin@artica.es>
* include/functions_menu.php: Fix another screen

View File

@ -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&#x20;script&#x20;is&#x20;used&#x20;to&#x20;automatically&#x20;detect&#x20;SNMP&#x20;Interfaces&#x20;on&#x20;devices,&#x20;used&#x20;as&#x20;Recon&#x20;Custom&#x20;Script&#x20;in&#x20;the&#x20;recon&#x20;task.&#x20;Parameters&#x20;used&#x20;are:&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;network.&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;several&#x20;communities&#x20;separated&#x20;by&#x20;comma.&#x20;For&#x20;example:&#x20;snmp_community,public,private&#x20;&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;optative&#x20;parameter&#x20;to&#x20;force&#x20;process&#x20;downed&#x20;interfaces&#x20;&#40;use:&#x20;&#039;-a&#039;&#41;.&#x20;Only&#x20;up&#x20;interfaces&#x20;are&#x20;processed&#x20;by&#x20;default&#x20;&#x0d;&#x0a;&#x0d;&#x0a;See&#x20;documentation&#x20;for&#x20;more&#x20;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;