jbe@440: BEGIN; jbe@440: jbe@440: CREATE OR REPLACE VIEW "liquid_feedback_version" AS jbe@440: SELECT * FROM (VALUES ('3.0.4', 3, 0, 4)) jbe@440: AS "subquery"("string", "major", "minor", "revision"); jbe@440: jbe@440: ALTER TABLE "member" ADD COLUMN "authority" TEXT; jbe@440: ALTER TABLE "member" ADD COLUMN "authority_uid" TEXT; jbe@440: ALTER TABLE "member" ADD COLUMN "authority_login" TEXT; jbe@440: jbe@440: 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)'; jbe@440: 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)'; jbe@440: COMMENT ON COLUMN "member"."authority_login" IS 'Login name for external accounts (field is not unique!)'; jbe@440: jbe@440: ALTER TABLE "member" ADD CONSTRAINT "authority_requires_uid_and_vice_versa" jbe@440: CHECK ("authority" NOTNULL = "authority_uid" NOTNULL); jbe@440: jbe@440: ALTER TABLE "member" ADD CONSTRAINT "authority_uid_unique_per_authority" jbe@440: UNIQUE ("authority", "authority_uid"); jbe@440: jbe@440: ALTER TABLE "member" ADD CONSTRAINT "authority_login_requires_authority" jbe@440: CHECK ("authority" NOTNULL OR "authority_login" ISNULL); jbe@440: jbe@440: CREATE INDEX "member_authority_login_idx" ON "member" ("authority_login"); jbe@440: jbe@440: ALTER TABLE "session" ADD COLUMN "authority" TEXT; jbe@440: ALTER TABLE "session" ADD COLUMN "authority_uid" TEXT; jbe@440: ALTER TABLE "session" ADD COLUMN "authority_login" TEXT; jbe@440: jbe@440: COMMENT ON COLUMN "session"."authority" IS 'Temporary store for "member"."authority" during member account creation'; jbe@440: COMMENT ON COLUMN "session"."authority_uid" IS 'Temporary store for "member"."authority_uid" during member account creation'; jbe@440: COMMENT ON COLUMN "session"."authority_login" IS 'Temporary store for "member"."authority_login" during member account creation'; jbe@440: jbe@440: COMMIT;