diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index a89d06558a..3032113c25 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-02-22 Juan Manuel Ramon + + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql + extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Added fields + id_template to treport and foreign key to treport_content_item to + propagate delete over report tables. + 2012-02-22 Miguel de Dios * install.php, index.php, include/functions_ui.php: cleaned source code diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql index 22a963687d..96d2bb56c4 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql @@ -190,3 +190,12 @@ CREATE TABLE IF NOT EXISTS `tgraph_source_template` ( PRIMARY KEY(`id_gs_template`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- 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; + +-- ----------------------------------------------------- +-- Table `treport` +-- ----------------------------------------------------- +ALTER TABLE treport ADD COLUMN `id_template` INTEGER UNSIGNED DEFAULT 0; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql index cb0fac6f48..6c07fd4eee 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql @@ -182,3 +182,13 @@ CREATE tgraph_source_template ( ); CREATE SEQUENCE tgraph_source_template_s INCREMENT BY 1 START WITH 1; + +-- ----------------------------------------------------- +-- Table `treport_content_item` +-- ----------------------------------------------------- +ALTER TABLE treport_content_item ADD FOREIGN KEY (id_report_content) REFERENCES treport_content(id_rc) ON DELETE CASCADE; + +-- ----------------------------------------------------- +-- Table `treport` +-- ----------------------------------------------------- +ALTER TABLE treport ADD (id_template NUMBER(10, 0) default 0 NOT NULL); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql index 42ea49a799..27a38715d3 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql @@ -167,3 +167,13 @@ CREATE TABLE IF NOT EXISTS "tgraph_source_template" ( "weight" DOUBLE PRECISION default 2.0, "exact_match" SMALLINT NOT NULL default 0 ); + +-- ----------------------------------------------------- +-- 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; + +-- ----------------------------------------------------- +-- Table `treport` +-- ----------------------------------------------------- +ALTER TABLE "treport" ADD COLUMN "id_template" INTEGER NOT NULL default 0; diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 0b50e8a94b..473b6dd4fe 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -936,7 +936,8 @@ CREATE TABLE treport ( header CLOB default NULL, first_page CLOB default NULL, footer CLOB default NULL, - custom_font VARCHAR2(200) default NULL + custom_font VARCHAR2(200) default NULL, + id_template NUMBER(10, 0) default 0 NOT NULL ); CREATE SEQUENCE treport_s INCREMENT BY 1 START WITH 1; @@ -1015,7 +1016,7 @@ CREATE OR REPLACE TRIGGER treport_cont_sla_comb_update AFTER UPDATE OF ID_RC ON CREATE TABLE treport_content_item ( id NUMBER(10, 0) NOT NULL PRIMARY KEY, - id_report_content NUMBER(10, 0) NOT NULL, + id_report_content NUMBER(10, 0) NOT NULL REFERENCES treport_content(id_rc) ON DELETE CASCADE, id_agent_module NUMBER(10, 0) NOT NULL, server_name CLOB default '' ); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 6f45322fcf..046f82eff0 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -750,7 +750,8 @@ CREATE TABLE "treport" ( "header" TEXT default NULL, "first_page" TEXT default NULL, "footer" TEXT default NULL, - "custom_font" varchar(200) default NULL + "custom_font" varchar(200) default NULL, + "id_template" BIGINT NOT NULL default 0 ); -- ----------------------------------------------------- @@ -808,7 +809,7 @@ CREATE TABLE "treport_content_sla_combined" ( CREATE TABLE "treport_content_item" ( "id" SERIAL NOT NULL PRIMARY KEY, - "id_report_content" INTEGER NOT NULL, + "id_report_content" INTEGER NOT NULL REFERENCES treport_content("id_rc") ON UPDATE CASCADE ON DELETE CASCADE, "id_agent_module" INTEGER NOT NULL, "server_name" TEXT DEFAULT '' ); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 541b4925de..47750dd090 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -832,7 +832,7 @@ CREATE TABLE IF NOT EXISTS `treport` ( `first_page` MEDIUMTEXT default NULL, `footer` MEDIUMTEXT default NULL, `custom_font` varchar(200) default NULL, - + `id_template` INTEGER UNSIGNED DEFAULT 0, PRIMARY KEY(`id_report`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -900,7 +900,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_item` ( `id_report_content` INTEGER UNSIGNED NOT NULL, `id_agent_module` int(10) unsigned NOT NULL, `server_name` text default '', - PRIMARY KEY(`id`) + PRIMARY KEY(`id`), + FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) + ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `treport_custom_sql` (