migrator.go -> MigrateColumn.

// check unique, if column has "uniqueIndex" tag, it's unique = true.
This commit is contained in:
piyongcai 2022-05-16 08:57:10 +08:00
parent 2c13ea008e
commit 286e4ea884

View File

@ -440,7 +440,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
} }
// check unique // check unique
if unique, ok := columnType.Unique(); ok && unique != field.Unique { if unique, ok := columnType.Unique(); ok && !(unique == field.Unique || field.UniqueIndex == unique) {
// not primary key // not primary key
if !field.PrimaryKey { if !field.PrimaryKey {
alterColumn = true alterColumn = true