From e2a7d967e08cec98e69289b315e8c6fc76d7e7af Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Wed, 9 Jun 2021 10:47:38 +0200 Subject: [PATCH] [#90] Deleting shared network doesn't delete subnet anymore --- .../scripts/pgsql/upgrade_6.2_to_7.0.sh.in | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in b/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in index e2449cfd8f..0b26cb4e92 100644 --- a/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in @@ -206,8 +206,10 @@ CREATE TABLE dhcp6_subnet ( reservations_out_of_pool BOOLEAN DEFAULT NULL, cache_threshold float DEFAULT NULL, cache_max_age BIGINT DEFAULT NULL, - CONSTRAINT fk_dhcp6_subnet_shared_network FOREIGN KEY (shared_network_name) REFERENCES dhcp6_shared_network (name), - CONSTRAINT fk_ddns_replace_client_name FOREIGN KEY (ddns_replace_client_name) REFERENCES ddns_replace_client_name_types (type) + CONSTRAINT fk_dhcp6_subnet_shared_network FOREIGN KEY (shared_network_name) + REFERENCES dhcp6_shared_network (name) ON DELETE SET NULL ON UPDATE NO ACTION, + CONSTRAINT fk_ddns_replace_client_name FOREIGN KEY (ddns_replace_client_name) + REFERENCES ddns_replace_client_name_types (type) ); CREATE TRIGGER dhcp6_subnet_modification_ts_update @@ -217,12 +219,6 @@ CREATE TRIGGER dhcp6_subnet_modification_ts_update CREATE INDEX dhcp6_subnet_idx1 ON dhcp6_subnet (modification_ts); CREATE INDEX dhcp6_subnet_idx2 ON dhcp6_subnet (shared_network_name); --- TODO: on delete set up dhcp6_subnet_shared_network to NULL --- the MySQL equivalent is: CONSTRAINT `fk_dhcp6_subnet_shared_network` FOREIGN KEY (`shared_network_name`) REFERENCES --- `dhcp6_shared_network` (`name`) ON DELETE SET NULL ON UPDATE NO ACTION - - - -- Create a table that holds all address pools in IPv6. @@ -545,8 +541,10 @@ CREATE TABLE dhcp4_subnet ( reservations_out_of_pool BOOLEAN DEFAULT NULL, cache_threshold float DEFAULT NULL, cache_max_age BIGINT DEFAULT NULL, - CONSTRAINT fk_dhcp4_subnet_shared_network FOREIGN KEY (shared_network_name) REFERENCES dhcp4_shared_network (name), - CONSTRAINT fk_ddns_replace_client_name FOREIGN KEY (ddns_replace_client_name) REFERENCES ddns_replace_client_name_types (type) + CONSTRAINT fk_dhcp4_subnet_shared_network FOREIGN KEY (shared_network_name) + REFERENCES dhcp4_shared_network (name) ON DELETE SET NULL ON UPDATE NO ACTION, + CONSTRAINT fk_ddns_replace_client_name FOREIGN KEY (ddns_replace_client_name) + REFERENCES ddns_replace_client_name_types (type) ); CREATE TRIGGER dhcp4_subnet_modification_ts_update