
jbe@574: BEGIN;
jbe@574: 
jbe@574: CREATE OR REPLACE VIEW "liquid_feedback_version" AS
jbe@574:   SELECT * FROM (VALUES ('4.0.1', 4, 0, 1))
jbe@574:   AS "subquery"("string", "major", "minor", "revision");
jbe@574: 
jbe@578: ALTER TABLE "member" ADD COLUMN "role" BOOLEAN NOT NULL DEFAULT FALSE;
jbe@578: 
jbe@578: CREATE TABLE "agent" (
jbe@578:         PRIMARY KEY ("controlled_id", "controller_id"),
jbe@578:         "controlled_id"         INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
jbe@578:         "controller_id"         INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
jbe@578:         CONSTRAINT "controlled_id_and_controller_id_differ" CHECK (
jbe@578:             "controlled_id" != "controller_id" ) );
jbe@578: CREATE INDEX "agent_controller_id_idx" ON "agent" ("controller_id");
jbe@578: 
jbe@578: COMMENT ON TABLE "agent" IS 'Privileges for role accounts';
jbe@578: 
jbe@574: CREATE OR REPLACE VIEW "expired_token" AS
jbe@574:   SELECT * FROM "token" WHERE now() > "expiry" AND NOT (
jbe@574:     "token_type" = 'authorization' AND "used" AND EXISTS (
jbe@574:       SELECT NULL FROM "token" AS "other"
jbe@574:       WHERE "other"."authorization_token_id" = "token"."id" ) );
jbe@574: 
jbe@575: ALTER TABLE "system_application" RENAME COLUMN "discovery_baseurl" TO "base_url";
jbe@575: ALTER TABLE "system_application" ADD COLUMN "manifest_url" TEXT;
jbe@575: 
jbe@576: COMMENT ON COLUMN "system_application"."base_url"     IS 'Base URL for users';
jbe@576: COMMENT ON COLUMN "system_application"."manifest_url" IS 'URL referring to a manifest that can be used for application (type/version) discovery';
jbe@575: 
jbe@574: COMMIT;




