dba595fd2d
Migration 20260511000001 adiciona campo 'notes' (Observacao, textarea, sort_order=30) como campo extra default no commitment determinado 'Sessao'. Antes Sessao era a unica excecao entre os nativos — Leitura/Supervisao/ Aula/Analise ja tinham. Padroniza pra que a Observacao da sessao siga o mesmo mecanismo de extra_fields dos outros, e o frontend remova a textarea hardcoded do AgendaEventDialog (proximo commit). Backfill: insere 'notes' em TODOS os commitments Sessao ja existentes (idempotente). Forward-fix: substitui a funcao seed_determined_commitments incluindo o bloco de Sessao + 'notes' pra novos tenants. Schema regenerado via db.cjs schema-export pra refletir o estado pos- migration. agenciapsi-db-dashboard.html regenerado pelo generate-dashboard.cjs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.1 KiB
PL/PgSQL
44 lines
1.1 KiB
PL/PgSQL
-- Functions: auth
|
|
-- Gerado automaticamente em 2026-05-11T16:53:50.917Z
|
|
-- Total: 4
|
|
|
|
CREATE FUNCTION auth.email() RETURNS text
|
|
LANGUAGE sql STABLE
|
|
AS $$
|
|
select
|
|
coalesce(
|
|
nullif(current_setting('request.jwt.claim.email', true), ''),
|
|
(nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'email')
|
|
)::text
|
|
$$;
|
|
|
|
CREATE FUNCTION auth.jwt() RETURNS jsonb
|
|
LANGUAGE sql STABLE
|
|
AS $$
|
|
select
|
|
coalesce(
|
|
nullif(current_setting('request.jwt.claim', true), ''),
|
|
nullif(current_setting('request.jwt.claims', true), '')
|
|
)::jsonb
|
|
$$;
|
|
|
|
CREATE FUNCTION auth.role() RETURNS text
|
|
LANGUAGE sql STABLE
|
|
AS $$
|
|
select
|
|
coalesce(
|
|
nullif(current_setting('request.jwt.claim.role', true), ''),
|
|
(nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'role')
|
|
)::text
|
|
$$;
|
|
|
|
CREATE FUNCTION auth.uid() RETURNS uuid
|
|
LANGUAGE sql STABLE
|
|
AS $$
|
|
select
|
|
coalesce(
|
|
nullif(current_setting('request.jwt.claim.sub', true), ''),
|
|
(nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'sub')
|
|
)::uuid
|
|
$$;
|