Answers.Body: <p>This bug seems to occur on old (i.e. version 2.x) installations, due to an error in an old upgrade script that removed the location_id field from the civicrm_group_contact table.</p>
  
  <p>You can fix it using this sql:</p>
  
  <pre><code>ALTER TABLE civicrm_group_contact ADD COLUMN `location_id` int(10) unsigned DEFAULT NULL COMMENT 'Optional location to associate with this membership'
  </code></pre>
  
  <p>Credit for the solution goes to Eileen, via this commit:</p>
  
  <p><a href="https://github.com/wikimedia/wikimedia-fundraising-crm/commit/e5b853cd55ebf83b68a783a86bf3274dcf20dfb9" rel="nofollow noreferrer">https://github.com/wikimedia/wikimedia-fundraising-crm/commit/e5b853cd55ebf83b68a783a86bf3274dcf20dfb9</a></p>
  
  <p>Credit for the original issue linked in the question above goes to Lizz Trudeau.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-03T15:13:58.813Z
Answers.LastActivityDate: 2018-07-03T15:13:58.813Z
Answers.UserDisplayName: Alan Dixon
Body: <p>[copied from <a href="https://issues.civicrm.org/jira/browse/CRM-20711" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-20711</a>
  noted on CiviCRM version 4.7.27]</p>
  
  <p>In the Contact record, when I try to remove or delete a contact from a group they've already been added to, I receive this error:</p>
  
  <p>DB Constraint Violation - group_id should possibly be marked as mandatory for GroupContact,get API. If so, please raise a bug report.</p>
  
  <p>I am able to remove a contact from a group when in the Group's list of contacts view, so this isn't critical. Posting in case it happens for others.</p>
  
Tags: <upgrade><database><groups>
Title: When removing a group from a contact I get: Error - DB Constraint Violation - GroupContact, get API
ThreadText: # When removing a group from a contact I get: Error - DB Constraint Violation - GroupContact, get API
  
  (Asked by: username_0 on 2018-07-03)
  
  [copied from <https://issues.civicrm.org/jira/browse/CRM-20711>
  noted on CiviCRM version 4.7.27]
  
  In the Contact record, when I try to remove or delete a contact from a group they've already been added to, I receive this error:
  
  DB Constraint Violation - group\_id should possibly be marked as mandatory for GroupContact,get API. If so, please raise a bug report.
  
  I am able to remove a contact from a group when in the Group's list of contacts view, so this isn't critical. Posting in case it happens for others.
  
  **Tags:** upgrade, database, groups
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-07-03. Score: 1
  
  This bug seems to occur on old (i.e. version 2.x) installations, due to an error in an old upgrade script that removed the location\_id field from the civicrm\_group\_contact table.
  
  You can fix it using this sql:
  
  ```
  ALTER TABLE civicrm_group_contact ADD COLUMN `location_id` int(10) unsigned DEFAULT NULL COMMENT 'Optional location to associate with this membership'
  
  ```
  
  Credit for the solution goes to Eileen, via this commit:
  
  <https://github.com/wikimedia/wikimedia-fundraising-crm/commit/e5b853cd55ebf83b68a783a86bf3274dcf20dfb9>
  
  Credit for the original issue linked in the question above goes to Lizz Trudeau.
  
  
  ---
  
  