diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 1ed66cb53c..4c1b1965e6 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -83,6 +83,7 @@ Yii Framework 2 Change Log - Bug #4592: Fixed `yii help` command was listing incorrect action names for methods like `actionSayNO` (samdark) - Bug #4654: Fixed issue with PostgreSQL and inserting boolean values with batch insert (cebe) - Bug #4727: Fixed wrong Stylus definition in `\yii\web\AssetConverter` (samdark) +- Bug #4813: Fixed MSSQL schema that was getting incorrect info about constraints (samdark, SerjRamone, o-rey) - Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark) - Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul) - Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue) diff --git a/framework/db/mssql/Schema.php b/framework/db/mssql/Schema.php index ce52d30ce9..23eef4e614 100644 --- a/framework/db/mssql/Schema.php +++ b/framework/db/mssql/Schema.php @@ -344,7 +344,7 @@ JOIN {$keyColumnUsageTableName} AS [kcu1] ON JOIN {$keyColumnUsageTableName} AS [kcu2] ON [kcu2].[constraint_catalog] = [rc].[constraint_catalog] AND [kcu2].[constraint_schema] = [rc].[constraint_schema] AND - [kcu2].[constraint_name] = [rc].[constraint_name] AND + [kcu2].[constraint_name] = [rc].[unique_constraint_name] AND [kcu2].[ordinal_position] = [kcu1].[ordinal_position] WHERE [kcu1].[table_name] = :tableName SQL;