Skip to content

Commit

Permalink
fix: AutoMigrate panic
Browse files Browse the repository at this point in the history
commit 17752a9d043b3638517227535d396d9462d85173
Author: Jinzhu <wosmvp@gmail.com>
Date:   Thu Apr 7 23:35:41 2022 +0800

    Refactor #97

commit 28f957e
Author: a631807682 <631807682@qq.com>
Date:   Thu Apr 7 18:03:19 2022 +0800

    fix: AutoMigrate panic
  • Loading branch information
a631807682 authored and jinzhu committed Apr 7, 2022
1 parent 55755e3 commit 8e32323
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ func (m Migrator) AlterColumn(value interface{}, field string) error {
if field := stmt.Schema.LookUpField(field); field != nil {
var (
columnTypes, _ = m.DB.Migrator().ColumnTypes(value)
fieldColumnType migrator.ColumnType
fieldColumnType *migrator.ColumnType
)
for _, columnType := range columnTypes {
if columnType.Name() == field.DBName {
fieldColumnType, _ = columnType.(migrator.ColumnType)
fieldColumnType, _ = columnType.(*migrator.ColumnType)
}
}

Expand Down

0 comments on commit 8e32323

Please sign in to comment.