5.65.alpha1.mysql.tpl - Add pre-upgrade snapshots for existing upgrade-steps
authorTim Otten <totten@civicrm.org>
Thu, 3 Aug 2023 08:34:29 +0000 (01:34 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 3 Aug 2023 08:48:05 +0000 (01:48 -0700)
CRM/Upgrade/Incremental/sql/5.65.alpha1.mysql.tpl

index 2ac634fee903317a188810a0134facd16cd4ab4a..f0226d96c39b735b06be5b6dc9e82cfea9e96cbe 100644 (file)
@@ -1,9 +1,19 @@
 {* file to handle db changes in 5.65.alpha1 during upgrade *}
 
+-- 5.65.alpha1 has multiple changes to civicrm_group table. Snapshot for all of them.
+{crmUpgradeSnapshot name=group}
+  SELECT id, name, title, frontend_title, description, frontend_description
+  FROM civicrm_group
+  WHERE name IS NULL OR frontend_title IS NULL OR frontend_title = "" OR frontend_description IS NULL OR frontend_description = ""
+{/crmUpgradeSnapshot}
+
 -- Ensure new name field is not null/unique. Setting to ID is a bit lazy - but it works.
 UPDATE civicrm_group SET `name` = `id` WHERE name IS NULL;
 
 -- Ensure API entity names always start with uppercase
+{crmUpgradeSnapshot name=job}
+  SELECT id, api_entity FROM civicrm_job
+{/crmUpgradeSnapshot}
 UPDATE `civicrm_job` SET `api_entity` = CONCAT(UPPER(SUBSTRING(`api_entity`, 1 ,1)), SUBSTRING(`api_entity`, 2));
 
 -- Add name field, make frontend_title required (in conjunction with php function)
@@ -27,8 +37,15 @@ UPDATE `civicrm_job` SET `api_entity` = CONCAT(UPPER(SUBSTRING(`api_entity`, 1 ,
   WHERE (`frontend_description` IS NULL OR `frontend_description` = '') AND description <> '';
 {/if}
 
+{crmUpgradeSnapshot name=schedule}
+  SELECT id, limit_to FROM civicrm_action_schedule
+{/crmUpgradeSnapshot}
 UPDATE `civicrm_action_schedule` SET `limit_to` = 2 WHERE `limit_to` = 0;
 
+{crmUpgradeSnapshot name=mailcomp}
+  SELECT id, body_html, body_text, subject FROM civicrm_mailing_component
+  WHERE component_type IN ('Welcome', 'Subscribe')
+{/crmUpgradeSnapshot}
 {literal}
 UPDATE civicrm_mailing_component
 SET body_html = REPLACE(body_html, '{welcome.group}', '{group.frontend_title}'),
@@ -43,6 +60,9 @@ subject = REPLACE(subject, '{subscribe.group}', '{group.frontend_title}')
 WHERE component_type = 'Subscribe';
 {/literal}
 
+{crmUpgradeSnapshot name=loctype}
+  SELECT id, name, display_name, is_reserved, is_active, is_default FROM civicrm_location_type
+{/crmUpgradeSnapshot}
 UPDATE `civicrm_location_type` SET `is_reserved` = 0 WHERE `is_reserved` IS NULL;
 UPDATE `civicrm_location_type` SET `is_active` = 0 WHERE `is_active` IS NULL;
 UPDATE `civicrm_location_type` SET `is_default` = 0 WHERE `is_default` IS NULL;