Добавлен индекс для таблицы oauth_sessions

This commit is contained in:
ErickSkrauch 2017-04-15 23:01:13 +03:00
parent 9f376a8d00
commit bc3a4112eb
2 changed files with 16 additions and 1 deletions

View File

@ -52,7 +52,7 @@ class SessionStorage extends AbstractStorage implements SessionInterface {
->andWhere([
'client_id' => $clientId,
'owner_type' => $ownerType,
'owner_id' => $ownerId,
'owner_id' => (string)$ownerId, // Переводим в строку, чтобы работали индексы, т.к. поле varchar
])->scalar();
if ($sessionId === false) {

View File

@ -0,0 +1,15 @@
<?php
use console\db\Migration;
class m170415_195802_oauth_sessions_owner_id_index extends Migration {
public function safeUp() {
$this->createIndex('owner_id', '{{%oauth_sessions}}', 'owner_id');
}
public function safeDown() {
$this->dropIndex('owner_id', '{{%oauth_sessions}}');
}
}