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) »
  • Upgrading from 4.0.5 to 4.3 -solved
Pages: [1]

Author Topic: Upgrading from 4.0.5 to 4.3 -solved  (Read 1804 times)

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Upgrading from 4.0.5 to 4.3 -solved
October 06, 2013, 11:22:32 am
I am upgrading my installation of CIVICRM from version 4.0 to 4.3
After I hit the upgrade button I get the following

          CiviCRM Upgrade Tasks

With  Retry and Skip buttons

Nothing else. Clicking either button has no effect.  I have not seen anything other post with a similar error.

Thanks for any help!

Indar
« Last Edit: October 21, 2013, 12:32:16 pm by ibhola »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading from 4.0.5 to 4.3
October 07, 2013, 05:49:16 am
If you Google for "Retry and Skip  civicrm upgrade" you will find several posts about this actually. The problem is that the JS code is not loading and probably this is due to file template caches. Did you empty your cache?
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.

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 16, 2013, 11:17:10 am
I read the post - seems the fix is to do a step by step upgrade.
I upgraded from 4.0.5 to 4.1 no issues

During the upgrade from 4.1 to 4.2.9 I got the following during the upgrade. I am unable to proceed. I tried going back to 4.1 and doing the upgrade again - same results. Should I manually be adding/changing something to get past the error?


Type   DB_Error
Code   -3
Message   DB Error: constraint violation
Mode   16
UserInfo   INSERT INTO civicrm_line_item (entity_table , entity_id , label , qty , unit_price , line_total , participant_count ) VALUES ('civicrm_contribution' , 10204 , 'Contribution Amount' , 1 , 300.00 , 300.00 , 0 ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`sari_drpl1`.`civicrm_line_item`, CONSTRAINT `FK_civicrm_line_item_price_field_id` FOREIGN KEY (`price_field_id`) REFERENCES `civicrm_price_field` (`id`) ON DELETE CASCADE)]
DebugInfo   INSERT INTO civicrm_line_item (entity_table , entity_id , label , qty , unit_price , line_total , participant_count ) VALUES ('civicrm_contribution' , 10204 , 'Contribution Amount' , 1 , 300.00 , 300.00 , 0 ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`sari_drpl1`.`civicrm_line_item`, CONSTRAINT `FK_civicrm_line_item_price_field_id` FOREIGN KEY (`price_field_id`) REFERENCES `civicrm_price_field` (`id`) ON DELETE CASCADE)]

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading from 4.0.5 to 4.3
October 16, 2013, 11:44:20 am
This is a different issue. It would appear that your DB is trying to reference a non-existent price field. Did you have price fields that you deleted?
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.

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 16, 2013, 12:25:57 pm
I am not involved in day to day operations but as far as I am aware we do no use price sets. (We are now trying to get comfortable with civicrm so we do not use the majority of the functionality) we do not access the database directly so even if a price set was deleted, would Civicrm not have managed the  fk contraints?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading from 4.0.5 to 4.3
October 16, 2013, 12:37:17 pm
> would Civicrm not have managed the  fk contraints?

You are correct that it should, but all software packages have bugs and dealing with FK constraints is not always easy. Anyhow it appears that there are price sets from the civicrm_line_item that it's trying to insert.

Actually perhaps you're right and it's not referencing any price field ID and that's the problem. I'm not sure.

One potential solution is to remove the constraint, run the upgrade, and then put it back.
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.

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 16, 2013, 12:59:19 pm
Thanks - I'll try that.
Good catch that it is not referencing the price_field_id
« Last Edit: October 17, 2013, 04:17:00 am by ibhola »

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 18, 2013, 05:45:42 pm
one step closer: I dropped the foreign key (without issues) on that table and the upgrade
from 4.1 to 4.2.9 completed successfully :)
upgrade to 4.3.7 failed with this error >:(

Error: Upgrade DB to 4.3.alpha1: SQL]
Error Field   Error Value
Type   DB_Error
Code   -1
Message   DB Error: unknown error
Mode   16
UserInfo   ALTER TABLE `civicrm_line_item` DROP FOREIGN KEY `FK_civicrm_line_item_price_field_id`, CHANGE `price_field_id` `price_field_id` INT( 10 ) UNSIGNED DEFAULT NULL [nativecode=1025 ** Error on rename of './sari_drpl1/civicrm_line_item' to './sari_drpl1/#sql2-4c4a-1afc162' (errno: 152)]
DebugInfo   ALTER TABLE `civicrm_line_item` DROP FOREIGN KEY `FK_civicrm_line_item_price_field_id`, CHANGE `price_field_id` `price_field_id` INT( 10 ) UNSIGNED DEFAULT NULL [nativecode=1025 ** Error on rename of './sari_drpl1/civicrm_line_item' to './sari_drpl1/#sql2-4c4a-1afc162' (errno: 152)]

I tried to drop the Foreign key manually and get the same error
Based in the bug report at http://bugs.mysql.com/bug.php?id=14347 I manually modified the query to "drop Key" instead of "drop foreign key" and that seemed to work. But trying again with upgrade (after DB restore) failed at the same place.

Any ideas? where can I change the update script and is it recommended?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading from 4.0.5 to 4.3
October 19, 2013, 11:37:59 am
If you receive a series of errors like this, you might want to run the Ensuring Schema Integrity on Upgrades procedure.
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.

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 19, 2013, 05:14:46 pm
I followed the suggestions - now I am getting the following error  on the same table as when I was upgrading from 4.1 to 4.2

ALTER TABLE `civicrm_line_item` ADD CONSTRAINT `FK_civicrm_line_item_price_field_id` FOREIGN KEY (`price_field_id`) REFERENCES `civicrm_price_field`(id) ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`sari_drpl1`., CONSTRAINT `FK_civicrm_line_item_price_field_id` FOREIGN KEY (`price_field_id`) REFERENCES `civicrm_price_field` (`id`) ON)]


Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading from 4.0.5 to 4.3
October 20, 2013, 03:17:31 am
I would suggest you try the same as before--remove this FK temporarily.
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.

ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 20, 2013, 01:03:25 pm
I am now back to the original message

ALTER TABLE `civicrm_line_item` DROP FOREIGN KEY `FK_civicrm_line_item_price_field_id`, CHANGE `price_field_id` `price_field_id` INT( 10 ) UNSIGNED DEFAULT NULL [nativecode=1025 ** Error on rename of './sari_drpl1/civicrm_line_item' to './sari_drpl1/#sql2-4c4a-1c88901' (errno: 152)]

I don't know if now that I dropped the key, based on the suggestion, it is erroring when the script is trying to do the drop?



ibhola

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Drupal v7.22
  • MySQL version: 5.5.23
  • PHP version: 5.3.27
Re: Upgrading from 4.0.5 to 4.3
October 20, 2013, 02:44:14 pm
Finally I got the upgrade completed. :D
The issue was one record in the civicrm_line_item that has a value of 0 that was not in the price_field table - I was able to discover it by doing a outer join between the two tables.
It was a data issue but I don't know how civicrm allowed that entry in the first instance.

Thanks for all your help and suggestions.

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Upgrading from 4.0.5 to 4.3
October 21, 2013, 08:22:15 am
Possibly related - I have found that in earlier CiviCRM versions you didn't need a label on your options (e.g. donation options). These options get turned into price sets at some point, and have additional DB constraints added, so it fails.

The simple answer is - before upgrading, check that your donation options all have a label (which sucks, because in those versions, it was often a good idea to not have labels)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrading from 4.0.5 to 4.3 -solved

This forum was archived on 2017-11-26.