# HG changeset patch # User jbe # Date 1520183407 -3600 # Node ID 1cb6710fc4296baf56ddcc5135722a522a3cee5c # Parent 78f6833f5f19f0da5b8c4aaab7c0b6926752e549 Introduced "accepted" flag for agents of role/member accounts diff -r 78f6833f5f19 -r 1cb6710fc429 core.sql --- a/core.sql Sun Mar 04 17:59:11 2018 +0100 +++ b/core.sql Sun Mar 04 18:10:07 2018 +0100 @@ -212,12 +212,15 @@ PRIMARY KEY ("controlled_id", "controller_id"), "controlled_id" INT4 REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE, "controller_id" INT4 REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + "accepted" BOOLEAN, CONSTRAINT "controlled_id_and_controller_id_differ" CHECK ( "controlled_id" != "controller_id" ) ); CREATE INDEX "agent_controller_id_idx" ON "agent" ("controller_id"); COMMENT ON TABLE "agent" IS 'Privileges for role accounts'; +COMMENT ON COLUMN "agent"."accepted" IS 'If "accepted" is NULL, then the member was invited to be an agent, but has not reacted yet. If it is TRUE, the member has accepted the invitation, if it is FALSE, the member has rejected the invitation.'; + CREATE TABLE "verification" ( "id" SERIAL8 PRIMARY KEY, diff -r 78f6833f5f19 -r 1cb6710fc429 update/core-update.v4.0.0-v4.0.1.sql --- a/update/core-update.v4.0.0-v4.0.1.sql Sun Mar 04 17:59:11 2018 +0100 +++ b/update/core-update.v4.0.0-v4.0.1.sql Sun Mar 04 18:10:07 2018 +0100 @@ -10,12 +10,15 @@ PRIMARY KEY ("controlled_id", "controller_id"), "controlled_id" INT4 REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE, "controller_id" INT4 REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + "accepted" BOOLEAN, CONSTRAINT "controlled_id_and_controller_id_differ" CHECK ( "controlled_id" != "controller_id" ) ); CREATE INDEX "agent_controller_id_idx" ON "agent" ("controller_id"); COMMENT ON TABLE "agent" IS 'Privileges for role accounts'; +COMMENT ON COLUMN "agent"."accepted" IS 'If "accepted" is NULL, then the member was invited to be an agent, but has not reacted yet. If it is TRUE, the member has accepted the invitation, if it is FALSE, the member has rejected the invitation.'; + ALTER TABLE "session" ADD COLUMN "real_member_id" INT4 REFERENCES "member" ("id") ON DELETE RESTRICT ON UPDATE CASCADE; COMMENT ON COLUMN "session"."member_id" IS 'Reference to member, who is logged in, or role account in use';