2

I have successfully upgraded many other CiviCRM installations over the years, but I've been unable to work my way through this issue so far.

  • Ubuntu 14.04
  • MySQL 5.7.23
  • Apache/2.4.7
  • PHP Version 5.6.37
  • Drupal 7.59
  • CiviCRM 4.2.20

I am trying to upgrade CiviCRM 4.2.20 to 4.3.11. Ultimately the goal is to get to 4.6 LTS. I have tried repairing the CiviCRM schema (this database has only 2 custom fields), and I've also tried the SET foreign_key_checks = 0; work around on importing the db, but I've still been unsuccessful at upgrading. I always hit this error at the stage of:

[Error: Upgrade DB to 4.3.alpha1]

ALTER TABLE civicrm_membership_type DROP FOREIGN KEY FK_civicrm_membership_autorenewal_msg_id [nativecode=1091 ** Can't DROP 'FK_civicrm_membership_autorenewal_msg_id'; check that column/key exists]

I found a helpful thread somewhere that suggesting that MySQL 5.5 may have been the culprit, so I upgraded to MySQL 5.7, and still get the exact same error regardless of MySQL version. I have a fresh export and backups, so every time I try something it is with a fresh working version of the database on 4.2.20. Any help is greatly appreciated!

Thank you,
--Tony

Error: Upgrade DB to 4.3.alpha1

Update Based on Jon G's suggestion I tried commenting out the offending lines in CRM/Upgrade/Incremental/php/FourThree.php, reloaded a fresh database for upgrading, but still continued to receive the exact same error. The only difference this time being, after I hit refresh to try and force the upgrade to continue, then another message occurred:

ALTER TABLE civicrm_premiums ADD COLUMN premiums_nothankyou_position int(10) unsigned DEFAULT '1' [nativecode=1060 ** Duplicate column name 'premiums_nothankyou_position']

I couldn't grep any more lines to comment out of the FourThree.php upgrade file, and wasn't sure how this would affect database integrity. The suggested threads (CRM-12458, CRM-11260) seem to relate, but I was ultimately unable to use the information to solve this issue, admittedly due to the lack in my technical understanding.

0

This appears to be identical to CRM-12458. Which is unusual - most cases where you'd get this error were solved in CRM-11260 but there are still edge cases that can cause this.

I would read those links in full - but my guess is you should edit CRM/Upgrade/Incremental/php/FourThree.php. Remove the four highlighted lined at this link - that is, lines 883-886.

Since you're dropping a foreign key constraint that doesn't exist, there should be no difference as a result of removing these lines. Note that you may have to remove some of the following lines if you get similar errors.

  • Thank you for the fast response. I did try commenting out those lines, and the upgrade failed with the exact same message. The only difference this time being, after I hit refresh to try and force the upgrade to continue, then another message occurred: – drupleg Sep 20 '18 at 14:32
  • 1
    The "Duplicate column name" suggests that perhaps you didn't restore the pre-upgrade database before trying again. For that matter, that would also cause the original issue you're describing. – Jon G - Megaphone Tech Sep 20 '18 at 16:46
  • Thank you again for your guidance. I also attempted the upgrade with the previous version of the database restored from last weeks's pre-upgraded CiviCRM 4.2.8 (to an new freshly created empty MySQL database), and still receive the same error. The 4.2.8 version is the oldest backup I have, so it seems something has already gone awry with the FK_civicrm_membership_autorenewal_msg_id in whatever backup database copies I have as well. We'll stay with v4.2.20 for the time being. Thanks again! – drupleg Sep 20 '18 at 21:13
  • 1
    4.2 is VERY old and has known security issues. While you might have to deal with a handful of fields like this, my guess is that you don't have anything of value in the civicrm_premiums.premiums_nothankyou_position field. If not, simply drop the column from your database schema and retry this. – Jon G - Megaphone Tech Sep 20 '18 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.