src/Koldy/Db/Migration/Manager.php
public static function createMigration(string $name): void
    {
        $directory = Application::getApplicationPath('migrations');

        if (!is_dir($directory)) {
            Directory::mkdir($directory, 0755);
        }

        $timestamp = time();
        $className = Util::camelCase($name, null, false);
        $phpClassName = "Migration_{$timestamp}_{$className}";
        $fileName = "{$timestamp}_{$className}.php";
        $fullPath = Application::getApplicationPath("migrations/{$fileName}");

        $migrationFileContent = file_get_contents(__DIR__ . '/MigrationTemplate.php');
        $migrationFileContent = str_replace('templateClassName', $phpClassName, $migrationFileContent);
        $migrationFileContent = str_replace('templateClassGenerated', date('r'), $migrationFileContent);

        if (file_put_contents($fullPath, $migrationFileContent) === false) {
            throw new Application\Exception("Unable to write to migration file on path={$fullPath}");
        }

        Log::info("Created DB migration with name: {$name}");
        Log::info("You may now open application/migrations/{$fileName} and add your migration code");
    }
public static function createMigration(string $name): void
    {
        $directory = Application::getApplicationPath('migrations');

        if (!is_dir($directory)) {
            Directory::mkdir($directory, 0755);
        }

        $timestamp = time();
        $className = Util::camelCase($name, null, false);
        $phpClassName = "Migration_{$timestamp}_{$className}";
        $fileName = "{$timestamp}_{$className}.php";
        $fullPath = Application::getApplicationPath("migrations/{$fileName}");

        $migrationFileContent = file_get_contents(__DIR__ . '/MigrationTemplate.php');
        $migrationFileContent = str_replace('templateClassName', $phpClassName, $migrationFileContent);
        $migrationFileContent = str_replace('templateClassGenerated', date('r'), $migrationFileContent);

        if (file_put_contents($fullPath, $migrationFileContent) === false) {
            throw new Application\Exception("Unable to write to migration file on path={$fullPath}");
        }

        Log::info("Created DB migration with name: {$name}");
        Log::info("You may now open application/migrations/{$fileName} and add your migration code");
    }
public static function createMigration ( string $ name ) : void { $ directory = Application :: getApplicationPath ( 'migrations' ) ; if ( ! is_dir ( $ directory ) ) { Directory :: mkdir ( $ directory , 0755 ) ; } $ timestamp = time ( ) ; $ className = Util :: camelCase ( $ name , null , false ) ; $ phpClassName = "Migration_{$timestamp}_{$className}" ; $ fileName = "{$timestamp}_{$className}.php" ; $ fullPath = Application :: getApplicationPath ( "migrations/{$fileName}" ) ; $ migrationFileContent = file_get_contents ( __DIR__ . '/MigrationTemplate.php' ) ; $ migrationFileContent = str_replace ( 'templateClassName' , $ phpClassName , $ migrationFileContent ) ; $ migrationFileContent = str_replace ( 'templateClassGenerated' , date ( 'r' ) , $ migrationFileContent ) ; if ( file_put_contents ( $ fullPath , $ migrationFileContent ) === false ) { throw new Application \ Exception ( "Unable to write to migration file on path={$fullPath}" ) ; } Log :: info ( "Created DB migration with name: {$name}" ) ; Log :: info ( "You may now open application/migrations/{$fileName} and add your migration code" ) ; }
Create migration with given name

@param string $name

@throws Application\Exception
@throws \Koldy\Config\Exception
@throws \Koldy\Exception
@throws \Koldy\Filesystem\Exception
Create migration with given name