{"record":{"id":"7e41bb167b319b36","repo":"yiisoft/yii2","slug":"the-step-argument-must-be-greater-than-0","errorCode":null,"errorMessage":"The step argument must be greater than 0.","messagePattern":"The step argument must be greater than 0\\.","errorType":"exception","errorClass":"yii\\console\\Exception","httpStatus":null,"severity":"error","filePath":"framework/console/controllers/BaseMigrateController.php","lineNumber":264,"sourceCode":"     * yii migrate/down     # revert the last migration\n     * yii migrate/down 3   # revert the last 3 migrations\n     * yii migrate/down all # revert all migrations\n     * ```\n     *\n     * @param int|string $limit the number of migrations to be reverted. Defaults to 1,\n     * meaning the last applied migration will be reverted. When value is \"all\", all migrations will be reverted.\n     * @throws Exception if the number of the steps specified is less than 1.\n     *\n     * @return int the status of the action execution. 0 means normal, other values mean abnormal.\n     */\n    public function actionDown($limit = 1)\n    {\n        if ($limit === 'all') {\n            $limit = null;\n        } else {\n            $limit = (int) $limit;\n            if ($limit < 1) {\n                throw new Exception('The step argument must be greater than 0.');\n            }\n        }\n\n        $migrations = $this->getMigrationHistory($limit);\n\n        if (empty($migrations)) {\n            $this->stdout(\"No migration has been done before.\\n\", Console::FG_YELLOW);\n\n            return ExitCode::OK;\n        }\n\n        $migrations = array_keys($migrations);\n\n        $n = count($migrations);\n        $this->stdout(\"Total $n \" . ($n === 1 ? 'migration' : 'migrations') . \" to be reverted:\\n\", Console::FG_YELLOW);\n        foreach ($migrations as $migration) {\n            $this->stdout(\"\\t$migration\\n\");\n        }","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/console/controllers/BaseMigrateController.php#L246-L282","documentation":"Error \"The step argument must be greater than 0.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/console/controllers/BaseMigrateController.php:264 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}