liquid_feedback_core
diff update/core-update.v3.0.3-v3.0.4.sql @ 440:9055fd4de232
Added data structures to support externally managed accounts (e.g. LDAP)
author | jbe |
---|---|
date | Tue Jul 22 18:46:25 2014 +0200 (2014-07-22) |
parents | |
children | f5c78b0590c6 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/update/core-update.v3.0.3-v3.0.4.sql Tue Jul 22 18:46:25 2014 +0200 1.3 @@ -0,0 +1,34 @@ 1.4 +BEGIN; 1.5 + 1.6 +CREATE OR REPLACE VIEW "liquid_feedback_version" AS 1.7 + SELECT * FROM (VALUES ('3.0.4', 3, 0, 4)) 1.8 + AS "subquery"("string", "major", "minor", "revision"); 1.9 + 1.10 +ALTER TABLE "member" ADD COLUMN "authority" TEXT; 1.11 +ALTER TABLE "member" ADD COLUMN "authority_uid" TEXT; 1.12 +ALTER TABLE "member" ADD COLUMN "authority_login" TEXT; 1.13 + 1.14 +COMMENT ON COLUMN "member"."authority" IS 'NULL if LiquidFeedback Core is authoritative for the member account; otherwise a string that indicates the source/authority of the external account (e.g. ''LDAP'' for an LDAP account)'; 1.15 +COMMENT ON COLUMN "member"."authority_uid" IS 'Unique identifier (unique per "authority") that allows to identify an external account (e.g. even if the login name changes)'; 1.16 +COMMENT ON COLUMN "member"."authority_login" IS 'Login name for external accounts (field is not unique!)'; 1.17 + 1.18 +ALTER TABLE "member" ADD CONSTRAINT "authority_requires_uid_and_vice_versa" 1.19 + CHECK ("authority" NOTNULL = "authority_uid" NOTNULL); 1.20 + 1.21 +ALTER TABLE "member" ADD CONSTRAINT "authority_uid_unique_per_authority" 1.22 + UNIQUE ("authority", "authority_uid"); 1.23 + 1.24 +ALTER TABLE "member" ADD CONSTRAINT "authority_login_requires_authority" 1.25 + CHECK ("authority" NOTNULL OR "authority_login" ISNULL); 1.26 + 1.27 +CREATE INDEX "member_authority_login_idx" ON "member" ("authority_login"); 1.28 + 1.29 +ALTER TABLE "session" ADD COLUMN "authority" TEXT; 1.30 +ALTER TABLE "session" ADD COLUMN "authority_uid" TEXT; 1.31 +ALTER TABLE "session" ADD COLUMN "authority_login" TEXT; 1.32 + 1.33 +COMMENT ON COLUMN "session"."authority" IS 'Temporary store for "member"."authority" during member account creation'; 1.34 +COMMENT ON COLUMN "session"."authority_uid" IS 'Temporary store for "member"."authority_uid" during member account creation'; 1.35 +COMMENT ON COLUMN "session"."authority_login" IS 'Temporary store for "member"."authority_login" during member account creation'; 1.36 + 1.37 +COMMIT;