public function handle($request) { echo "Mysql migration loader. Version: " . $this->app->parameters['app-version'] . "\n\n"; echo "Usage:\n"; echo " db-migration <command> [--option value]\n"; $commands = $this->getAvaialbeCommands(); echo "\nCommands:\n"; foreach ($commands as $key => $value) { echo sprintf(" %-15s %s\n", $key, $value); } echo "\nOptions:\n"; echo " Full name | Short | Default | Note\n"; echo "-----------------------------------------------------\n"; echo " --clean no (yes|no) Clean output, no headers\n"; echo " --config -f db-migration.yml Path to config YML file. Default at current folder\n"; echo " --migrations -m migrations Path to migration scripts, repeatable option\n"; echo " --driver -r mysql Database driver\n"; $drivers = $this->getAvaialbeDrivers(); foreach ($drivers as $driver_name) { $c_name = Utilities::strToClassName($driver_name); $c_name = 'Reactor\\DbMigration\\Drivers\\' . $c_name . 'Driver'; $driver = new $c_name(); $argumets = $driver->getDefaults(); echo "\n'{$driver_name}' driver:\n"; echo " Full name | Short | Default | Note\n"; echo "-----------------------------------------------------\n"; foreach ($argumets as $value) { echo sprintf(" --%-16s -%-6s %-18s %s\n", $value[0], $value[1], $value[2], $value[3]); } } echo "\nAll options can be specified in YML file. Pleae use full name of option.\n\n"; }
public function handleBody() { $this->loadCommonParameters(); if (!$this->app->parameters['clean']) { $this->welcome(); } $command = $this->getCommand(); $c_name = Utilities::strToClassName($command); $c_name = 'Reactor\\DbMigration\\CliControllers\\' . $c_name . 'Controller'; if (!class_exists($c_name)) { throw new \Exception("No such command '{$command}'", 1); } $command_ctrl = new $c_name($this->app); $command_ctrl->handle($this->request); }