Refactor solution to minimize regressions.
This commit is contained in:
parent
62274b23ac
commit
980cff4d3e
@ -456,10 +456,10 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
alterColumn bool
|
alterColumn bool
|
||||||
isSameType = strings.HasPrefix(fullDataType, realDataType)
|
isSameType = fullDataType == realDataType
|
||||||
)
|
)
|
||||||
|
|
||||||
if !field.PrimaryKey {
|
if !isSameType && !field.PrimaryKey {
|
||||||
// check type
|
// check type
|
||||||
if !strings.HasPrefix(fullDataType, realDataType) {
|
if !strings.HasPrefix(fullDataType, realDataType) {
|
||||||
// check type aliases
|
// check type aliases
|
||||||
@ -474,6 +474,8 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
|||||||
if !isSameType {
|
if !isSameType {
|
||||||
alterColumn = true
|
alterColumn = true
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
isSameType = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user