Skip to content

Commit

Permalink
Optimized index truncation to avoid name collisions.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Feb 24, 2014
1 parent 401739a commit fd6c07d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion framework/Db/lib/Horde/Db/Adapter/Oracle/Schema.php
Expand Up @@ -702,7 +702,13 @@ public function removeIndex($tableName, $options = array())
public function indexName($tableName, $options = array())
{
$index = parent::indexName($tableName, $options);
return $this->_truncateTo30($index);
if (strlen($index) <= 30) {
return $index;
}
if (isset($options['name']) && $index == $options['name']) {
return $this->_truncate($index);
}
return substr('ind_' . $this->_truncate($tableName, 15) . '_' . hash('crc32', $index), 0, 30);
}

/**
Expand Down

0 comments on commit fd6c07d

Please sign in to comment.