Make sure we don't generate MySQL index names longer than 64 characters
authorChuck Hagenbuch <chuck@horde.org>
Sun, 3 Oct 2010 17:40:01 +0000 (13:40 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 3 Oct 2010 17:41:47 +0000 (13:41 -0400)
framework/Db/lib/Horde/Db/Adapter/Mysql/Schema.php

index 46df902..ae69e8e 100644 (file)
@@ -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