Skip to content

Commit b897def

Browse files
fix(applier): added support for unique text column, they are mapped to uint8[] (#1583)
1 parent 7cc7cc8 commit b897def

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

‎go/logic/applier.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package logic
88
import (
99
gosql "database/sql"
1010
"fmt"
11+
"reflect"
1112
"regexp"
1213
"strings"
1314
"sync/atomic"
@@ -1298,7 +1299,8 @@ func (this *Applier) updateModifiesUniqueKeyColumns(dmlEvent *binlog.BinlogDMLEv
12981299
tableOrdinal := this.migrationContext.OriginalTableColumns.Ordinals[column.Name]
12991300
whereColumnValue := dmlEvent.WhereColumnValues.AbstractValues()[tableOrdinal]
13001301
newColumnValue := dmlEvent.NewColumnValues.AbstractValues()[tableOrdinal]
1301-
if newColumnValue != whereColumnValue {
1302+
1303+
if !reflect.DeepEqual(whereColumnValue, newColumnValue) {
13021304
return column.Name, true
13031305
}
13041306
}

‎go/logic/applier_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ func TestApplierGenerateSqlModeQuery(t *testing.T) {
6262
}
6363

6464
func TestApplierUpdateModifiesUniqueKeyColumns(t *testing.T) {
65-
columns := sql.NewColumnList([]string{"id", "item_id"})
66-
columnValues := sql.ToColumnValues([]interface{}{123456, 42})
65+
columns := sql.NewColumnList([]string{"id", "item_id", "item_text"})
66+
columnValues := sql.ToColumnValues([]interface{}{123456, 42, []uint8{116, 101, 115, 116}})
6767

6868
migrationContext := base.NewMigrationContext()
6969
migrationContext.OriginalTableColumns = columns

0 commit comments

Comments
 (0)