liquid_feedback_core

changeset 175:62ac82e55a57

Added constraints on table "initiative"; Added comment for column "initiative"."rank"
author jbe
date Tue Jun 07 21:30:20 2011 +0200 (2011-06-07)
parents 368fe2299d07
children b2d87fbb123b
files core.sql
line diff
     1.1 --- a/core.sql	Tue Jun 07 20:56:42 2011 +0200
     1.2 +++ b/core.sql	Tue Jun 07 21:30:20 2011 +0200
     1.3 @@ -588,6 +588,11 @@
     1.4              "reverse_beat_path" ISNULL AND "multistage_majority" ISNULL AND
     1.5              "eligible" ISNULL AND "winner" ISNULL AND "rank" ISNULL ) ),
     1.6          CONSTRAINT "better_excludes_worse" CHECK (NOT ("better_than_status_quo" AND "worse_than_status_quo")),
     1.7 +        CONSTRAINT "minimum_requirement_to_be_eligible" CHECK (
     1.8 +          "eligible" = FALSE OR
     1.9 +          ("direct_majority" AND "indirect_majority" AND "better_than_status_quo") ),
    1.10 +        CONSTRAINT "winner_must_be_eligible" CHECK ("winner"=FALSE OR "eligible"=TRUE),
    1.11 +        CONSTRAINT "winner_must_have_first_rank" CHECK ("winner"=FALSE OR "rank"=1),
    1.12          CONSTRAINT "unique_rank_per_issue" UNIQUE ("issue_id", "rank") );
    1.13  CREATE INDEX "initiative_created_idx" ON "initiative" ("created");
    1.14  CREATE INDEX "initiative_revoked_idx" ON "initiative" ("revoked");
    1.15 @@ -619,6 +624,7 @@
    1.16  COMMENT ON COLUMN "initiative"."multistage_majority"     IS 'TRUE, if either (a) this initiative has no better rank than the status quo, or (b) there exists a better ranked initiative X, which directly beats this initiative, and either more voters prefer X to this initiative than voters preferring X to the status quo or less voters prefer this initiative to X than voters preferring the status quo to X';
    1.17  COMMENT ON COLUMN "initiative"."eligible"                IS 'Initiative is "attainable" and depending on selected policy has no "reverse_beat_path" or "multistage_majority"';
    1.18  COMMENT ON COLUMN "initiative"."winner"                  IS 'Winner is the "eligible" initiative with best "schulze_rank" and in case of ties with lowest "id"';
    1.19 +COMMENT ON COLUMN "initiative"."rank"                    IS 'Unique ranking for all "admitted" initiatives per issue; lower rank is better; a winner always has rank 1, but rank 1 does not imply that an initiative is winner; initiatives with "direct_majority" AND "indirect_majority" always have a better (lower) rank than other initiatives';
    1.20  
    1.21  
    1.22  CREATE TABLE "battle" (

Impressum / About Us