[icinga-checkins] icinga.org: icingaweb2-module-director/fiddle/mfrosch: schema/pgsql: add job tables

git at icinga.org git at icinga.org
Tue May 24 16:46:44 CEST 2016


Module: icingaweb2-module-director
Branch: fiddle/mfrosch
Commit: b40e1af5e83cde6b440c7d5830265f96e61b0848
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=b40e1af5e83cde6b440c7d5830265f96e61b0848

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri May 20 23:57:56 2016 +0200

schema/pgsql: add job tables

---

 schema/pgsql-migrations/upgrade_94.sql |   34 ++++++++++++++++++++++++++++++++
 schema/pgsql.sql                       |   33 ++++++++++++++++++++++++++++++-
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/schema/pgsql-migrations/upgrade_94.sql b/schema/pgsql-migrations/upgrade_94.sql
new file mode 100644
index 0000000..5341a8b
--- /dev/null
+++ b/schema/pgsql-migrations/upgrade_94.sql
@@ -0,0 +1,34 @@
+CREATE TABLE director_job (
+  id serial,
+  job_name character varying(64) NOT NULL,
+  job_class character varying(72) NOT NULL,
+  disabled enum_boolean NOT NULL DEFAULT 'n',
+  run_interval integer NOT NULL, -- seconds
+  last_attempt_succeeded enum_boolean DEFAULT NULL,
+  ts_last_attempt timestamp with time zone DEFAULT NULL,
+  ts_last_error timestamp with time zone DEFAULT NULL,
+  last_error_message text NULL DEFAULT NULL,
+  PRIMARY KEY (id)
+);
+
+CREATE UNIQUE INDEX director_job_unique_job_name ON director_job (job_name);
+
+
+CREATE TABLE director_job_setting (
+  job_id integer NOT NULL,
+  setting_name character varying(64) NOT NULL,
+  setting_value text DEFAULT NULL,
+  PRIMARY KEY (job_id, setting_name),
+  CONSTRAINT director_job_setting_job
+    FOREIGN KEY (job_id)
+    REFERENCES director_job (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+);
+
+CREATE INDEX director_job_setting_job ON director_job_setting (job_id);
+
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (94, NOW());
diff --git a/schema/pgsql.sql b/schema/pgsql.sql
index 6d049a5..b5f0d9d 100644
--- a/schema/pgsql.sql
+++ b/schema/pgsql.sql
@@ -207,6 +207,37 @@ CREATE TABLE director_datafield_setting (
 CREATE INDEX director_datafield_datafield ON director_datafield_setting (datafield_id);
 
 
+CREATE TABLE director_job (
+  id serial,
+  job_name character varying(64) NOT NULL,
+  job_class character varying(72) NOT NULL,
+  disabled enum_boolean NOT NULL DEFAULT 'n',
+  run_interval integer NOT NULL, -- seconds
+  last_attempt_succeeded enum_boolean DEFAULT NULL,
+  ts_last_attempt timestamp with time zone DEFAULT NULL,
+  ts_last_error timestamp with time zone DEFAULT NULL,
+  last_error_message text NULL DEFAULT NULL,
+  PRIMARY KEY (id)
+);
+
+CREATE UNIQUE INDEX director_job_unique_job_name ON director_job (job_name);
+
+
+CREATE TABLE director_job_setting (
+  job_id integer NOT NULL,
+  setting_name character varying(64) NOT NULL,
+  setting_value text DEFAULT NULL,
+  PRIMARY KEY (job_id, setting_name),
+  CONSTRAINT director_job_setting_job
+    FOREIGN KEY (job_id)
+    REFERENCES director_job (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+);
+
+CREATE INDEX director_job_setting_job ON director_job_setting (job_id);
+
+
 CREATE TABLE director_schema_migration (
   schema_version SMALLINT NOT NULL,
   migration_time TIMESTAMP WITH TIME ZONE NOT NULL,
@@ -1482,4 +1513,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (93, NOW());
+  VALUES (94, NOW());



More information about the icinga-checkins mailing list