diff --git a/src/Command.php b/src/Command.php index d22d6ca..f720dfa 100644 --- a/src/Command.php +++ b/src/Command.php @@ -17,6 +17,8 @@ use think\facade\Config; abstract class Command extends \think\console\Command { + protected $config = 'database'; + public function getAdapter() { if (isset($this->adapter)) { diff --git a/src/command/Migrate.php b/src/command/Migrate.php index 18e0b77..0659b8e 100644 --- a/src/command/Migrate.php +++ b/src/command/Migrate.php @@ -17,7 +17,6 @@ use Phinx\Migration\AbstractMigration; use Phinx\Migration\MigrationInterface; use Phinx\Util\Util; use think\console\Input; -use think\console\input\Option as InputOption; use think\console\Output; use think\facade\Env; use think\migration\Command; @@ -30,27 +29,9 @@ abstract class Migrate extends Command */ protected $migrations; - public function __construct($name = null) - { - - parent::__construct($name); - - $this->addOption('--config', null, InputOption::VALUE_REQUIRED, 'The database config name', 'database'); - } - - /** - * 初始化 - * @param Input $input An InputInterface instance - * @param Output $output An OutputInterface instance - */ - protected function initialize(Input $input, Output $output) - { - $this->config = $input->getOption('config'); - } - protected function getPath() { - return $this->getConfig('path', Env::get('root_path') . 'database') . DIRECTORY_SEPARATOR . 'migrations' . ('database' !== $this->config ? DIRECTORY_SEPARATOR . $this->config : ''); + return Env::get('root_path') . 'database' . DIRECTORY_SEPARATOR . 'migrations'; } protected function executeMigration(MigrationInterface $migration, $direction = MigrationInterface::UP) diff --git a/src/command/Seed.php b/src/command/Seed.php index e3666f5..8639dda 100644 --- a/src/command/Seed.php +++ b/src/command/Seed.php @@ -27,7 +27,7 @@ abstract class Seed extends Command protected function getPath() { - return $this->getConfig('path', Env::get('root_path') . 'database') . DIRECTORY_SEPARATOR . 'seeds'; + return Env::get('root_path') . 'database' . DIRECTORY_SEPARATOR . 'seeds'; } public function getSeeds()