Удаляем уникальный индекс для поля client_token в таблице minecraft_access_keys

This commit is contained in:
ErickSkrauch 2016-10-25 02:43:27 +03:00
parent 945f02e4ab
commit 20b0076672
2 changed files with 16 additions and 1 deletions

View File

@ -69,8 +69,8 @@ class AuthenticationForm extends Form {
protected function createMinecraftAccessToken(Account $account) : MinecraftAccessKey { protected function createMinecraftAccessToken(Account $account) : MinecraftAccessKey {
/** @var MinecraftAccessKey|null $accessTokenModel */ /** @var MinecraftAccessKey|null $accessTokenModel */
$accessTokenModel = MinecraftAccessKey::findOne([ $accessTokenModel = MinecraftAccessKey::findOne([
'client_token' => $this->clientToken,
'account_id' => $account->id, 'account_id' => $account->id,
'client_token' => $this->clientToken,
]); ]);
if ($accessTokenModel === null) { if ($accessTokenModel === null) {

View File

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