liquid_feedback_core

view update/core-update.v1.2.5-v1.2.6.sql @ 97:58451b5565ae

Introduced (organizational) units

- New table "unit"
- Each "area" refers to one unit
- "invite_code"s are valid for one or many units
- New table "privilege" stores "voting_right" for units
- Delegation scope 'global' is replaced by delegation scope 'unit'
- View "global_delegation" is replaced by "unit_delegation"
- Removed helper view "active_delegation"
- Checking that members have "voting_right" in several views and functions
- New view "unit_member_count" to update "member_count" column of new unit table
- New argument list for function "delegation_chain"(...) containing "unit_id"
- Renamed column "member_active" to "member_valid" in "delegation_chain_row"
- Modified demo.sql and init.sql to support units
author jbe
date Tue Dec 07 00:04:44 2010 +0100 (2010-12-07)
parents dcaa1525c388
children
line source
1 BEGIN;
3 CREATE OR REPLACE VIEW "liquid_feedback_version" AS
4 SELECT * FROM (VALUES ('1.2.6', 1, 2, 6))
5 AS "subquery"("string", "major", "minor", "revision");
7 CREATE VIEW "active_delegation" AS
8 SELECT "delegation".* FROM "delegation"
9 JOIN "member" ON "delegation"."truster_id" = "member"."id"
10 WHERE "member"."active" = TRUE;
12 COMMENT ON VIEW "active_delegation" IS 'Delegations where the truster_id refers to an active member';
14 DROP VIEW "global_delegation";
16 CREATE VIEW "global_delegation" AS
17 SELECT * FROM "active_delegation"
18 WHERE "scope" = 'global';
20 COMMENT ON VIEW "global_delegation" IS 'Global delegations from active members';
22 CREATE OR REPLACE VIEW "area_delegation" AS
23 SELECT DISTINCT ON ("area"."id", "delegation"."truster_id")
24 "area"."id" AS "area_id",
25 "delegation"."id",
26 "delegation"."truster_id",
27 "delegation"."trustee_id",
28 "delegation"."scope"
29 FROM "area" JOIN "active_delegation" AS "delegation"
30 ON "delegation"."scope" = 'global'
31 OR "delegation"."area_id" = "area"."id"
32 ORDER BY
33 "area"."id",
34 "delegation"."truster_id",
35 "delegation"."scope" DESC;
37 COMMENT ON VIEW "area_delegation" IS 'Resulting area delegations from active members';
39 CREATE OR REPLACE VIEW "issue_delegation" AS
40 SELECT DISTINCT ON ("issue"."id", "delegation"."truster_id")
41 "issue"."id" AS "issue_id",
42 "delegation"."id",
43 "delegation"."truster_id",
44 "delegation"."trustee_id",
45 "delegation"."scope"
46 FROM "issue" JOIN "active_delegation" AS "delegation"
47 ON "delegation"."scope" = 'global'
48 OR "delegation"."area_id" = "issue"."area_id"
49 OR "delegation"."issue_id" = "issue"."id"
50 ORDER BY
51 "issue"."id",
52 "delegation"."truster_id",
53 "delegation"."scope" DESC;
55 COMMENT ON VIEW "issue_delegation" IS 'Resulting issue delegations from active members';
57 COMMIT;

Impressum / About Us