Skip to content

Commit effae08

Browse files
author
Shlomi Noach
committed
supporting change of column name-case
1 parent bf5489a commit effae08

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

go/logic/inspect.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -656,18 +656,21 @@ func (this *Inspector) getSharedUniqueKeys(originalUniqueKeys, ghostUniqueKeys [
656656

657657
// getSharedColumns returns the intersection of two lists of columns in same order as the first list
658658
func (this *Inspector) getSharedColumns(originalColumns, ghostColumns *sql.ColumnList, columnRenameMap map[string]string) (*sql.ColumnList, *sql.ColumnList) {
659-
columnsInGhost := make(map[string]bool)
660-
for _, ghostColumn := range ghostColumns.Names() {
661-
columnsInGhost[ghostColumn] = true
662-
}
663659
sharedColumnNames := []string{}
664660
for _, originalColumn := range originalColumns.Names() {
665661
isSharedColumn := false
666-
if columnsInGhost[originalColumn] || columnsInGhost[columnRenameMap[originalColumn]] {
667-
isSharedColumn = true
662+
for _, ghostColumn := range ghostColumns.Names() {
663+
if strings.EqualFold(originalColumn, ghostColumn) {
664+
isSharedColumn = true
665+
}
666+
if strings.EqualFold(columnRenameMap[originalColumn], ghostColumn) {
667+
isSharedColumn = true
668+
}
668669
}
669-
if this.migrationContext.DroppedColumnsMap[originalColumn] {
670-
isSharedColumn = false
670+
for droppedColumn := range this.migrationContext.DroppedColumnsMap {
671+
if strings.EqualFold(originalColumn, droppedColumn) {
672+
isSharedColumn = false
673+
}
671674
}
672675
if isSharedColumn {
673676
sharedColumnNames = append(sharedColumnNames, originalColumn)

0 commit comments

Comments
 (0)