mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
primary/replica in a definitely non-breaking way (#18106)
This commit is contained in:
@ -206,7 +206,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
$tableName = $db->quoteTableName($tableName);
|
||||
if ($value === null) {
|
||||
$key = $this->db->quoteColumnName(reset($table->primaryKey));
|
||||
$value = $this->db->usePrimary(function (Connection $db) use ($key, $tableName) {
|
||||
$value = $this->db->useMaster(function (Connection $db) use ($key, $tableName) {
|
||||
return $db->createCommand("SELECT MAX($key) FROM $tableName")->queryScalar();
|
||||
});
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user