Add SQL migration file

This commit is contained in:
raviks789 2025-06-04 12:41:11 +02:00
parent 3e4e00c8af
commit 0f123a2291
No known key found for this signature in database

View File

@ -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());