liquid_feedback_core
diff update/core-update.v2.2.5-v2.2.6.sql @ 398:806561cce3b1
New table "issue_order" for ordering fields to avoid a bottleneck with locking
| author | jbe |
|---|---|
| date | Fri Oct 11 20:07:41 2013 +0200 (2013-10-11) |
| parents | 1e4fcb7f0eac |
| children | 782eb17c7ad9 |
line diff
1.1 --- a/update/core-update.v2.2.5-v2.2.6.sql Fri Oct 11 13:42:16 2013 +0200 1.2 +++ b/update/core-update.v2.2.5-v2.2.6.sql Fri Oct 11 20:07:41 2013 +0200 1.3 @@ -4,11 +4,15 @@ 1.4 SELECT * FROM (VALUES ('2.2.6', 2, 2, 6)) 1.5 AS "subquery"("string", "major", "minor", "revision"); 1.6 1.7 -ALTER TABLE "issue" ADD COLUMN "order_in_admission_state" INT4; 1.8 -ALTER TABLE "issue" ADD COLUMN "order_in_open_states" INT4; 1.9 +CREATE TABLE "issue_order" ( 1.10 + "id" INT8 PRIMARY KEY REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 1.11 + "order_in_admission_state" INT4, 1.12 + "order_in_open_states" INT4 ); 1.13 1.14 -COMMENT ON COLUMN "issue"."order_in_admission_state" IS 'To be used for sorting issues within an area, when showing only issues in admission state; NULL values sort last; updated by "lf_update_issue_order"'; 1.15 -COMMENT ON COLUMN "issue"."order_in_open_states" IS 'To be used for sorting issues within an area, when showing all open issues; NULL values sort last; updated by "lf_update_issue_order"'; 1.16 +COMMENT ON TABLE "issue_order" IS 'Ordering information for issues that are not stored in the "issue" table to avoid locking of multiple issues at once'; 1.17 + 1.18 +COMMENT ON COLUMN "issue_order"."order_in_admission_state" IS 'To be used for sorting issues within an area, when showing only issues in admission state; NULL values sort last; updated by "lf_update_issue_order"'; 1.19 +COMMENT ON COLUMN "issue_order"."order_in_open_states" IS 'To be used for sorting issues within an area, when showing all open issues; NULL values sort last; updated by "lf_update_issue_order"'; 1.20 1.21 CREATE VIEW "issue_supporter_in_admission_state" AS 1.22 SELECT DISTINCT 1.23 @@ -31,7 +35,7 @@ 1.24 "area_id", 1.25 "id" AS "issue_id", 1.26 "order_in_admission_state" * 2 - 1 AS "minimum_position" 1.27 - FROM "issue" 1.28 + FROM "issue" NATURAL LEFT JOIN "issue_order" 1.29 WHERE "closed" ISNULL 1.30 ORDER BY 1.31 coalesce(