supporting change of column name-case
This commit is contained in:
parent
bf5489a56d
commit
effae08fbf
@ -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
|
// 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) {
|
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{}
|
sharedColumnNames := []string{}
|
||||||
for _, originalColumn := range originalColumns.Names() {
|
for _, originalColumn := range originalColumns.Names() {
|
||||||
isSharedColumn := false
|
isSharedColumn := false
|
||||||
if columnsInGhost[originalColumn] || columnsInGhost[columnRenameMap[originalColumn]] {
|
for _, ghostColumn := range ghostColumns.Names() {
|
||||||
isSharedColumn = true
|
if strings.EqualFold(originalColumn, ghostColumn) {
|
||||||
|
isSharedColumn = true
|
||||||
|
}
|
||||||
|
if strings.EqualFold(columnRenameMap[originalColumn], ghostColumn) {
|
||||||
|
isSharedColumn = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if this.migrationContext.DroppedColumnsMap[originalColumn] {
|
for droppedColumn := range this.migrationContext.DroppedColumnsMap {
|
||||||
isSharedColumn = false
|
if strings.EqualFold(originalColumn, droppedColumn) {
|
||||||
|
isSharedColumn = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if isSharedColumn {
|
if isSharedColumn {
|
||||||
sharedColumnNames = append(sharedColumnNames, originalColumn)
|
sharedColumnNames = append(sharedColumnNames, originalColumn)
|
||||||
|
Loading…
Reference in New Issue
Block a user