| 123456789101112131415161718192021222324252627282930 |
- #!/usr/bin/env php
- <?php
- declare(strict_types=1);
- require __DIR__ . '/../vendor/autoload.php';
- $argv = $_SERVER['argv'] ?? [];
- $command = $argv[1] ?? null;
- switch ($command) {
- case 'db:migrate':
- $cmd = sprintf(
- '%s --configuration=%s',
- escapeshellarg(__DIR__ . '/../vendor/bin/phinx') . ' migrate',
- escapeshellarg(__DIR__ . '/../config/phinx.php')
- );
- passthru($cmd, $exitCode);
- exit($exitCode);
- case null:
- case '--help':
- case '-h':
- fwrite(STDOUT, "Usage: console <command>\n\nCommands:\n db:migrate Run Phinx migrations\n");
- exit(0);
- default:
- fwrite(STDERR, "Unknown command: {$command}\n");
- exit(1);
- }
|