[icinga-checkins] icinga.org: icingaweb2-module-director/master: schema/mysql: add timeperiod support for jobs

git at icinga.org git at icinga.org
Fri May 20 15:58:35 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 9c31a51a184c35d4a12d3dd1f1a38cbe19d30a45
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=9c31a51a184c35d4a12d3dd1f1a38cbe19d30a45

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri May 20 15:58:08 2016 +0200

schema/mysql: add timeperiod support for jobs

---

 schema/mysql-migrations/upgrade_97.sql |   11 +++++++++++
 schema/mysql.sql                       |   10 ++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/schema/mysql-migrations/upgrade_97.sql b/schema/mysql-migrations/upgrade_97.sql
new file mode 100644
index 0000000..7da33b2
--- /dev/null
+++ b/schema/mysql-migrations/upgrade_97.sql
@@ -0,0 +1,11 @@
+ALTER TABLE director_job
+  ADD COLUMN timeperiod_id INT(10) UNSIGNED DEFAULT NULL AFTER run_interval,
+  ADD CONSTRAINT director_job_period
+    FOREIGN KEY timeperiod (timeperiod_id)
+    REFERENCES icinga_timeperiod (id)
+    ON DELETE RESTRICT
+    ON UPDATE CASCADE;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (97, NOW());
diff --git a/schema/mysql.sql b/schema/mysql.sql
index 3aad671..d6ea040 100644
--- a/schema/mysql.sql
+++ b/schema/mysql.sql
@@ -146,12 +146,18 @@ CREATE TABLE director_job (
   job_class VARCHAR(72) NOT NULL,
   disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
   run_interval INT(10) UNSIGNED NOT NULL, -- seconds
+  timeperiod_id INT(10) UNSIGNED DEFAULT NULL,
   last_attempt_succeeded ENUM('y', 'n') DEFAULT NULL,
   ts_last_attempt DATETIME DEFAULT NULL,
   ts_last_error DATETIME DEFAULT NULL,
   last_error_message TEXT,
   PRIMARY KEY (id),
-  UNIQUE KEY (job_name)
+  UNIQUE KEY (job_name),
+  CONSTRAINT director_job_period
+    FOREIGN KEY timeperiod (timeperiod_id)
+    REFERENCES icinga_timeperiod (id)
+    ON DELETE RESTRICT
+    ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 CREATE TABLE director_job_setting (
@@ -1303,4 +1309,4 @@ CREATE TABLE sync_run (
 
 INSERT INTO director_schema_migration
   SET migration_time = NOW(),
-      schema_version = 96;
+      schema_version = 97;



More information about the icinga-checkins mailing list