summaryrefslogtreecommitdiffstats
path: root/src/share/database/scripts
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2023-07-06 23:04:23 +0200
committerFrancis Dupont <fdupont@isc.org>2023-07-06 23:04:23 +0200
commit47693d30ea2774225d461679310fd4a33686abf1 (patch)
treecd5267cb2f542a0eac5bce7f4f328b22258aae19 /src/share/database/scripts
parent[#2869] Checkpoint add delete cascade (diff)
downloadkea-47693d30ea2774225d461679310fd4a33686abf1.tar.xz
kea-47693d30ea2774225d461679310fd4a33686abf1.zip
[#2869] Finished delete cascade
Diffstat (limited to 'src/share/database/scripts')
-rw-r--r--src/share/database/scripts/mysql/dhcpdb_create.mysql12
-rw-r--r--src/share/database/scripts/mysql/upgrade_019_to_020.sh.in12
2 files changed, 24 insertions, 0 deletions
diff --git a/src/share/database/scripts/mysql/dhcpdb_create.mysql b/src/share/database/scripts/mysql/dhcpdb_create.mysql
index 0e78580510..62a1b07a53 100644
--- a/src/share/database/scripts/mysql/dhcpdb_create.mysql
+++ b/src/share/database/scripts/mysql/dhcpdb_create.mysql
@@ -5832,6 +5832,18 @@ UPDATE dhcp6_global_parameter
SET name = 'ddns-conflict-resolution-mode', value = 'no-check-with-dhcid', parameter_type = 4
WHERE name = 'ddns-use-conflict-resolution' and value = 'false';
+-- Add a constraint on lease6_relay_id that any lease_addr must map to
+-- a lease6 address.
+ALTER TABLE lease6_relay_id
+ ADD CONSTRAINT fk_lease6_relay_id_addr FOREIGN KEY (lease_addr)
+ REFERENCES lease6 (address) ON DELETE CASCADE ON UPDATE NO ACTION;
+
+-- Add a constraint on lease6_remote_id that any lease_addr must map to
+-- a lease6 address.
+ALTER TABLE lease6_remote_id
+ ADD CONSTRAINT fk_lease6_remote_id_addr FOREIGN KEY (lease_addr)
+ REFERENCES lease6 (address) ON DELETE CASCADE ON UPDATE NO ACTION;
+
-- Update the schema version number.
UPDATE schema_version
SET version = '20', minor = '0';
diff --git a/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in b/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in
index 8d15c44a60..98546be209 100644
--- a/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in
+++ b/src/share/database/scripts/mysql/upgrade_019_to_020.sh.in
@@ -73,6 +73,18 @@ UPDATE dhcp6_global_parameter
SET name = 'ddns-conflict-resolution-mode', value = 'no-check-with-dhcid', parameter_type = 4
WHERE name = 'ddns-use-conflict-resolution' and value = 'false';
+-- Add a constraint on lease6_relay_id that any lease_addr must map to
+-- a lease6 address.
+ALTER TABLE lease6_relay_id
+ ADD CONSTRAINT fk_lease6_relay_id_addr FOREIGN KEY (lease_addr)
+ REFERENCES lease6 (address) ON DELETE CASCADE ON UPDATE NO ACTION;
+
+-- Add a constraint on lease6_remote_id that any lease_addr must map to
+-- a lease6 address.
+ALTER TABLE lease6_remote_id
+ ADD CONSTRAINT fk_lease6_remote_id_addr FOREIGN KEY (lease_addr)
+ REFERENCES lease6 (address) ON DELETE CASCADE ON UPDATE NO ACTION;
+
-- Update the schema version number.
UPDATE schema_version
SET version = '20', minor = '0';