CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Deleting Contact doesn't Delete civicrm_group_contact Record
Pages: [1]

Author Topic: Deleting Contact doesn't Delete civicrm_group_contact Record  (Read 968 times)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Deleting Contact doesn't Delete civicrm_group_contact Record
September 14, 2011, 11:44:32 am
I have a C 4.0.5 D 7.8 site which had some 20K contacts, 6K were in the Trash. I want to start fresh with this site b/c the imports someone else did are bad, so I first tried the export.php and import.php into a fresh install, but that failed with a PHP error (I hope to report about that elsewhere).

So instead I used the regular web interface to permanently delete all contacts, and then all from the Trash. Now civicrm_contacts has one row. Problem is that civicrm_group_contact has 19K rows. I would expect that permanently deleting a contact would remove his rows in that table.

Also custom data tables for data groups marked as "All Contact Types" have hundreds of records--they should have just one.

Seems to be these are bugs.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Deleting Contact doesn't Delete civicrm_group_contact Record
September 14, 2011, 12:42:46 pm

1. can u check that your tables are innodb

2. can u check the constraints on the tables where u still have entries

most of contact deletion is actually done by the DB via cascaded constraints, and as such there is no code in civi that goes in and deletes those records

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Deleting Contact doesn't Delete civicrm_group_contact Record
September 14, 2011, 01:13:21 pm
Quote from: Donald Lobo on September 14, 2011, 12:42:46 pm
most of contact deletion is actually done by the DB via cascaded constraints

Ah, right, of course. Anyhow they are all InnoDB and have all the FKs.

But, for some reason, I now see that they are all missing the constraints such as

Code: [Select]
  ADD CONSTRAINT `FK_civicrm_group_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE,
and that's the issue.

I will try to add those to a fresh copy and then re-delete everyone.

Thanks!
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Deleting Contact doesn't Delete civicrm_group_contact Record
September 14, 2011, 01:14:55 pm
Wanted to mention that I'm not sure how this situation could have come about. I am presuming that the third party which borked the import also managed the bork the DB schema...
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Deleting Contact doesn't Delete civicrm_group_contact Record

This forum was archived on 2017-11-26.