From 7e192a415138968c28f4ef6b61d437005333a721 Mon Sep 17 00:00:00 2001 From: javilanz Date: Fri, 20 May 2011 11:44:35 +0000 Subject: [PATCH] 2011-05-20 Javier Lanz * pandoradb.postgreSQL.sql, pandoradb.oracle.sql, pandoradb.sql, extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added 'server_name' column to treport_content, treport_content_sla_combined and treport_content_item git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4372 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- .../extras/pandoradb_migrate_v3.2_to_v4.0.sql | 10 +++++++--- pandora_console/pandoradb.oracle.sql | 13 +++++++------ pandora_console/pandoradb.postgreSQL.sql | 11 +++++++---- pandora_console/pandoradb.sql | 7 ++++--- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql b/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql index 38a1b485e0..5abdda09cb 100644 --- a/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql +++ b/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql @@ -43,6 +43,8 @@ ALTER TABLE `treport_content` ADD COLUMN `show_graph` INT NOT NULL DEFAULT 0; ALTER TABLE `treport_content` ADD COLUMN `group_by_agent` INT NOT NULL DEFAULT 0; ALTER TABLE `treport_content` ADD COLUMN `id_group` int (10) unsigned NOT NULL DEFAULT 0; ALTER TABLE `treport_content` ADD COLUMN `id_module_group` int (10) unsigned NOT NULL DEFAULT 0; +ALTER TABLE `treport_content` ADD COLUMN `style` TEXT NOT NULL DEFAULT ''; +ALTER TABLE `treport_content` ADD COLUMN `server_name` TEXT DEFAULT ''; -- ----------------------------------------------------- -- Table `treport_content_item` @@ -50,7 +52,8 @@ ALTER TABLE `treport_content` ADD COLUMN `id_module_group` int (10) unsigned NOT CREATE TABLE IF NOT EXISTS `treport_content_item` ( `id` INTEGER UNSIGNED NOT NULL auto_increment, `id_report_content` INTEGER UNSIGNED NOT NULL, - `id_agent_module` int(10) unsigned NOT NULL, + `id_agent_module` int(10) unsigned NOT NULL, + `server_name` TEXT DEFAULT '', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -73,9 +76,10 @@ ALTER TABLE `talert_template_module_actions` ADD COLUMN `module_action_threshold ALTER TABLE `talert_template_module_actions` ADD COLUMN `last_execution` bigint(20) NOT NULL DEFAULT '0'; -- ----------------------------------------------------- --- Table `treport_content` +-- Table `treport_content_sla_combined` -- ----------------------------------------------------- -ALTER TABLE `treport_content` ADD COLUMN `style` TEXT NOT NULL DEFAULT ''; +ALTER TABLE `treport_content_sla_combined` ADD COLUMN `server_name` TEXT DEFAULT ''; +ALTER TABLE `treport_content_sla_combined` DROP FOREIGN KEY treport_content_sla_combined_ibfk_2; -- ----------------------------------------------------- -- Table `tperfil` diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 12b1cbcfa8..1711a1a77f 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -942,7 +942,8 @@ CREATE TABLE treport_content ( group_by_agent NUMBER(10, 0) default 0 NOT NULL, style CLOB default '', id_group NUMBER(10, 0) default 0 NOT NULL, - id_module_group NUMBER(10, 0) default 0 NOT NULL + id_module_group NUMBER(10, 0) default 0 NOT NULL, + server_name CLOB default '' ); CREATE SEQUENCE treport_content_s INCREMENT BY 1 START WITH 1; @@ -955,10 +956,11 @@ CREATE OR REPLACE TRIGGER treport_content_update AFTER UPDATE OF ID_REPORT ON tr CREATE TABLE treport_content_sla_combined ( id NUMBER(10, 0) NOT NULL PRIMARY KEY, id_report_content NUMBER(10, 0) NOT NULL REFERENCES treport_content(id_rc) ON DELETE CASCADE, - id_agent_module NUMBER(10, 0) NOT NULL REFERENCES tagente_modulo(id_agente_modulo) ON DELETE CASCADE, + id_agent_module NUMBER(10, 0) NOT NULL, sla_max BINARY_DOUBLE default 0 NOT NULL, sla_min BINARY_DOUBLE default 0 NOT NULL, - sla_limit BINARY_DOUBLE default 0 NOT NULL + sla_limit BINARY_DOUBLE default 0 NOT NULL, + server_name CLOB default '' ); CREATE SEQUENCE treport_cont_sla_c_s INCREMENT BY 1 START WITH 1; @@ -968,13 +970,12 @@ CREATE OR REPLACE TRIGGER treport_content_sla_comb_inc BEFORE INSERT ON treport_ -- on update trigger CREATE OR REPLACE TRIGGER treport_cont_sla_comb_update AFTER UPDATE OF ID_RC ON treport_content FOR EACH ROW BEGIN UPDATE treport_content_sla_combined SET ID_REPORT_CONTENT = :NEW.ID_RC WHERE ID_REPORT_CONTENT = :OLD.ID_RC; END;; --- on update trigger 1 -CREATE OR REPLACE TRIGGER treport_cont_sla_comb_update1 AFTER UPDATE OF ID_AGENTE_MODULO ON tagente_modulo FOR EACH ROW BEGIN UPDATE treport_content_sla_combined SET ID_AGENT_MODULE = :NEW.ID_AGENTE_MODULO WHERE ID_AGENT_MODULE = :OLD.ID_AGENTE_MODULO; END;; CREATE TABLE treport_content_item ( id NUMBER(10, 0) NOT NULL PRIMARY KEY, id_report_content NUMBER(10, 0) NOT NULL, - id_agent_module NUMBER(10, 0) NOT NULL + id_agent_module NUMBER(10, 0) NOT NULL, + server_name CLOB default '' ); CREATE SEQUENCE treport_content_item_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 972820af6f..3e020a9bae 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -764,22 +764,25 @@ CREATE TABLE "treport_content" ( "group_by_agent" INTEGER NOT NULL default 0, "style" TEXT NOT NULL DEFAULT '', "id_group" INTEGER NOT NULL default 0, - "id_module_group" INTEGER NOT NULL default 0 + "id_module_group" INTEGER NOT NULL default 0, + "server_name" TEXT DEFAULT '' ); CREATE TABLE "treport_content_sla_combined" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_report_content" INTEGER NOT NULL REFERENCES treport_content("id_rc") ON UPDATE CASCADE ON DELETE CASCADE, - "id_agent_module" INTEGER NOT NULL REFERENCES tagente_modulo("id_agente_modulo") ON UPDATE CASCADE ON DELETE CASCADE, + "id_agent_module" INTEGER NOT NULL, "sla_max" DOUBLE PRECISION NOT NULL default 0, "sla_min" DOUBLE PRECISION NOT NULL default 0, - "sla_limit" DOUBLE PRECISION NOT NULL default 0 + "sla_limit" DOUBLE PRECISION NOT NULL default 0, + "server_name" TEXT DEFAULT '' ); CREATE TABLE "treport_content_item" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_report_content" INTEGER NOT NULL, - "id_agent_module" INTEGER NOT NULL + "id_agent_module" INTEGER NOT NULL, + "server_name" TEXT DEFAULT '' ); CREATE TABLE "treport_custom_sql" ( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 3c6a3cb51d..04ad9bbf1e 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -833,6 +833,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `style` TEXT NOT NULL DEFAULT '', `id_group` INT (10) unsigned NOT NULL DEFAULT 0, `id_module_group` INT (10) unsigned NOT NULL DEFAULT 0, + `server_name` text default '', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -844,11 +845,10 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` ( `id_agent_module` int(10) unsigned NOT NULL, `sla_max` double(18,2) NOT NULL default 0, `sla_min` double(18,2) NOT NULL default 0, - `sla_limit` double(18,2) NOT NULL default 0, + `sla_limit` double(18,2) NOT NULL default 0, + `server_name` text default '', PRIMARY KEY(`id`), FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) - ON UPDATE CASCADE ON DELETE CASCADE, - FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -856,6 +856,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_item` ( `id` INTEGER UNSIGNED NOT NULL auto_increment, `id_report_content` INTEGER UNSIGNED NOT NULL, `id_agent_module` int(10) unsigned NOT NULL, + `server_name` text default '', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8;