From c1a2db30c76441d8175cb4b71783866ea7901281 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 20 Sep 2016 10:45:10 +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=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/console/command/optimize/Schema.php | 8 ++++++-- library/think/db/Query.php | 12 +++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/library/think/console/command/optimize/Schema.php b/library/think/console/command/optimize/Schema.php index 7ed6d1e7..a1f40cd9 100644 --- a/library/think/console/command/optimize/Schema.php +++ b/library/think/console/command/optimize/Schema.php @@ -72,7 +72,6 @@ class Schema extends Command $output->writeln('Succeed!'); return; } else { - $dbName = Db::getConfig('database'); $tables = Db::getTables(); } @@ -97,11 +96,16 @@ class Schema extends Command protected function buildDataBaseSchema($tables, $db) { + if ('' == $db) { + $dbName = Db::getConfig('database') . '.'; + } else { + $dbName = $db; + } foreach ($tables as $table) { $content = 'getConfig('database') . '.' . $guid; - } if (!isset(self::$info[$guid])) { + if (!strpos($guid, '.')) { + $schema = $this->getConfig('database') . '.' . $guid; + } else { + $schema = $guid; + } // 读取缓存 - if (is_file(RUNTIME_PATH . 'schema/' . $guid . '.php')) { - $info = include RUNTIME_PATH . 'schema/' . $guid . '.php'; + if (is_file(RUNTIME_PATH . 'schema/' . $schema . '.php')) { + $info = include RUNTIME_PATH . 'schema/' . $schema . '.php'; } else { $info = $this->connection->getFields($guid); }