When upgrading to 7.x-1.2 I get the following error during updb:
SQLSTATE: Integrity constraint violation: 1048 Column 'engagement_score' cannot be null
Performed update: redhen_engagement_update_7101
The problem lies in the UPDATE statement:
UPDATE redhen_contact rc SET engagement_score = (SELECT SUM(score) FROM redhen_engagement re JOIN redhen_engagement_score res on re.engagement_score = res.name WHERE re.contact_id = rc.contact_id)
The inner select return NULL if there is no engagements logged for a contact. Locally I've solved this by adding an COALESCE(…, 0) around the inner select.
The statement takes a long time for larger databases (perhaps due to the inner select). Maybe it's better to use a JOIN and avoid NULL values altogether.