{"record":{"id":"fc7b25bb6e3c005f","repo":"yiisoft/yii2","slug":"the-limit-must-be-greater-than-0","errorCode":null,"errorMessage":"The limit must be greater than 0.","messagePattern":"The limit must be greater than 0\\.","errorType":"exception","errorClass":"yii\\console\\Exception","httpStatus":null,"severity":"error","filePath":"framework/console/controllers/BaseMigrateController.php","lineNumber":557,"sourceCode":"     *\n     * ```\n     * yii migrate/history     # showing the last 10 migrations\n     * yii migrate/history 5   # showing the last 5 migrations\n     * yii migrate/history all # showing the whole history\n     * ```\n     *\n     * @param int|string $limit the maximum number of migrations to be displayed.\n     * If it is \"all\", the whole migration history will be displayed.\n     * @throws \\yii\\console\\Exception if invalid limit value passed\n     */\n    public function actionHistory($limit = 10)\n    {\n        if ($limit === 'all') {\n            $limit = null;\n        } else {\n            $limit = (int) $limit;\n            if ($limit < 1) {\n                throw new Exception('The limit 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        } else {\n            $n = count($migrations);\n            if ($limit > 0) {\n                $this->stdout(\"Showing the last $n applied \" . ($n === 1 ? 'migration' : 'migrations') . \":\\n\", Console::FG_YELLOW);\n            } else {\n                $this->stdout(\"Total $n \" . ($n === 1 ? 'migration has' : 'migrations have') . \" been applied before:\\n\", Console::FG_YELLOW);\n            }\n            foreach ($migrations as $version => $time) {\n                $this->stdout(\"\\t(\" . date('Y-m-d H:i:s', $time) . ') ' . $version . \"\\n\");\n            }\n        }","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/console/controllers/BaseMigrateController.php#L539-L575","documentation":"Error \"The limit must be greater than 0.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/console/controllers/BaseMigrateController.php:557 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"}