From 8c86ed3656dd5e0556dd535dcc023c4af92ceb11 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 18 Sep 2016 19:20:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=95=B0=E6=8D=AE=E8=A1=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=BC=93=E5=AD=98=E7=94=9F=E6=88=90=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=94=9F=E6=88=90=E5=A4=9A=E4=B8=AA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/console/command/optimize/Schema.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/library/think/console/command/optimize/Schema.php b/library/think/console/command/optimize/Schema.php index 0cc3d3df..a81d6d57 100644 --- a/library/think/console/command/optimize/Schema.php +++ b/library/think/console/command/optimize/Schema.php @@ -24,7 +24,8 @@ class Schema extends Command protected function configure() { $this->setName('optimize:schema') - ->addOption('table', null, Option::VALUE_REQUIRED, 'Build table schema cache .') + ->addOption('db', null, Option::VALUE_REQUIRED, 'db name .') + ->addOption('table', null, Option::VALUE_REQUIRED, 'table name .') ->setDescription('Build database schema cache.'); } @@ -33,18 +34,24 @@ class Schema extends Command if ($input->hasOption('table')) { $tables[] = $input->getOption('table'); } else { - $tables = Db::getTables(); + if ($input->hasOption('db')) { + $dbName = $input->getOption('db'); + $tables = Db::getTables($dbName); + } else { + $tables = Db::getTables(); + } } if (!is_dir(RUNTIME_PATH . 'schema')) { @mkdir(RUNTIME_PATH . 'schema', 0755, true); } + $db = isset($dbName) ? $dbName . '.' : ''; foreach ($tables as $table) { $content = 'writeln('Succeed!');