From cc80608da14dd5380dff9b564e319dc32ba7ee60 Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Fri, 22 May 2015 20:58:48 -0400 Subject: [PATCH] Alter the languages.formula field to increase the length from 128 to 1024 (Belarusian plurals formula was being truncated at 128, which caused errors in export to Transifex) (DBOINCP-141) --- .../boinctranslate/boinctranslate.install | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.install b/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.install index 5582afb457..f07dda4d5c 100644 --- a/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.install +++ b/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.install @@ -7,6 +7,22 @@ function boinctranslate_install() { // Use schema API to create database table //drupal_install_schema('boinctranslate'); + + // Alter the formula field in the languages table to increase length from 128 + // to 1024 characters (longer formulas were being truncated) + $ret = array(); + db_change_field( + $ret, + 'languages', + 'formula', + 'formula', + array( + 'type' => 'varchar', + 'length' => 1024, + 'not null' => TRUE, + 'default' => '', + ) + ); } /** @@ -26,3 +42,12 @@ function boinctranslate_schema() { $schema['boinctranslate'] = array(); return $schema; }*/ + +/** + * Implementation of hook_schema_alter(). + */ +function boinctranslate_schema_alter(&$schema) { + // Notify the schema system that the length of languages.formula has been + // increased to 1024 (was 128) + $schema['languages']['fields']['formula']['length'] = 1024; +}