and more in a single search tool across platforms. Read the announcement here. |
02/07/2024 08:55 AM
We are trying to remove few duplicate inactive entitlements from Entitlement_values through db script.
But are failing with below error
ERROR 1451 (23000) at line 1 in file: 'datafix_stmt4_updated.sql': Cannot delete or update a parent row: a foreign key constraint fails (`saviyntdb`.`entitlement_values`, CONSTRAINT `FK469E7074BE8E85C9` FOREIGN KEY (`REFERENCED_ENTITLEMENT`) REFERENCES `entitlement_values` (`ENTITLEMENT_VALUEKEY`))
Note: we deleted unused 400 duplicate inactive entitlements with the same script (delete from entitlement_values where entitlement_valuekey in ('','','');) and entitlement_valuekey values are filtered making sure those entitlement_valuekey is not referenced in any of the below
account_entitlements1,role_entitlements,entitlementmap,arstasks,entitlement_values_history,certification_entitlement_value,certification_account_entitlement1_status
02/07/2024 07:24 PM
Deleting data from database in not best practise it can cause issue in future.
you can disable foreign key checks temporarily
-- Disable foreign key checks
SET FOREIGN_KEY_CHECKS = 0;
-- Perform your actions here
DELETE FROM parent_table WHERE id = 123;
-- Re-enable foreign key checks
SET FOREIGN_KEY_CHECKS = 1;