改进模型的字段缓存 虚拟模型不生成字段缓存

This commit is contained in:
thinkphp
2016-09-19 16:13:57 +08:00
parent fb52e8a421
commit 64b4a53de7

View File

@@ -84,12 +84,14 @@ class Schema extends Command
protected function buildModelSchema($class)
{
$table = $class::getTable();
$dbName = $class::getConfig('database');
$content = '<?php ' . PHP_EOL . 'return ';
$info = $class::getConnection()->getFields($table);
$content .= var_export($info, true) . ';';
file_put_contents(RUNTIME_PATH . 'schema' . DS . $dbName . '.' . $table . EXT, $content);
if ($class instanceof \think\Model) {
$table = $class::getTable();
$dbName = $class::getConfig('database');
$content = '<?php ' . PHP_EOL . 'return ';
$info = $class::getConnection()->getFields($table);
$content .= var_export($info, true) . ';';
file_put_contents(RUNTIME_PATH . 'schema' . DS . $dbName . '.' . $table . EXT, $content);
}
}
protected function buildDataBaseSchema($tables, $db)