You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -10,11 +12,11 @@ CREATE TABLE IF NOT EXISTS fmsg_api_sub_account (
10
12
created_at timestamptzNOT NULL DEFAULT now(),
11
13
updated_at timestamptzNOT NULL DEFAULT now(),
12
14
PRIMARY KEY (owner_addr, agent),
13
-
UNIQUE (sub_addr),
14
15
UNIQUE (key_id),
15
16
CHECK (max_sub_accounts >0),
17
+
CHECK (grant_type IN ('derived_sub_account', 'delegated_identity')),
16
18
CHECK (
17
-
(agent =''AND sub_addr IS NULLAND key_id IS NULLAND key_hash IS NULLAND allowed_cidrs IS NULLAND key_expires_at IS NULL)
19
+
(agent =''AND sub_addr IS NULLANDdisplay_name IS NULLANDkey_id IS NULLAND key_hash IS NULLAND allowed_cidrs IS NULLAND key_expires_at IS NULL)
18
20
OR
19
21
(agent <>''AND sub_addr IS NOT NULLAND key_id IS NOT NULLAND key_hash IS NOT NULLAND allowed_cidrs IS NOT NULLAND cardinality(allowed_cidrs) >0AND key_expires_at IS NOT NULL)
20
22
),
@@ -26,3 +28,7 @@ CREATE INDEX IF NOT EXISTS fmsg_api_sub_account_owner_idx
26
28
27
29
CREATE INDEX IF NOT EXISTS fmsg_api_sub_account_sub_idx
28
30
ON fmsg_api_sub_account ((lower(sub_addr)));
31
+
32
+
CREATE UNIQUE INDEX IF NOT EXISTS fmsg_api_sub_account_owner_sub_unique
33
+
ON fmsg_api_sub_account ((lower(owner_addr)), (lower(sub_addr)))
0 commit comments