- Fixed field declaration for PostgreSQL 7.4
[gnucomo.git] / src / gcm_daemon / classes / gnucomo_db_version.php
index f4a4d42..9ce5cfb 100644 (file)
@@ -14,8 +14,8 @@
    {
      case 1:
        //DROP the rule that prohibits updates (change of spec).
-       $local_sql = "DROP RULE log_update";
-       $dbms->query($local_sql); //DISABLED FOR NEW ROLE LOG-tABLE  ???
+       //$local_sql = "DROP RULE log_update";
+       //$dbms->query($local_sql); //DISABLED FOR NEW ROLE LOG-tABLE  ???
 
      case 2:
        //In the log table processed should be false by default
@@ -339,7 +339,7 @@ case 36:
      $local_sql  = "CREATE TABLE notification_check (";
      $local_sql .= "checkid bigint DEFAULT nextval('checkid_seq'::text) NOT NULL,";
      $local_sql .= "checkname TEXT, description TEXT, time_between_executions INTERVAL, ";
-     $local_sql .= "last_execution DATETIME, execution_counter BIGINT,";
+     $local_sql .= "last_execution timestamp, execution_counter BIGINT,";
      $local_sql .= "notificationcounter BIGINT)";
      $dbms->query($local_sql);
 
@@ -540,6 +540,78 @@ case 43:
      $local_sql = "CREATE INDEX log_adv_email_status      ON log_adv_daemon_email (status)";
      $dbms->query($local_sql);
 
+   case 44:
+
+     $local_sql = "CREATE TABLE object_abuse
+                   (
+                           objectid   bigint,
+                           source     inet,
+                           nr_abuses  integer,
+                           status     text,
+
+                           primary key (objectid, source)
+                   );";
+     $dbms->query($local_sql);
+     $dbms->query("GRANT SELECT ON log_adv_daemon_email TO GROUP view, GROUP ops, GROUP admin");
+     $dbms->query("GRANT SELECT ON object_abuse TO GROUP view, GROUP ops, GROUP admin");
+     $dbms->query("GRANT INSERT ON object_abuse TO GROUP admin");
+     $dbms->query("GRANT UPDATE ON object_abuse TO GROUP ops, GROUP admin");
+     $dbms->query("GRANT DELETE ON object_abuse TO GROUP admin");
+     $dbms->query("GRANT SELECT ON object_statistics TO GROUP view, GROUP ops, GROUP admin");
+
+     $local_sql = "INSERT INTO type_of_issue (name, suggested_priority, description, active)";
+     $local_sql .= " VALUES ('abuses exceeded',5,'Abuse treshold exceeded from an IP address', true) ";
+     $dbms->query($local_sql);
+
+   case 45:
+
+     $local_sql = "CREATE TABLE service_pattern
+                   (
+                         service   text,
+                         rank      int,
+                         pattern   text,
+                         action    text,
+                         argument  text,
+
+                         primary key (service, rank)
+                   )";
+     $dbms->query($local_sql);
+     $local_sql = "INSERT INTO service_pattern VALUES ('ANY', 999999, '.+', 'notify', 'unmatched log')";
+     $dbms->query($local_sql);
+     $local_sql = "INSERT INTO type_of_issue (name, suggested_priority, description, active)";
+     $local_sql .= " VALUES ('unmatched log',5,'Log entries could not be matched', true) ";
+     $dbms->query($local_sql);
+
+   case 46:
+
+     $local_sql = "CREATE TABLE log_abuse
+                   (
+                           logid      bigint,
+                          objectid   bigint,
+                           source     inet
+                   )";
+     $dbms->query($local_sql);
+
+   case 47:
+
+     $local_sql = "INSERT INTO service_pattern VALUES ('ANY', 999990, '[Ee][Rr][Rr][Oo][Rr]', 'notify', 'Error detected')";
+     $dbms->query($local_sql);
+     $local_sql = "INSERT INTO type_of_issue (name, suggested_priority, description, active)";
+     $local_sql .= " VALUES ('Error detected',5,'An Error is reported in the log', true) ";
+     $dbms->query($local_sql);
+
+     $local_sql = "INSERT INTO service_pattern VALUES ('ANY', 999991, '[Ff][Aa][Ii][Ll]', 'notify', 'Failure detected')";
+     $dbms->query($local_sql);
+     $local_sql = "INSERT INTO type_of_issue (name, suggested_priority, description, active)";
+     $local_sql .= " VALUES ('Failure detected',5,'A Failure is reported in the log', true) ";
+     $dbms->query($local_sql);
+
+     $local_sql = "INSERT INTO service_pattern VALUES ('ANY', 999992, '[Ww][Aa][Rr][Nn]', 'notify', 'Warning detected')";
+     $dbms->query($local_sql);
+     $local_sql = "INSERT INTO type_of_issue (name, suggested_priority, description, active)";
+     $local_sql .= " VALUES ('Warning detected',3,'A Warning is reported in the log', true) ";
+     $dbms->query($local_sql);
+
 
 //These columns have to be removed when a new version of PGSQL has become mainstream that supportsa DROP COLUMN
 /*