feat: 支持已有表生成代码

This commit is contained in:
JaguarJack
2024-12-22 07:46:20 +08:00
parent 3867be14b2
commit c03213e7c3
2 changed files with 40 additions and 0 deletions

View File

@@ -48,6 +48,18 @@ class Schemas extends CatchModel
*/
public function storeBy(array $data): bool
{
// 从已有 schema 中选择
if (isset($data['schema_name'])) {
$columns = SchemaFacade::getColumnListing($data['schema_name']);
return parent::storeBy([
'module' => $data['module'],
'name' => $data['schema_name'],
'columns' => implode(',', $columns),
'is_soft_delete' => isset($columns['deleted_at']) ? Status::Enable : Status::Disable,
]);
}
$schema = $data['schema'];
$structures = $data['structures'];