mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-03-25 21:02:40 +00:00
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:
parent
b6f46cd38c
commit
d93bfdd2fa
3 changed files with 22 additions and 2 deletions
|
@ -280,7 +280,7 @@ END;
|
||||||
|
|
||||||
$$);
|
$$);
|
||||||
|
|
||||||
CALL r.create_triggers ('person', $$
|
CALL r.create_triggers ('local_user', $$
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE
|
UPDATE
|
||||||
local_site AS a
|
local_site AS a
|
||||||
|
@ -290,7 +290,7 @@ BEGIN
|
||||||
SELECT
|
SELECT
|
||||||
coalesce(sum(count_diff), 0) AS users
|
coalesce(sum(count_diff), 0) AS users
|
||||||
FROM select_old_and_new_rows AS old_and_new_rows
|
FROM select_old_and_new_rows AS old_and_new_rows
|
||||||
WHERE (person).local) AS diff
|
WHERE (local_user).accepted_application) AS diff
|
||||||
WHERE
|
WHERE
|
||||||
diff.users != 0;
|
diff.users != 0;
|
||||||
|
|
||||||
|
|
9
migrations/2025-03-11-015056_local_user_trigger/down.sql
Normal file
9
migrations/2025-03-11-015056_local_user_trigger/down.sql
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
UPDATE
|
||||||
|
local_site
|
||||||
|
SET
|
||||||
|
users = (
|
||||||
|
SELECT
|
||||||
|
count(*)
|
||||||
|
FROM
|
||||||
|
local_user);
|
||||||
|
|
11
migrations/2025-03-11-015056_local_user_trigger/up.sql
Normal file
11
migrations/2025-03-11-015056_local_user_trigger/up.sql
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
UPDATE
|
||||||
|
local_site
|
||||||
|
SET
|
||||||
|
users = (
|
||||||
|
SELECT
|
||||||
|
count(*)
|
||||||
|
FROM
|
||||||
|
local_user
|
||||||
|
WHERE
|
||||||
|
accepted_application);
|
||||||
|
|
Loading…
Reference in a new issue