From f147e873721747fb735c54211095676ea78c53cb Mon Sep 17 00:00:00 2001 From: colemanw Date: Mon, 23 Oct 2023 21:36:09 -0400 Subject: [PATCH] Increase length of ActionSchedule.name and fix swapped comments in upgrader Fixes dev/core#4696 by increasing the column length before writing to it. Also fixes an error in the upgrader where Discount.entity_table and ActionSchedule.name descriptions were accidentally swapped. --- CRM/Core/DAO/ActionSchedule.php | 12 ++++++------ CRM/Upgrade/Incremental/php/FiveSixtySeven.php | 1 + CRM/Upgrade/Incremental/php/FiveSixtySix.php | 6 +++--- xml/schema/Core/ActionSchedule.xml | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php index f75590e064..1f00ac68b8 100644 --- a/CRM/Core/DAO/ActionSchedule.php +++ b/CRM/Core/DAO/ActionSchedule.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/ActionSchedule.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7cd61559377e23d6ad4c833616f22a12) + * (GenCodeChecksum:e6121895aa480e9b4fdbf171b01b91dc) */ /** @@ -57,10 +57,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { public $id; /** - * Name of the action(reminder) + * Name of the scheduled action * * @var string - * (SQL type: varchar(64)) + * (SQL type: varchar(128)) * Note that values will be retrieved from the database as a string. */ public $name; @@ -491,10 +491,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, 'title' => ts('Name'), - 'description' => ts('Name of the action(reminder)'), + 'description' => ts('Name of the scheduled action'), 'required' => TRUE, - 'maxlength' => 64, - 'size' => CRM_Utils_Type::BIG, + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, 'usage' => [ 'import' => FALSE, 'export' => FALSE, diff --git a/CRM/Upgrade/Incremental/php/FiveSixtySeven.php b/CRM/Upgrade/Incremental/php/FiveSixtySeven.php index 7b7d586b65..1f4941cf77 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixtySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveSixtySeven.php @@ -69,6 +69,7 @@ class CRM_Upgrade_Incremental_php_FiveSixtySeven extends CRM_Upgrade_Incremental public function upgrade_5_67_beta2($rev): void { // Repeat step from 5.66 because it was added late in the release-cycle $this->addTask('Make ActionSchedule.name required', 'alterColumn', 'civicrm_action_schedule', 'name', "varchar(128) NOT NULL COMMENT 'Name of the scheduled action'"); + $this->addTask('Make Discount.entity_table required', 'alterColumn', 'civicrm_discount', 'entity_table', "varchar(64) NOT NULL COMMENT 'physical tablename for entity being joined to discount, e.g. civicrm_event'"); } /** diff --git a/CRM/Upgrade/Incremental/php/FiveSixtySix.php b/CRM/Upgrade/Incremental/php/FiveSixtySix.php index 55c6d1df36..cc0bdd2853 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixtySix.php +++ b/CRM/Upgrade/Incremental/php/FiveSixtySix.php @@ -35,12 +35,12 @@ class CRM_Upgrade_Incremental_php_FiveSixtySix extends CRM_Upgrade_Incremental_B * The version number matching this function name */ public function upgrade_5_66_alpha1($rev): void { + // Increase column length before the upgrade sql writes to it + $this->addTask('Increase ActionSchedule.name length', 'alterColumn', 'civicrm_action_schedule', 'name', "varchar(128) COMMENT 'Name of the scheduled action'"); $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); + // These run after the sql file $this->addTask('Make Contribution.tax_amount required', 'alterColumn', 'civicrm_contribution', 'tax_amount', "decimal(20,2) DEFAULT 0 NOT NULL COMMENT 'Total tax amount of this contribution.'"); $this->addTask('Make LineItem.tax_amount required', 'alterColumn', 'civicrm_line_item', 'tax_amount', "decimal(20,2) DEFAULT 0 NOT NULL COMMENT 'tax of each item'"); - // These run after the sql file - $this->addTask('Make Discount.entity_table required', 'alterColumn', 'civicrm_discount', 'entity_table', "varchar(64) NOT NULL COMMENT 'Name of the action(reminder)'"); - $this->addTask('Make ActionSchedule.name required', 'alterColumn', 'civicrm_action_schedule', 'name', "varchar(64) NOT NULL COMMENT 'physical tablename for entity being joined to discount, e.g. civicrm_event'"); $this->addTask(ts('Create index %1', [1 => 'civicrm_action_schedule.UI_name']), 'addIndex', 'civicrm_action_schedule', 'name', 'UI'); $this->addTask('Add fields to civicrm_mail_settings to allow more flexibility for email to activity', 'addMailSettingsFields'); $this->addTask('Move serialized contents of civicrm_survey.recontact_interval into civicrm_option_value.filter', 'migrateRecontactInterval'); diff --git a/xml/schema/Core/ActionSchedule.xml b/xml/schema/Core/ActionSchedule.xml index 9063c21e40..c9b31a4958 100644 --- a/xml/schema/Core/ActionSchedule.xml +++ b/xml/schema/Core/ActionSchedule.xml @@ -36,8 +36,8 @@ Text - 64 - Name of the action(reminder) + 128 + Name of the scheduled action 3.4 -- 2.25.1