mirror of
https://github.com/elyby/accounts.git
synced 2024-11-09 23:12:20 +05:30
30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
use console\db\Migration;
|
||
|
|
||
|
class m180224_132027_extend_oauth_clients_attributes extends Migration {
|
||
|
|
||
|
public function safeUp() {
|
||
|
$this->addColumn('{{%oauth_clients}}', 'type', $this->string()->notNull()->after('secret'));
|
||
|
$this->addColumn('{{%oauth_clients}}', 'website_url', $this->string()->null()->after('redirect_uri'));
|
||
|
$this->addColumn('{{%oauth_clients}}', 'minecraft_server_ip', $this->string()->null()->after('website_url'));
|
||
|
$this->addColumn('{{%oauth_clients}}', 'is_deleted', $this->boolean()->notNull()->defaultValue(false)->after('is_trusted'));
|
||
|
$this->update('{{%oauth_clients}}', [
|
||
|
'type' => 'application',
|
||
|
]);
|
||
|
$this->addColumn('{{%oauth_sessions}}', 'created_at', $this->integer()->unsigned()->notNull());
|
||
|
$this->update('{{%oauth_sessions}}', [
|
||
|
'created_at' => time(),
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
public function safeDown() {
|
||
|
$this->dropColumn('{{%oauth_clients}}', 'type');
|
||
|
$this->dropColumn('{{%oauth_clients}}', 'website_url');
|
||
|
$this->dropColumn('{{%oauth_clients}}', 'minecraft_server_ip');
|
||
|
$this->dropColumn('{{%oauth_clients}}', 'is_deleted');
|
||
|
$this->dropColumn('{{%oauth_sessions}}', 'created_at');
|
||
|
}
|
||
|
|
||
|
}
|