Update user count from local_user table instead of person table, and only count users with accepted application (#5495)

* Update user count from local_user instead of person, and only count users with accepted application

* fix

* Update up.sql

* Update down.sql
This commit is contained in:
dullbananas 2025-03-11 08:37:40 -07:00 committed by GitHub
parent b6f46cd38c
commit d93bfdd2fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View file

@ -280,7 +280,7 @@ END;
$$);
CALL r.create_triggers ('person', $$
CALL r.create_triggers ('local_user', $$
BEGIN
UPDATE
local_site AS a
@ -290,7 +290,7 @@ BEGIN
SELECT
coalesce(sum(count_diff), 0) AS users
FROM select_old_and_new_rows AS old_and_new_rows
WHERE (person).local) AS diff
WHERE (local_user).accepted_application) AS diff
WHERE
diff.users != 0;

View file

@ -0,0 +1,9 @@
UPDATE
local_site
SET
users = (
SELECT
count(*)
FROM
local_user);

View file

@ -0,0 +1,11 @@
UPDATE
local_site
SET
users = (
SELECT
count(*)
FROM
local_user
WHERE
accepted_application);