diff --git a/framework/yii/console/controllers/MigrateController.php b/framework/yii/console/controllers/MigrateController.php
index <HASH>..<HASH> 100644
--- a/framework/yii/console/controllers/MigrateController.php
+++ b/framework/yii/console/controllers/MigrateController.php
@@ -584,7 +584,7 @@ class MigrateController extends Controller
 			->from($this->migrationTable)
 			->orderBy('version DESC')
 			->limit($limit)
-			->createCommand()
+			->createCommand($this->db)
 			->queryAll();
 		$history = ArrayHelper::map($rows, 'version', 'apply_time');
 		unset($history[self::BASE_MIGRATION]);
Fix Issue #<I>

Fixes issue #<I>. Command is created for the selected database, not the default database.