Skip to content

Error when deleting row in Inventory Management demo app

When deleting a product in Inventory app. You can receive an error similar to the following:

Cannot delete or update a parent row: a foreign key constraint fails (`inventorymanager`, `purchases`, CONSTRAINT `purchase_product_fk` FOREIGN KEY (`ProductId`) REFERENCES `products` (`id`))

This is not a phpGrid error. It is due to the foreign constrain in table product. Basically, one cannot delete a product that still has outstanding purchase. Otherwise, this leaves orphan records, not ideal.  

You can remove the constrain from database, however, it is highly not recommended.


Feedback and Knowledge Base