增加 optimize:schema 命令 用于生成 数据表字段信息缓存

This commit is contained in:
thinkphp
2016-09-18 17:01:55 +08:00
parent 09598e67b3
commit 2b476fe7ff
5 changed files with 67 additions and 7 deletions

View File

@@ -1375,7 +1375,12 @@ class Query
list($guid) = explode(' ', $tableName);
if (!isset(self::$info[$guid])) {
$info = $this->connection->getFields($tableName);
// 读取缓存
if (is_file(RUNTIME_PATH . 'schema/' . $guid . '.php')) {
$info = include RUNTIME_PATH . 'schema/' . $guid . '.php';
} else {
$info = $this->connection->getFields($guid);
}
$fields = array_keys($info);
$bind = $type = [];
foreach ($info as $key => $val) {