feat: 更新数据重复记录错误输出信息并跳过
This commit is contained in:
@@ -103,6 +103,10 @@ func processSQLFile(db *gorm.DB, filePath string) {
|
||||
} else if strings.Contains(errorStr, "duplicate key") {
|
||||
// 忽略重复索引错误
|
||||
// Error 1061 (42000): Duplicate key name 'key_name'
|
||||
} else if strings.Contains(errorStr, "duplicate entry") {
|
||||
// 忽略重复记录错误
|
||||
// Error 1062 (23000): Duplicate entry 'value' for key 'key_name'
|
||||
log.Println(errorStr)
|
||||
} else if strings.Contains(errorStr, "unknown column") {
|
||||
// 忽略未知字段错误
|
||||
// Error 1054 (42S22): Unknown column 'field_name' in 'table'
|
||||
|
||||
Reference in New Issue
Block a user