schema: align PostgreSQL and MySQL sync types

This commit is contained in:
Thomas Gelf 2016-03-05 20:34:24 +01:00
parent 4d84b41272
commit f37671c2c0
4 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,17 @@
ALTER TABLE sync_rule
MODIFY COLUMN object_type enum(
'host',
'service',
'command',
'user',
'hostgroup',
'servicegroup',
'usergroup',
'datalistEntry',
'endpoint',
'zone'
) NOT NULL;
INSERT INTO director_schema_migration
SET migration_time = NOW(),
schema_version = 82;

View File

@ -1154,7 +1154,18 @@ CREATE TABLE imported_row_property (
CREATE TABLE sync_rule (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
rule_name VARCHAR(255) NOT NULL,
object_type enum('host', 'host_template', 'service', 'service_template', 'command', 'command_template', 'user', 'user_template', 'hostgroup', 'servicegroup', 'usergroup', 'datalistEntry', 'endpoint', 'zone') NOT NULL,
object_type enum(
'host',
'service',
'command',
'user',
'hostgroup',
'servicegroup',
'usergroup',
'datalistEntry',
'endpoint',
'zone'
) NOT NULL,
update_policy ENUM('merge', 'override', 'ignore') NOT NULL,
purge_existing ENUM('y', 'n') NOT NULL DEFAULT 'n',
filter_expression TEXT DEFAULT NULL,

View File

@ -0,0 +1,12 @@
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'service' AFTER 'host';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'command' AFTER 'service';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'hostgroup';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'servicegroup';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'usergroup';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'datalistEntry';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'endpoint';
ALTER TYPE enum_sync_rule_object_type ADD VALUE 'zone';
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (82, NOW());

View File

@ -25,7 +25,18 @@ CREATE TYPE enum_command_object_type AS ENUM('object', 'template', 'external_obj
CREATE TYPE enum_apply_object_type AS ENUM('object', 'template', 'apply', 'external_object');
CREATE TYPE enum_state_name AS ENUM('OK', 'Warning', 'Critical', 'Unknown', 'Up', 'Down');
CREATE TYPE enum_type_name AS ENUM('DowntimeStart', 'DowntimeEnd', 'DowntimeRemoved', 'Custom', 'Acknowledgement', 'Problem', 'Recovery', 'FlappingStart', 'FlappingEnd');
CREATE TYPE enum_sync_rule_object_type AS ENUM('host', 'user');
CREATE TYPE enum_sync_rule_object_type AS ENUM(
'host',
'service',
'command',
'user',
'hostgroup',
'servicegroup',
'usergroup',
'datalistEntry',
'endpoint',
'zone'
);
CREATE TYPE enum_sync_rule_update_policy AS ENUM('merge', 'override', 'ignore');
CREATE TYPE enum_sync_property_merge_policy AS ENUM('override', 'merge');
@ -1415,4 +1426,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
-- set current schema version
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (81, NOW());
VALUES (82, NOW());