Fix AddUniqueIndex with soft delete

This commit is contained in:
Jinzhu 2016-03-17 18:09:21 +08:00
parent 55a8e63aad
commit 8c099e0945
1 changed files with 1 additions and 1 deletions

View File

@ -547,7 +547,7 @@ func (s *DB) AddIndex(indexName string, columns ...string) *DB {
// AddUniqueIndex add unique index for columns with given name // AddUniqueIndex add unique index for columns with given name
func (s *DB) AddUniqueIndex(indexName string, columns ...string) *DB { func (s *DB) AddUniqueIndex(indexName string, columns ...string) *DB {
scope := s.clone().NewScope(s.Value) scope := s.clone().Unscoped().NewScope(s.Value)
scope.addIndex(true, indexName, columns...) scope.addIndex(true, indexName, columns...)
return scope.db return scope.db
} }