liquid_feedback_core

diff update/core-update.v1.4.0-v1.5.0.sql @ 182:4c03ef70dd92

Removed trigger "set_activated_timestamp"; Updated update script
author jbe
date Fri Jul 29 15:23:42 2011 +0200 (2011-07-29)
parents 1024224df943
children ed2f94a397cd
line diff
     1.1 --- a/update/core-update.v1.4.0-v1.5.0.sql	Wed Jul 06 23:16:48 2011 +0200
     1.2 +++ b/update/core-update.v1.4.0-v1.5.0.sql	Fri Jul 29 15:23:42 2011 +0200
     1.3 @@ -6,7 +6,16 @@
     1.4    SELECT * FROM (VALUES ('1.5.0_devel', 1, 5, -1))
     1.5    AS "subquery"("string", "major", "minor", "revision");
     1.6  
     1.7 +ALTER TABLE "member" ADD COLUMN "invite_code" TEXT UNIQUE;
     1.8 +ALTER TABLE "member" ADD COLUMN "admin_comment" TEXT;
     1.9 +ALTER TABLE "member" ADD COLUMN "activated" TIMESTAMPTZ;
    1.10 +ALTER TABLE "member" ALTER COLUMN "active" SET DEFAULT FALSE;
    1.11  ALTER TABLE "member" ADD COLUMN "formatting_engine" TEXT;
    1.12 +
    1.13 +COMMENT ON COLUMN "member"."created"           IS 'Creation of member record and/or invite code';
    1.14 +COMMENT ON COLUMN "member"."invite_code"       IS 'Optional invite code, to allow a member to initialize his/her account the first time';
    1.15 +COMMENT ON COLUMN "member"."activated"         IS 'Timestamp of activation of account (i.e. usage of "invite_code"); needs to be set for "active" members';
    1.16 +COMMENT ON COLUMN "member"."active"            IS 'Memberships, support and votes are taken into account when corresponding members are marked as active. When the user does not log in for an extended period of time, this flag may be set to FALSE. If the user is not locked, he/she may reset the active flag by logging in (has to be set to TRUE by frontend on every login).';
    1.17  COMMENT ON COLUMN "member"."formatting_engine" IS 'Allows different formatting engines (i.e. wiki formats) to be used for "member"."statement"';
    1.18  
    1.19  CREATE TABLE "rendered_member_statement" (
    1.20 @@ -1034,6 +1043,18 @@
    1.21  
    1.22  BEGIN;
    1.23  
    1.24 +UPDATE "member" SET "activated" = "created";
    1.25 +
    1.26 +UPDATE "member" SET
    1.27 +  "created" = "invite_code"."created",
    1.28 +  "invite_code" = "invite_code"."code",
    1.29 +  "admin_comment" = "invite_code"."comment"
    1.30 +  FROM "invite_code"
    1.31 +  WHERE "member"."id" = "invite_code"."member_id";
    1.32 +
    1.33 +DROP TABLE "invite_code_unit";
    1.34 +DROP TABLE "invite_code";
    1.35 +
    1.36  UPDATE "initiative" SET
    1.37      "direct_majority"        = "rank" NOTNULL,
    1.38      "indirect_majority"      = "rank" NOTNULL,
    1.39 @@ -1105,4 +1126,6 @@
    1.40  
    1.41  COMMIT;
    1.42  
    1.43 +ALTER TABLE "member" ADD CONSTRAINT "not_active_without_activated"
    1.44 +  CHECK ("activated" NOTNULL OR "active" = FALSE);
    1.45  ALTER TABLE "suggestion" ALTER COLUMN "draft_id" SET NOT NULL;

Impressum / About Us