File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,9 +111,8 @@ X-FMSG-Act-As: @user_bot@example.com
111111The requested address must be granted to the authenticated user and must exist
112112in fmsgid.
113113
114- Apply [ dd.sql] ( dd.sql ) before enabling API-key auth. Existing
115- deployments that already applied the earlier API-key table should apply
116- [ api_keys_delegation.sql] ( api_keys_delegation.sql ) .
114+ Apply [ dd.sql] ( dd.sql ) before enabling API-key auth. The file is idempotent and
115+ also upgrades deployments that previously applied the earlier API-key table.
117116
118117To set a custom per-owner grant limit, insert an owner config row:
119118
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -31,6 +31,28 @@ CREATE TABLE IF NOT EXISTS fmsg_api_sub_account (
3131 CHECK (agent = ' ' OR agent NOT LIKE ' %\_ %' ESCAPE ' \' )
3232);
3333
34+ ALTER TABLE fmsg_api_sub_account
35+ ADD COLUMN IF NOT EXISTS grant_type text NOT NULL DEFAULT ' derived_sub_account' ;
36+
37+ ALTER TABLE fmsg_api_sub_account
38+ ADD COLUMN IF NOT EXISTS display_name text;
39+
40+ ALTER TABLE fmsg_api_sub_account
41+ DROP CONSTRAINT IF EXISTS fmsg_api_sub_account_sub_addr_key;
42+
43+ DO $$
44+ BEGIN
45+ IF NOT EXISTS (
46+ SELECT 1
47+ FROM pg_constraint
48+ WHERE conname = ' fmsg_api_sub_account_grant_type_check'
49+ ) THEN
50+ ALTER TABLE fmsg_api_sub_account
51+ ADD CONSTRAINT fmsg_api_sub_account_grant_type_check
52+ CHECK (grant_type IN (' derived_sub_account' , ' delegated_identity' ));
53+ END IF;
54+ END $$;
55+
3456CREATE INDEX IF NOT EXISTS fmsg_api_sub_account_owner_idx
3557 ON fmsg_api_sub_account ((lower(owner_addr)));
3658
You can’t perform that action at this time.
0 commit comments