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); }