Browse Source

MigrateCommand enhancement. `all` option added for `down` action.

tags/2.0.0-rc
Alexander Kochetov 11 years ago
parent
commit
5f2101893e
  1. 8
      framework/console/controllers/MigrateController.php

8
framework/console/controllers/MigrateController.php

@ -203,7 +203,13 @@ class MigrateController extends Controller
*/ */
public function actionDown($limit = 1) 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) { if ($limit < 1) {
throw new Exception("The step argument must be greater than 0."); throw new Exception("The step argument must be greater than 0.");
} }

Loading…
Cancel
Save