forked from mirror/gorm
Merge branch 'WingGao-path1'
This commit is contained in:
commit
1856135e10
8
scope.go
8
scope.go
|
@ -1228,11 +1228,15 @@ func (scope *Scope) autoIndex() *Scope {
|
|||
}
|
||||
|
||||
for name, columns := range indexes {
|
||||
scope.NewDB().Model(scope.Value).AddIndex(name, columns...)
|
||||
if db := scope.NewDB().Model(scope.Value).AddIndex(name, columns...); db.Error != nil {
|
||||
scope.db.AddError(db.Error)
|
||||
}
|
||||
}
|
||||
|
||||
for name, columns := range uniqueIndexes {
|
||||
scope.NewDB().Model(scope.Value).AddUniqueIndex(name, columns...)
|
||||
if db := scope.NewDB().Model(scope.Value).AddUniqueIndex(name, columns...); db.Error != nil {
|
||||
scope.db.AddError(db.Error)
|
||||
}
|
||||
}
|
||||
|
||||
return scope
|
||||
|
|
Loading…
Reference in New Issue