primary/replica in a definitely non-breaking way (#18106)

This commit is contained in:
Brandon Kelly
2020-06-16 01:33:27 -07:00
committed by GitHub
parent 4c416c7982
commit eb956e9c6b
27 changed files with 212 additions and 214 deletions

View File

@ -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 {