@@ -651,24 +651,51 @@ CREATE TABLE icinga_host_field (
651651 ON UPDATE CASCADE
652652) ENGINE= InnoDB DEFAULT CHARSET= utf8;
653653
654+ CREATE TABLE director_property (
655+ uuid binary(16 ) NOT NULL ,
656+ parent_uuid binary(16 ) NULL DEFAULT NULL ,
657+ key_name varchar (255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
658+ label varchar (255 ) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL ,
659+ description text DEFAULT NULL ,
660+ value_type enum(' string' , ' number' , ' bool' , ' fixed-array' , ' dynamic-array' , ' fixed-dictionary' , ' dynamic-dictionary' ) COLLATE utf8mb4_unicode_ci NOT NULL ,
661+ PRIMARY KEY (uuid)
662+ ) ENGINE= InnoDB DEFAULT CHARSET= utf8;
663+
664+ CREATE TABLE icinga_host_property (
665+ host_uuid binary(16 ) NOT NULL ,
666+ property_uuid binary(16 ) NOT NULL ,
667+ required enum(' y' , ' n' ) NOT NULL DEFAULT ' n' ,
668+ PRIMARY KEY (host_uuid, property_uuid),
669+ CONSTRAINT icinga_host_property_host
670+ FOREIGN KEY host(host_uuid)
671+ REFERENCES icinga_host (uuid)
672+ ON DELETE CASCADE
673+ ON UPDATE CASCADE,
674+ CONSTRAINT icinga_host_custom_property
675+ FOREIGN KEY property(property_uuid)
676+ REFERENCES director_property (uuid)
677+ ON DELETE CASCADE
678+ ON UPDATE CASCADE
679+ ) ENGINE= InnoDB DEFAULT CHARSET= utf8;
680+
654681CREATE TABLE icinga_host_var (
655682 host_id INT (10 ) UNSIGNED NOT NULL ,
656683 varname VARCHAR (255 ) NOT NULL COLLATE utf8_bin,
657684 varvalue TEXT DEFAULT NULL ,
658685 format enum (' string' , ' json' , ' expression' ), -- immer string vorerst
659686 checksum VARBINARY(20 ) DEFAULT NULL ,
660- property_uuid VARBINARY (16 ) DEFAULT NULL ,
687+ property_uuid BINARY (16 ) DEFAULT NULL ,
661688 PRIMARY KEY (host_id, varname),
662689 INDEX search_idx (varname),
663690 INDEX checksum (checksum),
664691 CONSTRAINT icinga_host_var_host
665- FOREIGN KEY host (host_id)
666- REFERENCES icinga_host (id)
667- ON DELETE CASCADE
668- ON UPDATE CASCADE
669- CONSTRAINT icinga_host_var_property_uuid
670- FOREIGN KEY property_uuid (property_uuid)
671- REFERENCES director_property_uuid (uuid)x0
692+ FOREIGN KEY host (host_id)
693+ REFERENCES icinga_host (id)
694+ ON DELETE CASCADE
695+ ON UPDATE CASCADE,
696+ CONSTRAINT icinga_host_var_property_uuid
697+ FOREIGN KEY property (property_uuid)
698+ REFERENCES director_property (uuid)
672699) ENGINE= InnoDB DEFAULT CHARSET= utf8;
673700
674701ALTER TABLE icinga_host_template_choice
@@ -2448,33 +2475,6 @@ CREATE TABLE branched_icinga_dependency (
24482475 ON UPDATE CASCADE
24492476) ENGINE= InnoDB DEFAULT CHARSET= utf8;
24502477
2451- CREATE TABLE director_property (
2452- uuid binary(16 ) NOT NULL ,
2453- parent_uuid binary(16 ) NULL DEFAULT NULL ,
2454- key_name varchar (255 ) COLLATE utf8mb4_unicode_ci NOT NULL ,
2455- label varchar (255 ) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL ,
2456- description text DEFAULT NULL ,
2457- value_type enum(' string' , ' number' , ' bool' , ' fixed-array' , ' dynamic-array' , ' fixed-dictionary' , ' dynamic-dictionary' ) COLLATE utf8mb4_unicode_ci NOT NULL
2458- PRIMARY KEY (uuid)
2459- ) ENGINE= InnoDB DEFAULT CHARSET= utf8mb4 COLLATE= utf8mb4_bin;
2460-
2461- CREATE TABLE icinga_host_property (
2462- host_uuid binary(16 ) NOT NULL ,
2463- property_uuid binary(16 ) NOT NULL ,
2464- required enum(' y' , ' n' ) NOT NULL DEFAULT ' n' ,
2465- PRIMARY KEY (host_uuid, property_uuid),
2466- CONSTRAINT icinga_host_property_host
2467- FOREIGN KEY host(host_uuid)
2468- REFERENCES icinga_host (uuid)
2469- ON DELETE CASCADE
2470- ON UPDATE CASCADE,
2471- CONSTRAINT icinga_host_custom_property
2472- FOREIGN KEY property(property_uuid)
2473- REFERENCES director_property (uuid)
2474- ON DELETE CASCADE
2475- ON UPDATE CASCADE
2476- ) ENGINE= InnoDB DEFAULT CHARSET= utf8mb4 COLLATE= utf8mb4_bin;
2477-
24782478INSERT INTO director_schema_migration
24792479 (schema_version, migration_time)
2480- VALUES (190 , NOW());
2480+ VALUES (191 , NOW());
0 commit comments