tl;dr: After a failed upgrade, is updating the table structure enough?

I had a failed upgrade due to a mysql crash a few days ago (4.7.6 to 4.7.11). The database worked fine once mysql was back up, but I had a warning about a partial upgrade. Putting the backup back in place and rerunning the upgrade didn't do the trick, so I went table by table, comparing it to a successful upgrade, and updated the table structures accordingly. I then went into the domain table and updated the version number. Assuming the table structures are perfectly updated, are there factors I haven't considered?


When you do an import of an previous version of your database, you should first delete all the views / table because newer version of CiviCRM often create new tables that don't get deleted when you put the backup back.

If you do not want to (or can't) start the full update, you should :

  1. look at domain table column version and find the version where it has crashed (e.g. 4.7.beta3)
  2. go into CRM/Upgrade/Incremental/sql and find the last successful sql query - should be in the version immediately following your current version (e.g. 4.7.beta4.mysql.tpl if your version is 4.7.beta3)
  3. get all the queries from the file you found and run them (e.g. 4.7.beta4.mysql.tpl) - you might have to change the .sql to change token (e.g. {$domainID} => 1, assuming you only have one domain)
  4. change the domain::version to the new version (e.g. 4.7.beta4) in your database
  5. check for any specific code in CRM/Upgrade/Incremental/php/FourXXX.php to check for specific upgrade code
  6. relaunch the upgrade - it should be able to finish the upgrade

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.