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,FsDbMigrationRepo};
|
2023-08-16 21:18:12 +00:00
|
|
|
|
|
|
|
require_once __DIR__ . '/../mince.php';
|
|
|
|
|
2025-01-22 13:30:21 +00:00
|
|
|
echo 'Creating migration manager...' . PHP_EOL;
|
|
|
|
$manager = $mince->dbCtx->createMigrationManager();
|
2023-08-16 21:18:12 +00:00
|
|
|
|
2025-01-22 13:30:21 +00:00
|
|
|
echo 'Preparing to run migrations...' . PHP_EOL;
|
|
|
|
$manager->init();
|
2023-08-16 21:18:12 +00:00
|
|
|
|
2025-01-22 13:30:21 +00:00
|
|
|
echo 'Creating migration repository...' . PHP_EOL;
|
|
|
|
$repo = $mince->dbCtx->createMigrationRepo();
|
2023-08-16 21:18:12 +00:00
|
|
|
|
2025-01-22 13:30:21 +00:00
|
|
|
echo 'Running migrations...' . PHP_EOL;
|
|
|
|
$completed = $manager->processMigrations($repo);
|
2023-08-16 21:18:12 +00:00
|
|
|
|
2025-01-22 13:30:21 +00:00
|
|
|
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;
|
|
|
|
}
|
2023-08-16 21:18:12 +00:00
|
|
|
|
2025-01-22 13:30:21 +00:00
|
|
|
echo PHP_EOL;
|
2023-08-16 21:18:12 +00:00
|
|
|
|