diff --git a/library/think/console/command/optimize/Schema.php b/library/think/console/command/optimize/Schema.php index 2da00037..6d50d5f7 100644 --- a/library/think/console/command/optimize/Schema.php +++ b/library/think/console/command/optimize/Schema.php @@ -84,12 +84,14 @@ class Schema extends Command protected function buildModelSchema($class) { - $table = $class::getTable(); - $dbName = $class::getConfig('database'); - $content = '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 = 'getFields($table); + $content .= var_export($info, true) . ';'; + file_put_contents(RUNTIME_PATH . 'schema' . DS . $dbName . '.' . $table . EXT, $content); + } } protected function buildDataBaseSchema($tables, $db)