feat: 跟踪任务添加标题,任务错误移除已发任务

This commit is contained in:
TsMask
2025-05-12 18:19:35 +08:00
parent ca3f1b7738
commit 872567b28a
8 changed files with 131 additions and 13 deletions

View File

@@ -93,8 +93,16 @@ func processSQLFile(db *gorm.DB, filePath string) {
if strings.HasSuffix(line, ";") {
// 执行 SQL 语句
if err := db.Exec(sqlBuilder.String()).Error; err != nil {
log.Fatalln(err.Error())
return
errorStr := err.Error()
if strings.Contains(strings.ToLower(errorStr), "duplicate column") {
// 重复字段错误忽略
// log.Printf("Exec SQL: %s\n", line)
// log.Println(err.Error())
} else {
// 其他错误终止程序
log.Fatalln(errorStr)
return
}
}
sqlBuilder.Reset()