liquid_feedback_core
view update/core-update.v1.2.5-v1.2.6.sql @ 78:4fc1779a9c98
add test policies
the test policies have values that move them quickly to the target area for frontend development
the test policies have values that move them quickly to the target area for frontend development
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Mon Oct 04 14:24:29 2010 +0200 (2010-10-04) |
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;