/*
 | Job Scheduler Tables for Event Management with PostgreSQL 8.x
 | SOS GmbH, 2008-04-30, andreas.pueschel@sos-berlin.com
*/


/* Table for events */
set SQL_MODE=ANSI_QUOTES;

CREATE TABLE IF NOT EXISTS REPORTING_CUSTOM_EVENTS (
  "ID"                    INTEGER         NOT NULL AUTO_INCREMENT, /* unique event entry identifier */
  "SCHEDULER_ID"            VARCHAR(100)    NOT NULL,                /* Job Scheduler instance that handles events */
  "REMOTE_URL"            VARCHAR(100)            ,                /* url of remote Job Scheduler that throws events */
  "REMOTE_SCHEDULER_HOST" VARCHAR(100)            ,                /* host of remote Job Scheduler that throws events */
  "REMOTE_SCHEDULER_PORT" INTEGER                 ,                /* port of remote Job Scheduler that throws events */
  "JOB_CHAIN"             VARCHAR(250)            ,                /* job chain that throws event */
  "ORDER_ID"              VARCHAR(250)            ,                /* order identification */
  "JOB_NAME"              VARCHAR(100)            ,                /* job that throws event */
  "EVENT_CLASS"           VARCHAR(100)    NOT NULL,                /* event class name */
  "EVENT_ID"              VARCHAR(100)    DEFAULT '' NOT NULL,     /* event identification */
  "EXIT_CODE"             VARCHAR(100)    DEFAULT '',              /* exit code */
  "PARAMETERS"            LONGTEXT                ,                /* event parameters as XML format <params><param name="x" value="y"/>...</params> */
  "CREATED"               DATETIME        NOT NULL,                /* timestamp for creation date */
  "EXPIRES"               DATETIME                ,                /* timestamp for expiration date */
  INDEX SCHEDULER_EVENTS_EVENT ("EVENT_CLASS", "EVENT_ID"),
  PRIMARY KEY ( "ID" )
) ENGINE=InnoDB;