foreign key constraint fail when upgrading mysql schema from 1.9.11 to 2.0.0
For clarity, this happens when upgrading from schema version 11 to schema version 12.
This happens when the dhcp4_options
table has entries with non-NULL values in the dhcp_client_class, but the dhcp4_client_class
table has no entry with such a value in the name
column.
Is reaching such a state possible only with CB commands?
The error message is:
Processing /opt/kea/share/kea/scripts/mysql/upgrade_011_to_012.sh file...
ERROR 1452 (23000) at line 16: Cannot add or update a child row: a foreign key constraint fails (`keatest`.`#sql-alter-1-2`, CONSTRAINT `fk_dhcp4_options_client_class` FOREIGN KEY (`dhcp_client_class`) REFERENCES `dhcp4_client_class` (`name`) ON DELETE CASCADE ON UPDATE )
Is turning the update statements from the upgrade script into the following a solution?
UPDATE dhcp4_options SET dhcp_client_class = NULL;
UPDATE dhcp6_options SET dhcp_client_class = NULL;
Reproduction steps: https://support.isc.org/Ticket/Display.html?id=19464#txn-720297