]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#90] Deleting shared network doesn't delete subnet anymore
authorTomek Mrugalski <tomek@isc.org>
Wed, 9 Jun 2021 08:47:38 +0000 (10:47 +0200)
committerTomek Mrugalski <tomek@isc.org>
Thu, 28 Oct 2021 10:31:41 +0000 (12:31 +0200)
src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in

index e2449cfd8fb6c651b756bc04475a8396cd1ed366..0b26cb4e92db6a2da3314c3e3a013522356bc07e 100644 (file)
@@ -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