From 12e5b6059b560c2bf9cec6928ac7ab4aec28006d Mon Sep 17 00:00:00 2001 From: arjen Date: Wed, 3 Dec 2003 08:06:57 +0000 Subject: [PATCH] Changed the type of log_adv_daemon_email.delay and log_adv_daemon_email.xdelay from time to interval. These delays can be more than 24 hours. --- src/database/create.sql | 12 ++++-- src/gcm_daemon/classes/gnucomo_db_version.php | 55 +++++++++++++++++++++++++++ src/gcm_daemon/gcm_daemon.php | 10 +++-- 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/src/database/create.sql b/src/database/create.sql index e497a25..33909f0 100644 --- a/src/database/create.sql +++ b/src/database/create.sql @@ -12,7 +12,11 @@ -- DBA create the database and give access permissions. -- -- $Log: create.sql,v $ --- Revision 1.17 2003-09-02 12:49:47 arjen +-- Revision 1.18 2003-12-03 08:06:57 arjen +-- Changed the type of log_adv_daemon_email.delay and log_adv_daemon_email.xdelay +-- from time to interval. These delays can be more than 24 hours. +-- +-- Revision 1.17 2003/09/02 12:49:47 arjen -- BUGFIX: Secondary indices on log_notification were unique. -- Additional information in the 'usr' table: 'display_name' and 'email'. -- Added new issues and services. @@ -151,7 +155,7 @@ CREATE TABLE "db_value" COPY "db_value" FROM stdin; -db_version 43 +db_version 44 gcm_daemon_version 5 log_processing 0 last_notification 0 @@ -275,8 +279,8 @@ CREATE TABLE log_adv_daemon_email external_messageid TEXT, to_email TEXT, from_email TEXT, - delay TIME, - xdelay TIME, + delay interval, + xdelay interval, mailer TEXT, status TEXT, pid INT, diff --git a/src/gcm_daemon/classes/gnucomo_db_version.php b/src/gcm_daemon/classes/gnucomo_db_version.php index a83930a..f4a4d42 100644 --- a/src/gcm_daemon/classes/gnucomo_db_version.php +++ b/src/gcm_daemon/classes/gnucomo_db_version.php @@ -486,6 +486,61 @@ case 42: $local_sql = "INSERT INTO service VALUES ('modprobe','Kernel modules', 1, 5) "; $dbms->query($local_sql); +case 43: + + // We need to change the type of the 'delay' and 'xdelay' fields in + // the 'log_adv_daemon_email' table from type time to type interval. + // This can not be done directly; it requires recreating the entire + // table and copying data from the old table. + + $local_sql = "ALTER TABLE log_adv_daemon_email RENAME TO old_table"; + $dbms->query($local_sql); + + $local_sql = "CREATE TABLE log_adv_daemon_email + ( + source_ip INET, + destination_ip INET, + internal_messageid TEXT, + external_messageid TEXT, + to_email TEXT, + from_email TEXT, + delay interval, + xdelay interval, + mailer TEXT, + status TEXT, + pid INT, + size INT, + pri INT, + relay TEXT, + status_details TEXT, + dsn TEXT + ) INHERITS (log_adv_daemon)"; + $dbms->query($local_sql); + + $local_sql = "INSERT INTO log_adv_daemon_email SELECT * FROM old_table"; + $dbms->query($local_sql); + + $local_sql = "DROP TABLE old_table"; + $dbms->query($local_sql); + + // The indices need to be recreated as well. + + $local_sql = "CREATE INDEX log_adv_daemon_email_s_ip ON log_adv_daemon_email (source_ip)"; + $dbms->query($local_sql); + + $local_sql = "CREATE INDEX log_adv_daemon_email_d_ip ON log_adv_daemon_email (destination_ip)"; + $dbms->query($local_sql); + + $local_sql = "CREATE INDEX log_adv_daemon_email_to ON log_adv_daemon_email (to_email)"; + $dbms->query($local_sql); + + $local_sql = "CREATE INDEX log_adv_daemon_email_from ON log_adv_daemon_email (from_email)"; + $dbms->query($local_sql); + + $local_sql = "CREATE INDEX log_adv_email_status ON log_adv_daemon_email (status)"; + $dbms->query($local_sql); + + //These columns have to be removed when a new version of PGSQL has become mainstream that supportsa DROP COLUMN /* diff --git a/src/gcm_daemon/gcm_daemon.php b/src/gcm_daemon/gcm_daemon.php index bd65a72..440d723 100755 --- a/src/gcm_daemon/gcm_daemon.php +++ b/src/gcm_daemon/gcm_daemon.php @@ -20,7 +20,11 @@ Gnucomo-0.0.8: September 4th 2003 $Log: gcm_daemon.php,v $ - Revision 1.17 2003-10-29 09:58:29 arjen + Revision 1.18 2003-12-03 08:07:21 arjen + Changed the type of log_adv_daemon_email.delay and log_adv_daemon_email.xdelay + from time to interval. These delays can be more than 24 hours. + + Revision 1.17 2003/10/29 09:58:29 arjen Create separate notifications for different objects in service_check(). Revision 1.16 2003/09/03 12:48:48 arjen @@ -59,7 +63,7 @@ */ -// $Id: gcm_daemon.php,v 1.17 2003-10-29 09:58:29 arjen Exp $ +// $Id: gcm_daemon.php,v 1.18 2003-12-03 08:07:21 arjen Exp $ ini_set('include_path', '.:./classes:../phpclasses'); ini_set('html_errors', 'false'); @@ -76,7 +80,7 @@ require_once "gnucomo.process_log.php"; $project_name = "gnucomo"; // name of the entire project $app_name = "gcm_daemon"; // name of the application running $developrelease = "FALSE"; // Indicates if special debug settings are needed -$db_version = 43; // The db_version indicates what the level of +$db_version = 44; // The db_version indicates what the level of // the database should be. If the database is // old an update will be generated. $gcmd_version = 5; // This value indicates the active version of -- 2.11.0