From 0f123a229109b069f79c104a827c29aab59bc44e Mon Sep 17 00:00:00 2001 From: raviks789 Date: Wed, 4 Jun 2025 12:41:11 +0200 Subject: [PATCH] Add SQL migration file --- schema/mysql-migrations/upgrade_190.sql | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 schema/mysql-migrations/upgrade_190.sql diff --git a/schema/mysql-migrations/upgrade_190.sql b/schema/mysql-migrations/upgrade_190.sql new file mode 100644 index 00000000..646c064e --- /dev/null +++ b/schema/mysql-migrations/upgrade_190.sql @@ -0,0 +1,30 @@ +CREATE TABLE director_property ( + uuid binary(16) NOT NULL, + parent_uuid binary(16) NULL DEFAULT NULL, + key_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + label varchar(255) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + value_type enum('string', 'number', 'bool', 'array', 'dict') COLLATE utf8mb4_unicode_ci NOT NULL, + instantiable enum('y', 'n') NOT NULL DEFAULT 'n', + PRIMARY KEY (uuid) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +CREATE TABLE icinga_host_property ( + host_uuid binary(16) NOT NULL, + property_uuid binary(16) NOT NULL, + required enum('y', 'n') NOT NULL DEFAULT 'n', + PRIMARY KEY (host_uuid, property_uuid), + CONSTRAINT icinga_host_property_host + FOREIGN KEY host(host_uuid) + REFERENCES icinga_host (uuid) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT icinga_host_custom_property + FOREIGN KEY property(property_uuid) + REFERENCES director_property (uuid) + ON DELETE CASCADE + ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +INSERT INTO director_schema_migration +(schema_version, migration_time) +VALUES (190, NOW());