liquid_feedback_core

changeset 23:137c98fa0b4f

Added tables allowing frontends to store member-relation, area, issue and suggestion settings
author jbe
date Sat Feb 06 03:32:04 2010 +0100 (2010-02-06)
parents 063baac35f79
children 85ee75f90ecd
files core.sql
line diff
     1.1 --- a/core.sql	Sat Feb 06 03:31:13 2010 +0100
     1.2 +++ b/core.sql	Sat Feb 06 03:32:04 2010 +0100
     1.3 @@ -150,7 +150,7 @@
     1.4          "value"                 TEXT            NOT NULL );
     1.5  CREATE INDEX "setting_key_idx" ON "setting" ("key");
     1.6  
     1.7 -COMMENT ON TABLE "setting" IS 'Place to store a frontend specific member setting as a string';
     1.8 +COMMENT ON TABLE "setting" IS 'Place to store a frontend specific settings for members as a string';
     1.9  
    1.10  COMMENT ON COLUMN "setting"."key" IS 'Name of the setting, preceded by a frontend specific prefix';
    1.11  
    1.12 @@ -163,13 +163,23 @@
    1.13          "value"                 TEXT            NOT NULL );
    1.14  CREATE INDEX "setting_map_key_idx" ON "setting_map" ("key");
    1.15  
    1.16 -COMMENT ON TABLE "setting_map" IS 'Place to store a frontend specific member setting as a map of key value pairs';
    1.17 +COMMENT ON TABLE "setting_map" IS 'Place to store a frontend specific setting for members as a map of key value pairs';
    1.18  
    1.19  COMMENT ON COLUMN "setting_map"."key"    IS 'Name of the setting, preceded by a frontend specific prefix';
    1.20  COMMENT ON COLUMN "setting_map"."subkey" IS 'Key of a map entry';
    1.21  COMMENT ON COLUMN "setting_map"."value"  IS 'Value of a map entry';
    1.22  
    1.23  
    1.24 +CREATE TABLE "member_relation_setting" (
    1.25 +        PRIMARY KEY ("member_id", "key", "other_member_id"),
    1.26 +        "member_id"             INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.27 +        "key"                   TEXT            NOT NULL,
    1.28 +        "other_member_id"       INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.29 +        "value"                 TEXT            NOT NULL );
    1.30 +
    1.31 +COMMENT ON TABLE "setting" IS 'Place to store a frontend specific settings related to relations between members as a string';
    1.32 +
    1.33 +
    1.34  CREATE TYPE "member_image_type" AS ENUM ('photo', 'avatar');
    1.35  
    1.36  COMMENT ON TYPE "member_image_type" IS 'Types of images for a member';
    1.37 @@ -290,6 +300,16 @@
    1.38  COMMENT ON COLUMN "area"."autoreject_weight"   IS 'Sum of weight of members using the autoreject feature';
    1.39  
    1.40  
    1.41 +CREATE TABLE "area_setting" (
    1.42 +        PRIMARY KEY ("member_id", "key", "area_id"),
    1.43 +        "member_id"             INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.44 +        "key"                   TEXT            NOT NULL,
    1.45 +        "area_id"               INT4            REFERENCES "area" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.46 +        "value"                 TEXT            NOT NULL );
    1.47 +
    1.48 +COMMENT ON TABLE "area_setting" IS 'Place for frontend to store area specific settings of members as strings';
    1.49 +
    1.50 +
    1.51  CREATE TABLE "allowed_policy" (
    1.52          PRIMARY KEY ("area_id", "policy_id"),
    1.53          "area_id"               INT4            REFERENCES "area" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.54 @@ -375,6 +395,16 @@
    1.55  COMMENT ON COLUMN "issue"."voter_count"           IS 'Total number of direct and delegating voters; This value is related to the final voting, while "population" is related to snapshots before the final voting';
    1.56  
    1.57  
    1.58 +CREATE TABLE "issue_setting" (
    1.59 +        PRIMARY KEY ("member_id", "key", "issue_id"),
    1.60 +        "member_id"             INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.61 +        "key"                   TEXT            NOT NULL,
    1.62 +        "issue_id"              INT4            REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.63 +        "value"                 TEXT            NOT NULL );
    1.64 +
    1.65 +COMMENT ON TABLE "issue_setting" IS 'Place for frontend to store issue specific settings of members as strings';
    1.66 +
    1.67 +
    1.68  CREATE TABLE "initiative" (
    1.69          UNIQUE ("issue_id", "id"),  -- index needed for foreign-key on table "vote"
    1.70          "issue_id"              INT4            NOT NULL REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.71 @@ -428,6 +458,16 @@
    1.72  COMMENT ON COLUMN "initiative"."rank"           IS 'Rank of approved initiatives (winner is 1), calculated from table "direct_voter"';
    1.73  
    1.74  
    1.75 +CREATE TABLE "initiative_setting" (
    1.76 +        PRIMARY KEY ("member_id", "key", "initiative_id"),
    1.77 +        "member_id"             INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.78 +        "key"                   TEXT            NOT NULL,
    1.79 +        "initiative_id"         INT4            REFERENCES "initiative" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.80 +        "value"                 TEXT            NOT NULL );
    1.81 +
    1.82 +COMMENT ON TABLE "initiative_setting" IS 'Place for frontend to store initiative specific settings of members as strings';
    1.83 +
    1.84 +
    1.85  CREATE TABLE "draft" (
    1.86          UNIQUE ("initiative_id", "id"),  -- index needed for foreign-key on table "supporter"
    1.87          "initiative_id"         INT4            NOT NULL REFERENCES "initiative" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.88 @@ -489,6 +529,16 @@
    1.89  COMMENT ON COLUMN "suggestion"."plus2_fulfilled_count"    IS 'Calculated from table "direct_supporter_snapshot", not requiring informed supporters';
    1.90  
    1.91  
    1.92 +CREATE TABLE "suggestion_setting" (
    1.93 +        PRIMARY KEY ("member_id", "key", "suggestion_id"),
    1.94 +        "member_id"             INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.95 +        "key"                   TEXT            NOT NULL,
    1.96 +        "suggestion_id"         INT8            REFERENCES "suggestion" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.97 +        "value"                 TEXT            NOT NULL );
    1.98 +
    1.99 +COMMENT ON TABLE "suggestion_setting" IS 'Place for frontend to store suggestion specific settings of members as strings';
   1.100 +
   1.101 +
   1.102  CREATE TABLE "membership" (
   1.103          PRIMARY KEY ("area_id", "member_id"),
   1.104          "area_id"               INT4            REFERENCES "area" ("id") ON DELETE CASCADE ON UPDATE CASCADE,

Impressum / About Us