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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Error in upgrading to 2.2.0 - civicrm_group_nesting
Pages: [1]

Author Topic: Error in upgrading to 2.2.0 - civicrm_group_nesting  (Read 1996 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Error in upgrading to 2.2.0 - civicrm_group_nesting
March 13, 2009, 11:56:03 pm
I'm getting this message upgrading from 2.1.1 to 2.2.0 on Joomla 1.5.7.

Quote
     Sorry. A non-recoverable error has occurred.

    DB Error: unknown error

    Database Error Code: Error on rename of './cbfecom_cbfj15c22/civicrm_group_nesting' to './cbfecom_cbfj15c22/#sql2-ad6-61c7' (errno: 152), 1025

    Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => ALTER TABLE `civicrm_group_nesting`
    DROP FOREIGN KEY `FK_civicrm_group_nesting_child_group_id` [nativecode=1025 ** Error on rename of './cbfecom_cbfj15c22/civicrm_group_nesting' to './cbfecom_cbfj15c22/#sql2-ad6-61c7' (errno: 152)]
    [type] => DB_Error
    [user_info] => ALTER TABLE `civicrm_group_nesting`
    DROP FOREIGN KEY `FK_civicrm_group_nesting_child_group_id` [nativecode=1025 ** Error on rename of './cbfecom_cbfj15c22/civicrm_group_nesting' to './cbfecom_cbfj15c22/#sql2-ad6-61c7' (errno: 152)]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="ALTER TABLE `civicrm_group_nesting`
    DROP FOREIGN KEY `FK_civicrm_group_nesting_child_group_id` [nativecode=1025 ** Error on rename of './cbfecom_cbfj15c22/civicrm_group_nesting' to './cbfecom_cbfj15c22/#sql2-ad6-61c7' (errno: 152)]"]
)
[/quote]

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: Error in upgrading to 2.2.0 - civicrm_group_nesting
March 14, 2009, 12:44:54 am
Most likey the table 'civicrm_group_nesting' does not have constraint set, not sure why.

Following query -
Code: [Select]
show create table civicrm_group_nesting; will show you the constraints currently set for the table.

One solution is to run the following query before restarting the upgrade and check -
Code: [Select]
ALTER TABLE `civicrm_group_nesting`
    ADD CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`) ON DELETE CASCADE;
« Last Edit: March 14, 2009, 12:52:07 am by Deepak Srivastava »
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Error in upgrading to 2.2.0 - civicrm_group_nesting
March 14, 2009, 04:20:00 am
My bad.

I did the install on a copy of the CiviCRM database, but I did not enable the constraints. Hence the failure when trying to delete a foreign key, which didn't exist.

Thanks for your prompt response, Deepak - it helped me understand where the problem might be.

Ken

yeppers

  • Guest
Re: Error in upgrading to 2.2.0 - civicrm_group_nesting
December 08, 2009, 02:27:45 pm
I am new to CiviCRM and also having the same error trying to upgrade from 2.1 (.0) to 2.2. Doing this:

ALTER TABLE `civicrm_group_nesting` ADD CONSTRAINT `FK_civicrm_group_nesting_child_group_id` FOREIGN KEY (`child_group_id`) REFERENCES `civicrm_group` (`id`) ON DELETE CASCADE;

did at least result in a new error now referencing the civicrm_note table:

Error Details:

Code: [Select]

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    code(in brackets) => a515ac9c2796ca0e23adbe92c68fc9fc
    [message] => DB Error: a515ac9c2796ca0e23adbe92c68fc9fc
    [mode] => 16
    [debug_info] => ALTER TABLE civicrm_note
    DROP FOREIGN KEY `FK_civicrm_note_contact_id` [nativecode=1025 ** Error on rename of './wcg/civicrm_note' to './wcg/#sql2-144a-2ac1e' (errno: 152)]
    [type] => DB_Error


When I tried what I thought was the equivalent 'ALTER TABLE' for the civicrm_note table I got an error:

mysql> ALTER TABLE `civicrm_note` ADD CONSTRAINT `FK_civicrm_note_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE;
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`wcg/#sql-144a_2affc`, CONSTRAINT `FK_civicrm_note_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)

I have since found the 'insuring schema integrity on upgrades' page but if there is a simple answer please let me know.

Thank you!
« Last Edit: December 08, 2009, 05:44:29 pm by yeppers »

yeppers

  • Guest
Re: Error in upgrading to 2.2.0 - civicrm_group_nesting
December 09, 2009, 09:46:55 am
Actually that page is no help as it seems only to refer to versions prior to version 2.

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: Error in upgrading to 2.2.0 - civicrm_group_nesting
December 09, 2009, 11:10:08 pm
yeppers,

Your db look to have orphan entries in civicrm_note table. In other words there are entries in civicrm_note table pointing to non-existing contacts.
If you can remove those entries, you 'll be able to add the foreign key constraint ( & upgrade script can drop it).
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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Error in upgrading to 2.2.0 - civicrm_group_nesting

This forum was archived on 2017-11-26.