mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进模型的字段缓存 虚拟模型不生成字段缓存
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user