Skip to content

Commit fe68db4

Browse files
committed
Fix string matching for PanicOnWarnings to correctly suppress warnings when renaming unique keys
Error message formats are different across mysql distributions and versions
1 parent 1ca8ffc commit fe68db4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

go/logic/applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ func (this *Applier) ApplyIterationInsertQuery() (chunkSize int64, rowsAffected
778778
continue
779779
}
780780
migrationUniqueKeySuffix := fmt.Sprintf("for key '%s.%s'", this.migrationContext.GetGhostTableName(), this.migrationContext.UniqueKey.NameInGhostTable)
781-
if strings.HasPrefix(message, "Duplicate entry") && strings.HasSuffix(message, migrationUniqueKeySuffix) {
781+
if strings.Contains(message, "Duplicate entry") && strings.Contains(message, migrationUniqueKeySuffix) {
782782
continue
783783
}
784784
sqlWarnings = append(sqlWarnings, fmt.Sprintf("%s: %s (%d)", level, message, code))

0 commit comments

Comments
 (0)