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
- 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!
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.