27 lines
806 B
Text
27 lines
806 B
Text
|
#!/usr/bin/env php
|
||
|
<?php
|
||
|
use Index\Data\Migration\DbMigrationManager;
|
||
|
use Index\Data\Migration\FsDbMigrationRepo;
|
||
|
|
||
|
require_once __DIR__ . '/../eeprom.php';
|
||
|
|
||
|
$repo = new FsDbMigrationRepo(PRM_MIGRATIONS);
|
||
|
if(!($repo instanceof FsDbMigrationRepo)) {
|
||
|
echo 'Migration repository type does not support creation of templates.' . PHP_EOL;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
$baseName = implode(' ', array_slice($argv, 1));
|
||
|
$manager = new DbMigrationManager($db, 'prm_' . DbMigrationManager::DEFAULT_TABLE);
|
||
|
|
||
|
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;
|