{"record":{"id":"cb2341b0f03ec509","repo":"yiisoft/yii2","slug":"the-migration-name-should-contain-letters-digits","errorCode":null,"errorMessage":"The migration name should contain letters, digits, underscore and/or backslash characters only.","messagePattern":"The migration name should contain letters, digits, underscore and/or backslash characters only\\.","errorType":"exception","errorClass":"yii\\console\\Exception","httpStatus":null,"severity":"error","filePath":"framework/console/controllers/BaseMigrateController.php","lineNumber":660,"sourceCode":"     * ```\n     * yii migrate/create app\\\\migrations\\\\createUserTable\n     * ```\n     *\n     * In case [[migrationPath]] is not set and no namespace is provided, the first entry of [[migrationNamespaces]] will be used.\n     *\n     * @param string $name the name of the new migration. This should only contain\n     * letters, digits, underscores and/or backslashes.\n     *\n     * Note: If the migration name is of a special form, for example create_xxx or\n     * drop_xxx, then the generated migration file will contain extra code,\n     * in this case for creating/dropping tables.\n     *\n     * @throws Exception if the name argument is invalid.\n     */\n    public function actionCreate($name)\n    {\n        if (!preg_match('/^[\\w\\\\\\\\]+$/', $name)) {\n            throw new Exception('The migration name should contain letters, digits, underscore and/or backslash characters only.');\n        }\n\n        list($namespace, $className) = $this->generateClassName($name);\n        // Abort if name is too long\n        $nameLimit = $this->getMigrationNameLimit();\n        if ($nameLimit !== null && strlen($className) > $nameLimit) {\n            throw new Exception('The migration name is too long.');\n        }\n\n        $migrationPath = $this->findMigrationPath($namespace);\n\n        $file = $migrationPath . DIRECTORY_SEPARATOR . $className . '.php';\n        if ($this->confirm(\"Create new migration '$file'?\")) {\n            $content = $this->generateMigrationSourceCode([\n                'name' => $name,\n                'className' => $className,\n                'namespace' => $namespace,\n            ]);","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/console/controllers/BaseMigrateController.php#L642-L678","documentation":"Error \"The migration name should contain letters, digits, underscore and/or backslash characters only.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/console/controllers/BaseMigrateController.php:660 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"}