From 696bbaea4c4135a6684a4f6321b9d28cbf146053 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sun, 30 Oct 2016 01:35:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D1=82=D0=BE=D0=B6=D0=B5?= =?UTF-8?q?=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D1=83=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=90=D0=BA?= =?UTF-8?q?=D0=BA=D0=B0=D1=83=D0=BD=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m161030_013122_ely_by_admin_app.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 console/migrations/m161030_013122_ely_by_admin_app.php 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]); + } + +}