From 721a43a41ccac866a375d60dcc400f925de29298 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 18 Jun 2015 11:50:42 +1200 Subject: [PATCH] CRM-16717 alter logging table field length when altering custom table field length --- CRM/Core/BAO/CustomField.php | 2 +- CRM/Core/BAO/SchemaHandler.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 506d63edf8..a7e04ba442 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -174,7 +174,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } if (!empty($defaultArray)) { - // also add the seperator before and after the value per new conventio (CRM-1604) + // also add the separator before and after the value per new convention (CRM-1604) $params['default_value'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $defaultArray) . CRM_Core_DAO::VALUE_SEPARATOR; } } diff --git a/CRM/Core/BAO/SchemaHandler.php b/CRM/Core/BAO/SchemaHandler.php index 2f49727852..975ca89a87 100644 --- a/CRM/Core/BAO/SchemaHandler.php +++ b/CRM/Core/BAO/SchemaHandler.php @@ -346,10 +346,12 @@ ALTER TABLE {$tableName} $config = CRM_Core_Config::singleton(); if ($config->logging) { - // logging support: if we’re adding a column (but only then!) make sure the potential relevant log table gets a column as well - if ($params['operation'] == 'add') { + // CRM-16717 not sure why this was originally limited to add. + // For example custom tables can have field length changes - which need to flow through to logging. + // Are there any modifies we DON'T was to call this function for (& shouldn't it be clever enough to cope?) + if ($params['operation'] == 'add' || $params['operation'] == 'modify') { $logging = new CRM_Logging_Schema(); - $logging->fixSchemaDifferencesFor($params['table_name'], array('ADD' => array($params['name'])), FALSE); + $logging->fixSchemaDifferencesFor($params['table_name'], array($prefix => array($params['name'])), FALSE); } } -- 2.25.1