liquid_feedback_core

diff demo.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 7744034552a3
children 3d5e38ea2fab
line diff
     1.1 --- a/demo.sql	Mon Dec 06 23:50:32 2010 +0100
     1.2 +++ b/demo.sql	Tue Dec 07 00:04:44 2010 +0100
     1.3 @@ -61,11 +61,17 @@
     1.4      END;
     1.5    $$;
     1.6  
     1.7 -INSERT INTO "area" ("name") VALUES
     1.8 -  ('Area #1'),  -- id 1
     1.9 -  ('Area #2'),  -- id 2
    1.10 -  ('Area #3'),  -- id 3
    1.11 -  ('Area #4');  -- id 4
    1.12 +INSERT INTO "unit" ("name") VALUES ('Main');
    1.13 +
    1.14 +INSERT INTO "privilege" ("unit_id", "member_id", "voting_right")
    1.15 +  SELECT 1 AS "unit_id", "id" AS "member_id", TRUE AS "voting_right"
    1.16 +  FROM "member";
    1.17 +
    1.18 +INSERT INTO "area" ("unit_id", "name") VALUES
    1.19 +  (1, 'Area #1'),  -- id 1
    1.20 +  (1, 'Area #2'),  -- id 2
    1.21 +  (1, 'Area #3'),  -- id 3
    1.22 +  (1, 'Area #4');  -- id 4
    1.23  
    1.24  INSERT INTO "allowed_policy" ("area_id", "policy_id", "default_policy")
    1.25    VALUES (1, 1, TRUE), (2, 1, TRUE), (3, 1, TRUE), (4, 1, TRUE);
    1.26 @@ -90,23 +96,23 @@
    1.27  
    1.28  -- global delegations
    1.29  INSERT INTO "delegation"
    1.30 -  ("truster_id", "scope", "trustee_id") VALUES
    1.31 -  ( 1, 'global',  9),
    1.32 -  ( 2, 'global', 11),
    1.33 -  ( 3, 'global', 12),
    1.34 -  ( 4, 'global', 13),
    1.35 -  ( 5, 'global', 14),
    1.36 -  ( 6, 'global',  7),
    1.37 -  ( 7, 'global',  8),
    1.38 -  ( 8, 'global',  6),
    1.39 -  (10, 'global',  9),
    1.40 -  (11, 'global',  9),
    1.41 -  (12, 'global', 21),
    1.42 -  (15, 'global', 10),
    1.43 -  (16, 'global', 17),
    1.44 -  (17, 'global', 19),
    1.45 -  (18, 'global', 19),
    1.46 -  (23, 'global', 22);
    1.47 +  ("truster_id", "scope", "unit_id", "trustee_id") VALUES
    1.48 +  ( 1, 'unit', 1,  9),
    1.49 +  ( 2, 'unit', 1, 11),
    1.50 +  ( 3, 'unit', 1, 12),
    1.51 +  ( 4, 'unit', 1, 13),
    1.52 +  ( 5, 'unit', 1, 14),
    1.53 +  ( 6, 'unit', 1,  7),
    1.54 +  ( 7, 'unit', 1,  8),
    1.55 +  ( 8, 'unit', 1,  6),
    1.56 +  (10, 'unit', 1,  9),
    1.57 +  (11, 'unit', 1,  9),
    1.58 +  (12, 'unit', 1, 21),
    1.59 +  (15, 'unit', 1, 10),
    1.60 +  (16, 'unit', 1, 17),
    1.61 +  (17, 'unit', 1, 19),
    1.62 +  (18, 'unit', 1, 19),
    1.63 +  (23, 'unit', 1, 22);
    1.64  
    1.65  -- delegations for topics
    1.66  INSERT INTO "delegation"

Impressum / About Us