Browse Source

Mysql unique index creation fix.

tags/2.0.6
Sebastian Thierer 9 years ago
parent
commit
e0d2107e1b
  1. 2
      framework/CHANGELOG.md
  2. 11
      framework/db/mysql/QueryBuilder.php

2
framework/CHANGELOG.md

@ -23,7 +23,7 @@ Yii Framework 2 Change Log
- Bug #8772: ActiveQuery failed removing duplicate records after join when the resultset did not contain the pk values e.g. after grouping (cebe)
- Bug #8900: Fixed determine active menu item with url-alias in route `\yii\widgets\Menu::isItemActive()` (demi)
- Bug #9046: Fixed problem with endless error loop when an error occurred after sending a stream or file download response to the user (cebe)
- Bug #9063: Workaround over mysql create index bug and table name change to lowercase. (sebathi)
- Bug #9063: Workaround over MySQL create index bug and table name change to lowercase. (sebathi)
- Bug: Fixed string comparison in `BaseActiveRecord::unlink()` which may result in wrong comparison result for hash valued primary keys starting with `0e` (cebe)
- Bug: Pass correct action name to `yii\console\Controller::options()` when default action was requested (cebe)
- Bug: Automatic garbage collection in `yii\caching\FileCache` was not triggered (kidol)

11
framework/db/mysql/QueryBuilder.php

@ -81,14 +81,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
/**
* Builds a SQL statement for creating a new index.
* @param string $name the name of the index. The name will be properly quoted by the method.
* @param string $table the table that the new index will be created for. The table name will be properly quoted by the method.
* @param string|array $columns the column(s) that should be included in the index. If there are multiple columns,
* separate them with commas or use an array to represent them. Each column name will be properly quoted
* by the method, unless a parenthesis is found in the name.
* @param boolean $unique whether to add UNIQUE constraint on the created index.
* @return string the SQL statement for creating a new index.
* @inheritdoc
*/
public function createIndex($name, $table, $columns, $unique = false)
{
@ -98,7 +91,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
. $this->db->quoteTableName($name)
. ' (' . $this->buildColumns($columns) . ')';
}
/**
* Builds a SQL statement for dropping a foreign key constraint.
* @param string $name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method.

Loading…
Cancel
Save