Deletion of managed dashboard entities causes DB constraint violations at managed entity / cache rebuild.
After deleting a dashboard (which can be done accidentally), attempting an operation that causes the managed entities to be evaluated causes a DB constraint error.
Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. API error: DB Constraint Violation - domain_id should possibly be marked as mandatory for Dashboard,create API. If so, please raise a bug report.
- Install an extension that created managed dashboard entities, such as Civisualize
- Go to the CiviCRM dashboard as an admin, and select "Configure my Dashboard"
- Delete any of the managed dashboards, so that they are no longer available for selection, and press Done
- Attempt an operation that triggers the managed entities to be checked, e.g. installing another extension (I think this actually happens every cache rebuild, so
cv flushon the command line should be sufficient).
A fatal error is thrown by the database, due to a foreign key constraint violation:
nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`izjlsytg_civicrm`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_dashboard_id` FOREIGN KEY (`dashboard_id`) REFERENCES `civicrm_dashboard` (`id`) ON DELETE CASCADE)
Entities are re-evaluated without issue and operation succeeds.
Agileware ref CIVICRM-1394