diff --git a/console/migrations/m161030_013122_ely_by_admin_app.php b/console/migrations/m161030_013122_ely_by_admin_app.php new file mode 100644 index 0000000..49fa91b --- /dev/null +++ b/console/migrations/m161030_013122_ely_by_admin_app.php @@ -0,0 +1,36 @@ +db->createCommand(' + SELECT COUNT(*) + FROM {{%oauth_clients}} + WHERE id = :app_name + LIMIT 1 + ', [ + 'app_name' => self::APP_NAME, + ])->queryScalar(); + + if (!$exists) { + $this->insert('{{%oauth_clients}}', [ + 'id' => self::APP_NAME, + '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' => self::APP_NAME]); + } + +}