aboutsummaryrefslogtreecommitdiffstats
path: root/models/db/consistency.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-04-08 12:13:34 +0800
committerGitHub <noreply@github.com>2024-04-08 04:13:34 +0000
commit074a3e05f665ad8c635a314f49080f8846e6d315 (patch)
tree24d4ec61b06beda2a720e333ce9db3c5292779ff /models/db/consistency.go
parent0c7b0c5acaae911d3d3fefa1d8b394594c860620 (diff)
downloadgitea-074a3e05f665ad8c635a314f49080f8846e6d315.tar.gz
gitea-074a3e05f665ad8c635a314f49080f8846e6d315.zip
Fix oauth2 builtin application logic (#30304)
Fix #29074 (allow to disable all builtin apps) and don't make the doctor command remove the builtin apps. By the way, rename refobject and joincond to camel case.
Diffstat (limited to 'models/db/consistency.go')
-rw-r--r--models/db/consistency.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/models/db/consistency.go b/models/db/consistency.go
index d19732cf80..d0b0ab8315 100644
--- a/models/db/consistency.go
+++ b/models/db/consistency.go
@@ -10,21 +10,21 @@ import (
)
// CountOrphanedObjects count subjects with have no existing refobject anymore
-func CountOrphanedObjects(ctx context.Context, subject, refobject, joinCond string) (int64, error) {
+func CountOrphanedObjects(ctx context.Context, subject, refObject, joinCond string) (int64, error) {
return GetEngine(ctx).
Table("`"+subject+"`").
- Join("LEFT", "`"+refobject+"`", joinCond).
- Where(builder.IsNull{"`" + refobject + "`.id"}).
+ Join("LEFT", "`"+refObject+"`", joinCond).
+ Where(builder.IsNull{"`" + refObject + "`.id"}).
Select("COUNT(`" + subject + "`.`id`)").
Count()
}
// DeleteOrphanedObjects delete subjects with have no existing refobject anymore
-func DeleteOrphanedObjects(ctx context.Context, subject, refobject, joinCond string) error {
+func DeleteOrphanedObjects(ctx context.Context, subject, refObject, joinCond string) error {
subQuery := builder.Select("`"+subject+"`.id").
From("`"+subject+"`").
- Join("LEFT", "`"+refobject+"`", joinCond).
- Where(builder.IsNull{"`" + refobject + "`.id"})
+ Join("LEFT", "`"+refObject+"`", joinCond).
+ Where(builder.IsNull{"`" + refObject + "`.id"})
b := builder.Delete(builder.In("id", subQuery)).From("`" + subject + "`")
_, err := GetEngine(ctx).Exec(b)
return err