From 385155402e3bcbfa68042059eaee68b09f2bd393 Mon Sep 17 00:00:00 2001 From: vgilc Date: Mon, 9 Jan 2012 11:45:00 +0000 Subject: [PATCH] 2012-01-09 Vanessa Gil * pandoradb.oracle.sql pandoradb.postgreSQL.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 migration script for 4.1 version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5329 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++ .../pandoradb_migrate_4.0.x_to_4.1.mysql.sql | 19 ++------- .../pandoradb_migrate_4.0.x_to_4.1.oracle.sql | 31 ++++++++++++++ ...doradb_migrate_4.0.x_to_4.1.postgreSQL.sql | 42 +++++++++++++++++++ pandora_console/pandoradb.oracle.sql | 2 +- pandora_console/pandoradb.postgreSQL.sql | 41 ++++++++++++++++++ 6 files changed, 127 insertions(+), 16 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f8d918f029..74ce9cee22 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2012-01-09 Vanessa Gil + * pandoradb.oracle.sql + pandoradb.postgreSQL.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 migration + script for 4.1 version. + 2012-01-09 Vanessa Gil * godmode/netflow/nf_item_list.php godmode/netflow/nf_report_item.php 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 340756c0ed..231d1ce5bd 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 @@ -30,19 +30,6 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report` ( PRIMARY KEY(`id_report`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- ----------------------------------------------------- --- Table `tnetflow_options` --- ----------------------------------------------------- - -CREATE TABLE IF NOT EXISTS `tnetflow_options` ( - `id_option` int(10) unsigned NOT NULL auto_increment, - `id_name` varchar(60) NOT NULL default '0', - `description` TEXT NOT NULL default '', - `path` varchar(200), - `port` varchar(100), -PRIMARY KEY (`id_option`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- ----------------------------------------------------- -- Table `tnetflow_report_content` -- ----------------------------------------------------- @@ -50,14 +37,16 @@ PRIMARY KEY (`id_option`) CREATE TABLE IF NOT EXISTS `tnetflow_report_content` ( `id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `id_report` INTEGER UNSIGNED NOT NULL default 0, - `id_filter` varchar(60), + `id_filter` INTEGER UNSIGNED NOT NULL default 0, `date` bigint(20) NOT NULL default '0', `period` int(11) NOT NULL default 0, `max` int (11) NOT NULL default 0, `show_graph` varchar(60), PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES tnetflow_report(`id_report`) - ON UPDATE CASCADE ON DELETE CASCADE + ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY (`id_filter`) REFERENCES tnetflow_filter(`id_sg`) + ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- 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 cb742037a2..1a71ddc6e1 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 @@ -3,3 +3,34 @@ -- ----------------------------------------------------- alter table tusuario add (disabled NUMBER(10,0) default 0 NOT NULL); + +-- ----------------------------------------------------- +-- Table "tnetflow_report" +-- ----------------------------------------------------- + +CREATE TABLE tnetflow_report ( +id_report NUMBER(10, 0) NOT NULL PRIMARY KEY, +id_name VARCHAR2(100) NOT NULL, +description CLOB default '', +"group" VARCHAR2(50) +); + +CREATE SEQUENCE tnetflow_report_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tnetflow_report_inc BEFORE INSERT ON tnetflow_report REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetflow_report_s.nextval INTO :NEW.ID_REPORT FROM dual; END tnetflow_report_inc;; + +-- ----------------------------------------------------- +-- Table "tnetflow_report_content" +-- ----------------------------------------------------- + +CREATE TABLE tnetflow_report_content ( +id_rc NUMBER(10, 0) NOT NULL PRIMARY KEY, +id_report NUMBER(10, 0) NOT NULL REFERENCES tnetflow_report(id_report) ON DELETE CASCADE, +id_filter NUMBER(10,0) NOT NULL REFERENCES tnetflow_filter(id_sg) ON DELETE CASCADE, +"date" NUMBER(20, 0) default 0 NOT NULL, +period NUMBER(11, 0) default 0 NOT NULL, +max NUMBER(11, 0) default 0 NOT NULL, +show_graph VARCHAR2(60) +); + +CREATE SEQUENCE tnetflow_report_content_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tnetflow_report_content_inc BEFORE INSERT ON tnetflow_report_content REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetflow_report_content_s.nextval INTO :NEW.ID_RC FROM dual; END tnetflow_report_content_inc;; 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 1151d73575..dfabde8eab 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 @@ -3,3 +3,45 @@ -- ----------------------------------------------------- ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0; + +-- ----------------------------------------------------- +-- Table `tnetflow_filter` +-- ----------------------------------------------------- +CREATE TABLE "tnetflow_filter" ( + "id_sg" SERIAL NOT NULL PRIMARY KEY, + "id_name" varchar(60) NOT NULL default '', + "group" varchar(60), + "ip_dst" varchar(100), + "ip_src" varchar(100), + "dst_port" varchar(100), + "src_port" varchar(100), + "aggregate" varchar(60), + "show_packets" SMALLINT default 0, + "show_bytes" SMALLINT default 0, + "show_bps" SMALLINT default 0, + "show_bpp" SMALLINT default 0 +); + +-- ----------------------------------------------------- +-- Table `tnetflow_report` +-- ----------------------------------------------------- +CREATE TABLE "tnetflow_report" ( + "id_report" SERIAL NOT NULL PRIMARY KEY, + "id_name" varchar(150) NOT NULL default '', + "description" TEXT, + "group" varchar(60) +); + +-- ----------------------------------------------------- +-- Table `tnetflow_report_content` +-- ----------------------------------------------------- +CREATE TABLE "tnetflow_report_content" ( + "id_rc" SERIAL NOT NULL PRIMARY KEY, + "id_report" INTEGER NOT NULL default 0 REFERENCES tnetflow_report("id_report") ON DELETE CASCADE, + "id_filter" INTEGER NOT NULL default 0 REFERENCES tnetflow_filter("id_sg") ON DELETE CASCADE, + "date" BIGINT NOT NULL default 0, + "period" INTEGER NOT NULL default 0, + "max" INTEGER NOT NULL default 0, + "show_graph" varchar(60) +); + diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 9c9ba2cc76..94e66f8ff7 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1519,7 +1519,7 @@ CREATE OR REPLACE TRIGGER tnetflow_report_inc BEFORE INSERT ON tnetflow_report R CREATE TABLE tnetflow_report_content ( id_rc NUMBER(10, 0) NOT NULL PRIMARY KEY, id_report NUMBER(10, 0) NOT NULL REFERENCES tnetflow_report(id_report) ON DELETE CASCADE, -id_filter VARCHAR2(100), +id_filter NUMBER(10,0) NOT NULL REFERENCES tnetflow_filter(id_sg) ON DELETE CASCADE, "date" NUMBER(20, 0) default 0 NOT NULL, period NUMBER(11, 0) default 0 NOT NULL, max NUMBER(11, 0) default 0 NOT NULL, diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index aa7dac206c..4bf54234b7 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1189,3 +1189,44 @@ CREATE TABLE "ttag_event" ( ); CREATE INDEX "ttag_event_id_evento_idx" ON "ttag_event"("id_evento"); + +-- ----------------------------------------------------- +-- Table `tnetflow_filter` +-- ----------------------------------------------------- +CREATE TABLE "tnetflow_filter" ( + "id_sg" SERIAL NOT NULL PRIMARY KEY, + "id_name" varchar(60) NOT NULL default '', + "group" varchar(60), + "ip_dst" varchar(100), + "ip_src" varchar(100), + "dst_port" varchar(100), + "src_port" varchar(100), + "aggregate" varchar(60), + "show_packets" SMALLINT default 0, + "show_bytes" SMALLINT default 0, + "show_bps" SMALLINT default 0, + "show_bpp" SMALLINT default 0 +); + +-- ----------------------------------------------------- +-- Table `tnetflow_report` +-- ----------------------------------------------------- +CREATE TABLE "tnetflow_report" ( + "id_report" SERIAL NOT NULL PRIMARY KEY, + "id_name" varchar(150) NOT NULL default '', + "description" TEXT, + "group" varchar(60) +); + +-- ----------------------------------------------------- +-- Table `tnetflow_report_content` +-- ----------------------------------------------------- +CREATE TABLE "tnetflow_report_content" ( + "id_rc" SERIAL NOT NULL PRIMARY KEY, + "id_report" INTEGER NOT NULL default 0 REFERENCES tnetflow_report("id_report") ON DELETE CASCADE, + "id_filter" INTEGER NOT NULL default 0 REFERENCES tnetflow_filter("id_sg") ON DELETE CASCADE, + "date" BIGINT NOT NULL default 0, + "period" INTEGER NOT NULL default 0, + "max" INTEGER NOT NULL default 0, + "show_graph" varchar(60) +);