34 lines
915 B
Text
Executable file
34 lines
915 B
Text
Executable file
#!/usr/bin/env php8.2
|
|
<?php
|
|
use Index\Data\Migration\FsDbMigrationRepo;
|
|
|
|
require_once __DIR__ . '/../makai.php';
|
|
|
|
try {
|
|
touch(MKI_ROOT . '/.migrating');
|
|
chmod(MKI_ROOT . '/.migrating', 0777);
|
|
|
|
echo 'Creating migration manager...' . PHP_EOL;
|
|
$manager = $makai->createMigrationManager();
|
|
|
|
echo 'Preparing to run migrations...' . PHP_EOL;
|
|
$manager->init();
|
|
|
|
echo 'Creating migration repository...' . PHP_EOL;
|
|
$repo = $makai->createMigrationRepo();
|
|
|
|
echo 'Running migrations...' . PHP_EOL;
|
|
$completed = $manager->processMigrations($repo);
|
|
|
|
if(empty($completed)) {
|
|
echo 'There were no migrations to run!' . PHP_EOL;
|
|
} else {
|
|
echo 'The following migrations have been completed:' . PHP_EOL;
|
|
foreach($completed as $migration)
|
|
echo ' - ' . $migration . PHP_EOL;
|
|
}
|
|
|
|
echo PHP_EOL;
|
|
} finally {
|
|
unlink(MKI_ROOT . '/.migrating');
|
|
}
|