Repository: github/gh-ost

Issue:
Cant migrate tables with text column unique keys
When running a DDL to migrate a table with a text column that is a unique key gh-ost fails to apply update DML  events.
It fails in the `updateModifiesUniqueKeyColumns` function in applier.go method. That is because text columns are mapped to unit8[] slices which cannot be compared using '!=': https://github.com/github/gh-ost/blob/7cc7cc8d28e17ad1b1eeee24bb0593782db41fed/go/logic/applier.go#L1301
That leads to a connection close and then no more DML events are handled for the table anymore.

Hints from issue comments:
@markmarkmarkthebest: go mysql type mapping: https://github.com/go-mysql-org/go-mysql/issues/770

Solution patch:
diff --git a/go/logic/applier.go b/go/logic/applier.go
index a7edaed..c575a2f 100644
--- a/go/logic/applier.go
+++ b/go/logic/applier.go
@@ -8,6 +8,7 @@ package logic
 import (
 	gosql "database/sql"
 	"fmt"
+	"reflect"
 	"regexp"
 	"strings"
 	"sync/atomic"
@@ -1298,7 +1299,8 @@ func (this *Applier) updateModifiesUniqueKeyColumns(dmlEvent *binlog.BinlogDMLEv
 		tableOrdinal := this.migrationContext.OriginalTableColumns.Ordinals[column.Name]
 		whereColumnValue := dmlEvent.WhereColumnValues.AbstractValues()[tableOrdinal]
 		newColumnValue := dmlEvent.NewColumnValues.AbstractValues()[tableOrdinal]
-		if newColumnValue != whereColumnValue {
+
+		if !reflect.DeepEqual(whereColumnValue, newColumnValue) {
 			return column.Name, true
 		}
 	}



Test patch:
diff --git a/go/logic/applier_test.go b/go/logic/applier_test.go
index fb76a1a..13e8a4d 100644
--- a/go/logic/applier_test.go
+++ b/go/logic/applier_test.go
@@ -62,8 +62,8 @@ func TestApplierGenerateSqlModeQuery(t *testing.T) {
 }
 
 func TestApplierUpdateModifiesUniqueKeyColumns(t *testing.T) {
-	columns := sql.NewColumnList([]string{"id", "item_id"})
-	columnValues := sql.ToColumnValues([]interface{}{123456, 42})
+	columns := sql.NewColumnList([]string{"id", "item_id", "item_text"})
+	columnValues := sql.ToColumnValues([]interface{}{123456, 42, []uint8{116, 101, 115, 116}})
 
 	migrationContext := base.NewMigrationContext()
 	migrationContext.OriginalTableColumns = columns