From 2fefa7a7f0590c03312854901f1bbf07495cbe91 Mon Sep 17 00:00:00 2001
From: Earl Miles <merlin@logrus.com>
Date: Thu, 22 Jan 2009 01:55:58 +0000
Subject: [PATCH] Fix major bug with too-long page names. Thanks drewish!

---
 ctools.install | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/ctools.install b/ctools.install
index e2c7a66a..7de01fe8 100644
--- a/ctools.install
+++ b/ctools.install
@@ -25,7 +25,19 @@ function ctools_uninstall() {
 function ctools_schema() {
   // Currently, schema 1 is the only schema we have. As we make updates,
   // we might either create a new schema 2 or make adjustments here.
-  return ctools_schema_1();
+  return ctools_schema_2();
+}
+
+/**
+ * Version 2 of the CTools schema.
+ */
+function ctools_schema_2() {
+  $schema = ctools_schema_1();
+
+  // update the 'name' field to be 128 bytes long:
+  $schema['ctools_object_cache']['fields']['name']['length'] = 128;
+
+  return $schema;
 }
 
 /**
@@ -71,3 +83,18 @@ function ctools_schema_1() {
   );
   return $schema;
 }
+
+/**
+ * Enlarge the ctools_object_cache.name column to prevent truncation and weird
+ * errors.
+ */
+function ctools_update_6001() {
+  $ret = array();
+
+  // Perform updates like this to reduce code duplication.
+  $schema = ctools_schema_2();
+
+  db_change_field($ret, 'ctools_object_cache', 'name', 'name', $schema['ctools_object_cache']['fields']['name']);
+
+  return $ret;
+}
-- 
GitLab