special case string comparisons

This commit is contained in:
Andy Arthur
2022-08-08 17:29:13 -07:00
parent 2b7d973cfa
commit a1f45645cf
+7 -6
View File
@@ -17,7 +17,6 @@ package migrate
import (
"context"
"fmt"
"github.com/dolthub/vitess/go/sqltypes"
"io"
"strings"
"time"
@@ -155,11 +154,13 @@ func equalRows(old, new sql.Row, sch sql.Schema) (bool, error) {
var err error
var cmp int
for i := range new {
// special case char field comparisons
if sch[i].Type.Type() == sqltypes.Char {
if s, ok := new[i].(string); ok {
new[i] = strings.TrimRightFunc(s, unicode.IsSpace)
}
// special case string comparisons
if s, ok := old[i].(string); ok {
old[i] = strings.TrimRightFunc(s, unicode.IsSpace)
}
if s, ok := new[i].(string); ok {
new[i] = strings.TrimRightFunc(s, unicode.IsSpace)
}
// special case time comparison to account