From 16a370fed2778b7e2c4dc8d484e174f7438af43e Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Wed, 20 Nov 2024 17:20:48 +0100 Subject: [PATCH] schema/mysql: add environment_id, remove duplicates https://github.com/Icinga/icingadb/pull/795#pullrequestreview-2449103721 --- schema/mysql/upgrades/dependencies.sql | 6 ++++++ schema/mysql/upgrades/dependencies2.sql | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) delete mode 100644 schema/mysql/upgrades/dependencies2.sql diff --git a/schema/mysql/upgrades/dependencies.sql b/schema/mysql/upgrades/dependencies.sql index bbfb38c0c..a4fecf526 100644 --- a/schema/mysql/upgrades/dependencies.sql +++ b/schema/mysql/upgrades/dependencies.sql @@ -1,10 +1,12 @@ CREATE TABLE `dependency` ( `id` binary(20) NOT NULL, + `environment_id` binary(20) NOT NULL, `name` text NOT NULL, `display_name` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; +-- TODO CREATE TABLE `dependency_state` ( `id` binary(20) NOT NULL, `dependency_id` binary(20) NOT NULL, @@ -16,11 +18,13 @@ CREATE TABLE `dependency_state` ( CREATE TABLE `redundancy_group` ( `id` binary(20) NOT NULL, + `environment_id` binary(20) NOT NULL, `name` text NOT NULL, `display_name` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; +-- TODO CREATE TABLE `redundancy_group_state` ( `id` binary(20) NOT NULL, `redundancy_group_id` binary(20) NOT NULL, @@ -33,6 +37,7 @@ CREATE TABLE `redundancy_group_state` ( CREATE TABLE `dependency_node` ( `id` binary(20) NOT NULL, + `environment_id` binary(20) NOT NULL, `host_id` binary(20) DEFAULT NULL, `service_id` binary(20) DEFAULT NULL, `redundancy_group_id` binary(20) DEFAULT NULL, @@ -46,6 +51,7 @@ CREATE TABLE `dependency_node` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; CREATE TABLE `dependency_edge` ( + `environment_id` binary(20) NOT NULL, `to_node_id` binary(20) NOT NULL, `from_node_id` binary(20) NOT NULL, `dependency_id` binary(20) DEFAULT NULL, diff --git a/schema/mysql/upgrades/dependencies2.sql b/schema/mysql/upgrades/dependencies2.sql deleted file mode 100644 index 364a137bd..000000000 --- a/schema/mysql/upgrades/dependencies2.sql +++ /dev/null @@ -1,2 +0,0 @@ -alter table redundancy_group_state - add last_state_change bigint unsigned not null;