From: Marcin Siodelski Date: Mon, 4 Mar 2019 12:05:19 +0000 (+0100) Subject: [#489,!250] Drop constraints on dhcp6_[pd]_pool prior to rename. X-Git-Tag: 430-configure-location-of-datadir_base~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01fc4d5bb4105b90c7025e8ca8131c3c15203848;p=thirdparty%2Fkea.git [#489,!250] Drop constraints on dhcp6_[pd]_pool prior to rename. --- diff --git a/src/share/database/scripts/mysql/dhcpdb_create.mysql b/src/share/database/scripts/mysql/dhcpdb_create.mysql index b88dee9579..475bdb6d15 100644 --- a/src/share/database/scripts/mysql/dhcpdb_create.mysql +++ b/src/share/database/scripts/mysql/dhcpdb_create.mysql @@ -1848,12 +1848,34 @@ ALTER TABLE dhcp6_global_parameter -- Rename dhcp6_subnet_id column of dhcp6_pool and dhcp6_pd_pool +ALTER TABLE dhcp6_pool + DROP FOREIGN KEY fk_dhcp6_pool_subnet_id; +DROP INDEX fk_dhcp6_pool_subnet_id + ON dhcp6_pool; + +ALTER TABLE dhcp6_pd_pool + DROP FOREIGN KEY fk_dhcp6_pd_pool_subnet_id; +DROP INDEX fk_dhcp6_pd_pool_subnet_id + ON dhcp6_pd_pool; + ALTER TABLE dhcp6_pool CHANGE dhcp6_subnet_id subnet_id INT(10) UNSIGNED NOT NULL; ALTER TABLE dhcp6_pd_pool CHANGE dhcp6_subnet_id subnet_id INT(10) UNSIGNED NOT NULL; +ALTER TABLE dhcp6_pool + ADD CONSTRAINT fk_dhcp6_pool_subnet_id + FOREIGN KEY (subnet_id) + REFERENCES dhcp6_subnet (subnet_id) + ON DELETE CASCADE ON UPDATE NO ACTION; + +ALTER TABLE dhcp6_pd_pool + ADD CONSTRAINT fk_dhcp6_pd_pool_subnet_id + FOREIGN KEY (subnet_id) + REFERENCES dhcp6_subnet (subnet_id) + ON DELETE CASCADE ON UPDATE NO ACTION; + -- align dhcp6_shared_network_server indexes on dhcp4_shared_network_server ALTER TABLE dhcp6_shared_network_server diff --git a/src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh.in b/src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh.in index 3be2a7bad0..e7038380a4 100644 --- a/src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh.in +++ b/src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh.in @@ -530,12 +530,34 @@ ALTER TABLE dhcp6_global_parameter -- Rename dhcp6_subnet_id column of dhcp6_pool and dhcp6_pd_pool +ALTER TABLE dhcp6_pool + DROP FOREIGN KEY fk_dhcp6_pool_subnet_id; +DROP INDEX fk_dhcp6_pool_subnet_id + ON dhcp6_pool; + +ALTER TABLE dhcp6_pd_pool + DROP FOREIGN KEY fk_dhcp6_pd_pool_subnet_id; +DROP INDEX fk_dhcp6_pd_pool_subnet_id + ON dhcp6_pd_pool; + ALTER TABLE dhcp6_pool CHANGE dhcp6_subnet_id subnet_id INT(10) UNSIGNED NOT NULL; ALTER TABLE dhcp6_pd_pool CHANGE dhcp6_subnet_id subnet_id INT(10) UNSIGNED NOT NULL; +ALTER TABLE dhcp6_pool + ADD CONSTRAINT fk_dhcp6_pool_subnet_id + FOREIGN KEY (subnet_id) + REFERENCES dhcp6_subnet (subnet_id) + ON DELETE CASCADE ON UPDATE NO ACTION; + +ALTER TABLE dhcp6_pd_pool + ADD CONSTRAINT fk_dhcp6_pd_pool_subnet_id + FOREIGN KEY (subnet_id) + REFERENCES dhcp6_subnet (subnet_id) + ON DELETE CASCADE ON UPDATE NO ACTION; + -- align dhcp6_shared_network_server indexes on dhcp4_shared_network_server ALTER TABLE dhcp6_shared_network_server