summaryrefslogtreecommitdiffstats
path: root/schema/mysql-legacy-changes
diff options
context:
space:
mode:
Diffstat (limited to 'schema/mysql-legacy-changes')
-rw-r--r--schema/mysql-legacy-changes/upgrade_1.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_10.sql14
-rw-r--r--schema/mysql-legacy-changes/upgrade_11.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_12.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_13.sql18
-rw-r--r--schema/mysql-legacy-changes/upgrade_14.sql18
-rw-r--r--schema/mysql-legacy-changes/upgrade_15.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_16.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_17.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_18.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_19.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_2.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_20.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_21.sql15
-rw-r--r--schema/mysql-legacy-changes/upgrade_22.sql43
-rw-r--r--schema/mysql-legacy-changes/upgrade_23.sql51
-rw-r--r--schema/mysql-legacy-changes/upgrade_24.sql91
-rw-r--r--schema/mysql-legacy-changes/upgrade_25.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_26.sql4
-rw-r--r--schema/mysql-legacy-changes/upgrade_27.sql58
-rw-r--r--schema/mysql-legacy-changes/upgrade_28.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_29.sql16
-rw-r--r--schema/mysql-legacy-changes/upgrade_3.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_30.sql8
-rw-r--r--schema/mysql-legacy-changes/upgrade_31.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_32.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_33.sql11
-rw-r--r--schema/mysql-legacy-changes/upgrade_34.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_35.sql6
-rw-r--r--schema/mysql-legacy-changes/upgrade_36.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_37.sql17
-rw-r--r--schema/mysql-legacy-changes/upgrade_38.sql4
-rw-r--r--schema/mysql-legacy-changes/upgrade_39.sql5
-rw-r--r--schema/mysql-legacy-changes/upgrade_4.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_40.sql9
-rw-r--r--schema/mysql-legacy-changes/upgrade_41.sql19
-rw-r--r--schema/mysql-legacy-changes/upgrade_42.sql7
-rw-r--r--schema/mysql-legacy-changes/upgrade_43.sql13
-rw-r--r--schema/mysql-legacy-changes/upgrade_44.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_45.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_46.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_47.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_48.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_49.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_5.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_50.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_51.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_52.sql5
-rw-r--r--schema/mysql-legacy-changes/upgrade_53.sql9
-rw-r--r--schema/mysql-legacy-changes/upgrade_54.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_55.sql8
-rw-r--r--schema/mysql-legacy-changes/upgrade_56.sql13
-rw-r--r--schema/mysql-legacy-changes/upgrade_57.sql20
-rw-r--r--schema/mysql-legacy-changes/upgrade_58.sql5
-rw-r--r--schema/mysql-legacy-changes/upgrade_59.sql3
-rw-r--r--schema/mysql-legacy-changes/upgrade_6.sql5
-rw-r--r--schema/mysql-legacy-changes/upgrade_60.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_61.sql2
-rw-r--r--schema/mysql-legacy-changes/upgrade_62.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_7.sql1
-rw-r--r--schema/mysql-legacy-changes/upgrade_8.sql36
-rw-r--r--schema/mysql-legacy-changes/upgrade_9.sql1
62 files changed, 686 insertions, 0 deletions
diff --git a/schema/mysql-legacy-changes/upgrade_1.sql b/schema/mysql-legacy-changes/upgrade_1.sql
new file mode 100644
index 0000000..e9b1008
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE icinga_user ADD COLUMN object_type ENUM('object', 'template') NOT NULL AFTER zone_id;
+
diff --git a/schema/mysql-legacy-changes/upgrade_10.sql b/schema/mysql-legacy-changes/upgrade_10.sql
new file mode 100644
index 0000000..2709186
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_10.sql
@@ -0,0 +1,14 @@
+ALTER TABLE icinga_hostgroup_parent DROP FOREIGN KEY icinga_hostgroup_parent_parent;
+ALTER TABLE icinga_hostgroup_parent ADD CONSTRAINT icinga_hostgroup_parent_parent
+ FOREIGN KEY parent (parent_hostgroup_id)
+ REFERENCES icinga_hostgroup (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE;
+
+ALTER TABLE icinga_usergroup_parent DROP FOREIGN KEY icinga_usergroup_parent_parent;
+ALTER TABLE icinga_usergroup_parent ADD CONSTRAINT icinga_usergroup_parent_parent
+ FOREIGN KEY parent (parent_usergroup_id)
+ REFERENCES icinga_usergroup (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE;
+
diff --git a/schema/mysql-legacy-changes/upgrade_11.sql b/schema/mysql-legacy-changes/upgrade_11.sql
new file mode 100644
index 0000000..8aaf71a
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_11.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_zone ADD is_global ENUM('y', 'n') NOT NULL DEFAULT 'n' AFTER object_type;
diff --git a/schema/mysql-legacy-changes/upgrade_12.sql b/schema/mysql-legacy-changes/upgrade_12.sql
new file mode 100644
index 0000000..5ee2525
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_12.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_service_inheritance (
+ service_id INT(10) UNSIGNED NOT NULL,
+ parent_service_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (service_id, parent_service_id),
+ UNIQUE KEY unique_order (service_id, weight),
+ CONSTRAINT icinga_service_inheritance_service
+ FOREIGN KEY host (service_id)
+ REFERENCES icinga_service (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_service_inheritance_parent_service
+ FOREIGN KEY host (parent_service_id)
+ REFERENCES icinga_service (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_13.sql b/schema/mysql-legacy-changes/upgrade_13.sql
new file mode 100644
index 0000000..96b0aad
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_13.sql
@@ -0,0 +1,18 @@
+CREATE TABLE icinga_user_inheritance (
+ user_id INT(10) UNSIGNED NOT NULL,
+ parent_user_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (user_id, parent_user_id),
+ UNIQUE KEY unique_order (user_id, weight),
+ CONSTRAINT icinga_user_inheritance_user
+ FOREIGN KEY host (user_id)
+ REFERENCES icinga_user (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_user_inheritance_parent_user
+ FOREIGN KEY host (parent_user_id)
+ REFERENCES icinga_user (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
diff --git a/schema/mysql-legacy-changes/upgrade_14.sql b/schema/mysql-legacy-changes/upgrade_14.sql
new file mode 100644
index 0000000..506f779
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_14.sql
@@ -0,0 +1,18 @@
+CREATE TABLE icinga_timeperiod_inheritance (
+ timeperiod_id INT(10) UNSIGNED NOT NULL,
+ parent_timeperiod_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (timeperiod_id, parent_timeperiod_id),
+ UNIQUE KEY unique_order (timeperiod_id, weight),
+ CONSTRAINT icinga_timeperiod_inheritance_timeperiod
+ FOREIGN KEY host (timeperiod_id)
+ REFERENCES icinga_timeperiod (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_timeperiod_inheritance_parent_timeperiod
+ FOREIGN KEY host (parent_timeperiod_id)
+ REFERENCES icinga_timeperiod (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
diff --git a/schema/mysql-legacy-changes/upgrade_15.sql b/schema/mysql-legacy-changes/upgrade_15.sql
new file mode 100644
index 0000000..c5f7dd7
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_15.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_hostgroup_inheritance (
+ hostgroup_id INT(10) UNSIGNED NOT NULL,
+ parent_hostgroup_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (hostgroup_id, parent_hostgroup_id),
+ UNIQUE KEY unique_order (hostgroup_id, weight),
+ CONSTRAINT icinga_hostgroup_inheritance_hostgroup
+ FOREIGN KEY host (hostgroup_id)
+ REFERENCES icinga_hostgroup (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_hostgroup_inheritance_parent_hostgroup
+ FOREIGN KEY host (parent_hostgroup_id)
+ REFERENCES icinga_hostgroup (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_16.sql b/schema/mysql-legacy-changes/upgrade_16.sql
new file mode 100644
index 0000000..0a41a68
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_16.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_servicegroup_inheritance (
+ servicegroup_id INT(10) UNSIGNED NOT NULL,
+ parent_servicegroup_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (servicegroup_id, parent_servicegroup_id),
+ UNIQUE KEY unique_order (servicegroup_id, weight),
+ CONSTRAINT icinga_servicegroup_inheritance_servicegroup
+ FOREIGN KEY host (servicegroup_id)
+ REFERENCES icinga_servicegroup (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_servicegroup_inheritance_parent_servicegroup
+ FOREIGN KEY host (parent_servicegroup_id)
+ REFERENCES icinga_servicegroup (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_17.sql b/schema/mysql-legacy-changes/upgrade_17.sql
new file mode 100644
index 0000000..58f7e88
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_17.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_command_inheritance (
+ command_id INT(10) UNSIGNED NOT NULL,
+ parent_command_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (command_id, parent_command_id),
+ UNIQUE KEY unique_order (command_id, weight),
+ CONSTRAINT icinga_command_inheritance_command
+ FOREIGN KEY command (command_id)
+ REFERENCES icinga_command (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_command_inheritance_parent_command
+ FOREIGN KEY command (parent_command_id)
+ REFERENCES icinga_command (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_18.sql b/schema/mysql-legacy-changes/upgrade_18.sql
new file mode 100644
index 0000000..5d3eb85
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_18.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_zone_inheritance (
+ zone_id INT(10) UNSIGNED NOT NULL,
+ parent_zone_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (zone_id, parent_zone_id),
+ UNIQUE KEY unique_order (zone_id, weight),
+ CONSTRAINT icinga_zone_inheritance_zone
+ FOREIGN KEY zone (zone_id)
+ REFERENCES icinga_zone (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_zone_inheritance_parent_zone
+ FOREIGN KEY zone (parent_zone_id)
+ REFERENCES icinga_zone (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_19.sql b/schema/mysql-legacy-changes/upgrade_19.sql
new file mode 100644
index 0000000..2980ccc
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_19.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_usergroup_inheritance (
+ usergroup_id INT(10) UNSIGNED NOT NULL,
+ parent_usergroup_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (usergroup_id, parent_usergroup_id),
+ UNIQUE KEY unique_order (usergroup_id, weight),
+ CONSTRAINT icinga_usergroup_inheritance_usergroup
+ FOREIGN KEY usergroup (usergroup_id)
+ REFERENCES icinga_usergroup (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_usergroup_inheritance_parent_usergroup
+ FOREIGN KEY usergroup (parent_usergroup_id)
+ REFERENCES icinga_usergroup (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_2.sql b/schema/mysql-legacy-changes/upgrade_2.sql
new file mode 100644
index 0000000..04f3733
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_2.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_command_argument ADD UNIQUE KEY unique_idx (command_id, argument_name);
diff --git a/schema/mysql-legacy-changes/upgrade_20.sql b/schema/mysql-legacy-changes/upgrade_20.sql
new file mode 100644
index 0000000..91a86a2
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_20.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_endpoint_inheritance (
+ endpoint_id INT(10) UNSIGNED NOT NULL,
+ parent_endpoint_id INT(10) UNSIGNED NOT NULL,
+ weight MEDIUMINT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (endpoint_id, parent_endpoint_id),
+ UNIQUE KEY unique_order (endpoint_id, weight),
+ CONSTRAINT icinga_endpoint_inheritance_endpoint
+ FOREIGN KEY endpoint (endpoint_id)
+ REFERENCES icinga_endpoint (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_endpoint_inheritance_parent_endpoint
+ FOREIGN KEY endpoint (parent_endpoint_id)
+ REFERENCES icinga_endpoint (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_21.sql b/schema/mysql-legacy-changes/upgrade_21.sql
new file mode 100644
index 0000000..7c72b86
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_21.sql
@@ -0,0 +1,15 @@
+DROP TABLE director_datalist_value;
+
+CREATE TABLE director_datalist_entry (
+ list_id INT(10) UNSIGNED NOT NULL,
+ entry_name VARCHAR(255) DEFAULT NULL,
+ entry_value TEXT DEFAULT NULL,
+ format enum ('string', 'expression', 'json'),
+ PRIMARY KEY (list_id, entry_name),
+ CONSTRAINT director_datalist_value_datalist
+ FOREIGN KEY datalist (list_id)
+ REFERENCES director_datalist (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
diff --git a/schema/mysql-legacy-changes/upgrade_22.sql b/schema/mysql-legacy-changes/upgrade_22.sql
new file mode 100644
index 0000000..418145c
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_22.sql
@@ -0,0 +1,43 @@
+CREATE TABLE icinga_host_field (
+ host_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
+ fieldname VARCHAR(64) NOT NULL,
+ caption VARCHAR(255) NOT NULL,
+ datatype_id INT(10) UNSIGNED NOT NULL,
+-- datatype_param? multiple ones?
+ default_value TEXT DEFAULT NULL,
+ format enum ('string', 'json', 'expression'),
+ PRIMARY KEY (host_id, fieldname),
+ KEY search_idx (fieldname),
+ CONSTRAINT icinga_host_field_host
+ FOREIGN KEY host(host_id)
+ REFERENCES icinga_host (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_host_field_datatype
+ FOREIGN KEY datatype (datatype_id)
+ REFERENCES director_datatype (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE icinga_service_field (
+ service_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
+ fieldname VARCHAR(64) NOT NULL,
+ caption VARCHAR(255) NOT NULL,
+ datatype_id INT(10) UNSIGNED NOT NULL,
+ -- datatype_param? multiple ones?
+ default_value TEXT DEFAULT NULL,
+ format enum ('string', 'json', 'expression'),
+ PRIMARY KEY (service_id, fieldname),
+ KEY search_idx (fieldname),
+ CONSTRAINT icinga_service_field_service
+ FOREIGN KEY service (service_id)
+ REFERENCES icinga_service (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_service_field_datatype
+ FOREIGN KEY datatype (datatype_id)
+ REFERENCES director_datatype (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_23.sql b/schema/mysql-legacy-changes/upgrade_23.sql
new file mode 100644
index 0000000..2368a17
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_23.sql
@@ -0,0 +1,51 @@
+DROP TABLE director_datatype;
+
+CREATE TABLE director_datafield (
+ id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ varname VARCHAR(64) NOT NULL,
+ caption VARCHAR(255) NOT NULL,
+ description TEXT DEFAULT NULL,
+ datatype varchar(255) NOT NULL,
+-- datatype_param? multiple ones?
+ format enum ('string', 'json', 'expression'),
+ PRIMARY KEY (id),
+ KEY search_idx (varname)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+DROP TABLE icinga_host_field;
+
+CREATE TABLE icinga_host_field (
+ host_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
+ datafield_id INT(10) UNSIGNED NOT NULL,
+ is_required ENUM('y', 'n') DEFAULT NULL,
+ PRIMARY KEY (host_id, datafield_id),
+ CONSTRAINT icinga_host_field_host
+ FOREIGN KEY host(host_id)
+ REFERENCES icinga_host (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_host_field_datafield
+ FOREIGN KEY datafield(datafield_id)
+ REFERENCES director_datafield (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+DROP TABLE icinga_service_field;
+
+CREATE TABLE icinga_service_field (
+ service_id INT(10) UNSIGNED NOT NULL COMMENT 'Makes only sense for templates',
+ datafield_id INT(10) UNSIGNED NOT NULL,
+ is_required ENUM('y', 'n') DEFAULT NULL,
+ PRIMARY KEY (service_id, datafield_id),
+ CONSTRAINT icinga_service_field_service
+ FOREIGN KEY service(service_id)
+ REFERENCES icinga_service (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_service_field_datafield
+ FOREIGN KEY datafield(datafield_id)
+ REFERENCES director_datafield (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file
diff --git a/schema/mysql-legacy-changes/upgrade_24.sql b/schema/mysql-legacy-changes/upgrade_24.sql
new file mode 100644
index 0000000..4c380b1
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_24.sql
@@ -0,0 +1,91 @@
+CREATE TABLE import_source (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ source_name VARCHAR(64) NOT NULL,
+ provider_class VARCHAR(72) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE import_source_setting (
+ source_id INT(10) UNSIGNED NOT NULL,
+ setting_name VARCHAR(64) NOT NULL,
+ setting_value VARCHAR(255) NOT NULL,
+ PRIMARY KEY (source_id, setting_name),
+ CONSTRAINT import_source_settings_source
+ FOREIGN KEY source (source_id)
+ REFERENCES import_source (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE imported_rowset (
+ checksum VARBINARY(20) NOT NULL,
+ PRIMARY KEY (checksum)
+) ENGINE=InnoDB;
+
+CREATE TABLE import_run (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ source_id INT(10) UNSIGNED NOT NULL,
+ imported_rowset_checksum VARBINARY(20) DEFAULT NULL,
+ start_time DATETIME NOT NULL,
+ end_time DATETIME DEFAULT NULL,
+ succeeded ENUM('y', 'n') DEFAULT NULL,
+ PRIMARY KEY (id),
+ CONSTRAINT import_run_source
+ FOREIGN KEY import_source (source_id)
+ REFERENCES import_source (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE,
+ CONSTRAINT import_run_rowset
+ FOREIGN KEY rowset (imported_rowset_checksum)
+ REFERENCES imported_rowset (checksum)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE imported_row (
+ checksum VARBINARY(20) NOT NULL COMMENT 'sha1(object_name;property_checksum;...)',
+ object_name VARCHAR(255) NOT NULL,
+ PRIMARY KEY (checksum)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE imported_rowset_row (
+ rowset_checksum VARBINARY(20) NOT NULL,
+ row_checksum VARBINARY(20) NOT NULL,
+ PRIMARY KEY (rowset_checksum, row_checksum),
+ CONSTRAINT imported_rowset_row_rowset
+ FOREIGN KEY rowset_row_rowset (rowset_checksum)
+ REFERENCES imported_rowset (checksum)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT imported_rowset_row_row
+ FOREIGN KEY rowset_row_rowset (row_checksum)
+ REFERENCES imported_row (checksum)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+CREATE TABLE imported_property (
+ checksum VARBINARY(20) NOT NULL,
+ property_name VARCHAR(64) NOT NULL,
+ property_value TEXT NOT NULL,
+ format enum ('string', 'expression', 'json'),
+ PRIMARY KEY (checksum),
+ KEY search_idx (property_name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE imported_row_property (
+ row_checksum VARBINARY(20) NOT NULL,
+ property_checksum VARBINARY(20) NOT NULL,
+ PRIMARY KEY (row_checksum, property_checksum),
+ CONSTRAINT imported_row_property_row
+ FOREIGN KEY row_checksum (row_checksum)
+ REFERENCES imported_row (checksum)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT imported_row_property_property
+ FOREIGN KEY property_checksum (property_checksum)
+ REFERENCES imported_property (checksum)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
diff --git a/schema/mysql-legacy-changes/upgrade_25.sql b/schema/mysql-legacy-changes/upgrade_25.sql
new file mode 100644
index 0000000..f4d2d90
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_25.sql
@@ -0,0 +1,2 @@
+ALTER TABLE import_source ADD COLUMN key_column VARCHAR(64) NOT NULL AFTER source_name;
+ALTER TABLE import_source ADD INDEX search_idx (key_column);
diff --git a/schema/mysql-legacy-changes/upgrade_26.sql b/schema/mysql-legacy-changes/upgrade_26.sql
new file mode 100644
index 0000000..d7f0c46
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_26.sql
@@ -0,0 +1,4 @@
+ALTER TABLE import_run DROP FOREIGN KEY import_run_rowset;
+ALTER TABLE import_run CHANGE imported_rowset_checksum rowset_checksum varbinary(20) DEFAULT NULL;
+ALTER TABLE import_run ADD CONSTRAINT import_run_rowset FOREIGN KEY rowset (rowset_checksum) REFERENCES imported_rowset (checksum) ON DELETE RESTRICT ON UPDATE CASCADE;
+
diff --git a/schema/mysql-legacy-changes/upgrade_27.sql b/schema/mysql-legacy-changes/upgrade_27.sql
new file mode 100644
index 0000000..684e45c
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_27.sql
@@ -0,0 +1,58 @@
+
+CREATE TABLE sync_rule (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ rule_name VARCHAR(255) NOT NULL,
+ object_type ENUM('host', 'user') NOT NULL,
+ update_policy ENUM('merge', 'override', 'ignore') NOT NULL,
+ purge_existing ENUM('y', 'n') NOT NULL DEFAULT 'n',
+ filter_expression TEXT NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE sync_property (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ rule_id INT(10) UNSIGNED NOT NULL,
+ source_id INT(10) UNSIGNED NOT NULL,
+ source_expression VARCHAR(255) NOT NULL,
+ destination_field VARCHAR(64),
+ priority SMALLINT UNSIGNED NOT NULL,
+ filter_expression TEXT DEFAULT NULL,
+ merge_policy ENUM('override', 'merge') NOT NULL,
+ PRIMARY KEY (id),
+ CONSTRAINT sync_property_rule
+ FOREIGN KEY sync_rule (rule_id)
+ REFERENCES sync_rule (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT sync_property_source
+ FOREIGN KEY import_source (source_id)
+ REFERENCES import_source (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE sync_modifier (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ property_id INT(10) UNSIGNED NOT NULL,
+ provider_class VARCHAR(72) NOT NULL,
+ PRIMARY KEY (id),
+ CONSTRAINT sync_modifier_property
+ FOREIGN KEY sync_property (property_id)
+ REFERENCES sync_property (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE sync_modifier_param (
+ modifier_id INT UNSIGNED NOT NULL,
+ param_name VARCHAR(64) NOT NULL,
+ param_value TEXT DEFAULT NULL,
+ PRIMARY KEY (modifier_id, param_name),
+ CONSTRAINT sync_modifier_param_modifier
+ FOREIGN KEY modifier (modifier_id)
+ REFERENCES sync_modifier (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
diff --git a/schema/mysql-legacy-changes/upgrade_28.sql b/schema/mysql-legacy-changes/upgrade_28.sql
new file mode 100644
index 0000000..2451311
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_28.sql
@@ -0,0 +1 @@
+ALTER TABLE sync_rule MODIFY filter_expression TEXT DEFAULT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_29.sql b/schema/mysql-legacy-changes/upgrade_29.sql
new file mode 100644
index 0000000..e841a7f
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_29.sql
@@ -0,0 +1,16 @@
+DROP TABLE sync_modifier_param;
+DROP TABLE sync_modifier;
+
+CREATE TABLE import_row_modifier (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ property_id INT(10) UNSIGNED NOT NULL,
+ provider_class VARCHAR(72) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE import_row_modifier_settings (
+ modifier_id INT UNSIGNED NOT NULL,
+ settings_name VARCHAR(64) NOT NULL,
+ settings_value TEXT DEFAULT NULL,
+ PRIMARY KEY (modifier_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_3.sql b/schema/mysql-legacy-changes/upgrade_3.sql
new file mode 100644
index 0000000..1a093d6
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_3.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_hostgroup ADD COLUMN object_type ENUM('object', 'template') NOT NULL AFTER display_name; \ No newline at end of file
diff --git a/schema/mysql-legacy-changes/upgrade_30.sql b/schema/mysql-legacy-changes/upgrade_30.sql
new file mode 100644
index 0000000..1cd60b8
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_30.sql
@@ -0,0 +1,8 @@
+DROP TABLE import_row_modifier_settings;
+
+CREATE TABLE import_row_modifier_setting (
+ modifier_id INT UNSIGNED NOT NULL,
+ setting_name VARCHAR(64) NOT NULL,
+ setting_value TEXT DEFAULT NULL,
+ PRIMARY KEY (modifier_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_31.sql b/schema/mysql-legacy-changes/upgrade_31.sql
new file mode 100644
index 0000000..d8031ed
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_31.sql
@@ -0,0 +1,2 @@
+ALTER TABLE director_generated_file MODIFY content MEDIUMTEXT DEFAULT NULL;
+
diff --git a/schema/mysql-legacy-changes/upgrade_32.sql b/schema/mysql-legacy-changes/upgrade_32.sql
new file mode 100644
index 0000000..4d584de
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_32.sql
@@ -0,0 +1 @@
+ALTER TABLE import_source_setting MODIFY setting_value TEXT DEFAULT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_33.sql b/schema/mysql-legacy-changes/upgrade_33.sql
new file mode 100644
index 0000000..19f7e45
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_33.sql
@@ -0,0 +1,11 @@
+CREATE TABLE director_datafield_setting (
+ datafield_id INT(10) UNSIGNED NOT NULL,
+ setting_name VARCHAR(64) NOT NULL,
+ setting_value TEXT NOT NULL,
+ PRIMARY KEY (datafield_id, setting_name),
+ CONSTRAINT datafield_id_settings
+ FOREIGN KEY datafield (datafield_id)
+ REFERENCES director_datafield (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/schema/mysql-legacy-changes/upgrade_34.sql b/schema/mysql-legacy-changes/upgrade_34.sql
new file mode 100644
index 0000000..21af3d0
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_34.sql
@@ -0,0 +1,2 @@
+ALTER TABLE icinga_host_field MODIFY is_required ENUM('y', 'n') NOT NULL;
+ALTER TABLE icinga_service_field MODIFY is_required ENUM('y', 'n') NOT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_35.sql b/schema/mysql-legacy-changes/upgrade_35.sql
new file mode 100644
index 0000000..166a06f
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_35.sql
@@ -0,0 +1,6 @@
+ALTER TABLE icinga_command_argument DROP COLUMN value_format, ADD COLUMN argument_format ENUM('string', 'expression', 'json') NOT NULL DEFAULT 'string' AFTER argument_value;
+ALTER TABLE icinga_command_argument DEFAULT COLLATE utf8_bin;
+ALTER TABLE icinga_command_argument MODIFY COLUMN argument_name VARCHAR(64) DEFAULT NULL COLLATE utf8_bin;
+
+
+
diff --git a/schema/mysql-legacy-changes/upgrade_36.sql b/schema/mysql-legacy-changes/upgrade_36.sql
new file mode 100644
index 0000000..8905f10
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_36.sql
@@ -0,0 +1 @@
+ALTER TABLE sync_rule MODIFY COLUMN object_type enum('host', 'host_template', 'service', 'service_template', 'command', 'command_template', 'user', 'user_template', 'hostgroup', 'servicegroup', 'usergroup', 'datalistEntry') NOT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_37.sql b/schema/mysql-legacy-changes/upgrade_37.sql
new file mode 100644
index 0000000..2533370
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_37.sql
@@ -0,0 +1,17 @@
+CREATE TABLE icinga_command_field (
+ command_id INT(10) UNSIGNED NOT NULL,
+ datafield_id INT(10) UNSIGNED NOT NULL,
+ is_required ENUM('y', 'n') NOT NULL,
+ PRIMARY KEY (command_id, datafield_id),
+ CONSTRAINT icinga_command_field_command_argument
+ FOREIGN KEY host(command_id)
+ REFERENCES icinga_command_argument (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_command_field_datafield
+ FOREIGN KEY datafield(datafield_id)
+ REFERENCES director_datafield (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
diff --git a/schema/mysql-legacy-changes/upgrade_38.sql b/schema/mysql-legacy-changes/upgrade_38.sql
new file mode 100644
index 0000000..8760334
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_38.sql
@@ -0,0 +1,4 @@
+ALTER TABLE icinga_host
+ ADD COLUMN display_name VARCHAR(255) DEFAULT NULL,
+ ADD INDEX search_idx (display_name);
+
diff --git a/schema/mysql-legacy-changes/upgrade_39.sql b/schema/mysql-legacy-changes/upgrade_39.sql
new file mode 100644
index 0000000..81ee33d
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_39.sql
@@ -0,0 +1,5 @@
+ALTER TABLE director_deployment_log
+ MODIFY COLUMN startup_log TEXT DEFAULT NULL,
+ ADD COLUMN stage_name VARCHAR(64) DEFAULT NULL AFTER duration_dump,
+ ADD COLUMN stage_collected ENUM('y', 'n') DEFAULT NULL AFTER stage_name;
+
diff --git a/schema/mysql-legacy-changes/upgrade_4.sql b/schema/mysql-legacy-changes/upgrade_4.sql
new file mode 100644
index 0000000..4f005f2
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_4.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_servicegroup ADD COLUMN object_type ENUM('object', 'template') NOT NULL AFTER display_name; \ No newline at end of file
diff --git a/schema/mysql-legacy-changes/upgrade_40.sql b/schema/mysql-legacy-changes/upgrade_40.sql
new file mode 100644
index 0000000..55bcbed
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_40.sql
@@ -0,0 +1,9 @@
+
+ALTER TABLE director_deployment_log ADD COLUMN config_checksum VARBINARY(20) DEFAULT NULL AFTER config_id;
+ALTER TABLE director_deployment_log DROP COLUMN config_id;
+ALTER TABLE director_deployment_log ADD CONSTRAINT config_checksum
+ FOREIGN KEY config_checksum (config_checksum)
+ REFERENCES director_generated_config (checksum)
+ ON DELETE SET NULL
+ ON UPDATE RESTRICT;
+
diff --git a/schema/mysql-legacy-changes/upgrade_41.sql b/schema/mysql-legacy-changes/upgrade_41.sql
new file mode 100644
index 0000000..0ddb9b6
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_41.sql
@@ -0,0 +1,19 @@
+DROP TABLE icinga_command_field;
+
+CREATE TABLE icinga_command_field (
+ command_id INT(10) UNSIGNED NOT NULL,
+ datafield_id INT(10) UNSIGNED NOT NULL,
+ is_required ENUM('y', 'n') NOT NULL,
+ PRIMARY KEY (command_id, datafield_id),
+ CONSTRAINT icinga_command_field_command
+ FOREIGN KEY command_id (command_id)
+ REFERENCES icinga_command (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT icinga_command_field_datafield
+ FOREIGN KEY datafield(datafield_id)
+ REFERENCES director_datafield (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
diff --git a/schema/mysql-legacy-changes/upgrade_42.sql b/schema/mysql-legacy-changes/upgrade_42.sql
new file mode 100644
index 0000000..849ffda
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_42.sql
@@ -0,0 +1,7 @@
+ALTER TABLE import_run DROP FOREIGN KEY import_run_source;
+ALTER TABLE import_run ADD CONSTRAINT import_run_source
+ FOREIGN KEY import_source (source_id)
+ REFERENCES import_source (id)
+ ON DELETE CASCADE
+ ON UPDATE RESTRICT;
+
diff --git a/schema/mysql-legacy-changes/upgrade_43.sql b/schema/mysql-legacy-changes/upgrade_43.sql
new file mode 100644
index 0000000..4e6a810
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_43.sql
@@ -0,0 +1,13 @@
+CREATE TABLE icinga_service_assignment (
+ id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ service_id INT(10) UNSIGNED NOT NULL,
+ filter_string TEXT NOT NULL,
+ PRIMARY KEY (id),
+ CONSTRAINT icinga_service_assignment
+ FOREIGN KEY service (service_id)
+ REFERENCES icinga_service (id)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+
diff --git a/schema/mysql-legacy-changes/upgrade_44.sql b/schema/mysql-legacy-changes/upgrade_44.sql
new file mode 100644
index 0000000..a874f67
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_44.sql
@@ -0,0 +1,2 @@
+ALTER TABLE imported_property MODIFY property_value MEDIUMTEXT NULL DEFAULT NULL;
+
diff --git a/schema/mysql-legacy-changes/upgrade_45.sql b/schema/mysql-legacy-changes/upgrade_45.sql
new file mode 100644
index 0000000..c819424
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_45.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_command_argument MODIFY argument_format ENUM('string','expression','json') NULL DEFAULT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_46.sql b/schema/mysql-legacy-changes/upgrade_46.sql
new file mode 100644
index 0000000..cc7c5fc
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_46.sql
@@ -0,0 +1,2 @@
+ALTER TABLE icinga_command_argument MODIFY argument_name VARCHAR(64) COLLATE utf8_bin DEFAULT NULL COMMENT '-x, --host';
+
diff --git a/schema/mysql-legacy-changes/upgrade_47.sql b/schema/mysql-legacy-changes/upgrade_47.sql
new file mode 100644
index 0000000..cdaedad
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_47.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_command_argument DROP INDEX sort_idx, ADD INDEX sort_idx (command_id, sort_order);
diff --git a/schema/mysql-legacy-changes/upgrade_48.sql b/schema/mysql-legacy-changes/upgrade_48.sql
new file mode 100644
index 0000000..de72ece
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_48.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_zone MODIFY object_type ENUM('object', 'template', 'external_object') NOT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_49.sql b/schema/mysql-legacy-changes/upgrade_49.sql
new file mode 100644
index 0000000..35a9dc9
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_49.sql
@@ -0,0 +1 @@
+ALTER TABLE director_deployment_log MODIFY stage_name VARCHAR(96) DEFAULT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_5.sql b/schema/mysql-legacy-changes/upgrade_5.sql
new file mode 100644
index 0000000..4c17ce3
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_5.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_usergroup ADD COLUMN object_type ENUM('object', 'template') NOT NULL AFTER zone_id; \ No newline at end of file
diff --git a/schema/mysql-legacy-changes/upgrade_50.sql b/schema/mysql-legacy-changes/upgrade_50.sql
new file mode 100644
index 0000000..6d6a7a3
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_50.sql
@@ -0,0 +1 @@
+ALTER TABLE director_deployment_log MODIFY startup_log MEDIUMTEXT DEFAULT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_51.sql b/schema/mysql-legacy-changes/upgrade_51.sql
new file mode 100644
index 0000000..13df6d5
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_51.sql
@@ -0,0 +1,2 @@
+ALTER TABLE sync_rule MODIFY object_type enum('host', 'host_template', 'service', 'service_template', 'command', 'command_template', 'user', 'user_template', 'hostgroup', 'servicegroup', 'usergroup', 'datalistEntry', 'endpoint', 'zone') NOT NULL;
+
diff --git a/schema/mysql-legacy-changes/upgrade_52.sql b/schema/mysql-legacy-changes/upgrade_52.sql
new file mode 100644
index 0000000..fad0d56
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_52.sql
@@ -0,0 +1,5 @@
+ALTER TABLE icinga_endpoint
+ MODIFY object_type ENUM('object', 'template', 'external_object') NOT NULL,
+ ADD COLUMN host VARCHAR(255) DEFAULT NULL COMMENT 'IP address / hostname of remote node' AFTER object_name,
+ DROP column address;
+
diff --git a/schema/mysql-legacy-changes/upgrade_53.sql b/schema/mysql-legacy-changes/upgrade_53.sql
new file mode 100644
index 0000000..d6a54cb
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_53.sql
@@ -0,0 +1,9 @@
+ALTER TABLE icinga_service
+ ADD COLUMN host_id INT(10) UNSIGNED DEFAULT NULL AFTER display_name,
+ ADD UNIQUE KEY object_key (object_name, host_id),
+ ADD CONSTRAINT icinga_host
+ FOREIGN KEY host (host_id)
+ REFERENCES icinga_host (id)
+ ON DELETE SET NULL
+ ON UPDATE CASCADE;
+
diff --git a/schema/mysql-legacy-changes/upgrade_54.sql b/schema/mysql-legacy-changes/upgrade_54.sql
new file mode 100644
index 0000000..1b65963
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_54.sql
@@ -0,0 +1,2 @@
+ALTER TABLE director_generated_config_file MODIFY file_path VARCHAR(128) NOT NULL COMMENT 'e.g. zones/nafta/hosts.conf';
+
diff --git a/schema/mysql-legacy-changes/upgrade_55.sql b/schema/mysql-legacy-changes/upgrade_55.sql
new file mode 100644
index 0000000..4ad6feb
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_55.sql
@@ -0,0 +1,8 @@
+ALTER TABLE icinga_zone
+ DROP FOREIGN KEY icinga_zone_parent_zone,
+ CHANGE parent_zone_id parent_id INT(10) UNSIGNED DEFAULT NULL,
+ ADD CONSTRAINT icinga_zone_parent
+ FOREIGN KEY parent_zone (parent_id)
+ REFERENCES icinga_zone (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE;
diff --git a/schema/mysql-legacy-changes/upgrade_56.sql b/schema/mysql-legacy-changes/upgrade_56.sql
new file mode 100644
index 0000000..75683de
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_56.sql
@@ -0,0 +1,13 @@
+ALTER TABLE director_generated_file
+ ADD COLUMN cnt_object INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ ADD COLUMN cnt_template INT(10) UNSIGNED NOT NULL DEFAULT 0;
+
+UPDATE director_generated_file
+SET cnt_object = ROUND(
+ (LENGTH(content) - LENGTH( REPLACE(content, 'object ', '') ) )
+ / LENGTH('object ')
+), cnt_template = ROUND(
+ (LENGTH(content) - LENGTH( REPLACE(content, 'template ', '') ) )
+ / LENGTH('template ')
+);
+
diff --git a/schema/mysql-legacy-changes/upgrade_57.sql b/schema/mysql-legacy-changes/upgrade_57.sql
new file mode 100644
index 0000000..3b2f756
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_57.sql
@@ -0,0 +1,20 @@
+
+CREATE TABLE icinga_apiuser (
+ id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
+ object_name VARCHAR(255) NOT NULL,
+ object_type ENUM('object', 'template', 'external_object') NOT NULL,
+ password VARCHAR(255) DEFAULT NULL,
+ client_dn VARCHAR(64) DEFAULT NULL,
+ permissions TEXT DEFAULT NULL COMMENT 'JSON-encoded permissions',
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ALTER TABLE icinga_endpoint
+ ADD COLUMN apiuser_id INT(10) UNSIGNED DEFAULT NULL,
+ ADD CONSTRAINT icinga_apiuser
+ FOREIGN KEY apiuser (apiuser_id)
+ REFERENCES icinga_apiuser (id)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE;
+
+
diff --git a/schema/mysql-legacy-changes/upgrade_58.sql b/schema/mysql-legacy-changes/upgrade_58.sql
new file mode 100644
index 0000000..5771f6a
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_58.sql
@@ -0,0 +1,5 @@
+ALTER TABLE icinga_host
+ ADD COLUMN has_agent ENUM('y', 'n') DEFAULT NULL,
+ ADD COLUMN master_should_connect ENUM('y', 'n') DEFAULT NULL,
+ ADD COLUMN accept_config ENUM('y', 'n') DEFAULT NULL;
+
diff --git a/schema/mysql-legacy-changes/upgrade_59.sql b/schema/mysql-legacy-changes/upgrade_59.sql
new file mode 100644
index 0000000..8c760e2
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_59.sql
@@ -0,0 +1,3 @@
+ALTER TABLE icinga_service
+ ADD COLUMN use_agent ENUM('y', 'n') NOT NULL DEFAULT 'n';
+
diff --git a/schema/mysql-legacy-changes/upgrade_6.sql b/schema/mysql-legacy-changes/upgrade_6.sql
new file mode 100644
index 0000000..0834b10
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_6.sql
@@ -0,0 +1,5 @@
+ALTER TABLE icinga_endpoint
+ MODIFY zone_id INT(10) UNSIGNED DEFAULT NULL,
+ MODIFY port SMALLINT UNSIGNED DEFAULT NULL COMMENT '5665 if not set',
+ MODIFY log_duration VARCHAR(32) DEFAULT NULL COMMENT '1d if not set';
+
diff --git a/schema/mysql-legacy-changes/upgrade_60.sql b/schema/mysql-legacy-changes/upgrade_60.sql
new file mode 100644
index 0000000..5b0da8f
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_60.sql
@@ -0,0 +1,2 @@
+ALTER TABLE icinga_service MODIFY COLUMN use_agent ENUM('y', 'n') DEFAULT NULL;
+
diff --git a/schema/mysql-legacy-changes/upgrade_61.sql b/schema/mysql-legacy-changes/upgrade_61.sql
new file mode 100644
index 0000000..50d62fd
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_61.sql
@@ -0,0 +1,2 @@
+ALTER TABLE icinga_host DROP KEY object_name, ADD UNIQUE KEY object_name (object_name);
+
diff --git a/schema/mysql-legacy-changes/upgrade_62.sql b/schema/mysql-legacy-changes/upgrade_62.sql
new file mode 100644
index 0000000..a3aba5f
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_62.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_command MODIFY command TEXT DEFAULT NULL;
diff --git a/schema/mysql-legacy-changes/upgrade_7.sql b/schema/mysql-legacy-changes/upgrade_7.sql
new file mode 100644
index 0000000..38780b2
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_7.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_service DROP INDEX object_name; \ No newline at end of file
diff --git a/schema/mysql-legacy-changes/upgrade_8.sql b/schema/mysql-legacy-changes/upgrade_8.sql
new file mode 100644
index 0000000..a1c9d46
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_8.sql
@@ -0,0 +1,36 @@
+DROP TABLE director_generated_config_file;
+
+DROP TABLE director_generated_config;
+
+CREATE TABLE director_generated_config (
+ checksum VARBINARY(20) NOT NULL COMMENT 'SHA1(last_activity_checksum;file_path=checksum;file_path=checksum;...)',
+ director_version VARCHAR(64) DEFAULT NULL,
+ director_db_version INT(10) DEFAULT NULL,
+ duration INT(10) UNSIGNED DEFAULT NULL COMMENT 'Config generation duration (ms)',
+ last_activity_checksum VARBINARY(20) NOT NULL,
+ PRIMARY KEY (checksum),
+ CONSTRAINT director_generated_config_activity
+ FOREIGN KEY activity_checksum (last_activity_checksum)
+ REFERENCES director_activity_log (checksum)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE director_generated_config_file (
+ config_checksum VARBINARY(20) NOT NULL,
+ file_checksum VARBINARY(20) NOT NULL,
+ file_path VARCHAR(64) NOT NULL COMMENT 'e.g. zones/nafta/hosts.conf',
+ CONSTRAINT director_generated_config_file_config
+ FOREIGN KEY config (config_checksum)
+ REFERENCES director_generated_config (checksum)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT director_generated_config_file_file
+ FOREIGN KEY checksum (file_checksum)
+ REFERENCES director_generated_file (checksum)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT,
+ PRIMARY KEY (config_checksum, file_path),
+ INDEX search_idx (file_checksum)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
diff --git a/schema/mysql-legacy-changes/upgrade_9.sql b/schema/mysql-legacy-changes/upgrade_9.sql
new file mode 100644
index 0000000..4a7b93a
--- /dev/null
+++ b/schema/mysql-legacy-changes/upgrade_9.sql
@@ -0,0 +1 @@
+ALTER TABLE icinga_command MODIFY timeout SMALLINT UNSIGNED DEFAULT NULL; \ No newline at end of file