From effae08fbf54025111cf9627c322cc77575cf295 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Wed, 12 Jul 2017 12:33:32 +0300 Subject: [PATCH] supporting change of column name-case --- go/logic/inspect.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/go/logic/inspect.go b/go/logic/inspect.go index 181ed0b..5049193 100644 --- a/go/logic/inspect.go +++ b/go/logic/inspect.go @@ -656,18 +656,21 @@ func (this *Inspector) getSharedUniqueKeys(originalUniqueKeys, ghostUniqueKeys [ // getSharedColumns returns the intersection of two lists of columns in same order as the first list func (this *Inspector) getSharedColumns(originalColumns, ghostColumns *sql.ColumnList, columnRenameMap map[string]string) (*sql.ColumnList, *sql.ColumnList) { - columnsInGhost := make(map[string]bool) - for _, ghostColumn := range ghostColumns.Names() { - columnsInGhost[ghostColumn] = true - } sharedColumnNames := []string{} for _, originalColumn := range originalColumns.Names() { isSharedColumn := false - if columnsInGhost[originalColumn] || columnsInGhost[columnRenameMap[originalColumn]] { - isSharedColumn = true + for _, ghostColumn := range ghostColumns.Names() { + if strings.EqualFold(originalColumn, ghostColumn) { + isSharedColumn = true + } + if strings.EqualFold(columnRenameMap[originalColumn], ghostColumn) { + isSharedColumn = true + } } - if this.migrationContext.DroppedColumnsMap[originalColumn] { - isSharedColumn = false + for droppedColumn := range this.migrationContext.DroppedColumnsMap { + if strings.EqualFold(originalColumn, droppedColumn) { + isSharedColumn = false + } } if isSharedColumn { sharedColumnNames = append(sharedColumnNames, originalColumn)