From 5f2101893eb132ebfb74c4a12f12aeb46c0a61b1 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Fri, 9 May 2014 18:30:38 +0400 Subject: [PATCH] MigrateCommand enhancement. `all` option added for `down` action. --- framework/console/controllers/MigrateController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/console/controllers/MigrateController.php b/framework/console/controllers/MigrateController.php index 77fbbc98d1..4ee560010d 100644 --- a/framework/console/controllers/MigrateController.php +++ b/framework/console/controllers/MigrateController.php @@ -203,7 +203,13 @@ class MigrateController extends Controller */ public function actionDown($limit = 1) { - $limit = (int) $limit; + if ($limit === 'all') { + $query = new Query; + $limit = $query->from($this->migrationTable)->count(); + } else { + $limit = (int) $limit; + } + if ($limit < 1) { throw new Exception("The step argument must be greater than 0."); }