From 4fcda464e8aae3376782ea47dab968aef0e17a5f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 6 Sep 2019 09:39:35 +0200 Subject: [PATCH] Sync: allow notification, dependency, scheduled dt fixes #925 fixes #1209 fixes #1211 fixes #1212 --- application/forms/SyncRuleForm.php | 31 ++++++++++++++----------- schema/mysql-migrations/upgrade_166.sql | 21 +++++++++++++++++ schema/mysql.sql | 5 +++- schema/pgsql-migrations/upgrade_166.sql | 7 ++++++ schema/pgsql.sql | 5 +++- 5 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 schema/mysql-migrations/upgrade_166.sql create mode 100644 schema/pgsql-migrations/upgrade_166.sql diff --git a/application/forms/SyncRuleForm.php b/application/forms/SyncRuleForm.php index 145bb2bd..b4a1cbf0 100644 --- a/application/forms/SyncRuleForm.php +++ b/application/forms/SyncRuleForm.php @@ -8,20 +8,23 @@ class SyncRuleForm extends DirectorObjectForm { public function setup() { - $availableTypes = array( - 'host' => $this->translate('Host'), - 'hostgroup' => $this->translate('Host Group'), - 'service' => $this->translate('Service'), - 'servicegroup' => $this->translate('Service Group'), - 'serviceSet' => $this->translate('Service Set'), - 'user' => $this->translate('User'), - 'usergroup' => $this->translate('User Group'), - 'datalistEntry' => $this->translate('Data List Entry'), - 'command' => $this->translate('Command'), - 'timePeriod' => $this->translate('Time Period'), - 'endpoint' => $this->translate('Endpoint'), - 'zone' => $this->translate('Zone'), - ); + $availableTypes = [ + 'host' => $this->translate('Host'), + 'hostgroup' => $this->translate('Host Group'), + 'service' => $this->translate('Service'), + 'servicegroup' => $this->translate('Service Group'), + 'serviceSet' => $this->translate('Service Set'), + 'user' => $this->translate('User'), + 'usergroup' => $this->translate('User Group'), + 'datalistEntry' => $this->translate('Data List Entry'), + 'command' => $this->translate('Command'), + 'timePeriod' => $this->translate('Time Period'), + 'notification' => $this->translate('Notification'), + 'scheduledDowntime' => $this->translate('Scheduled Downtime'), + 'dependency' => $this->translate('Dependency'), + 'endpoint' => $this->translate('Endpoint'), + 'zone' => $this->translate('Zone'), + ]; $this->addElement('text', 'rule_name', array( 'label' => $this->translate('Rule name'), diff --git a/schema/mysql-migrations/upgrade_166.sql b/schema/mysql-migrations/upgrade_166.sql new file mode 100644 index 00000000..92b56f32 --- /dev/null +++ b/schema/mysql-migrations/upgrade_166.sql @@ -0,0 +1,21 @@ +ALTER TABLE sync_rule MODIFY object_type enum( + 'host', + 'service', + 'command', + 'user', + 'hostgroup', + 'servicegroup', + 'usergroup', + 'datalistEntry', + 'endpoint', + 'zone', + 'timePeriod', + 'serviceSet', + 'scheduledDowntime', + 'notification', + 'dependency' +) NOT NULL; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (166, NOW()); diff --git a/schema/mysql.sql b/schema/mysql.sql index f9133735..b197eabd 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -1484,7 +1484,10 @@ CREATE TABLE sync_rule ( 'endpoint', 'zone', 'timePeriod', - 'serviceSet' + 'serviceSet', + 'scheduledDowntime', + 'notification', + 'dependency' ) NOT NULL, update_policy ENUM('merge', 'override', 'ignore') NOT NULL, purge_existing ENUM('y', 'n') NOT NULL DEFAULT 'n', diff --git a/schema/pgsql-migrations/upgrade_166.sql b/schema/pgsql-migrations/upgrade_166.sql new file mode 100644 index 00000000..8d2edafb --- /dev/null +++ b/schema/pgsql-migrations/upgrade_166.sql @@ -0,0 +1,7 @@ +ALTER TYPE enum_sync_rule_object_type ADD VALUE 'scheduledDowntime'; +ALTER TYPE enum_sync_rule_object_type ADD VALUE 'notification'; +ALTER TYPE enum_sync_rule_object_type ADD VALUE 'dependency'; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (166, NOW()); diff --git a/schema/pgsql.sql b/schema/pgsql.sql index 8ea6ecac..2aa9512d 100644 --- a/schema/pgsql.sql +++ b/schema/pgsql.sql @@ -31,7 +31,10 @@ CREATE TYPE enum_sync_rule_object_type AS ENUM( 'endpoint', 'zone', 'timePeriod', - 'serviceSet' + 'serviceSet', + 'scheduledDowntime', + 'notification', + 'dependency' ); CREATE TYPE enum_sync_rule_update_policy AS ENUM('merge', 'override', 'ignore'); CREATE TYPE enum_sync_property_merge_policy AS ENUM('override', 'merge');