mince/tools/new-migration

21 lines
565 B
Text
Raw Permalink Normal View History

2023-08-16 21:18:12 +00:00
#!/usr/bin/env php
<?php
2024-10-05 14:48:18 +00:00
use Index\Db\Migration\DbMigrationManager;
2023-08-16 21:18:12 +00:00
require_once __DIR__ . '/../mince.php';
$repo = new FsDbMigrationRepo(MCR_DIR_MIG);
$baseName = implode(' ', array_slice($argv, 1));
$manager = new DbMigrationManager($db);
try {
$names = $manager->createNames($baseName);
} catch(InvalidArgumentException $ex) {
echo $ex->getMessage() . PHP_EOL;
return;
}
$repo->saveMigrationTemplate($names->name, $manager->template($names->className));
echo "Template for '{$names->className}' has been saved to {$names->name}.php." . PHP_EOL;