feat: 更新数据库时支持同步保存子表配置和DDL

- UpdateDatabaseRequest 添加 SubTables 字段
- 数据库更新时同步创建或更新子表记录
- 支持子表 DDL 的保存

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 10:33:30 +08:00
parent c917d6b04c
commit 2eddc53249
4 changed files with 75 additions and 15 deletions

View File

@@ -119,6 +119,7 @@ func (s *SubTableService) Create(req model.CreateSubTableRequest) (*model.SubTab
MappingType: req.MappingType,
RelationField: req.RelationField,
RelationType: req.RelationType,
DDL: req.DDL,
}
if err := s.repo.Create(info); err != nil {
@@ -196,6 +197,8 @@ func (s *SubTableService) Update(id string, req model.UpdateSubTableRequest) (*m
if req.RelationType != "" {
info.RelationType = req.RelationType
}
// 更新 DDL
info.DDL = req.DDL
if err := s.repo.Update(id, info); err != nil {
log.Printf("[SubTable Update] 更新失败: %v", err)