mirror of
https://github.com/elyby/accounts.git
synced 2024-08-25 13:59:53 +05:30
Исправлена ошибка доступа к authserver из-за перехода на использование хостов, а не доменов
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
use console\db\Migration;
|
|
|
|
class m160919_170008_improve_username_history extends Migration {
|
|
|
|
public function safeUp() {
|
|
$this->execute('
|
|
INSERT INTO {{%usernames_history}} (account_id, username, applied_in)
|
|
SELECT id as account_id, username, created_at as applied_at
|
|
FROM {{%accounts}}
|
|
');
|
|
$this->createIndex('applied_in', '{{%usernames_history}}', 'applied_in');
|
|
$this->createIndex('username', '{{%usernames_history}}', 'username');
|
|
}
|
|
|
|
public function safeDown() {
|
|
$this->dropIndex('applied_in', '{{%usernames_history}}');
|
|
$this->dropIndex('username', '{{%usernames_history}}');
|
|
$this->execute('
|
|
DELETE FROM {{%usernames_history}}
|
|
WHERE id IN (
|
|
SELECT t1.id
|
|
FROM (
|
|
SELECT id, MIN(applied_in)
|
|
FROM {{%usernames_history}}
|
|
GROUP BY account_id
|
|
) t1
|
|
)
|
|
');
|
|
}
|
|
|
|
}
|