Skip to content

Instantly share code, notes, and snippets.

@mlutfy
Created May 8, 2012 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlutfy/2638951 to your computer and use it in GitHub Desktop.
Save mlutfy/2638951 to your computer and use it in GitHub Desktop.

CiviCRM 2.1 to 4.0.7:

Patches in the upgrade scripts:

  • comment out "ALTER TABLE civicrm_domain ADD locale_custom_strings [...]" from sites/all/modules/CRM/Upgrade/Incremental/sql/3.2.alpha3.mysql.tpl
  • Comment out: Incremental/sql/3.1.beta2.mysql.tpl (towards the end, creation of civicrm_option_value.domain_id),
    -- ALTER TABLE `civicrm_option_value`
    --     ADD `domain_id` INT(10) UNSIGNED DEFAULT NULL COMMENT 'Which Domain is this option value for' AFTER `component_id`;
    --
    -- ALTER TABLE `civicrm_option_value`
    --     ADD CONSTRAINT `FK_civicrm_option_value_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`);
  • and CRM/Upgrade/ThreeOne/ThreeOne.php, line "CRM_Core_DAO::checkFieldExists( 'civicrm_option_value', 'domain_id')"

Upgrade process:

cd ~/platforms/civicrm-4.0.7-drupal-7.9-1/sites/NOM-DU-CAB-test.rcabm.org/
drush @cabsys21test.rcabm.org sql-dump > dump-cabsys21test.sql
echo 'show tables' | drush sqlc | grep -v Tables_in | grep -v "+" |  gawk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop table " $1 ";"}'  | drush sqlc
cat dump-cabsys21test.sql | drush sqlc

echo "UPDATE system set status = 0 where name = 'civicrm'" | drush sqlc
echo "delete from permission" | drush sqlc

echo "update system set schema_version = 7999 where name = 'text'" | drush sqlc
drush updatedb -y
drush updatedb -y
echo "update system set schema_version = 6999 where name = 'text'" | drush sqlc
drush updatedb -y

echo "ALTER TABLE civicrm_domain ADD locale_custom_strings text COLLATE utf8_unicode_ci COMMENT 'String Overrides';" | drush sqlc
echo "UPDATE system set status = 1 where name = 'civicrm'" | drush sqlc
  • CiviCRM: create the field civicrm_option_value.domain_id, otherwise the upgrade will crash:
ALTER TABLE `civicrm_option_value`
ADD `domain_id` INT(10) UNSIGNED DEFAULT NULL COMMENT 'Which Domain is this option value for' AFTER `component_id`;

ALTER TABLE `civicrm_option_value`
ADD CONSTRAINT `FK_civicrm_option_value_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`);

update civicrm_option_value set domain_id = 1;
  • Run the upgrade:
drush civicrm-upgrade-db --debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment