liquid_feedback_core

view update/core-update.v1.0.1-v1.0.2.sql @ 142:54ac8c473263

Use an improved definition for "disqualified" initiatives

"initiative"."disqualified" is TRUE, if the initiative may not win, because it either (a) has no better rank than the status quo, or (b) because there exists a better ranked initiative X, which directly beats this initiative, and either more voters prefer X to this initiative than voters preferring X to the status quo or less voters prefer this initiative to X than voters preferring the status quo to X
author jbe
date Wed Jun 01 16:58:00 2011 +0200 (2011-06-01)
parents c45df7907da6
children
line source
1 BEGIN;
3 CREATE OR REPLACE VIEW "liquid_feedback_version" AS
4 SELECT * FROM (VALUES ('1.0.2', 1, 0, 2))
5 AS "subquery"("string", "major", "minor", "revision");
7 CREATE OR REPLACE FUNCTION "delete_member_data"("member_id_p" "member"."id"%TYPE)
8 RETURNS VOID
9 LANGUAGE 'plpgsql' VOLATILE AS $$
10 BEGIN
11 UPDATE "member" SET
12 "login" = NULL,
13 "password" = NULL,
14 "notify_email" = NULL,
15 "notify_email_unconfirmed" = NULL,
16 "notify_email_secret" = NULL,
17 "notify_email_secret_expiry" = NULL,
18 "password_reset_secret" = NULL,
19 "password_reset_secret_expiry" = NULL,
20 "organizational_unit" = NULL,
21 "internal_posts" = NULL,
22 "realname" = NULL,
23 "birthday" = NULL,
24 "address" = NULL,
25 "email" = NULL,
26 "xmpp_address" = NULL,
27 "website" = NULL,
28 "phone" = NULL,
29 "mobile_phone" = NULL,
30 "profession" = NULL,
31 "external_memberships" = NULL,
32 "external_posts" = NULL,
33 "statement" = NULL
34 WHERE "id" = "member_id_p";
35 -- "text_search_data" is updated by triggers
36 UPDATE "member_history" SET "login" = NULL
37 WHERE "member_id" = "member_id_p";
38 DELETE FROM "setting" WHERE "member_id" = "member_id_p";
39 DELETE FROM "setting_map" WHERE "member_id" = "member_id_p";
40 DELETE FROM "member_relation_setting" WHERE "member_id" = "member_id_p";
41 DELETE FROM "member_image" WHERE "member_id" = "member_id_p";
42 DELETE FROM "contact" WHERE "member_id" = "member_id_p";
43 DELETE FROM "delegation" WHERE "truster_id" = "member_id_p";
44 DELETE FROM "membership" WHERE "member_id" = "member_id_p";
45 DELETE FROM "area_setting" WHERE "member_id" = "member_id_p";
46 DELETE FROM "issue_setting" WHERE "member_id" = "member_id_p";
47 DELETE FROM "initiative_setting" WHERE "member_id" = "member_id_p";
48 DELETE FROM "suggestion_setting" WHERE "member_id" = "member_id_p";
49 RETURN;
50 END;
51 $$;
53 CREATE OR REPLACE FUNCTION "delete_private_data"()
54 RETURNS VOID
55 LANGUAGE 'plpgsql' VOLATILE AS $$
56 BEGIN
57 UPDATE "member" SET
58 "login" = NULL,
59 "password" = NULL,
60 "notify_email" = NULL,
61 "notify_email_unconfirmed" = NULL,
62 "notify_email_secret" = NULL,
63 "notify_email_secret_expiry" = NULL,
64 "password_reset_secret" = NULL,
65 "password_reset_secret_expiry" = NULL,
66 "organizational_unit" = NULL,
67 "internal_posts" = NULL,
68 "realname" = NULL,
69 "birthday" = NULL,
70 "address" = NULL,
71 "email" = NULL,
72 "xmpp_address" = NULL,
73 "website" = NULL,
74 "phone" = NULL,
75 "mobile_phone" = NULL,
76 "profession" = NULL,
77 "external_memberships" = NULL,
78 "external_posts" = NULL,
79 "statement" = NULL;
80 -- "text_search_data" is updated by triggers
81 UPDATE "member_history" SET "login" = NULL;
82 DELETE FROM "setting";
83 DELETE FROM "setting_map";
84 DELETE FROM "member_relation_setting";
85 DELETE FROM "member_image";
86 DELETE FROM "contact";
87 DELETE FROM "area_setting";
88 DELETE FROM "issue_setting";
89 DELETE FROM "initiative_setting";
90 DELETE FROM "suggestion_setting";
91 DELETE FROM "invite_code";
92 DELETE FROM "session";
93 DELETE FROM "direct_voter" USING "issue"
94 WHERE "direct_voter"."issue_id" = "issue"."id"
95 AND "issue"."closed" ISNULL;
96 RETURN;
97 END;
98 $$;
100 COMMIT;

Impressum / About Us