Fix #18041: Fix RBAC migration for MSSQL

This commit is contained in:
DarkDef
2020-06-04 23:12:32 +03:00
committed by GitHub
parent 79ffb87a48
commit b83f06268f
2 changed files with 6 additions and 9 deletions

View File

@ -9,6 +9,7 @@ Yii Framework 2 Change Log
- Bug #18026: Fix `ArrayHelper::getValue()` did not work with `ArrayAccess` objects (mikk150)
- Enh #18048: Use `Instance::ensure()` to set `User::$accessChecker` (lav45)
- Bug #18051: Fix missing support for custom validation method in EachValidator (bizley)
- Bug #18041: Fix RBAC migration for MSSQL (darkdef)
2.0.35 May 02, 2020

View File

@ -41,15 +41,11 @@ class m200409_110543_rbac_update_mssql_trigger extends Migration
->from(['fkc' => 'sys.foreign_key_columns'])
->innerJoin(['c' => 'sys.columns'], 'fkc.parent_object_id = c.object_id AND fkc.parent_column_id = c.column_id')
->innerJoin(['r' => 'sys.columns'], 'fkc.referenced_object_id = r.object_id AND fkc.referenced_column_id = r.column_id')
->where(
[
'AND',
['fkc.parent_object_id' => $this->db->schema->getRawTableName($table)],
['fkc.referenced_object_id' => $this->db->schema->getRawTableName($referenceTable)],
['c.name' => $column],
['r.name' => $referenceColumn],
]
)->scalar($this->db);
->andWhere('fkc.parent_object_id=OBJECT_ID(:fkc_parent_object_id)',[':fkc_parent_object_id' => $this->db->schema->getRawTableName($table)])
->andWhere('fkc.referenced_object_id=OBJECT_ID(:fkc_referenced_object_id)',[':fkc_referenced_object_id' => $this->db->schema->getRawTableName($referenceTable)])
->andWhere(['c.name' => $column])
->andWhere(['r.name' => $referenceColumn])
->scalar($this->db);
}
/**