From 8c099e09459749e6485711483f9159f374265242 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Thu, 17 Mar 2016 18:09:21 +0800 Subject: [PATCH] Fix AddUniqueIndex with soft delete --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 243ee208..56c80019 100644 --- a/main.go +++ b/main.go @@ -547,7 +547,7 @@ func (s *DB) AddIndex(indexName string, columns ...string) *DB { // AddUniqueIndex add unique index for columns with given name 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...) return scope.db }