# HG changeset patch # User jbe # Date 1345426125 -7200 # Node ID 86f231bd69061f84299253deeabb03c58550d9d5 # Parent 2301a1f2acfa7343f54d05a7a932846b4bb55e15 Issues may have an admission_time set to NULL diff -r 2301a1f2acfa -r 86f231bd6906 core.sql --- a/core.sql Sun Aug 19 23:37:37 2012 +0200 +++ b/core.sql Mon Aug 20 03:28:45 2012 +0200 @@ -504,7 +504,7 @@ "closed" TIMESTAMPTZ, "ranks_available" BOOLEAN NOT NULL DEFAULT FALSE, "cleaned" TIMESTAMPTZ, - "admission_time" INTERVAL NOT NULL, + "admission_time" INTERVAL, "discussion_time" INTERVAL NOT NULL, "verification_time" INTERVAL NOT NULL, "voting_time" INTERVAL NOT NULL, @@ -513,6 +513,8 @@ "population" INT4, "voter_count" INT4, "status_quo_schulze_rank" INT4, + CONSTRAINT "admission_time_not_null_unless_instantly_accepted" CHECK ( + "admission_time" NOTNULL OR ("accepted" NOTNULL AND "accepted" = "created") ), CONSTRAINT "valid_state" CHECK (( ("accepted" ISNULL AND "half_frozen" ISNULL AND "fully_frozen" ISNULL AND "closed" ISNULL AND "ranks_available" = FALSE) OR ("accepted" ISNULL AND "half_frozen" ISNULL AND "fully_frozen" ISNULL AND "closed" NOTNULL AND "ranks_available" = FALSE) OR diff -r 2301a1f2acfa -r 86f231bd6906 update/core-update.v2.0.11-v2.1.0.sql --- a/update/core-update.v2.0.11-v2.1.0.sql Sun Aug 19 23:37:37 2012 +0200 +++ b/update/core-update.v2.0.11-v2.1.0.sql Mon Aug 20 03:28:45 2012 +0200 @@ -33,6 +33,10 @@ "verification_time" ISNULL AND "voting_time" ISNULL ) ); COMMENT ON COLUMN "policy"."polling" IS 'TRUE = special policy for non-user-generated issues without issue quorum, where certain initiatives (those having the "polling" flag set) do not need to pass the initiative quorum; "admission_time" MUST be set to NULL, the other timings may be set to NULL altogether, allowing individual timing for those issues'; +ALTER TABLE "issue" ALTER COLUMN "admission_time" DROP NOT NULL; +ALTER TABLE "issue" ADD CONSTRAINT "admission_time_not_null_unless_instantly_accepted" CHECK ( + "admission_time" NOTNULL OR ("accepted" NOTNULL AND "accepted" = "created") ); + ALTER TABLE "initiative" ADD COLUMN "polling" BOOLEAN NOT NULL DEFAULT FALSE; COMMENT ON COLUMN "initiative"."polling" IS 'Initiative does not need to pass the initiative quorum (see "policy"."polling")';