[3.0] Invalid foreign constraints lead to out-of-memory error
CiviRules 3.0 adds new foreign constraints to civirule_rule
on created_user_id
and modified_user_id
, but does not check to see if existing values are valid first. For some reason, rather than failing with a SQL error, running out of memory seems to happen (at least on my 4GB server).
For folks who are getting out-of-memory errors on upgrading to CiviRules 3.0, run this SQL:
select crr.* from civirule_rule crr LEFT JOIN civicrm_contact cc ON crr.created_user_id = cc.id WHERE cc.id IS NULL;
select crr.* from civirule_rule crr LEFT JOIN civicrm_contact cc ON crr.modified_user_id = cc.id WHERE cc.id IS NULL;
If either of those come up with any records, those records must be fixed before your upgrade will work.