Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8471

Upgrade database structure and migrate data from previous version

    Details

    • Type: Task
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.0.0
    • Fix Version/s: 4.3.0
    • Component/s: Accounting Integration
    • Labels:
      None

      Description

      The database changes are significant in this upgrade. Seems like SQL statements to modify the database structure and modify the data are handcoded rather than autogenerated by GenCode.php based on information in the xml/schema files.

      Currently the information for handling the changes to the tables and fields in the schema are in the xml/schema files. However, rather than starting to automatically produce the code to Alter tables and fields and migrate data appropriately, we do that manually and then remove the attributes from xml/schema as they will no longer be necessary.

      A number of affected fields are localizable. Ensure that the following pattern in 3.1.3.mysql.tpl is followed:

      {if $multilingual} {foreach from=$locales item=locale}

      UPDATE civicrm_option_value ov
      INNER JOIN civicrm_option_group og ON ( og.id = ov.option_group_id )
      SET ov.name = ov.label_{$locale}
      WHERE og.name = 'activity_type'
      AND ov.name IS NULL;

      {/foreach} {else}

      UPDATE civicrm_option_value ov
      INNER JOIN civicrm_option_group og ON ( og.id = ov.option_group_id )
      SET ov.name = ov.label
      WHERE og.name = 'activity_type'
      AND ov.name IS NULL;

      {/if}

      Manually code SQL to migrate data
      For example, if some fields have had their names changed:
      INSERT INTO civicrm_credit_adjustment ( ... ) SELECT cancel_date, cancel_reason, contribution_status_id, ... WHERE cancel_date IS NOT NULL;

        Attachments

          Activity

            People

            • Assignee:
              joemurray Joe Murray
              Reporter:
              joemurray Joe Murray
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: