1
0

console 732 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env php
  2. <?php
  3. declare(strict_types=1);
  4. require __DIR__ . '/../vendor/autoload.php';
  5. $argv = $_SERVER['argv'] ?? [];
  6. $command = $argv[1] ?? null;
  7. switch ($command) {
  8. case 'db:migrate':
  9. $cmd = sprintf(
  10. '%s --configuration=%s',
  11. escapeshellarg(__DIR__ . '/../vendor/bin/phinx') . ' migrate',
  12. escapeshellarg(__DIR__ . '/../config/phinx.php')
  13. );
  14. passthru($cmd, $exitCode);
  15. exit($exitCode);
  16. case null:
  17. case '--help':
  18. case '-h':
  19. fwrite(STDOUT, "Usage: console <command>\n\nCommands:\n db:migrate Run Phinx migrations\n");
  20. exit(0);
  21. default:
  22. fwrite(STDERR, "Unknown command: {$command}\n");
  23. exit(1);
  24. }