liquid_feedback_core
changeset 189:548152fa67e5
Added missing function "calculate_member_counts" to core-update.v1.4.0_rc4-v1.5.0_rc1.sql
author | jbe |
---|---|
date | Sat Jul 30 03:03:25 2011 +0200 (2011-07-30) |
parents | 8b496fa85a65 |
children | 9d811ba751c6 |
files | update/core-update.v1.4.0_rc4-v1.5.0_rc1.sql |
line diff
1.1 --- a/update/core-update.v1.4.0_rc4-v1.5.0_rc1.sql Sat Jul 30 01:57:27 2011 +0200 1.2 +++ b/update/core-update.v1.4.0_rc4-v1.5.0_rc1.sql Sat Jul 30 03:03:25 2011 +0200 1.3 @@ -329,6 +329,31 @@ 1.4 1.5 COMMENT ON FUNCTION "check_activity"() IS 'Deactivates members when "last_activity" is older than "system_setting"."member_ttl".'; 1.6 1.7 +CREATE OR REPLACE FUNCTION "calculate_member_counts"() 1.8 + RETURNS VOID 1.9 + LANGUAGE 'plpgsql' VOLATILE AS $$ 1.10 + BEGIN 1.11 + LOCK TABLE "member" IN SHARE MODE; 1.12 + LOCK TABLE "member_count" IN EXCLUSIVE MODE; 1.13 + LOCK TABLE "unit" IN EXCLUSIVE MODE; 1.14 + LOCK TABLE "area" IN EXCLUSIVE MODE; 1.15 + LOCK TABLE "privilege" IN SHARE MODE; 1.16 + LOCK TABLE "membership" IN SHARE MODE; 1.17 + DELETE FROM "member_count"; 1.18 + INSERT INTO "member_count" ("total_count") 1.19 + SELECT "total_count" FROM "member_count_view"; 1.20 + UPDATE "unit" SET "member_count" = "view"."member_count" 1.21 + FROM "unit_member_count" AS "view" 1.22 + WHERE "view"."unit_id" = "unit"."id"; 1.23 + UPDATE "area" SET 1.24 + "direct_member_count" = "view"."direct_member_count", 1.25 + "member_weight" = "view"."member_weight" 1.26 + FROM "area_member_count" AS "view" 1.27 + WHERE "view"."area_id" = "area"."id"; 1.28 + RETURN; 1.29 + END; 1.30 + $$; 1.31 + 1.32 CREATE OR REPLACE FUNCTION "create_interest_snapshot" 1.33 ( "issue_id_p" "issue"."id"%TYPE ) 1.34 RETURNS VOID