mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-53408] server/user_store: avoid antijoin for IsEmpty query (#23966)
This commit is contained in:
parent
6c821c8b13
commit
a307fd9da3
@ -2140,7 +2140,11 @@ func (us SqlUserStore) IsEmpty(excludeBots bool) (bool, error) {
|
||||
From("Users")
|
||||
|
||||
if excludeBots {
|
||||
builder = builder.LeftJoin("Bots ON Users.Id = Bots.UserId").Where("Bots.UserId IS NULL")
|
||||
if us.DriverName() == model.DatabaseDriverPostgres {
|
||||
builder = builder.LeftJoin("Bots ON Users.Id = Bots.UserId").Where("Bots.UserId IS NULL")
|
||||
} else {
|
||||
builder = builder.Where(sq.Expr("Users.Id NOT IN (SELECT UserId FROM Bots)"))
|
||||
}
|
||||
}
|
||||
|
||||
builder = builder.Suffix(")")
|
||||
|
Loading…
Reference in New Issue
Block a user