chatdesk-ui/auth_v2.169.0/migrations/20211202183645_update_auth_...

16 lines
311 B
PL/PgSQL

-- update auth.uid()
create or replace function {{ index .Options "Namespace" }}.uid()
returns uuid
language sql stable
as $$
select
nullif(
coalesce(
current_setting('request.jwt.claim.sub', true),
(current_setting('request.jwt.claims', true)::jsonb ->> 'sub')
),
''
)::uuid
$$;