liquid_feedback_core
view update/core-update.v1.0.0-v1.0.1.sql @ 126:5edfb00d840a
Implementation of Schulze's Supermajority Requirements
Changes in detail:
- Renamed column "agreed" of table "initiative" to "majority"
- Added column "winner" to table "initiative"
- Extended constraint "non_admitted_initiatives_cant_contain_voting_results" of table "initiative" to "rank" and "winner" columns
- Removed constraint "non_agreed_initiatives_cant_get_a_rank" from table "initiative"
- Replaced PRIMARY KEY of "battle" table by a single NOT NULL constraint on column "issue_id" and three (partial) indicies allowing NULL values as initiative ids
- Added constraint "initiative_ids_not_equal" to "battle" table
- Added view "battle_participant" which selects admitted initiatives plus one virtual "status-quo" initiative for each issue denoted by an initiative_id being NULL
- Modified "battle_view" to include all admitted initiatives plus the virtual "status-quo" initiative
- Modified function "calculate_ranks" to respect all battle participants, to set the rank of all initiatives where the rank is better than status-quo, and to mark the final winner (if existent)
Changes in detail:
- Renamed column "agreed" of table "initiative" to "majority"
- Added column "winner" to table "initiative"
- Extended constraint "non_admitted_initiatives_cant_contain_voting_results" of table "initiative" to "rank" and "winner" columns
- Removed constraint "non_agreed_initiatives_cant_get_a_rank" from table "initiative"
- Replaced PRIMARY KEY of "battle" table by a single NOT NULL constraint on column "issue_id" and three (partial) indicies allowing NULL values as initiative ids
- Added constraint "initiative_ids_not_equal" to "battle" table
- Added view "battle_participant" which selects admitted initiatives plus one virtual "status-quo" initiative for each issue denoted by an initiative_id being NULL
- Modified "battle_view" to include all admitted initiatives plus the virtual "status-quo" initiative
- Modified function "calculate_ranks" to respect all battle participants, to set the rank of all initiatives where the rank is better than status-quo, and to mark the final winner (if existent)
author | jbe |
---|---|
date | Tue May 24 03:01:49 2011 +0200 (2011-05-24) |
parents | 74c985baf082 |
children |
line source
1 BEGIN;
3 CREATE OR REPLACE VIEW "liquid_feedback_version" AS
4 SELECT * FROM (VALUES ('1.0.1', 1, 0, 1))
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 "area_setting" WHERE "member_id" = "member_id_p";
45 DELETE FROM "issue_setting" WHERE "member_id" = "member_id_p";
46 DELETE FROM "initiative_setting" WHERE "member_id" = "member_id_p";
47 DELETE FROM "suggestion_setting" WHERE "member_id" = "member_id_p";
48 RETURN;
49 END;
50 $$;
52 COMMIT;