Browse Source

Fix wrong array index in unique indexes for MySql

tags/2.0.0-beta
Luciano Baraglia 11 years ago
parent
commit
166f8aa582
  1. 4
      framework/yii/db/mysql/Schema.php

4
framework/yii/db/mysql/Schema.php

@ -267,8 +267,8 @@ class Schema extends \yii\db\Schema
$regexp = '/UNIQUE KEY\s+([^\(^\s]+)\s*\(([^\)]+)\)/mi';
if (preg_match_all($regexp, $sql, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$indexName = str_replace('`', '', $match[2]);
$indexColumns = array_map('trim', explode(',', str_replace('`', '', $match[3])));
$indexName = str_replace('`', '', $match[1]);
$indexColumns = array_map('trim', explode(',', str_replace('`', '', $match[2])));
$uniqueIndexes[$indexName] = $indexColumns;
}
}

Loading…
Cancel
Save