From d877d2f520b940a1cb9fae49ee829d9141d49563 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sun, 3 Oct 2010 13:40:01 -0400 Subject: [PATCH] Make sure we don't generate MySQL index names longer than 64 characters --- framework/Db/lib/Horde/Db/Adapter/Mysql/Schema.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/framework/Db/lib/Horde/Db/Adapter/Mysql/Schema.php b/framework/Db/lib/Horde/Db/Adapter/Mysql/Schema.php index 46df902ba..ae69e8efc 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Mysql/Schema.php +++ b/framework/Db/lib/Horde/Db/Adapter/Mysql/Schema.php @@ -367,6 +367,21 @@ class Horde_Db_Adapter_Mysql_Schema extends Horde_Db_Adapter_Base_Schema } /** + * Get the name of the index + * + * @param string $tableName + * @param array $options + */ + public function indexName($tableName, $options=array()) + { + $indexName = parent::indexName($tableName, $options); + if (strlen($indexName) > 64) { + $indexName = substr($indexName, 0, 64); + } + return $indexName; + } + + /** * SHOW VARIABLES LIKE 'name' * * @param string $name -- 2.11.0