#!/usr/bin/env php register(MigrationServiceProvider::class); /** @var Handler $errorHandler */ $errorHandler = $app->get(Handler::class); $errorHandler->setHandler(Handler::ENV_PRODUCTION, new NullHandler()); /** @var Migrate $migration */ $migration = $app->get('db.migration'); $migration->setOutput(function ($text) { echo $text . PHP_EOL; }); if (isset($argv[1]) && in_array(strtolower($argv[1]), ['help', '--help', '-h'])) { echo PHP_EOL . 'Usage: ' . $argv[0] . ' [up|down] [one-step]' . PHP_EOL . PHP_EOL; exit; } $method = Migrate::UP; if (isset($argv[1]) && strtolower($argv[1]) == 'down') { $argv = array_values($argv); $method = Migrate::DOWN; } $oneStep = false; if (isset($argv[2]) && strtolower($argv[2]) == 'one-step') { $oneStep = true; } $migration->run($baseDir, $method, $oneStep);