From 774a7b52cbf8ddfac70fd7fe4507a2eec8f35242 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 25 May 2013 00:16:30 +0400 Subject: [PATCH] yiic migrate/create should not require db component --- framework/yii/console/controllers/MigrateController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/framework/yii/console/controllers/MigrateController.php b/framework/yii/console/controllers/MigrateController.php index 0acc672..b437450 100644 --- a/framework/yii/console/controllers/MigrateController.php +++ b/framework/yii/console/controllers/MigrateController.php @@ -115,11 +115,13 @@ class MigrateController extends Controller } $this->migrationPath = $path; - if (is_string($this->db)) { - $this->db = Yii::$app->getComponent($this->db); - } - if (!$this->db instanceof Connection) { - throw new Exception("The 'db' option must refer to the application component ID of a DB connection."); + if($action->id!=='create') { + if (is_string($this->db)) { + $this->db = Yii::$app->getComponent($this->db); + } + if (!$this->db instanceof Connection) { + throw new Exception("The 'db' option must refer to the application component ID of a DB connection."); + } } $version = Yii::getVersion();