forked from mirror/gorm
Merge pull request #336 from bramp/deleted-at-join-issue-335
Fixes #335 - Added scoped table name to "deleted_at" where clause. This ...
This commit is contained in:
commit
016e91db20
|
@ -168,7 +168,8 @@ func (scope *Scope) whereSql() (sql string) {
|
||||||
var primaryCondiations, andConditions, orConditions []string
|
var primaryCondiations, andConditions, orConditions []string
|
||||||
|
|
||||||
if !scope.Search.Unscope && scope.HasColumn("DeletedAt") {
|
if !scope.Search.Unscope && scope.HasColumn("DeletedAt") {
|
||||||
primaryCondiations = append(primaryCondiations, "(deleted_at IS NULL OR deleted_at <= '0001-01-02')")
|
sql := fmt.Sprintf("(%v.deleted_at IS NULL OR %v.deleted_at <= '0001-01-02')", scope.QuotedTableName(), scope.QuotedTableName())
|
||||||
|
primaryCondiations = append(primaryCondiations, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !scope.PrimaryKeyZero() {
|
if !scope.PrimaryKeyZero() {
|
||||||
|
|
Loading…
Reference in New Issue