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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Cannot delete sample contact after installation
Pages: [1]

Author Topic: Cannot delete sample contact after installation  (Read 4525 times)

stevewickii

  • Guest
Cannot delete sample contact after installation
December 06, 2007, 07:33:42 pm
I am using Drupal 5 and CiviCRM 1.9 PHP5.

I just installed civicrm, and accidentally had it install all of the Sample data that comes with it.

No big deal I thought.  I'll just delete the sample data.  So, I Listed All contacts (that are not CMS users) and selected the "Delete Contacts" action and hit "Go". Here's what I got.

> Deleted Contacts: 100

> Total Selected Contacts: 101


I have tried many times to delete the "Inner City Arts" sample contact with NO success, and No error message.

I really need help troubleshooting and deleting this contact.

Thanks   ::)

-Stephen

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cannot delete sample contact after installation
December 06, 2007, 07:50:07 pm
Quote
I have tried many times to delete the "Inner City Arts" sample contact with NO success, and No error message.

In sample data we have defined Membership Types for "Inner City Arts" organization, hence this record cannot be deleted.

So you should delete all Membership Types associated with this Contact.
http://demo.civicrm.org/drupal/civicrm/admin/member/membershipType?reset=1

Then try deleting this contact.

HTH

kurund
Found this reply helpful? Support CiviCRM

natwind

  • Guest
Re: Cannot delete sample contact after installation
March 20, 2008, 12:38:32 pm
Hello, I had this same problem and deleted the membership types as advised.  After doing so, I tried to delete Inner City Arts once again and now got an error:

Quote
     Sorry. A non-recoverable error has occurred.

    Database Error Code: Cannot delete or update a parent row: a foreign key constraint fails (`nation17_civicrm/civicrm_note`, CONSTRAINT `FK_civicrm_note_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`)), 1451

    Return to home page.

Error Details:
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 1 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`nation17_civicrm/civicrm_note`, CONSTRAINT `FK_civicrm_note_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 1 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`nation17_civicrm/civicrm_note`, CONSTRAINT `FK_civicrm_note_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`))]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 1 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`nation17_civicrm/civicrm_note`, CONSTRAINT `FK_civicrm_note_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`))]"]
)
[/code]

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: Cannot delete sample contact after installation
March 24, 2008, 02:11:50 am
Sample data has creator (contact_id column of civicrm_note table) set to 1, for all notes, which is the contact_id of 'Inner City Arts' and hence the problem.

A safe temporary solution for you would be to update the creator for all notes to contact-id of admin (whose creator is 'Inner City Arts').
For e.g if admin's contact id is 102, run the following query:
Code: [Select]
UPDATE civicrm_note SET contact_id =102 WHERE contact_id =1;(assuming contact id for "Inner City Arts" is 1)

Since the case doesn't seem to have been handled, need fixing.

Filed an issue here: http://issues.civicrm.org/jira/browse/CRM-2887

Thanks.
« Last Edit: March 24, 2008, 05:52:00 am by Deepak Srivastava »
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Cannot delete sample contact after installation

This forum was archived on 2017-11-26.