fix(log): F6 polish — log datasource create error log + schema patches for auth_type/token/headers + ES default index sync on datasource select

This commit is contained in:
attacker committed 2026-06-28 06:04:18 +08:00
1 parent 6bba6144f3
commit 5fb74a787a
3 files changed
+17 -6

No files matched your search

+3
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"io"
"log"
"net/http"
"strings"
"time"
@@ -76,6 +77,8 @@ func (h *LogDSHandler) Create(c *gin.Context) {
IsDefault: req.IsDefault, Status: 1,
}
if err := h.db.Create(&ds).Error; err != nil {
// 记录详细错误,便于排查字段缺失/唯一约束等数据库问题 // Logan.Li
log.Printf("[LogDataSource] 创建数据源失败: %v", err)
if errors.Is(err, gorm.ErrDuplicatedKey) {
c.JSON(409, model.Response{Code: 409, Message: "数据源名称已存在"})
return