diff --git a/src/Command.php b/src/Command.php index 75504b7..b4db21f 100644 --- a/src/Command.php +++ b/src/Command.php @@ -41,7 +41,9 @@ public function getAdapter() */ protected function getDbConfig(): array { - $config = $this->app->config->get('database'); + $default = $this->app->config->get('database.default'); + + $config = $this->app->config->get("database.connections.{$default}"); if (0 == $config['deploy']) { $dbConfig = [ @@ -67,7 +69,9 @@ protected function getDbConfig(): array ]; } - $dbConfig['default_migration_table'] = $dbConfig['table_prefix'] . ($config['migration_table'] ?? 'migrations'); + $table = $this->app->config->get('database.migration_table', 'migrations'); + + $dbConfig['default_migration_table'] = $dbConfig['table_prefix'] . $table; return $dbConfig; } diff --git a/src/command/migrate/Run.php b/src/command/migrate/Run.php index 1a7d437..4714f02 100644 --- a/src/command/migrate/Run.php +++ b/src/command/migrate/Run.php @@ -23,10 +23,10 @@ class Run extends Migrate protected function configure() { $this->setName('migrate:run') - ->setDescription('Migrate the database') - ->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to migrate to') - ->addOption('--date', '-d', InputOption::VALUE_REQUIRED, 'The date to migrate to') - ->setHelp(<<setDescription('Migrate the database') + ->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to migrate to') + ->addOption('--date', '-d', InputOption::VALUE_REQUIRED, 'The date to migrate to') + ->setHelp(<<migrate:run command runs all available migrations, optionally up to a specific version php think migrate:run @@ -35,7 +35,7 @@ protected function configure() php think migrate:run -v EOT - ); + ); } /** @@ -43,7 +43,6 @@ protected function configure() * * @param Input $input * @param Output $output - * @return integer integer 0 on success, or an error code. */ protected function execute(Input $input, Output $output) {