public function actionCreate(RequestApplicationInterface $app, $name)
    {
        if (!preg_match('/^[\w\\\\]+$/', $name)) {
            throw new Exception('The migration name should contain letters, digits, underscore and/or backslash characters only.');
        }

        list($namespace, $className) = $this->generateClassName($name);
        // Abort if name is too long
        $nameLimit = $this->getMigrationNameLimit();
        if ($nameLimit !== null && strlen($className) > $nameLimit) {
            throw new Exception('The migration name is too long.');
        }

        $migrationPath = $this->findMigrationPath($namespace);

        $file = $migrationPath . DIRECTORY_SEPARATOR . $className . '.php';
        return $this->confirm("Create new migration '$file'?")->then(
            function() use ($app, $name, $className, $namespace, $migrationPath, $file) {
                $content = $this->generateMigrationSourceCode([
                    'name' => $name,
                    'className' => $className,
                    'namespace' => $namespace,
                ], $app);
                FileHelper::createDirectory($migrationPath);
                file_put_contents($file, $content, LOCK_EX);
                $this->stdout("New migration created successfully.\n", Console::FG_GREEN);
                return true;
            }
        );
    }
public function actionCreate(RequestApplicationInterface $app, $name)
    {
        if (!preg_match('/^[\w\\\\]+$/', $name)) {
            throw new Exception('The migration name should contain letters, digits, underscore and/or backslash characters only.');
        }

        list($namespace, $className) = $this->generateClassName($name);
        // Abort if name is too long
        $nameLimit = $this->getMigrationNameLimit();
        if ($nameLimit !== null && strlen($className) > $nameLimit) {
            throw new Exception('The migration name is too long.');
        }

        $migrationPath = $this->findMigrationPath($namespace);

        $file = $migrationPath . DIRECTORY_SEPARATOR . $className . '.php';
        return $this->confirm("Create new migration '$file'?")->then(
            function() use ($app, $name, $className, $namespace, $migrationPath, $file) {
                $content = $this->generateMigrationSourceCode([
                    'name' => $name,
                    'className' => $className,
                    'namespace' => $namespace,
                ], $app);
                FileHelper::createDirectory($migrationPath);
                file_put_contents($file, $content, LOCK_EX);
                $this->stdout("New migration created successfully.\n", Console::FG_GREEN);
                return true;
            }
        );
    }
public function actionCreate ( RequestApplicationInterface $ app , $ name ) { if ( ! preg_match ( '/^[\w\\\\]+$/' , $ name ) ) { throw new Exception ( 'The migration name should contain letters, digits, underscore and/or backslash characters only.' ) ; } list ( $ namespace , $ className ) = $ this -> generateClassName ( $ name ) ; // Abort if name is too long $ nameLimit = $ this -> getMigrationNameLimit ( ) ; if ( $ nameLimit !== null && strlen ( $ className ) > $ nameLimit ) { throw new Exception ( 'The migration name is too long.' ) ; } $ migrationPath = $ this -> findMigrationPath ( $ namespace ) ; $ file = $ migrationPath . DIRECTORY_SEPARATOR . $ className . '.php' ; return $ this -> confirm ( "Create new migration '$file'?" ) -> then ( function ( ) use ( $ app , $ name , $ className , $ namespace , $ migrationPath , $ file ) { $ content = $ this -> generateMigrationSourceCode ( [ 'name' => $ name , 'className' => $ className , 'namespace' => $ namespace , ] , $ app ) ; FileHelper :: createDirectory ( $ migrationPath ) ; file_put_contents ( $ file , $ content , LOCK_EX ) ; $ this -> stdout ( "New migration created successfully.\n" , Console :: FG_GREEN ) ; return true ; } ) ; }
Creates a new migration.

This command creates a new migration using the available migration template.
After using this command, developers should modify the created migration
skeleton by filling up the actual migration logic.

```
console migrate/create create_user_table
```

In order to generate a namespaced migration, you should specify a namespace before the migration's name.
Note that backslash (`\`) is usually considered a special character in the shell, so you need to escape it
properly to avoid shell errors or incorrect behavior.
For example:

```
console migrate/create 'app\\migrations\\createUserTable'
```

In case [[migrationPath]] is not set and no namespace is provided, the first entry of [[migrationNamespaces]] will be used.

@param RequestApplicationInterface $app
@param string                      $name the name of the new migration. This should only contain
letters, digits, underscores and/or backslashes.

Note: If the migration name is of a special form, for example create_xxx or
drop_xxx, then the generated migration file will contain extra code,
in this case for creating/dropping tables.

@return ExtendedPromiseInterface
@throws Exception if the name argument is invalid.
@throws \Reaction\Exceptions\Exception
Creates a new migration .