Remove unnecessary clone.

This commit is contained in:
Ryoga Kitagawa 2020-04-21 10:33:43 +09:00 committed by GitHub
parent 7ea143b548
commit 607870f0aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -732,7 +732,7 @@ func (s *DB) AddForeignKey(field string, dest string, onDelete string, onUpdate
// RemoveForeignKey Remove foreign key from the given scope, e.g:
// db.Model(&User{}).RemoveForeignKey("city_id", "cities(id)")
func (s *DB) RemoveForeignKey(field string, dest string) *DB {
scope := s.clone().NewScope(s.Value)
scope := s.NewScope(s.Value)
scope.removeForeignKey(field, dest)
return scope.db
}