diff --git a/scope.go b/scope.go index 9a237998..eadcb1f1 100644 --- a/scope.go +++ b/scope.go @@ -677,7 +677,7 @@ func (scope *Scope) whereSQL() (sql string) { primaryConditions, andConditions, orConditions []string ) - if !scope.Search.Unscoped && hasDeletedAtField { + if !scope.Search.Unscoped && hasDeletedAtField && !scope.Search.raw { sql := fmt.Sprintf("%v.%v IS NULL", quotedTableName, scope.Quote(deletedAtField.DBName)) primaryConditions = append(primaryConditions, sql) }