Answers.Body: <p>Based on chat discussion there was a missing database field for unknown reasons. Running this helped:</p>
  
  <p><code>ALTER TABLE civicrm_membership ADD COLUMN status_override_end_date date DEFAULT NULL COMMENT 'Then end date of membership status override if ''Override until selected date'' override type is selected.';</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-06T20:57:36.070Z
Answers.LastActivityDate: 2020-01-06T20:57:36.070Z
Answers.UserDisplayName: Demerit
Body: <p>I recently moved to a new webhost with Drupal 7 and upgraded to CiviCRM 5.21.0. Everything seems to be working fine, I have no errors in the Administration Console. However, when I go to cases, and I reassign a case role, I get an error:</p>
  
  <p>"DB Constraint Violation - membership_contact_id should possibly be marked as mandatory for Membership,get API. If so, please raise a bug report."</p>
  
  <p>I don't even have CiviMember or CiviCampaign enabled. I ran the upgrade script again, no issues. I disabled and re-enabled CiviCase again. Clear cache, deleted everything in template_c. I don't know what else to try. Any ideas? </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-06T13:48:46.287Z
Comments.Text: What extensions do you have installed?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-06T19:09:59.527Z
Comments.Text: Summary Fields, Related Permissions Module, CiviRules
Comments.UserDisplayName: Kristine
Tags: <drupal><civicase>
Title: Reassigning Case Role Gives DB Constraint on Membership
ThreadText: # Reassigning Case Role Gives DB Constraint on Membership
  
  (Asked by: username_0 on 2020-01-06)
  
  I recently moved to a new webhost with Drupal 7 and upgraded to CiviCRM 5.21.0. Everything seems to be working fine, I have no errors in the Administration Console. However, when I go to cases, and I reassign a case role, I get an error:
  
  "DB Constraint Violation - membership\_contact\_id should possibly be marked as mandatory for Membership,get API. If so, please raise a bug report."
  
  I don't even have CiviMember or CiviCampaign enabled. I ran the upgrade script again, no issues. I disabled and re-enabled CiviCase again. Clear cache, deleted everything in template\_c. I don't know what else to try. Any ideas?
  
  **Tags:** drupal, civicase
  
  > **Comments:**
  > **username_1**: What extensions do you have installed?  
  > **username_0**: Summary Fields, Related Permissions Module, CiviRules  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-01-06. Score: 2 | Accepted answer
  
  Based on chat discussion there was a missing database field for unknown reasons. Running this helped:
  
  `ALTER TABLE civicrm_membership ADD COLUMN status_override_end_date date DEFAULT NULL COMMENT 'Then end date of membership status override if ''Override until selected date'' override type is selected.';`
  
  
  ---
  
  