mirror of
https://github.com/elyby/accounts.git
synced 2024-11-09 23:12:20 +05:30
35 lines
912 B
PHP
35 lines
912 B
PHP
<?php
|
|
|
|
use console\db\Migration;
|
|
|
|
class m161030_013122_ely_by_admin_app extends Migration {
|
|
|
|
public function safeUp() {
|
|
$exists = $this->db->createCommand('
|
|
SELECT COUNT(*)
|
|
FROM {{%oauth_clients}}
|
|
WHERE id = :app_name
|
|
LIMIT 1
|
|
', [
|
|
'app_name' => 'ely_admin',
|
|
])->queryScalar();
|
|
|
|
if (!$exists) {
|
|
$this->insert('{{%oauth_clients}}', [
|
|
'id' => 'ely_admin',
|
|
'secret' => 'change_this_on_production',
|
|
'name' => 'Admin Ely.by',
|
|
'description' => '',
|
|
'redirect_uri' => 'http://admin.ely.by/authorization/oauth',
|
|
'is_trusted' => 1,
|
|
'created_at' => time(),
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function safeDown() {
|
|
$this->delete('{{%oauth_clients}}', ['id' => 'ely_admin']);
|
|
}
|
|
|
|
}
|