2016-08-09 00:50:24 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
use console\db\Migration;
|
|
|
|
|
|
|
|
class m160808_191142_ely_by_app extends Migration {
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function safeUp(): void {
|
2016-08-09 00:50:24 +05:30
|
|
|
$exists = $this->db->createCommand('
|
|
|
|
SELECT COUNT(*)
|
|
|
|
FROM {{%oauth_clients}}
|
|
|
|
WHERE id = "ely"
|
|
|
|
LIMIT 1
|
|
|
|
')->queryScalar();
|
|
|
|
|
|
|
|
if (!$exists) {
|
|
|
|
$this->insert('{{%oauth_clients}}', [
|
|
|
|
'id' => 'ely',
|
|
|
|
'secret' => 'change_this_on_production',
|
|
|
|
'name' => 'Ely.by',
|
|
|
|
'description' => '',
|
|
|
|
'redirect_uri' => 'http://ely.by/authorization/oauth',
|
|
|
|
'is_trusted' => 1,
|
|
|
|
'created_at' => time(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function safeDown(): void {
|
2016-08-09 00:50:24 +05:30
|
|
|
$this->delete('{{%oauth_clients}}', ['id' => 'ely']);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|