Skip to content

Commit

Permalink
Merge pull request #19740 from agh1/notnotnull
Browse files Browse the repository at this point in the history
dev/translation#58 further regression fix: don't make group title NOT NULL even for a moment
  • Loading branch information
eileenmcnaughton authored Mar 7, 2021
2 parents 5747164 + ffc64a9 commit c16fd30
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions CRM/Upgrade/Incremental/php/FiveThirtyOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
* @param string $rev
*/
public function upgrade_5_31_alpha1($rev) {
$this->addTask('Expand internal civicrm group title field to be 255 in length', 'grouptitlefieldExpand');
$this->addTask('Expand internal civicrm group title field to be 255 in length', 'groupTitleRestore');
$this->addTask('Add in optional public title group table', 'addColumn', 'civicrm_group', 'frontend_title', "varchar(255) DEFAULT NULL COMMENT 'Alternative public title for this Group.'", TRUE, '5.31.alpha1', FALSE);
$this->addTask('Add in optional public description group table', 'addColumn', 'civicrm_group', 'frontend_description', "text DEFAULT NULL COMMENT 'Alternative public description of the group.'", TRUE, '5.31.alpha1');
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
Expand Down Expand Up @@ -145,30 +145,6 @@ public static function installGreenwich(CRM_Queue_TaskContext $ctx) {
return TRUE;
}

/**
* Expands the length of the civicrm_group.title field in the database to be 255.
*
* @param \CRM_Queue_TaskContext $ctx
*
* @return bool
*/
public static function grouptitlefieldExpand(CRM_Queue_TaskContext $ctx) {
$locales = CRM_Core_I18n::getMultilingual();
$queries = [];
if ($locales) {
foreach ($locales as $locale) {
$queries[] = "ALTER TABLE civicrm_group CHANGE `title_{$locale}` `title_{$locale}` varchar(255) NOT NULL COMMENT 'Name of Group.'";
}
}
else {
$queries[] = "ALTER TABLE civicrm_group CHANGE `title` `title` varchar(255) NOT NULL COMMENT 'Name of Group.'";
}
foreach ($queries as $query) {
CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
}
return TRUE;
}

/**
* The prior task grouptitlefieldExpand went a bit too far in making the `title` NOT NULL.
*
Expand Down

0 comments on commit c16fd30

Please sign in to comment.