diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 359e088..f113e61 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -20,7 +20,30 @@ "Bash(find:*)", "Bash(ls:*)", "Bash(npx vite:*)", - "Bash(powershell -Command \"$content = [System.IO.File]::ReadAllText\\(''src/views/pages/clinic/clinic/ClinicFeaturesPage.vue'', [System.Text.Encoding]::UTF8\\); $content = $content -replace [char]0x201C, ''\"\"'' -replace [char]0x201D, ''\"\"''; [System.IO.File]::WriteAllText\\(''src/views/pages/clinic/clinic/ClinicFeaturesPage.vue'', $content, [System.Text.Encoding]::UTF8\\)\")" + "Bash(powershell -Command \"$content = [System.IO.File]::ReadAllText\\(''src/views/pages/clinic/clinic/ClinicFeaturesPage.vue'', [System.Text.Encoding]::UTF8\\); $content = $content -replace [char]0x201C, ''\"\"'' -replace [char]0x201D, ''\"\"''; [System.IO.File]::WriteAllText\\(''src/views/pages/clinic/clinic/ClinicFeaturesPage.vue'', $content, [System.Text.Encoding]::UTF8\\)\")", + "Bash(xargs cat:*)", + "Bash(xxd \"D:/leonohama/AgenciaPsi.com.br/Sistema/agenciapsi-primesakai/DBS/2026-03-21/schema.sql\")", + "Bash(iconv -f UTF-16LE -t UTF-8 \"D:/leonohama/AgenciaPsi.com.br/Sistema/agenciapsi-primesakai/DBS/2026-03-21/schema.sql\")", + "Bash(mkdir -p docs/billing docs/planos docs/subscription-health docs/estrategia docs/specs)", + "Bash(mkdir -p database/backups database/migrations database/seeds database/fixes database/snippets)", + "Bash(cd:*)", + "Bash(mv disparando-whatsapp-local.md docs/whatsapp.md)", + "Bash(mv comandos.txt docs/)", + "Bash(mv dados-padrões-da-agenda.txt docs/)", + "Bash(mv USER_ARCHETYPES.html docs/)", + "Bash(mv Novo-DB/migration_*.sql database/migrations/)", + "Bash(mv Novo-DB/seed_*.sql database/seeds/)", + "Bash(mv Novo-DB/fix_*.sql database/fixes/)", + "Bash(npm install:*)", + "Bash(cp:*)", + "Bash(npm uninstall:*)", + "Bash(rm:*)", + "Bash(docker ps:*)", + "Bash(docker exec:*)", + "Bash(\"D:/leonohama/AgenciaPsi.com.br/Sistema/agenciapsi-primesakai/database-novo/backups/2026-03-23/schema.sql\")", + "Bash(\"D:/leonohama/AgenciaPsi.com.br/Sistema/agenciapsi-primesakai/database-novo/backups/2026-03-23/data.sql\")", + "Bash(\"D:/leonohama/AgenciaPsi.com.br/Sistema/agenciapsi-primesakai/database-novo/backups/2026-03-23/full_dump.sql\")", + "Bash(wc:*)" ] } } diff --git a/.gitignore b/.gitignore index 47cb90c..018ae1b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ api-generator/typedoc.json **/.DS_Store Dev-documentacao/ supabase/ +evolution-api/ \ No newline at end of file diff --git a/.hintrc b/.hintrc new file mode 100644 index 0000000..80894c6 --- /dev/null +++ b/.hintrc @@ -0,0 +1,15 @@ +{ + "extends": [ + "development" + ], + "hints": { + "compat-api/css": [ + "default", + { + "ignore": [ + "background-color: color-mix(in srgb, var(--primary-color) 50%, transparent)" + ] + } + ] + } +} \ No newline at end of file diff --git a/DBS/2026-03-11/Nova-Dev-Doc/supervisor_fase1.sql b/DBS/2026-03-11/Nova-Dev-Doc/supervisor_fase1.sql deleted file mode 100644 index 87ecaa1..0000000 --- a/DBS/2026-03-11/Nova-Dev-Doc/supervisor_fase1.sql +++ /dev/null @@ -1,414 +0,0 @@ --- ============================================================ --- SUPERVISOR — Fase 1 --- Aplicar no Supabase SQL Editor (em ordem) --- ============================================================ - - --- ──────────────────────────────────────────────────────────── --- 1. tenants.kind → adiciona 'supervisor' --- ──────────────────────────────────────────────────────────── -ALTER TABLE public.tenants - DROP CONSTRAINT IF EXISTS tenants_kind_check; - -ALTER TABLE public.tenants - ADD CONSTRAINT tenants_kind_check - CHECK (kind = ANY (ARRAY[ - 'therapist', - 'clinic_coworking', - 'clinic_reception', - 'clinic_full', - 'clinic', - 'saas', - 'supervisor' -- ← novo - ])); - - --- ──────────────────────────────────────────────────────────── --- 2. plans.target → adiciona 'supervisor' --- ──────────────────────────────────────────────────────────── -ALTER TABLE public.plans - DROP CONSTRAINT IF EXISTS plans_target_check; - -ALTER TABLE public.plans - ADD CONSTRAINT plans_target_check - CHECK (target = ANY (ARRAY[ - 'patient', - 'therapist', - 'clinic', - 'supervisor' -- ← novo - ])); - - --- ──────────────────────────────────────────────────────────── --- 3. plans.max_supervisees — limite de supervisionados --- ──────────────────────────────────────────────────────────── -ALTER TABLE public.plans - ADD COLUMN IF NOT EXISTS max_supervisees integer DEFAULT NULL; - -COMMENT ON COLUMN public.plans.max_supervisees IS - 'Limite de terapeutas que podem ser supervisionados. Apenas para planos target=supervisor. NULL = sem limite.'; - - --- ──────────────────────────────────────────────────────────── --- 4. Planos supervisor_free e supervisor_pro --- ──────────────────────────────────────────────────────────── -INSERT INTO public.plans (key, name, description, target, is_active, max_supervisees) -VALUES - ( - 'supervisor_free', - 'Supervisor Free', - 'Plano gratuito de supervisão. Até 3 terapeutas supervisionados.', - 'supervisor', - true, - 3 - ), - ( - 'supervisor_pro', - 'Supervisor PRO', - 'Plano profissional de supervisão. Até 20 terapeutas supervisionados.', - 'supervisor', - true, - 20 - ) -ON CONFLICT (key) DO UPDATE - SET - name = EXCLUDED.name, - description = EXCLUDED.description, - target = EXCLUDED.target, - is_active = EXCLUDED.is_active, - max_supervisees = EXCLUDED.max_supervisees; - - --- ──────────────────────────────────────────────────────────── --- 5. Features de supervisor --- ──────────────────────────────────────────────────────────── -INSERT INTO public.features (key, name, descricao) -VALUES - ( - 'supervisor.access', - 'Acesso à Supervisão', - 'Acesso básico ao espaço de supervisão (sala, lista de supervisionados).' - ), - ( - 'supervisor.invite', - 'Convidar Supervisionados', - 'Permite convidar terapeutas para participar da sala de supervisão.' - ), - ( - 'supervisor.sessions', - 'Sessões de Supervisão', - 'Agendamento e registro de sessões de supervisão.' - ), - ( - 'supervisor.reports', - 'Relatórios de Supervisão', - 'Relatórios avançados de progresso e evolução dos supervisionados.' - ) -ON CONFLICT (key) DO UPDATE - SET - name = EXCLUDED.name, - descricao = EXCLUDED.descricao; - - --- ──────────────────────────────────────────────────────────── --- 6. plan_features — vincula features aos planos supervisor --- ──────────────────────────────────────────────────────────── -DO $$ -DECLARE - v_free_id uuid; - v_pro_id uuid; - v_f_access uuid; - v_f_invite uuid; - v_f_sessions uuid; - v_f_reports uuid; -BEGIN - SELECT id INTO v_free_id FROM public.plans WHERE key = 'supervisor_free'; - SELECT id INTO v_pro_id FROM public.plans WHERE key = 'supervisor_pro'; - - SELECT id INTO v_f_access FROM public.features WHERE key = 'supervisor.access'; - SELECT id INTO v_f_invite FROM public.features WHERE key = 'supervisor.invite'; - SELECT id INTO v_f_sessions FROM public.features WHERE key = 'supervisor.sessions'; - SELECT id INTO v_f_reports FROM public.features WHERE key = 'supervisor.reports'; - - -- supervisor_free: access + invite (limitado por max_supervisees=3) - INSERT INTO public.plan_features (plan_id, feature_id) - VALUES - (v_free_id, v_f_access), - (v_free_id, v_f_invite) - ON CONFLICT DO NOTHING; - - -- supervisor_pro: tudo - INSERT INTO public.plan_features (plan_id, feature_id) - VALUES - (v_pro_id, v_f_access), - (v_pro_id, v_f_invite), - (v_pro_id, v_f_sessions), - (v_pro_id, v_f_reports) - ON CONFLICT DO NOTHING; -END; -$$; - - --- ──────────────────────────────────────────────────────────── --- 7. activate_subscription_from_intent — suporte a supervisor --- Supervisor = pessoal (user_id), sem tenant_id (igual therapist) --- ──────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) -RETURNS public.subscriptions -LANGUAGE plpgsql SECURITY DEFINER -AS $$ -declare - v_intent record; - v_sub public.subscriptions; - v_days int; - v_user_id uuid; - v_plan_id uuid; - v_target text; -begin - -- lê pela VIEW unificada - select * into v_intent - from public.subscription_intents - where id = p_intent_id; - - if not found then - raise exception 'Intent não encontrado: %', p_intent_id; - end if; - - if v_intent.status <> 'paid' then - raise exception 'Intent precisa estar paid para ativar assinatura'; - end if; - - -- resolve target e plan_id via plans.key - select p.id, p.target - into v_plan_id, v_target - from public.plans p - where p.key = v_intent.plan_key - limit 1; - - if v_plan_id is null then - raise exception 'Plano não encontrado em plans.key = %', v_intent.plan_key; - end if; - - v_target := lower(coalesce(v_target, '')); - - -- ✅ supervisor adicionado - if v_target not in ('clinic', 'therapist', 'supervisor') then - raise exception 'Target inválido em plans.target: %', v_target; - end if; - - -- regra por target - if v_target = 'clinic' then - if v_intent.tenant_id is null then - raise exception 'Intent sem tenant_id'; - end if; - else - -- therapist ou supervisor: vinculado ao user - v_user_id := v_intent.user_id; - if v_user_id is null then - v_user_id := v_intent.created_by_user_id; - end if; - end if; - - if v_target in ('therapist', 'supervisor') and v_user_id is null then - raise exception 'Não foi possível determinar user_id para assinatura %.', v_target; - end if; - - -- cancela assinatura ativa anterior - if v_target = 'clinic' then - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where tenant_id = v_intent.tenant_id - and plan_id = v_plan_id - and status = 'active'; - else - -- therapist ou supervisor - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where user_id = v_user_id - and plan_id = v_plan_id - and status = 'active' - and tenant_id is null; - end if; - - -- duração do plano (30 dias para mensal) - v_days := case - when lower(coalesce(v_intent.interval, 'month')) = 'year' then 365 - else 30 - end; - - -- cria nova assinatura - insert into public.subscriptions ( - user_id, - plan_id, - status, - started_at, - expires_at, - cancelled_at, - activated_at, - tenant_id, - plan_key, - interval, - source, - created_at, - updated_at - ) - values ( - case when v_target = 'clinic' then null else v_user_id end, - v_plan_id, - 'active', - now(), - now() + make_interval(days => v_days), - null, - now(), - case when v_target = 'clinic' then v_intent.tenant_id else null end, - v_intent.plan_key, - v_intent.interval, - 'manual', - now(), - now() - ) - returning * into v_sub; - - -- grava vínculo intent → subscription - if v_target = 'clinic' then - update public.subscription_intents_tenant - set subscription_id = v_sub.id - where id = p_intent_id; - else - update public.subscription_intents_personal - set subscription_id = v_sub.id - where id = p_intent_id; - end if; - - return v_sub; -end; -$$; - - --- ──────────────────────────────────────────────────────────── --- 8. subscriptions_validate_scope — suporte a supervisor --- ──────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.subscriptions_validate_scope() -RETURNS trigger -LANGUAGE plpgsql -AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target IN ('therapist', 'supervisor') THEN - -- supervisor é pessoal como therapist - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura % não deve ter tenant_id.', v_target; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura % exige user_id.', v_target; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - - --- ──────────────────────────────────────────────────────────── --- 9. subscription_intents_view_insert — suporte a supervisor --- supervisor é roteado como therapist (tabela personal) --- ──────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.subscription_intents_view_insert() -RETURNS trigger -LANGUAGE plpgsql SECURITY DEFINER -AS $$ -declare - v_target text; - v_plan_id uuid; -begin - select p.id, p.target into v_plan_id, v_target - from public.plans p - where p.key = new.plan_key; - - if v_plan_id is null then - raise exception 'Plano inválido: plan_key=%', new.plan_key; - end if; - - if lower(v_target) = 'clinic' then - if new.tenant_id is null then - raise exception 'Intenção clinic exige tenant_id.'; - end if; - - insert into public.subscription_intents_tenant ( - id, tenant_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.tenant_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := 'clinic'; - return new; - end if; - - -- therapist ou supervisor → tabela personal - if lower(v_target) in ('therapist', 'supervisor') then - insert into public.subscription_intents_personal ( - id, user_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.user_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := lower(v_target); -- 'therapist' ou 'supervisor' - return new; - end if; - - raise exception 'Target de plano não suportado: %', v_target; -end; -$$; - - --- ──────────────────────────────────────────────────────────── --- FIM — verificação rápida --- ──────────────────────────────────────────────────────────── -SELECT key, name, target, max_supervisees -FROM public.plans -WHERE target = 'supervisor' -ORDER BY key; diff --git a/DBS/2026-03-11/Novo-DB/migration_001.sql b/DBS/2026-03-11/Novo-DB/migration_001.sql deleted file mode 100644 index 74c6764..0000000 --- a/DBS/2026-03-11/Novo-DB/migration_001.sql +++ /dev/null @@ -1,296 +0,0 @@ --- ============================================================================= --- SEED 001 — Usuários fictícios para teste --- ============================================================================= --- Execute APÓS migration_001.sql --- --- Usuários criados: --- paciente@agenciapsi.com.br senha: Teste@123 → patient --- terapeuta@agenciapsi.com.br senha: Teste@123 → therapist --- clinica1@agenciapsi.com.br senha: Teste@123 → clinic_coworking --- clinica2@agenciapsi.com.br senha: Teste@123 → clinic_reception --- clinica3@agenciapsi.com.br senha: Teste@123 → clinic_full --- saas@agenciapsi.com.br senha: Teste@123 → saas_admin --- ============================================================================= - - --- ============================================================ --- Limpeza de seeds anteriores --- ============================================================ - -ALTER TABLE public.patient_groups DISABLE TRIGGER ALL; - -DELETE FROM public.tenant_members -WHERE user_id IN ( - SELECT id FROM auth.users - WHERE email IN ( - 'paciente@agenciapsi.com.br', - 'terapeuta@agenciapsi.com.br', - 'clinica1@agenciapsi.com.br', - 'clinica2@agenciapsi.com.br', - 'clinica3@agenciapsi.com.br', - 'saas@agenciapsi.com.br' - ) -); - -DELETE FROM public.tenants WHERE id IN ( - 'bbbbbbbb-0002-0002-0002-000000000002', - 'bbbbbbbb-0003-0003-0003-000000000003', - 'bbbbbbbb-0004-0004-0004-000000000004', - 'bbbbbbbb-0005-0005-0005-000000000005' -); - -DELETE FROM auth.users WHERE email IN ( - 'paciente@agenciapsi.com.br', - 'terapeuta@agenciapsi.com.br', - 'clinica1@agenciapsi.com.br', - 'clinica2@agenciapsi.com.br', - 'clinica3@agenciapsi.com.br', - 'saas@agenciapsi.com.br' -); - -ALTER TABLE public.patient_groups ENABLE TRIGGER ALL; - - --- ============================================================ --- 1. Usuários no auth.users --- ============================================================ - -INSERT INTO auth.users ( - id, email, encrypted_password, email_confirmed_at, - created_at, updated_at, raw_user_meta_data, role, aud -) -VALUES - ( - 'aaaaaaaa-0001-0001-0001-000000000001', - 'paciente@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Ana Paciente"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0002-0002-0002-000000000002', - 'terapeuta@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Bruno Terapeuta"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0003-0003-0003-000000000003', - 'clinica1@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Clinica Espaco Psi"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0004-0004-0004-000000000004', - 'clinica2@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Clinica Mente Sa"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0005-0005-0005-000000000005', - 'clinica3@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Clinica Bem Estar"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0006-0006-0006-000000000006', - 'saas@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Admin Plataforma"}'::jsonb, - 'authenticated', 'authenticated' - ); - - --- ============================================================ --- 2. Profiles --- ============================================================ - -INSERT INTO public.profiles (id, role, account_type, full_name) -VALUES - ('aaaaaaaa-0001-0001-0001-000000000001', 'portal_user', 'patient', 'Ana Paciente'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'portal_user', 'therapist', 'Bruno Terapeuta'), - ('aaaaaaaa-0003-0003-0003-000000000003', 'portal_user', 'clinic', 'Clinica Espaco Psi'), - ('aaaaaaaa-0004-0004-0004-000000000004', 'portal_user', 'clinic', 'Clinica Mente Sa'), - ('aaaaaaaa-0005-0005-0005-000000000005', 'portal_user', 'clinic', 'Clinica Bem Estar'), - ('aaaaaaaa-0006-0006-0006-000000000006', 'saas_admin', 'free', 'Admin Plataforma') -ON CONFLICT (id) DO UPDATE SET - role = EXCLUDED.role, - account_type = EXCLUDED.account_type, - full_name = EXCLUDED.full_name; - - --- ============================================================ --- 3. SaaS Admin --- ============================================================ - -INSERT INTO public.saas_admins (user_id, created_at) -VALUES ('aaaaaaaa-0006-0006-0006-000000000006', now()) -ON CONFLICT (user_id) DO NOTHING; - - --- ============================================================ --- 4. Tenant do terapeuta --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0002-0002-0002-000000000002', 'Bruno Terapeuta', 'therapist', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0002-0002-0002-000000000002', 'aaaaaaaa-0002-0002-0002-000000000002', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0002-0002-0002-000000000002'); -END; $$; - - --- ============================================================ --- 5. Tenant Clinica 1 — Coworking --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0003-0003-0003-000000000003', 'Clinica Espaco Psi', 'clinic_coworking', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0003-0003-0003-000000000003', 'aaaaaaaa-0003-0003-0003-000000000003', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0003-0003-0003-000000000003'); -END; $$; - - --- ============================================================ --- 6. Tenant Clinica 2 — Recepcao --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0004-0004-0004-000000000004', 'Clinica Mente Sa', 'clinic_reception', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0004-0004-0004-000000000004', 'aaaaaaaa-0004-0004-0004-000000000004', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0004-0004-0004-000000000004'); -END; $$; - - --- ============================================================ --- 7. Tenant Clinica 3 — Full --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0005-0005-0005-000000000005', 'Clinica Bem Estar', 'clinic_full', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0005-0005-0005-000000000005', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0005-0005-0005-000000000005'); -END; $$; - - --- ============================================================ --- 8. Subscriptions ativas --- ============================================================ - --- Paciente → patient_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0001-0001-0001-000000000001', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'patient_free'; - --- Terapeuta → therapist_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0002-0002-0002-000000000002', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'therapist_free'; - --- Clinica 1 → clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0003-0003-0003-000000000003', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Clinica 2 → clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0004-0004-0004-000000000004', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Clinica 3 → clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0005-0005-0005-000000000005', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - - --- ============================================================ --- 9. Vincula terapeuta à Clinica 3 (exemplo de associacao) --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0005-0005-0005-000000000005', - 'aaaaaaaa-0002-0002-0002-000000000002', - 'therapist', 'active', now() -) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - - --- ============================================================ --- Confirmacao --- ============================================================ - -DO $$ -BEGIN - RAISE NOTICE '✅ Seed aplicado com sucesso.'; - RAISE NOTICE ' paciente@agenciapsi.com.br → patient'; - RAISE NOTICE ' terapeuta@agenciapsi.com.br → therapist'; - RAISE NOTICE ' clinica1@agenciapsi.com.br → clinic_coworking'; - RAISE NOTICE ' clinica2@agenciapsi.com.br → clinic_reception'; - RAISE NOTICE ' clinica3@agenciapsi.com.br → clinic_full'; - RAISE NOTICE ' saas@agenciapsi.com.br → saas_admin'; - RAISE NOTICE ' Senha: Teste@123'; -END; -$$; diff --git a/DBS/2026-03-11/Novo-DB/migration_002_layout_variant.sql b/DBS/2026-03-11/Novo-DB/migration_002_layout_variant.sql deleted file mode 100644 index 6a74e0c..0000000 --- a/DBS/2026-03-11/Novo-DB/migration_002_layout_variant.sql +++ /dev/null @@ -1,13 +0,0 @@ --- ============================================================================= --- Migration 002 — Adiciona layout_variant em user_settings --- ============================================================================= --- Execute no SQL Editor do Supabase (ou via Docker psql). --- Tolerante: usa IF NOT EXISTS / DEFAULT para não quebrar dados existentes. --- ============================================================================= - -ALTER TABLE public.user_settings - ADD COLUMN IF NOT EXISTS layout_variant TEXT NOT NULL DEFAULT 'classic'; - --- ============================================================================= -RAISE NOTICE '✅ Coluna layout_variant adicionada a user_settings.'; --- ============================================================================= diff --git a/DBS/2026-03-11/Novo-DB/seed_001.sql b/DBS/2026-03-11/Novo-DB/seed_001.sql deleted file mode 100644 index c240a7e..0000000 --- a/DBS/2026-03-11/Novo-DB/seed_001.sql +++ /dev/null @@ -1,334 +0,0 @@ --- ============================================================================= --- SEED — Usuários fictícios para teste --- ============================================================================= --- IMPORTANTE: Execute APÓS a migration_001.sql --- IMPORTANTE: Requer extensão pgcrypto (já ativa no Supabase) --- --- Cria os seguintes usuários de teste: --- --- paciente@agenciapsi.com.br senha: Teste@123 → paciente --- terapeuta@agenciapsi.com.br senha: Teste@123 → terapeuta solo --- clinica1@agenciapsi.com.br senha: Teste@123 → clínica coworking --- clinica2@agenciapsi.com.br senha: Teste@123 → clínica com secretaria --- clinica3@agenciapsi.com.br senha: Teste@123 → clínica full --- saas@agenciapsi.com.br senha: Teste@123 → admin da plataforma --- --- ============================================================================= - -BEGIN; - --- ============================================================ --- Helper: cria usuário no auth.users + profile --- (Supabase não expõe auth.users diretamente, mas em SQL Editor --- com acesso de service_role podemos inserir diretamente) --- ============================================================ - --- Limpa seeds anteriores se existirem -DELETE FROM auth.users -WHERE email IN ( - 'paciente@agenciapsi.com.br', - 'terapeuta@agenciapsi.com.br', - 'clinica1@agenciapsi.com.br', - 'clinica2@agenciapsi.com.br', - 'clinica3@agenciapsi.com.br', - 'saas@agenciapsi.com.br' -); - --- ============================================================ --- 1. Cria usuários no auth.users --- ============================================================ - -INSERT INTO auth.users ( - instance_id, - id, - email, - encrypted_password, - email_confirmed_at, - confirmed_at, - created_at, - updated_at, - raw_user_meta_data, - raw_app_meta_data, - role, - aud, - is_sso_user, - is_anonymous, - confirmation_token, - recovery_token, - email_change_token_new, - email_change_token_current, - email_change -) -VALUES - -- Paciente - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0001-0001-0001-000000000001', - 'paciente@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), now(), - '{"name": "Ana Paciente"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Terapeuta - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0002-0002-0002-000000000002', - 'terapeuta@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), now(), - '{"name": "Bruno Terapeuta"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Clínica 1 — Coworking - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0003-0003-0003-000000000003', - 'clinica1@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), now(), - '{"name": "Clínica Espaço Psi"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Clínica 2 — Recepção - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0004-0004-0004-000000000004', - 'clinica2@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), now(), - '{"name": "Clínica Mente Sã"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Clínica 3 — Full - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0005-0005-0005-000000000005', - 'clinica3@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), now(), - '{"name": "Clínica Bem Estar"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- SaaS Admin - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0006-0006-0006-000000000006', - 'saas@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), now(), - '{"name": "Admin Plataforma"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ); - --- auth.identities (obrigatório para GoTrue reconhecer login email/senha) -INSERT INTO auth.identities (id, user_id, provider_id, provider, identity_data, created_at, updated_at, last_sign_in_at) -VALUES - (gen_random_uuid(), 'aaaaaaaa-0001-0001-0001-000000000001', 'paciente@agenciapsi.com.br', 'email', '{"sub": "aaaaaaaa-0001-0001-0001-000000000001", "email": "paciente@agenciapsi.com.br", "email_verified": true}'::jsonb, now(), now(), now()), - (gen_random_uuid(), 'aaaaaaaa-0002-0002-0002-000000000002', 'terapeuta@agenciapsi.com.br', 'email', '{"sub": "aaaaaaaa-0002-0002-0002-000000000002", "email": "terapeuta@agenciapsi.com.br", "email_verified": true}'::jsonb, now(), now(), now()), - (gen_random_uuid(), 'aaaaaaaa-0003-0003-0003-000000000003', 'clinica1@agenciapsi.com.br', 'email', '{"sub": "aaaaaaaa-0003-0003-0003-000000000003", "email": "clinica1@agenciapsi.com.br", "email_verified": true}'::jsonb, now(), now(), now()), - (gen_random_uuid(), 'aaaaaaaa-0004-0004-0004-000000000004', 'clinica2@agenciapsi.com.br', 'email', '{"sub": "aaaaaaaa-0004-0004-0004-000000000004", "email": "clinica2@agenciapsi.com.br", "email_verified": true}'::jsonb, now(), now(), now()), - (gen_random_uuid(), 'aaaaaaaa-0005-0005-0005-000000000005', 'clinica3@agenciapsi.com.br', 'email', '{"sub": "aaaaaaaa-0005-0005-0005-000000000005", "email": "clinica3@agenciapsi.com.br", "email_verified": true}'::jsonb, now(), now(), now()), - (gen_random_uuid(), 'aaaaaaaa-0006-0006-0006-000000000006', 'saas@agenciapsi.com.br', 'email', '{"sub": "aaaaaaaa-0006-0006-0006-000000000006", "email": "saas@agenciapsi.com.br", "email_verified": true}'::jsonb, now(), now(), now()) -ON CONFLICT (provider, provider_id) DO NOTHING; - - --- ============================================================ --- 2. Profiles (o trigger handle_new_user não dispara em inserts --- diretos no auth.users via SQL, então criamos manualmente) --- ============================================================ - -INSERT INTO public.profiles (id, role, account_type, full_name) -VALUES - ('aaaaaaaa-0001-0001-0001-000000000001', 'portal_user', 'patient', 'Ana Paciente'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'tenant_member', 'therapist', 'Bruno Terapeuta'), - ('aaaaaaaa-0003-0003-0003-000000000003', 'tenant_member', 'clinic', 'Clínica Espaço Psi'), - ('aaaaaaaa-0004-0004-0004-000000000004', 'tenant_member', 'clinic', 'Clínica Mente Sã'), - ('aaaaaaaa-0005-0005-0005-000000000005', 'tenant_member', 'clinic', 'Clínica Bem Estar'), - ('aaaaaaaa-0006-0006-0006-000000000006', 'saas_admin', 'free', 'Admin Plataforma') -ON CONFLICT (id) DO UPDATE SET - role = EXCLUDED.role, - account_type = EXCLUDED.account_type, - full_name = EXCLUDED.full_name; - - --- ============================================================ --- 3. SaaS Admin na tabela saas_admins --- ============================================================ - -INSERT INTO public.saas_admins (user_id, created_at) -VALUES ('aaaaaaaa-0006-0006-0006-000000000006', now()) -ON CONFLICT (user_id) DO NOTHING; - - --- ============================================================ --- 4. Tenant do terapeuta --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0002-0002-0002-000000000002', 'Bruno Terapeuta', 'therapist', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0002-0002-0002-000000000002', 'aaaaaaaa-0002-0002-0002-000000000002', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN PERFORM public.seed_determined_commitments('bbbbbbbb-0002-0002-0002-000000000002'); END $$; - - --- ============================================================ --- 5. Tenant da Clínica 1 — Coworking --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0003-0003-0003-000000000003', 'Clínica Espaço Psi', 'clinic_coworking', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0003-0003-0003-000000000003', 'aaaaaaaa-0003-0003-0003-000000000003', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN PERFORM public.seed_determined_commitments('bbbbbbbb-0003-0003-0003-000000000003'); END $$; - - --- ============================================================ --- 6. Tenant da Clínica 2 — Recepção --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0004-0004-0004-000000000004', 'Clínica Mente Sã', 'clinic_reception', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0004-0004-0004-000000000004', 'aaaaaaaa-0004-0004-0004-000000000004', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN PERFORM public.seed_determined_commitments('bbbbbbbb-0004-0004-0004-000000000004'); END $$; - - --- ============================================================ --- 7. Tenant da Clínica 3 — Full --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0005-0005-0005-000000000005', 'Clínica Bem Estar', 'clinic_full', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0005-0005-0005-000000000005', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN PERFORM public.seed_determined_commitments('bbbbbbbb-0005-0005-0005-000000000005'); END $$; - - --- ============================================================ --- 8. Subscriptions ativas para cada conta --- ============================================================ - --- Terapeuta → plano therapist_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0002-0002-0002-000000000002', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'therapist_free'; - --- Clínica 1 → plano clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0003-0003-0003-000000000003', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Clínica 2 → plano clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0004-0004-0004-000000000004', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Clínica 3 → plano clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0005-0005-0005-000000000005', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Paciente → plano patient_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0001-0001-0001-000000000001', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'patient_free'; - - --- ============================================================ --- 9. Vincula terapeuta à Clínica 3 (full) como exemplo --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0005-0005-0005-000000000005', - 'aaaaaaaa-0002-0002-0002-000000000002', - 'therapist', - 'active', - now() -) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - - --- ============================================================ --- 10. Confirma --- ============================================================ - -DO $$ -BEGIN - RAISE NOTICE '✅ Seed aplicado com sucesso.'; - RAISE NOTICE ''; - RAISE NOTICE ' Usuários criados:'; - RAISE NOTICE ' paciente@agenciapsi.com.br → patient'; - RAISE NOTICE ' terapeuta@agenciapsi.com.br → therapist (tenant próprio + vinculado à Clínica 3)'; - RAISE NOTICE ' clinica1@agenciapsi.com.br → clinic_coworking'; - RAISE NOTICE ' clinica2@agenciapsi.com.br → clinic_reception'; - RAISE NOTICE ' clinica3@agenciapsi.com.br → clinic_full'; - RAISE NOTICE ' saas@agenciapsi.com.br → saas_admin'; - RAISE NOTICE ' Senha de todos: Teste@123'; -END; -$$; - -COMMIT; diff --git a/DBS/2026-03-11/Novo-DB/seed_003.sql b/DBS/2026-03-11/Novo-DB/seed_003.sql deleted file mode 100644 index e849895..0000000 --- a/DBS/2026-03-11/Novo-DB/seed_003.sql +++ /dev/null @@ -1,283 +0,0 @@ --- ============================================================================= --- SEED 003 — Terapeuta 2, Terapeuta 3 e Secretária --- ============================================================================= --- Execute APÓS seed_001.sql (e seed_002.sql se quiser todos os seeds) --- Requer: pgcrypto (já ativo no Supabase) --- --- Cria os seguintes usuários de teste: --- --- therapist2@agenciapsi.com.br senha: Teste@123 → terapeuta 2 (tenant próprio + Clínica 3) --- therapist3@agenciapsi.com.br senha: Teste@123 → terapeuta 3 (tenant próprio + Clínica 3) --- secretary@agenciapsi.com.br senha: Teste@123 → clinic_admin na Clínica 2 (Mente Sã) --- --- UUIDs reservados: --- Terapeuta 2 → aaaaaaaa-0009-0009-0009-000000000009 --- Terapeuta 3 → aaaaaaaa-0010-0010-0010-000000000010 --- Secretária → aaaaaaaa-0011-0011-0011-000000000011 --- Tenant Terapeuta 2 → bbbbbbbb-0009-0009-0009-000000000009 --- Tenant Terapeuta 3 → bbbbbbbb-0010-0010-0010-000000000010 --- ============================================================================= - -BEGIN; - --- ============================================================ --- 1. Remove seeds anteriores (idempotente) --- ============================================================ - -DELETE FROM auth.users -WHERE email IN ( - 'therapist2@agenciapsi.com.br', - 'therapist3@agenciapsi.com.br', - 'secretary@agenciapsi.com.br' -); - - --- ============================================================ --- 2. Cria usuários no auth.users --- ⚠️ confirmed_at é coluna gerada — NÃO incluir na lista --- ============================================================ - -INSERT INTO auth.users ( - instance_id, - id, - email, - encrypted_password, - email_confirmed_at, - created_at, - updated_at, - raw_user_meta_data, - raw_app_meta_data, - role, - aud, - is_sso_user, - is_anonymous, - confirmation_token, - recovery_token, - email_change_token_new, - email_change_token_current, - email_change -) -VALUES - -- Terapeuta 2 - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0009-0009-0009-000000000009', - 'therapist2@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Eva Terapeuta"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Terapeuta 3 - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0010-0010-0010-000000000010', - 'therapist3@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Felipe Terapeuta"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Secretária - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0011-0011-0011-000000000011', - 'secretary@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Gabriela Secretária"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ); - - --- ============================================================ --- 3. auth.identities (obrigatório para GoTrue reconhecer login) --- ============================================================ - -INSERT INTO auth.identities (id, user_id, provider_id, provider, identity_data, created_at, updated_at, last_sign_in_at) -VALUES - ( - gen_random_uuid(), - 'aaaaaaaa-0009-0009-0009-000000000009', - 'therapist2@agenciapsi.com.br', - 'email', - '{"sub": "aaaaaaaa-0009-0009-0009-000000000009", "email": "therapist2@agenciapsi.com.br", "email_verified": true}'::jsonb, - now(), now(), now() - ), - ( - gen_random_uuid(), - 'aaaaaaaa-0010-0010-0010-000000000010', - 'therapist3@agenciapsi.com.br', - 'email', - '{"sub": "aaaaaaaa-0010-0010-0010-000000000010", "email": "therapist3@agenciapsi.com.br", "email_verified": true}'::jsonb, - now(), now(), now() - ), - ( - gen_random_uuid(), - 'aaaaaaaa-0011-0011-0011-000000000011', - 'secretary@agenciapsi.com.br', - 'email', - '{"sub": "aaaaaaaa-0011-0011-0011-000000000011", "email": "secretary@agenciapsi.com.br", "email_verified": true}'::jsonb, - now(), now(), now() - ) -ON CONFLICT (provider, provider_id) DO NOTHING; - - --- ============================================================ --- 4. Profiles --- ============================================================ - -INSERT INTO public.profiles (id, role, account_type, full_name) -VALUES - ( - 'aaaaaaaa-0009-0009-0009-000000000009', - 'tenant_member', - 'therapist', - 'Eva Terapeuta' - ), - ( - 'aaaaaaaa-0010-0010-0010-000000000010', - 'tenant_member', - 'therapist', - 'Felipe Terapeuta' - ), - ( - 'aaaaaaaa-0011-0011-0011-000000000011', - 'tenant_member', - 'therapist', - 'Gabriela Secretária' - ) -ON CONFLICT (id) DO UPDATE SET - role = EXCLUDED.role, - account_type = EXCLUDED.account_type, - full_name = EXCLUDED.full_name; - - --- ============================================================ --- 5. Tenants pessoais dos Terapeutas 2 e 3 --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES - ('bbbbbbbb-0009-0009-0009-000000000009', 'Eva Terapeuta', 'therapist', now()), - ('bbbbbbbb-0010-0010-0010-000000000010', 'Felipe Terapeuta', 'therapist', now()) -ON CONFLICT (id) DO NOTHING; - --- Terapeuta 2 → tenant_admin do próprio tenant -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0009-0009-0009-000000000009', - 'aaaaaaaa-0009-0009-0009-000000000009', - 'tenant_admin', 'active', now() -) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - --- Terapeuta 3 → tenant_admin do próprio tenant -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0010-0010-0010-000000000010', - 'aaaaaaaa-0010-0010-0010-000000000010', - 'tenant_admin', 'active', now() -) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - - --- ============================================================ --- 6. Vincula Terapeutas 2 e 3 à Clínica 3 — Full --- (mesmo padrão de terapeuta@agenciapsi.com.br no seed_001) --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES - ( - 'bbbbbbbb-0005-0005-0005-000000000005', -- Clínica Bem Estar (Full) - 'aaaaaaaa-0009-0009-0009-000000000009', -- Eva Terapeuta - 'therapist', 'active', now() - ), - ( - 'bbbbbbbb-0005-0005-0005-000000000005', -- Clínica Bem Estar (Full) - 'aaaaaaaa-0010-0010-0010-000000000010', -- Felipe Terapeuta - 'therapist', 'active', now() - ) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - - --- ============================================================ --- 7. Vincula Secretária à Clínica 2 (Recepção) como clinic_admin --- A secretária gerencia a recepção/agenda da clínica. --- Acessa a área /admin com o mesmo contexto de clinic_admin. --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0004-0004-0004-000000000004', -- Clínica Mente Sã (Recepção) - 'aaaaaaaa-0011-0011-0011-000000000011', -- Gabriela Secretária - 'clinic_admin', 'active', now() -) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - - --- ============================================================ --- 8. Subscriptions --- Terapeutas 2 e 3 → therapist_free (escopo: user_id) --- Secretária → sem assinatura própria (usa o plano da Clínica 2) --- ============================================================ - --- Terapeuta 2 → therapist_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0009-0009-0009-000000000009', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'therapist_free' -AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.user_id = 'aaaaaaaa-0009-0009-0009-000000000009' AND s.status = 'active' -); - --- Terapeuta 3 → therapist_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0010-0010-0010-000000000010', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', - 'seed', now(), now() -FROM public.plans p WHERE p.key = 'therapist_free' -AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.user_id = 'aaaaaaaa-0010-0010-0010-000000000010' AND s.status = 'active' -); - --- Nota: a Secretária não tem assinatura própria. --- O acesso vem do plano da Clínica 2 (tenant_id = bbbbbbbb-0004-0004-0004-000000000004). - - --- ============================================================ --- 9. Confirma --- ============================================================ - -DO $$ -BEGIN - RAISE NOTICE '✅ Seed 003 aplicado com sucesso.'; - RAISE NOTICE ''; - RAISE NOTICE ' Usuários criados:'; - RAISE NOTICE ' therapist2@agenciapsi.com.br → tenant próprio (bbbbbbbb-0009) + Clínica 3 como therapist'; - RAISE NOTICE ' therapist3@agenciapsi.com.br → tenant próprio (bbbbbbbb-0010) + Clínica 3 como therapist'; - RAISE NOTICE ' secretary@agenciapsi.com.br → clinic_admin na Clínica 2 Mente Sã (bbbbbbbb-0004)'; - RAISE NOTICE ' Senha de todos: Teste@123'; -END; -$$; - -COMMIT; diff --git a/DBS/2026-03-11/migrations/agendador_check_email.sql b/DBS/2026-03-11/migrations/agendador_check_email.sql deleted file mode 100644 index 0de3715..0000000 --- a/DBS/2026-03-11/migrations/agendador_check_email.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- agendador_check_email --- Verifica se um e-mail já possui solicitação anterior para este agendador --- SECURITY DEFINER → anon pode chamar sem burlar RLS diretamente --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - -CREATE OR REPLACE FUNCTION public.agendador_check_email( - p_slug text, - p_email text -) -RETURNS boolean -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; -BEGIN - SELECT c.owner_id INTO v_owner_id - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN false; END IF; - - RETURN EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes s - WHERE s.owner_id = v_owner_id - AND lower(s.paciente_email) = lower(trim(p_email)) - LIMIT 1 - ); -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_check_email(text, text) TO anon, authenticated; diff --git a/DBS/2026-03-11/migrations/agendador_features.sql b/DBS/2026-03-11/migrations/agendador_features.sql deleted file mode 100644 index 6e1701b..0000000 --- a/DBS/2026-03-11/migrations/agendador_features.sql +++ /dev/null @@ -1,62 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Feature keys do Agendador Online --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. Inserir as features ────────────────────────────────────────────────── -INSERT INTO public.features (key, name, descricao) -VALUES - ( - 'agendador.online', - 'Agendador Online', - 'Permite que pacientes solicitem agendamentos via link público. Inclui aprovação manual ou automática, controle de horários e notificações.' - ), - ( - 'agendador.link_personalizado', - 'Link Personalizado do Agendador', - 'Permite que o profissional escolha um slug de URL próprio para o agendador (ex: /agendar/dra-ana-silva) em vez de um link gerado automaticamente.' - ) -ON CONFLICT (key) DO UPDATE - SET name = EXCLUDED.name, - descricao = EXCLUDED.descricao; - --- ── 2. Vincular aos planos ────────────────────────────────────────────────── --- ATENÇÃO: ajuste os filtros de plan key/name conforme seus planos reais. --- Exemplo: agendador.online disponível para planos PRO e acima. --- agendador.link_personalizado apenas para planos Elite/Superior. - --- agendador.online → todos os planos com target 'therapist' ou 'clinic' --- (Adapte o WHERE conforme necessário) -INSERT INTO public.plan_features (plan_id, feature_id, enabled) -SELECT - p.id, - f.id, - true -FROM public.plans p -CROSS JOIN public.features f -WHERE f.key = 'agendador.online' - AND p.is_active = true - -- Comente a linha abaixo para liberar para TODOS os planos: - -- AND p.key IN ('pro', 'elite', 'clinic_pro', 'clinic_elite') -ON CONFLICT DO NOTHING; - --- agendador.link_personalizado → apenas planos superiores --- Deixe comentado e adicione manualmente quando definir os planos: --- INSERT INTO public.plan_features (plan_id, feature_id, enabled) --- SELECT p.id, f.id, true --- FROM public.plans p --- CROSS JOIN public.features f --- WHERE f.key = 'agendador.link_personalizado' --- AND p.key IN ('elite', 'clinic_elite', 'pro_plus') --- ON CONFLICT DO NOTHING; - --- ── 3. Verificação ───────────────────────────────────────────────────────── -SELECT - f.key, - f.name, - COUNT(pf.plan_id) AS planos_vinculados -FROM public.features f -LEFT JOIN public.plan_features pf ON pf.feature_id = f.id AND pf.enabled = true -WHERE f.key IN ('agendador.online', 'agendador.link_personalizado') -GROUP BY f.key, f.name -ORDER BY f.key; diff --git a/DBS/2026-03-11/migrations/agendador_fix_slots.sql b/DBS/2026-03-11/migrations/agendador_fix_slots.sql deleted file mode 100644 index e2d4e6e..0000000 --- a/DBS/2026-03-11/migrations/agendador_fix_slots.sql +++ /dev/null @@ -1,221 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- FIX: agendador_slots_disponiveis + agendador_dias_disponiveis --- Usa agenda_online_slots como fonte de slots --- Cruzamento com: agenda_eventos, recurrence_rules/exceptions, agendador_solicitacoes --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - -CREATE OR REPLACE FUNCTION public.agendador_slots_disponiveis( - p_slug text, - p_data date -) -RETURNS TABLE (hora time, disponivel boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_antecedencia int; - v_agora timestamptz; - v_db_dow int; - v_slot time; - v_slot_fim time; - v_slot_ts timestamptz; - v_ocupado boolean; - -- loop de recorrências - v_rule RECORD; - v_rule_start_dow int; - v_first_occ date; - v_day_diff int; - v_ex_type text; -BEGIN - SELECT c.owner_id, c.duracao_sessao_min, c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; - - FOR v_slot IN - SELECT s.time - FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - ORDER BY s.time - LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - v_ocupado := false; - - -- ── Antecedência mínima ────────────────────────────────────────────────── - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo'; - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- ── Eventos avulsos internos (agenda_eventos) ──────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos e - WHERE e.owner_id = v_owner_id - AND e.status::text NOT IN ('cancelado', 'faltou') - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::date = p_data - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (e.fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Recorrências ativas (recurrence_rules) ─────────────────────────────── - -- Loop explícito para evitar erros de tipo no cálculo do ciclo semanal - IF NOT v_ocupado THEN - FOR v_rule IN - SELECT - r.id, - r.start_date::date AS start_date, - r.end_date::date AS end_date, - r.start_time::time AS start_time, - r.end_time::time AS end_time, - COALESCE(r.interval, 1)::int AS interval - FROM public.recurrence_rules r - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND p_data >= r.start_date::date - AND (r.end_date IS NULL OR p_data <= r.end_date::date) - AND v_db_dow = ANY(r.weekdays) - AND r.start_time::time < v_slot_fim - AND r.end_time::time > v_slot - LOOP - -- Calcula a primeira ocorrência do dia-da-semana a partir do start_date - v_rule_start_dow := extract(dow from v_rule.start_date)::int; - v_first_occ := v_rule.start_date - + (((v_db_dow - v_rule_start_dow + 7) % 7))::int; - v_day_diff := (p_data - v_first_occ)::int; - - -- Ocorrência válida: diff >= 0 e divisível pelo ciclo semanal - IF v_day_diff >= 0 AND v_day_diff % (7 * v_rule.interval) = 0 THEN - - -- Verifica se há exceção para esta data - v_ex_type := NULL; - SELECT ex.type INTO v_ex_type - FROM public.recurrence_exceptions ex - WHERE ex.recurrence_id = v_rule.id - AND ex.original_date = p_data - LIMIT 1; - - -- Sem exceção, ou exceção que não cancela → bloqueia o slot - IF v_ex_type IS NULL OR v_ex_type NOT IN ( - 'cancel_session', 'patient_missed', - 'therapist_canceled', 'holiday_block', - 'reschedule_session' - ) THEN - v_ocupado := true; - EXIT; -- já basta uma regra que conflite - END IF; - - END IF; - END LOOP; - END IF; - - -- ── Recorrências remarcadas para este dia (reschedule → new_date = p_data) ─ - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 - FROM public.recurrence_exceptions ex - JOIN public.recurrence_rules r ON r.id = ex.recurrence_id - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND ex.type = 'reschedule_session' - AND ex.new_date = p_data - AND COALESCE(ex.new_start_time, r.start_time)::time < v_slot_fim - AND COALESCE(ex.new_end_time, r.end_time)::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Solicitações públicas pendentes ────────────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes sol - WHERE sol.owner_id = v_owner_id - AND sol.status = 'pendente' - AND sol.data_solicitada = p_data - AND sol.hora_solicitada = v_slot - AND (sol.reservado_ate IS NULL OR sol.reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_slots_disponiveis(text, date) TO anon, authenticated; - - --- ── agendador_dias_disponiveis ─────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.agendador_dias_disponiveis( - p_slug text, - p_ano int, - p_mes int -) -RETURNS TABLE (data date, tem_slots boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_agora timestamptz; - v_data date; - v_data_inicio date; - v_data_fim date; - v_db_dow int; - v_tem_slot boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - AND (v_data::text || ' ' || s.time::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo' - >= v_agora + (v_antecedencia || ' hours')::interval - ) INTO v_tem_slot; - - IF v_tem_slot THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_dias_disponiveis(text, int, int) TO anon, authenticated; diff --git a/DBS/2026-03-11/migrations/agendador_online.sql b/DBS/2026-03-11/migrations/agendador_online.sql deleted file mode 100644 index bc9390e..0000000 --- a/DBS/2026-03-11/migrations/agendador_online.sql +++ /dev/null @@ -1,170 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Agendador Online — tabelas de configuração e solicitações --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. agendador_configuracoes ────────────────────────────────────────────── -CREATE TABLE IF NOT EXISTS "public"."agendador_configuracoes" ( - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - - -- PRO / Ativação - "ativo" boolean DEFAULT false NOT NULL, - "link_slug" "text", - - -- Identidade Visual - "imagem_fundo_url" "text", - "imagem_header_url" "text", - "logomarca_url" "text", - "cor_primaria" "text" DEFAULT '#4b6bff', - - -- Perfil Público - "nome_exibicao" "text", - "endereco" "text", - "botao_como_chegar_ativo" boolean DEFAULT true NOT NULL, - "maps_url" "text", - - -- Fluxo de Agendamento - "modo_aprovacao" "text" DEFAULT 'aprovacao' NOT NULL, - "modalidade" "text" DEFAULT 'presencial' NOT NULL, - "tipos_habilitados" "jsonb" DEFAULT '["primeira","retorno"]'::jsonb NOT NULL, - "duracao_sessao_min" integer DEFAULT 50 NOT NULL, - "antecedencia_minima_horas" integer DEFAULT 24 NOT NULL, - "prazo_resposta_horas" integer DEFAULT 2 NOT NULL, - "reserva_horas" integer DEFAULT 2 NOT NULL, - - -- Pagamento - "pagamento_obrigatorio" boolean DEFAULT false NOT NULL, - "pix_chave" "text", - "pix_countdown_minutos" integer DEFAULT 20 NOT NULL, - - -- Triagem & Conformidade - "triagem_motivo" boolean DEFAULT true NOT NULL, - "triagem_como_conheceu" boolean DEFAULT false NOT NULL, - "verificacao_email" boolean DEFAULT false NOT NULL, - "exigir_aceite_lgpd" boolean DEFAULT true NOT NULL, - - -- Textos - "mensagem_boas_vindas" "text", - "texto_como_se_preparar" "text", - "texto_termos_lgpd" "text", - - -- Timestamps - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone DEFAULT now() NOT NULL, - - CONSTRAINT "agendador_configuracoes_pkey" PRIMARY KEY ("owner_id"), - CONSTRAINT "agendador_configuracoes_owner_fk" - FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_configuracoes_tenant_fk" - FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_configuracoes_modo_check" - CHECK ("modo_aprovacao" = ANY (ARRAY['automatico','aprovacao'])), - CONSTRAINT "agendador_configuracoes_modalidade_check" - CHECK ("modalidade" = ANY (ARRAY['presencial','online','ambos'])), - CONSTRAINT "agendador_configuracoes_duracao_check" - CHECK ("duracao_sessao_min" >= 10 AND "duracao_sessao_min" <= 240), - CONSTRAINT "agendador_configuracoes_antecedencia_check" - CHECK ("antecedencia_minima_horas" >= 0 AND "antecedencia_minima_horas" <= 720), - CONSTRAINT "agendador_configuracoes_reserva_check" - CHECK ("reserva_horas" >= 1 AND "reserva_horas" <= 48), - CONSTRAINT "agendador_configuracoes_pix_countdown_check" - CHECK ("pix_countdown_minutos" >= 5 AND "pix_countdown_minutos" <= 120), - CONSTRAINT "agendador_configuracoes_prazo_check" - CHECK ("prazo_resposta_horas" >= 1 AND "prazo_resposta_horas" <= 72) -); - -ALTER TABLE "public"."agendador_configuracoes" ENABLE ROW LEVEL SECURITY; - -DROP POLICY IF EXISTS "agendador_cfg_select" ON "public"."agendador_configuracoes"; -CREATE POLICY "agendador_cfg_select" ON "public"."agendador_configuracoes" - FOR SELECT USING (auth.uid() = owner_id); - -DROP POLICY IF EXISTS "agendador_cfg_write" ON "public"."agendador_configuracoes"; -CREATE POLICY "agendador_cfg_write" ON "public"."agendador_configuracoes" - USING (auth.uid() = owner_id) - WITH CHECK (auth.uid() = owner_id); - -CREATE INDEX IF NOT EXISTS "agendador_cfg_tenant_idx" - ON "public"."agendador_configuracoes" ("tenant_id"); - --- ── 2. agendador_solicitacoes ─────────────────────────────────────────────── -CREATE TABLE IF NOT EXISTS "public"."agendador_solicitacoes" ( - "id" "uuid" DEFAULT gen_random_uuid() NOT NULL, - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - - -- Dados do paciente - "paciente_nome" "text" NOT NULL, - "paciente_sobrenome" "text", - "paciente_email" "text" NOT NULL, - "paciente_celular" "text", - "paciente_cpf" "text", - - -- Agendamento solicitado - "tipo" "text" NOT NULL, - "modalidade" "text" NOT NULL, - "data_solicitada" date NOT NULL, - "hora_solicitada" time NOT NULL, - - -- Reserva temporária - "reservado_ate" timestamp with time zone, - - -- Triagem - "motivo" "text", - "como_conheceu" "text", - - -- Pagamento - "pix_status" "text" DEFAULT 'pendente', - "pix_pago_em" timestamp with time zone, - - -- Status geral - "status" "text" DEFAULT 'pendente' NOT NULL, - "recusado_motivo" "text", - - -- Autorização - "autorizado_em" timestamp with time zone, - "autorizado_por" "uuid", - - -- Vínculos internos - "user_id" "uuid", - "patient_id" "uuid", - "evento_id" "uuid", - - -- Timestamps - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone DEFAULT now() NOT NULL, - - CONSTRAINT "agendador_solicitacoes_pkey" PRIMARY KEY ("id"), - CONSTRAINT "agendador_sol_owner_fk" - FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_sol_tenant_fk" - FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_sol_status_check" - CHECK ("status" = ANY (ARRAY['pendente','autorizado','recusado','expirado'])), - CONSTRAINT "agendador_sol_tipo_check" - CHECK ("tipo" = ANY (ARRAY['primeira','retorno','reagendar'])), - CONSTRAINT "agendador_sol_modalidade_check" - CHECK ("modalidade" = ANY (ARRAY['presencial','online'])), - CONSTRAINT "agendador_sol_pix_check" - CHECK ("pix_status" IS NULL OR "pix_status" = ANY (ARRAY['pendente','pago','expirado'])) -); - -ALTER TABLE "public"."agendador_solicitacoes" ENABLE ROW LEVEL SECURITY; - -DROP POLICY IF EXISTS "agendador_sol_owner_select" ON "public"."agendador_solicitacoes"; -CREATE POLICY "agendador_sol_owner_select" ON "public"."agendador_solicitacoes" - FOR SELECT USING (auth.uid() = owner_id); - -DROP POLICY IF EXISTS "agendador_sol_owner_write" ON "public"."agendador_solicitacoes"; -CREATE POLICY "agendador_sol_owner_write" ON "public"."agendador_solicitacoes" - USING (auth.uid() = owner_id) - WITH CHECK (auth.uid() = owner_id); - -CREATE INDEX IF NOT EXISTS "agendador_sol_owner_idx" - ON "public"."agendador_solicitacoes" ("owner_id", "status"); - -CREATE INDEX IF NOT EXISTS "agendador_sol_tenant_idx" - ON "public"."agendador_solicitacoes" ("tenant_id"); - -CREATE INDEX IF NOT EXISTS "agendador_sol_data_idx" - ON "public"."agendador_solicitacoes" ("data_solicitada", "hora_solicitada"); diff --git a/DBS/2026-03-11/migrations/agendador_publico.sql b/DBS/2026-03-11/migrations/agendador_publico.sql deleted file mode 100644 index 4ca29d4..0000000 --- a/DBS/2026-03-11/migrations/agendador_publico.sql +++ /dev/null @@ -1,219 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Agendador Online — acesso público (anon) + função de slots disponíveis --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. Geração automática de slug ────────────────────────────────────────── --- Cria slug único de 8 chars quando o profissional ativa sem link_personalizado -CREATE OR REPLACE FUNCTION public.agendador_gerar_slug() -RETURNS trigger LANGUAGE plpgsql AS $$ -DECLARE - v_slug text; - v_exists boolean; -BEGIN - -- só gera se ativou e não tem slug ainda - IF NEW.ativo = true AND (NEW.link_slug IS NULL OR NEW.link_slug = '') THEN - LOOP - v_slug := lower(substring(replace(gen_random_uuid()::text, '-', ''), 1, 8)); - SELECT EXISTS ( - SELECT 1 FROM public.agendador_configuracoes - WHERE link_slug = v_slug AND owner_id <> NEW.owner_id - ) INTO v_exists; - EXIT WHEN NOT v_exists; - END LOOP; - NEW.link_slug := v_slug; - END IF; - RETURN NEW; -END; -$$; - -DROP TRIGGER IF EXISTS agendador_slug_trigger ON public.agendador_configuracoes; -CREATE TRIGGER agendador_slug_trigger - BEFORE INSERT OR UPDATE ON public.agendador_configuracoes - FOR EACH ROW EXECUTE FUNCTION public.agendador_gerar_slug(); - --- ── 2. Políticas públicas (anon) ──────────────────────────────────────────── - --- Leitura pública da config pelo slug (só ativo) -DROP POLICY IF EXISTS "agendador_cfg_public_read" ON public.agendador_configuracoes; -CREATE POLICY "agendador_cfg_public_read" ON public.agendador_configuracoes - FOR SELECT TO anon - USING (ativo = true AND link_slug IS NOT NULL); - --- Inserção pública de solicitações (qualquer pessoa pode solicitar) -DROP POLICY IF EXISTS "agendador_sol_public_insert" ON public.agendador_solicitacoes; -CREATE POLICY "agendador_sol_public_insert" ON public.agendador_solicitacoes - FOR INSERT TO anon - WITH CHECK (true); - --- Leitura da própria solicitação (pelo paciente logado) -DROP POLICY IF EXISTS "agendador_sol_patient_read" ON public.agendador_solicitacoes; -CREATE POLICY "agendador_sol_patient_read" ON public.agendador_solicitacoes - FOR SELECT TO authenticated - USING (auth.uid() = user_id OR auth.uid() = owner_id); - --- ── 3. Função: retorna slots disponíveis para uma data ────────────────────── --- Roda como SECURITY DEFINER (acessa agenda_regras e agenda_eventos sem RLS) -CREATE OR REPLACE FUNCTION public.agendador_slots_disponiveis( - p_slug text, - p_data date -) -RETURNS TABLE (hora time, disponivel boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_reserva int; - v_antecedencia int; - v_dia_semana int; -- 0=dom..6=sab (JS) → convertemos - v_db_dow int; -- 0=dom..6=sab no Postgres (extract dow) - v_inicio time; - v_fim time; - v_slot time; - v_slot_fim time; - v_agora timestamptz; -BEGIN - -- carrega config do agendador - SELECT - c.owner_id, - c.duracao_sessao_min, - c.reserva_horas, - c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_reserva, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN - RETURN; - END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; -- 0=dom..6=sab - - -- regra semanal para o dia da semana - SELECT hora_inicio, hora_fim - INTO v_inicio, v_fim - FROM public.agenda_regras_semanais - WHERE owner_id = v_owner_id - AND dia_semana = v_db_dow - AND ativo = true - LIMIT 1; - - IF v_inicio IS NULL THEN - RETURN; -- profissional não atende nesse dia - END IF; - - -- itera slots de v_duracao em v_duracao dentro da jornada - v_slot := v_inicio; - WHILE v_slot + (v_duracao || ' minutes')::interval <= v_fim LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - - -- bloco temporário para verificar conflitos - DECLARE - v_ocupado boolean := false; - v_slot_ts timestamptz; - BEGIN - -- antecedência mínima (compara em horário de Brasília) - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp AT TIME ZONE 'America/Sao_Paulo'; - - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- conflito com eventos existentes na agenda - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos - WHERE owner_id = v_owner_id - AND status::text NOT IN ('cancelado', 'faltou') - AND inicio_em AT TIME ZONE 'America/Sao_Paulo' >= p_data::timestamp - AND inicio_em AT TIME ZONE 'America/Sao_Paulo' < p_data::timestamp + interval '1 day' - AND (inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- conflito com solicitações pendentes (reservadas) - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes - WHERE owner_id = v_owner_id - AND status = 'pendente' - AND data_solicitada = p_data - AND hora_solicitada = v_slot - AND (reservado_ate IS NULL OR reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END; - - v_slot := v_slot + (v_duracao || ' minutes')::interval; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_slots_disponiveis(text, date) TO anon, authenticated; - --- ── 4. Função: retorna dias com disponibilidade no mês ───────────────────── -CREATE OR REPLACE FUNCTION public.agendador_dias_disponiveis( - p_slug text, - p_ano int, - p_mes int -- 1-12 -) -RETURNS TABLE (data date, tem_slots boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_data date; - v_data_inicio date; - v_data_fim date; - v_agora timestamptz; - v_db_dow int; - v_tem_regra boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - -- não oferece dias no passado ou dentro da antecedência mínima - IF v_data::timestamptz + '23:59:59'::interval > v_agora + (v_antecedencia || ' hours')::interval THEN - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_regras_semanais - WHERE owner_id = v_owner_id AND dia_semana = v_db_dow AND ativo = true - ) INTO v_tem_regra; - - IF v_tem_regra THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_dias_disponiveis(text, int, int) TO anon, authenticated; diff --git a/DBS/2026-03-11/migrations/agendador_status_convertido.sql b/DBS/2026-03-11/migrations/agendador_status_convertido.sql deleted file mode 100644 index cddb978..0000000 --- a/DBS/2026-03-11/migrations/agendador_status_convertido.sql +++ /dev/null @@ -1,19 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- FIX: adiciona status 'convertido' na constraint de agendador_solicitacoes --- e adiciona coluna motivo_recusa (alias amigável de recusado_motivo) --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - --- 1. Remove o CHECK existente e recria com os novos valores -ALTER TABLE public.agendador_solicitacoes - DROP CONSTRAINT IF EXISTS "agendador_sol_status_check"; - -ALTER TABLE public.agendador_solicitacoes - ADD CONSTRAINT "agendador_sol_status_check" - CHECK (status = ANY (ARRAY[ - 'pendente', - 'autorizado', - 'recusado', - 'expirado', - 'convertido' - ])); diff --git a/DBS/2026-03-11/migrations/agendador_storage.sql b/DBS/2026-03-11/migrations/agendador_storage.sql deleted file mode 100644 index 6d82893..0000000 --- a/DBS/2026-03-11/migrations/agendador_storage.sql +++ /dev/null @@ -1,56 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Storage bucket para imagens do Agendador Online --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. Criar o bucket ────────────────────────────────────────────────────── -INSERT INTO storage.buckets (id, name, public, file_size_limit, allowed_mime_types) -VALUES ( - 'agendador', - 'agendador', - true, -- público (URLs diretas sem assinar) - 5242880, -- 5 MB - ARRAY['image/jpeg','image/png','image/webp','image/gif'] -) -ON CONFLICT (id) DO UPDATE - SET public = true, - file_size_limit = 5242880, - allowed_mime_types = ARRAY['image/jpeg','image/png','image/webp','image/gif']; - --- ── 2. Políticas ─────────────────────────────────────────────────────────── - --- Leitura pública (anon e authenticated) -DROP POLICY IF EXISTS "agendador_storage_public_read" ON storage.objects; -CREATE POLICY "agendador_storage_public_read" - ON storage.objects FOR SELECT - USING (bucket_id = 'agendador'); - --- Upload: apenas o dono da pasta (owner_id é o primeiro segmento do path) -DROP POLICY IF EXISTS "agendador_storage_owner_insert" ON storage.objects; -CREATE POLICY "agendador_storage_owner_insert" - ON storage.objects FOR INSERT - TO authenticated - WITH CHECK ( - bucket_id = 'agendador' - AND (storage.foldername(name))[1] = auth.uid()::text - ); - --- Update/upsert pelo dono -DROP POLICY IF EXISTS "agendador_storage_owner_update" ON storage.objects; -CREATE POLICY "agendador_storage_owner_update" - ON storage.objects FOR UPDATE - TO authenticated - USING ( - bucket_id = 'agendador' - AND (storage.foldername(name))[1] = auth.uid()::text - ); - --- Delete pelo dono -DROP POLICY IF EXISTS "agendador_storage_owner_delete" ON storage.objects; -CREATE POLICY "agendador_storage_owner_delete" - ON storage.objects FOR DELETE - TO authenticated - USING ( - bucket_id = 'agendador' - AND (storage.foldername(name))[1] = auth.uid()::text - ); diff --git a/DBS/2026-03-11/migrations/remove_session_start_offset.sql b/DBS/2026-03-11/migrations/remove_session_start_offset.sql deleted file mode 100644 index 1ddddef..0000000 --- a/DBS/2026-03-11/migrations/remove_session_start_offset.sql +++ /dev/null @@ -1,6 +0,0 @@ --- Migration: remove session_start_offset_min from agenda_configuracoes --- This field is replaced by hora_inicio in agenda_regras_semanais (work schedule per day) --- The first session slot is now derived directly from hora_inicio of the work rule. - -ALTER TABLE public.agenda_configuracoes - DROP COLUMN IF EXISTS session_start_offset_min; diff --git a/DBS/2026-03-11/root/backup.sql b/DBS/2026-03-11/root/backup.sql deleted file mode 100644 index 9005277..0000000 Binary files a/DBS/2026-03-11/root/backup.sql and /dev/null differ diff --git a/DBS/2026-03-11/root/data_dump.sql b/DBS/2026-03-11/root/data_dump.sql deleted file mode 100644 index 5f71513..0000000 --- a/DBS/2026-03-11/root/data_dump.sql +++ /dev/null @@ -1,3195 +0,0 @@ -SET session_replication_role = replica; - --- --- PostgreSQL database dump --- - --- \restrict W3AlCqJoixQ6XbedqdnuDvY0yTRx6OcqqCIS8MVAvJRGtliRjQ8MiBhgEM6GeE6 - --- Dumped from database version 17.6 --- Dumped by pg_dump version 17.6 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET transaction_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- Data for Name: audit_log_entries; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."audit_log_entries" ("instance_id", "id", "payload", "created_at", "ip_address") VALUES - ('00000000-0000-0000-0000-000000000000', 'f305e6e5-729c-4be2-aa07-0d07d95e628a', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"lmnohama@gmail.com","user_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","user_phone":""}}', '2026-02-11 11:21:15.799045+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a61317ea-af19-486a-b5cb-13bf7f5dc5f9', '{"action":"login","actor_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","actor_username":"lmnohama@gmail.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:21:28.106223+00', ''), - ('00000000-0000-0000-0000-000000000000', '982d215a-c198-4a3a-8c3a-d6f6164c32a5', '{"action":"login","actor_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","actor_username":"lmnohama@gmail.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:22:09.171333+00', ''), - ('00000000-0000-0000-0000-000000000000', '8a856c44-1c40-4b68-b776-d162e5a069a3', '{"action":"login","actor_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","actor_username":"lmnohama@gmail.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:22:20.748067+00', ''), - ('00000000-0000-0000-0000-000000000000', '52bbcf72-19e5-490a-b441-329d50235b5e', '{"action":"login","actor_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","actor_username":"lmnohama@gmail.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:25:35.003092+00', ''), - ('00000000-0000-0000-0000-000000000000', '560a87c5-d971-4eaa-9828-0bffcdc1f35a', '{"action":"login","actor_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","actor_username":"lmnohama@gmail.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:26:06.188916+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e4ccf1a-0912-4b0e-a6c8-63046c986168', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"patient@gmail.com","user_id":"943690e0-8c82-4477-abac-b2073f46c060","user_phone":""}}', '2026-02-11 11:34:36.287119+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f222e777-5ffe-488a-bf9d-94595135cab5', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"therapist@gmail.com","user_id":"b18adf61-c707-44ad-9999-5dd11b356c70","user_phone":""}}', '2026-02-11 11:35:00.227641+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e2bc2c90-4315-432f-9908-20875c358e51', '{"action":"user_recovery_requested","actor_id":"b18adf61-c707-44ad-9999-5dd11b356c70","actor_username":"therapist@gmail.com","actor_via_sso":false,"log_type":"user"}', '2026-02-11 11:35:25.580484+00', ''), - ('00000000-0000-0000-0000-000000000000', '90206317-f769-4edd-90d7-64116c01d113', '{"action":"user_deleted","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"user_email":"therapist@gmail.com","user_id":"b18adf61-c707-44ad-9999-5dd11b356c70","user_phone":""}}', '2026-02-11 11:35:48.521762+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e3a1cdcc-f021-43f1-afd1-5166a5dcda2d', '{"action":"user_deleted","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"user_email":"patient@gmail.com","user_id":"943690e0-8c82-4477-abac-b2073f46c060","user_phone":""}}', '2026-02-11 11:35:52.353166+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cfd0e5c9-26aa-4443-b06e-4dff493997fd', '{"action":"user_deleted","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"user_email":"lmnohama@gmail.com","user_id":"fefafcce-75f0-4a86-9092-c3fc5e7c36d8","user_phone":""}}', '2026-02-11 11:35:55.523834+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd5c167c9-ae3e-489a-b40a-defdb4544205', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"admin@agenciapsi.com.br","user_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","user_phone":""}}', '2026-02-11 11:36:44.039603+00', ''), - ('00000000-0000-0000-0000-000000000000', '748f29e2-b9af-445b-b7f1-e87bdb5a0f30', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"patient@agenciapsi.com.br","user_id":"523003e7-17ab-4375-b912-040027a75c22","user_phone":""}}', '2026-02-11 11:37:09.078645+00', ''), - ('00000000-0000-0000-0000-000000000000', '22996062-8622-422b-96e6-6d8f4d3af681', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"therapist@agenciapsi.com.br","user_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","user_phone":""}}', '2026-02-11 11:37:28.308559+00', ''), - ('00000000-0000-0000-0000-000000000000', '1a5bc865-3f23-4473-963b-93f2f4710c67', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:40:20.987022+00', ''), - ('00000000-0000-0000-0000-000000000000', '2d07720f-bdbc-4c11-8b88-06ba25496e15', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:40:35.840373+00', ''), - ('00000000-0000-0000-0000-000000000000', '9d2e08b7-b1b3-4c61-9cbc-c1af9032ee9a', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:40:47.468113+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f658e3f-168f-4266-8d9d-669754bfa843', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 11:40:59.107324+00', ''), - ('00000000-0000-0000-0000-000000000000', '63236f3f-0af3-4668-89e0-8775320b64d7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:18:36.875934+00', ''), - ('00000000-0000-0000-0000-000000000000', 'acaefb48-da94-4bf1-9c91-565caf6001c9', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:23:13.707298+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af680bdb-cab9-4a77-b5d3-dec98612de07', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:33:27.572966+00', ''), - ('00000000-0000-0000-0000-000000000000', '181ed6b0-5829-42df-9a05-873eb66e5df9', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:34:06.6839+00', ''), - ('00000000-0000-0000-0000-000000000000', '5fce822c-89f1-472f-a0bb-df880c609985', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:36:44.743297+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bbfd248f-7ad2-4a21-b994-b013a764cd3c', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:37:00.014814+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a62939e6-fea8-4586-ae73-955be37a5a0b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:49:08.66749+00', ''), - ('00000000-0000-0000-0000-000000000000', '51d41e29-fcff-45ca-9066-e52de9d51ba2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 12:53:28.734655+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd1add95c-7d07-4ce3-857c-76a09be1f1f8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:49:55.853939+00', ''), - ('00000000-0000-0000-0000-000000000000', '4ae883d8-6443-46f0-8f6b-d9dacdab65e6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 13:51:40.679691+00', ''), - ('00000000-0000-0000-0000-000000000000', '9f2dae0d-adf3-4666-b973-3ba41bbc28f5', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:51:43.499067+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a23ec73-79db-4318-b5a3-92c63feda8c0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 13:53:23.787336+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e5275c22-9fd5-4e1b-b7a6-83723ca8c3e7', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:53:26.249258+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8693b7c-cb31-43dd-85a6-513b14c5d4c4', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 13:53:42.469026+00', ''), - ('00000000-0000-0000-0000-000000000000', '7a17f337-fbe0-4f1b-b40a-f00e853d8a1e', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:53:51.155387+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a88cd4a0-2f0c-4db8-a798-da4d708d95da', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 13:54:45.532333+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a64ac4a-c04b-45b6-b6af-666f5a2921ce', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:54:48.217518+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f9c9a26-d9f1-46db-9f98-d20c43490793', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 13:57:39.905224+00', ''), - ('00000000-0000-0000-0000-000000000000', '31ad596d-2f64-4224-84f6-bd8ee1db3f47', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:57:41.987922+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e66fe48-cd62-4bfc-a5ce-55da65eb8f45', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 13:58:23.876723+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d1391ae-2d4e-4010-a6db-27a53a26fa88', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 13:58:26.308395+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b9261645-2d7f-454d-8143-36bdbac0fe0c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:00:40.41189+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8fc88aa-687f-4cb1-8c75-5742ed128985', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:00:42.823591+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c0b3a6de-71e5-4795-a9f1-d0d806e604b5', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:02:24.884391+00', ''), - ('00000000-0000-0000-0000-000000000000', '9dd8e8de-22a8-47f5-ad6f-1823d3d79d95', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:02:27.535973+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c8a13512-e973-4c66-aa26-3091fbb318bf', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:04:49.049569+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6c73ae7-289b-4ab3-9aab-4e88884de57d', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:04:51.699446+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fcf2153c-28f4-4ded-a113-da19e03b5439', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:10:15.283996+00', ''), - ('00000000-0000-0000-0000-000000000000', '2652c53f-638e-4cc1-b6b9-415d19609bee', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:10:17.73853+00', ''), - ('00000000-0000-0000-0000-000000000000', '0b68513a-62ab-4b44-8b13-96cf969e25e7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:10:34.103267+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af03af05-4c52-4627-9bee-85feee548565', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:10:37.076425+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a667e56d-0420-4da9-988a-d61d76848bbb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:13:44.539343+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e1463403-1ebc-47d0-9ad6-998c8b9fb794', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:13:46.62109+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cf4cfdbe-56a1-4fa4-9586-764b7fc24003', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:13:57.304259+00', ''), - ('00000000-0000-0000-0000-000000000000', '259d68e7-9801-474e-b60b-ccae5929d7be', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:14:01.01565+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aeea0ff6-2f4f-400f-b2e1-7043321981a6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:17:05.647236+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e386c60-de11-4336-b32e-8b66cd3721ec', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:17:07.524071+00', ''), - ('00000000-0000-0000-0000-000000000000', '6298b670-d318-4ffa-93a7-4d5a9bf6fde0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:18:48.088549+00', ''), - ('00000000-0000-0000-0000-000000000000', '1772a915-da4d-4a72-9c1f-c9f460eb303a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:18:49.965991+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cf217d6d-aa39-47f2-b8e8-946572f95710', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:00:39.552028+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fe8191c2-fb3b-4ea1-aca6-17f6896979e5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:19:42.859787+00', ''), - ('00000000-0000-0000-0000-000000000000', '67812bce-0a7d-4fe8-8a3c-f94091a66afd', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:19:45.4876+00', ''), - ('00000000-0000-0000-0000-000000000000', '61bcdb99-141c-439d-b109-5b30941af539', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:19:50.992395+00', ''), - ('00000000-0000-0000-0000-000000000000', '965ab6df-6347-4a70-b426-f06c266e374c', '{"action":"user_recovery_requested","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:41:41.94802+00', ''), - ('00000000-0000-0000-0000-000000000000', '81114aad-62da-4766-9010-2a28cb4234b2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:42:52.777929+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c875c3f2-d421-4f38-9a59-dd754c96a4b6', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:42:53.115351+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a8ded04b-4444-4790-94ab-d7e686956ed9', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:42:53.116621+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b676b648-dac1-4382-9b10-a775cf3bfe79', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:43:17.300865+00', ''), - ('00000000-0000-0000-0000-000000000000', '959e41c4-d0b4-4573-89c2-6bbe0df6cf9d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:43:33.281568+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dc070f2c-e46e-4767-a368-69e7552194f0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:47:15.13976+00', ''), - ('00000000-0000-0000-0000-000000000000', '60d98140-8a92-4c08-8351-b589f4efff2e', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:47:15.501669+00', ''), - ('00000000-0000-0000-0000-000000000000', '8be3ad99-8f85-4446-8a43-7808c4efe63f', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:47:15.502957+00', ''), - ('00000000-0000-0000-0000-000000000000', '49e8581a-c456-44c1-b3ed-ad51bcdcdf2b', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:48:56.332413+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7d0cf1c-9c23-4958-8407-101a7caf98a7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:49:01.775415+00', ''), - ('00000000-0000-0000-0000-000000000000', 'df044d2f-c155-40e8-99a2-4c943e3cf3f1', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:49:04.610124+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c2cc6918-01ad-48fa-a33d-7934e85d733c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:49:11.377235+00', ''), - ('00000000-0000-0000-0000-000000000000', '7c84a05b-148b-436f-b165-a8c81652bdd2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:49:40.029964+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f28de60f-f35e-4ef2-9a26-912f2a47c8c5', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:49:40.354362+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e7675292-224c-4f83-b774-d32814f7f714', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:49:40.355531+00', ''), - ('00000000-0000-0000-0000-000000000000', '64a72a04-0d64-4ba8-a2b2-754ad05087bf', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:49:49.873133+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f079860a-92a6-4b2c-9985-53c114c8d83b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:50:01.800355+00', ''), - ('00000000-0000-0000-0000-000000000000', '3311d806-f22f-4fa5-a7c4-aa9c130d0ecc', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:54:09.303558+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ebeb229b-5ff6-490c-8344-1d1192f0cc10', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:54:09.635438+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a0f4d66-3f71-4ca5-9694-f31611505590', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:54:09.636815+00', ''), - ('00000000-0000-0000-0000-000000000000', '06372181-971a-46ff-81d8-9593e637a15a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:54:23.583566+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f17ecd8a-64ff-41f1-8d21-9add3a179972', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:54:29.962315+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c6b3e3e6-4688-4686-b339-6831d1862147', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:54:47.774596+00', ''), - ('00000000-0000-0000-0000-000000000000', '0ab8ffbc-4468-4539-8670-d2b4d59e227c', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:54:48.122042+00', ''), - ('00000000-0000-0000-0000-000000000000', '55ddd34c-8be6-4ebd-bb8e-e870f5947a8d', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 14:54:48.12318+00', ''), - ('00000000-0000-0000-0000-000000000000', '4f933a56-91d4-4765-b9c0-dc28b219ad54', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 14:59:53.525046+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ac7c5a92-2c1c-49e3-b293-8ad1404f3b50', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 14:59:55.69143+00', ''), - ('00000000-0000-0000-0000-000000000000', '9b03186b-1bf0-4d92-a2e7-8c685db7dc41', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:00:11.363743+00', ''), - ('00000000-0000-0000-0000-000000000000', '32bf8799-4b06-4614-ab1b-457ec41bdab6', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:00:44.993988+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de8a40ac-1f8f-4fd7-8f33-535c85bc0f6c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:00:55.261828+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f87ea688-ae0a-4295-8e9b-31c943ccbeda', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:01:01.105781+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a2810fab-7802-4b00-bb4d-e50b4cb8d965', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:01:05.179436+00', ''), - ('00000000-0000-0000-0000-000000000000', '99cd0e01-8949-4a5c-ae54-c29a7a9dd7b2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:01:12.755126+00', ''), - ('00000000-0000-0000-0000-000000000000', '092ed2ba-7ee7-4f8a-b012-63d1bd0c2a04', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:01:26.173968+00', ''), - ('00000000-0000-0000-0000-000000000000', '10cc0ad1-3c67-4876-a08c-82b92e2d0826', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 15:01:26.522423+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e4da7f4-a1cf-4252-8c22-9b35c253f940', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 15:01:26.523822+00', ''), - ('00000000-0000-0000-0000-000000000000', '672f24dd-4492-41ae-92c6-3083fcf482e8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:01:47.57416+00', ''), - ('00000000-0000-0000-0000-000000000000', '6c93c677-bb74-4ee9-8ba3-b145c98d6126', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:01:56.91662+00', ''), - ('00000000-0000-0000-0000-000000000000', '80f2b1fc-a44a-48ba-b671-05807b933040', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:02:29.157258+00', ''), - ('00000000-0000-0000-0000-000000000000', '31e11eb0-99c2-4c9e-9151-b10f338451fd', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:05:17.242876+00', ''), - ('00000000-0000-0000-0000-000000000000', '6746898b-3af7-4647-80de-88f575c77310', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:05:20.545309+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f3f115db-06a1-4faf-b40e-42826886a383', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:05:32.739787+00', ''), - ('00000000-0000-0000-0000-000000000000', '6440b0e4-6303-4222-a9df-48c98b68f968', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:07:46.033483+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f700774-676a-4fba-8af1-06c219a1144c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:07:49.166984+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a529a0ab-b231-4fe4-9bf3-109cffe48fe6', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:07:57.201737+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2c57694-e289-42ba-a70f-356369cfc44a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:07:58.98343+00', ''), - ('00000000-0000-0000-0000-000000000000', '70a46638-4178-4bd8-828e-4d2915a86618', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:08:02.629592+00', ''), - ('00000000-0000-0000-0000-000000000000', '9ec47d60-7ad5-4ea8-8566-c2f24ecb9dc9', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:08:08.445407+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e05e2a2-b768-457e-8840-1218ac84c467', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:08:22.057739+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f87eb893-7e10-4161-a89b-4fb4e458c6f3', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 15:08:22.372745+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b1b28d23-7cca-40bf-baba-a2b0713cbd9b', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 15:08:22.37394+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e9ce674a-b63b-4c46-9eb6-535dce55bdcd', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 15:08:41.172016+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd42cf48b-31ec-4f8a-9a41-f7e29484208c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:08:49.544705+00', ''), - ('00000000-0000-0000-0000-000000000000', '463ba651-0124-47a5-8923-64aa84d4b3d1', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 15:09:07.258743+00', ''), - ('00000000-0000-0000-0000-000000000000', '174dedd8-9b80-4b3b-a830-cdefe613b617', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-11 21:55:43.295991+00', ''), - ('00000000-0000-0000-0000-000000000000', '975d438a-bbd1-4e8c-a051-ea80d00509b6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-11 21:55:43.298666+00', ''), - ('00000000-0000-0000-0000-000000000000', '11e03919-e186-42af-9b52-d7347d9aec1e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 21:55:48.935223+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a79ad2c4-ffa3-44ce-abd3-4eb128176bc0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 21:56:00.329242+00', ''), - ('00000000-0000-0000-0000-000000000000', '61b85be9-3ce8-4a2c-8848-f308448a7c32', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 21:56:40.025717+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c2baa9a1-7e72-4b0c-b0ca-3d460c260236', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 21:56:56.280192+00', ''), - ('00000000-0000-0000-0000-000000000000', '1cb5c073-c8d3-4675-84f8-ec3c583af74c', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 21:56:56.627277+00', ''), - ('00000000-0000-0000-0000-000000000000', '5461fcd0-6e26-44eb-9b82-fed3bff1b266', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 21:56:56.628375+00', ''), - ('00000000-0000-0000-0000-000000000000', '6057fd62-5322-4f37-9ddc-a66653433497', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 21:57:08.841034+00', ''), - ('00000000-0000-0000-0000-000000000000', '6be3f4fb-e944-4443-bf51-90b227676c32', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 21:57:20.034648+00', ''), - ('00000000-0000-0000-0000-000000000000', '550d9f19-66df-44fd-b497-ef22e6b9d99f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 21:57:42.217069+00', ''), - ('00000000-0000-0000-0000-000000000000', '51cfe8d3-5dbd-457f-bf43-49ca6850efc7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:01:49.65735+00', ''), - ('00000000-0000-0000-0000-000000000000', '31d7a5c6-da69-43a6-b2d3-f0930ff55daf', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 22:01:50.386899+00', ''), - ('00000000-0000-0000-0000-000000000000', '5e6e22ec-0e16-4707-9a22-66b8e92a105f', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 22:01:50.388137+00', ''), - ('00000000-0000-0000-0000-000000000000', '47f016ac-9fec-4c34-b1e3-8cfbebc2c9d4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:06:16.568236+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd095f9cd-6ee5-41be-b866-eb991ec23f48', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 22:06:16.944938+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e8725fe8-b07b-4bb2-b81d-d3c1d0eee359', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 22:06:16.946275+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c6eae17-264f-435e-8aea-ef854ebe29a3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:07:02.678015+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a129ffad-1e44-48fd-bccc-f38472e93b94', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:07:19.941471+00', ''), - ('00000000-0000-0000-0000-000000000000', '2a132f0e-654c-41cb-b2e8-ece4a04ca3cf', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 22:07:20.421634+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c967c60f-c4c0-4c1a-ac88-cd09baaa0fac', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-11 22:07:20.422756+00', ''), - ('00000000-0000-0000-0000-000000000000', '34ba0af7-1100-4b8c-8099-b64509d253de', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 22:07:59.954549+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de89cff5-d157-4034-996b-780856f826f3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:08:12.910133+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a51e5985-25f6-4be7-bece-c19ceee872a8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 22:14:06.377867+00', ''), - ('00000000-0000-0000-0000-000000000000', '5bfee8f5-fc9c-44ae-9d44-6c9374b00a4a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:17:51.808578+00', ''), - ('00000000-0000-0000-0000-000000000000', '0b8fa389-46a7-4fad-9c5a-484e552ac8d5', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 22:17:54.703359+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e59eef00-7aad-4aeb-bf58-55a38cd0f926', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:18:12.968706+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2ad1c21-633b-4eb1-bf31-7a76b1eb65ac', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:18:31.850083+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e089d6b0-fe83-4273-ad36-d199bba817bb', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 22:18:39.499455+00', ''), - ('00000000-0000-0000-0000-000000000000', '6e90b0b5-eed6-40d3-9ff5-607ce5f72480', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:18:40.936685+00', ''), - ('00000000-0000-0000-0000-000000000000', '21b6cc45-7974-405c-b372-00c4d6cd7cc1', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:18:49.410452+00', ''), - ('00000000-0000-0000-0000-000000000000', '14e10272-e4f1-4c84-906c-4683f2797e3f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-11 22:48:15.586048+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fbdb1d8a-6ae4-4aa3-9d58-fc8040a7c456', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-11 22:48:28.921522+00', ''), - ('00000000-0000-0000-0000-000000000000', 'def639c6-a357-48ee-b8dd-b69b788dc527', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-11 23:47:57.410178+00', ''), - ('00000000-0000-0000-0000-000000000000', '71b29093-1390-4b90-acea-abc33283be19', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-11 23:47:57.412008+00', ''), - ('00000000-0000-0000-0000-000000000000', '149f0673-e8b6-4350-ae7a-254609cb2ca0', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 00:48:59.309259+00', ''), - ('00000000-0000-0000-0000-000000000000', '8b69f626-4f18-49e3-887e-209f9ba12e56', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 00:48:59.310714+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd7ab2159-c283-404d-9a02-db5b3a36bd9f', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 01:47:31.06462+00', ''), - ('00000000-0000-0000-0000-000000000000', '959ca95b-9ae5-407c-9e6f-9c783ba5e92c', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 01:47:31.072834+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e83ba05-ef49-4743-8252-0c1071af54b2', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 09:19:37.647997+00', ''), - ('00000000-0000-0000-0000-000000000000', '4d452129-1d58-4297-b393-62a397ea230a', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 09:19:37.653062+00', ''), - ('00000000-0000-0000-0000-000000000000', '4bc70da7-d93f-4591-be6f-ea0b91b75e0d', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-12 09:53:46.127981+00', ''), - ('00000000-0000-0000-0000-000000000000', '8fe039b9-382d-4b2c-8642-2c542f42e2ab', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-12 09:53:47.65975+00', ''), - ('00000000-0000-0000-0000-000000000000', '6fa707e6-4a08-4187-a3a9-23a3704b81e1', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 10:52:19.269285+00', ''), - ('00000000-0000-0000-0000-000000000000', '6db2dd6b-730b-484e-a3d9-8924ae55dcb8', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 10:52:19.270179+00', ''), - ('00000000-0000-0000-0000-000000000000', '791a67e2-4922-40c8-b827-f8e9b5939bf8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-12 11:35:22.873615+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aa097278-fe42-4580-930d-7882b33a0ed0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-12 11:35:25.102695+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8acb449-ce3f-4ec8-9e24-64505631fc97', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 13:02:09.333699+00', ''), - ('00000000-0000-0000-0000-000000000000', '0516c40e-3c45-4a2d-997f-93998edb9c37', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 13:02:09.338007+00', ''), - ('00000000-0000-0000-0000-000000000000', '05cf10dd-135e-4e65-be81-8bee223c9704', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 14:01:08.631706+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6e7af8e-1a77-4cd2-8c77-f83f9e316cf6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 14:01:08.633262+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f6f4bba-c69c-4b94-8a74-155d97a89fec', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 14:59:48.381069+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c06d375-a4cc-47ac-b08e-f297c5667fb9', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 14:59:48.382499+00', ''), - ('00000000-0000-0000-0000-000000000000', '94d4beef-5c7a-405d-b31d-621260ffe155', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 17:16:27.380503+00', ''), - ('00000000-0000-0000-0000-000000000000', '2d9d4f37-9da8-4200-9850-6d75515cff13', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 17:16:27.382688+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f275b447-b4f4-4bfc-81b4-4109bc5d0cca', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 18:32:23.532837+00', ''), - ('00000000-0000-0000-0000-000000000000', '79620e7f-9ae3-40f1-a105-04d497a002c3', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 18:32:23.534469+00', ''), - ('00000000-0000-0000-0000-000000000000', '2bd2a559-769c-4a29-927e-d7a5ae6440cb', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 21:24:24.536726+00', ''), - ('00000000-0000-0000-0000-000000000000', '3cbf4684-ac7b-4632-8b8d-c559b12cda85', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 21:24:24.537936+00', ''), - ('00000000-0000-0000-0000-000000000000', '56be5e58-8342-428c-8c6c-c908a885e2e9', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 22:28:34.709917+00', ''), - ('00000000-0000-0000-0000-000000000000', '48fdccf3-3751-4611-bdf5-d48a414596f7', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 22:28:34.714132+00', ''), - ('00000000-0000-0000-0000-000000000000', '3358f095-ab4d-4ca1-9105-a1f0efac94b7', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 23:27:13.062663+00', ''), - ('00000000-0000-0000-0000-000000000000', '62307f1a-3aab-4ef5-ba28-e0a852cf3997', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-12 23:27:13.063735+00', ''), - ('00000000-0000-0000-0000-000000000000', '983dacfe-5acc-405c-9898-99acae4dd0ca', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 09:57:46.744834+00', ''), - ('00000000-0000-0000-0000-000000000000', '249167b1-bcca-439d-8f3f-7ebbae83fdf7', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 09:57:46.74732+00', ''), - ('00000000-0000-0000-0000-000000000000', '2df59a8f-9817-4860-92f8-4bb0f85b4c4f', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 10:57:04.356755+00', ''), - ('00000000-0000-0000-0000-000000000000', '6203247b-c7cf-4797-8ec7-6075a6da2612', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 10:57:04.357977+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c39cce3-9ccd-4521-8905-f02e0794ac7a', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 11:56:11.441201+00', ''), - ('00000000-0000-0000-0000-000000000000', '8fea76f2-5281-42c8-8ae8-faa6c69a2196', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 11:56:11.449692+00', ''), - ('00000000-0000-0000-0000-000000000000', '82bb6629-980f-4f93-919d-33396a04b1a0', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 13:01:11.09915+00', ''), - ('00000000-0000-0000-0000-000000000000', '63e8d734-7a38-4ed6-9dca-72118a79efce', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 13:01:11.107235+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f31134c5-5ce6-47c6-a57d-efdcb89b8199', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 13:59:55.791874+00', ''), - ('00000000-0000-0000-0000-000000000000', '993458a0-973b-4485-8535-206b051d7056', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 13:59:55.793131+00', ''), - ('00000000-0000-0000-0000-000000000000', '1b2c74f8-dd3c-42a4-88e4-a27fb4bf117f', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 14:58:20.063776+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bb136aca-0447-4479-88cf-e49354ddf244', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 14:58:20.064756+00', ''), - ('00000000-0000-0000-0000-000000000000', '215e2b87-2604-4ab8-b67e-fec915c4898a', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 15:57:02.591868+00', ''), - ('00000000-0000-0000-0000-000000000000', '0e526aee-00de-461b-bda8-5a4bfe245a41', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 15:57:02.601695+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ff10605-1bd0-4ee5-ae50-9e522c5fdef8', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 22:58:26.955115+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c8a669eb-05f5-4741-85a8-4d7c49d5c2ad', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-13 22:58:26.96148+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b7d07c33-9a5a-4240-b880-4bd04c0b7ed5', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 00:02:16.911964+00', ''), - ('00000000-0000-0000-0000-000000000000', '33580c0c-1ce8-4b21-8c9a-e82bae9d35fc', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 00:02:16.913356+00', ''), - ('00000000-0000-0000-0000-000000000000', '9977de5c-e3c0-4cb8-a4a8-9fb467bab145', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 01:00:46.546498+00', ''), - ('00000000-0000-0000-0000-000000000000', '14518eb1-de4f-4cf7-98c4-af0cc2c032a6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 01:00:46.549436+00', ''), - ('00000000-0000-0000-0000-000000000000', '15af3274-ec4b-4177-b578-0c7aad150e4d', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 10:43:53.711786+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3730efb-500e-4f6e-bba9-f21efd31fd18', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 10:43:53.754339+00', ''), - ('00000000-0000-0000-0000-000000000000', '6820f83b-dae8-4347-aea9-5949432281da', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 11:43:28.549681+00', ''), - ('00000000-0000-0000-0000-000000000000', '889a5c5f-e10f-401f-b442-9f029776a631', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 11:43:28.551295+00', ''), - ('00000000-0000-0000-0000-000000000000', '1fbb2658-9e77-4a42-b6aa-448d6caf79b2', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 12:41:32.936843+00', ''), - ('00000000-0000-0000-0000-000000000000', '4acb311c-f087-4ca0-b98a-1b3a1ae5114e', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 12:41:32.938203+00', ''), - ('00000000-0000-0000-0000-000000000000', '1b1cde18-1b21-4c47-b505-cec0c3098271', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 13:55:27.58097+00', ''), - ('00000000-0000-0000-0000-000000000000', '5b4befd0-77b8-4357-9f3e-101a71072b4a', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 13:55:27.583996+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f26024fa-c07e-4f99-9600-a77cb0e222bf', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 21:27:34.335477+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c102fc6f-90d6-4932-b9cd-dcf99d0c9ddd', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 21:27:34.342978+00', ''), - ('00000000-0000-0000-0000-000000000000', '9aea927e-db41-401f-a6cc-208cd8ca1995', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 22:27:02.4926+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de5fb6dc-d192-499d-8a0f-79b5a1042f4f', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 22:27:02.520777+00', ''), - ('00000000-0000-0000-0000-000000000000', '29e728e9-c374-4609-9f8f-4afb3ae2dbf1', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 23:25:27.658617+00', ''), - ('00000000-0000-0000-0000-000000000000', '1756e12f-44fe-4acc-9f05-ddab5d48f32e', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-14 23:25:27.659826+00', ''), - ('00000000-0000-0000-0000-000000000000', '25457a7b-fa7b-4a8c-89c2-7770f4299cfb', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 00:28:10.822103+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a3cabff1-c5ae-490b-92b9-0017bdffb3c3', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 00:28:10.823175+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c4aa3890-c900-4b26-b0c7-bbdd7f416d95', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 02:18:15.200382+00', ''), - ('00000000-0000-0000-0000-000000000000', '7746183b-774a-473b-a795-94f651094ab6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 02:18:15.209983+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a41c4f1-8ad1-4713-9f10-390106dd37fb', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 02:18:23.82499+00', ''), - ('00000000-0000-0000-0000-000000000000', '46f5e870-e8eb-4a64-899a-3ebe031d0621', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 02:18:27.371026+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eecc1df6-7a5d-4831-b3a0-7ee06a5b21f5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 02:18:34.425763+00', ''), - ('00000000-0000-0000-0000-000000000000', '3663bd31-2a44-4c9c-b6bf-4534f4c57e98', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 02:19:08.062878+00', ''), - ('00000000-0000-0000-0000-000000000000', '25b18d38-35dc-4175-a498-3a58452fb95a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 02:19:25.798944+00', ''), - ('00000000-0000-0000-0000-000000000000', '08b1e5f3-6ac7-494f-b2fb-f9fef20365a7', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 03:18:11.801531+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd42a1824-88a1-4ac6-9f19-df54c7e33bc1', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 03:18:11.803062+00', ''), - ('00000000-0000-0000-0000-000000000000', '96598dd4-6502-4988-804d-3635b3ca8e3c', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 04:18:17.594327+00', ''), - ('00000000-0000-0000-0000-000000000000', '11fa7cee-6ac4-45ab-a870-a00fa8642501', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 04:18:17.595397+00', ''), - ('00000000-0000-0000-0000-000000000000', '73595fe8-1113-4de7-beb3-44452d5a0343', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 10:18:19.902374+00', ''), - ('00000000-0000-0000-0000-000000000000', '0f6a0113-4f36-48b1-9565-c63c203d81d4', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 10:18:19.904941+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6354481-695e-4e3b-8426-9305dcc4a2d5', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 11:16:50.231016+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd89794fa-5cf6-487b-848e-3db2dee858c8', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 11:16:50.232231+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f47739e7-8e15-4a5c-a596-a6f529b5ec37', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 12:19:52.971589+00', ''), - ('00000000-0000-0000-0000-000000000000', '6d853433-4359-4d87-9f09-4b2787c66476', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 12:19:52.978268+00', ''), - ('00000000-0000-0000-0000-000000000000', '47c084cb-3c77-4b37-b838-ef77d6ceec8b', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 13:23:11.923164+00', ''), - ('00000000-0000-0000-0000-000000000000', '170d5d6d-a17c-4f24-a932-4b8678cfd9c6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 13:23:11.935467+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e617a66-a659-45c9-8829-274a7b9afc95', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 13:24:03.022189+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dc21503e-7914-42c6-bcb0-1cc09c689ac4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:27:00.771078+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a8b6278-c58c-4ceb-8e6b-75734ada0abf', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 13:27:06.179238+00', ''), - ('00000000-0000-0000-0000-000000000000', '35682e53-f5f9-470d-a088-8cd9ec154bbe', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:27:08.325505+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6b4cbcb-925e-485f-8df3-c26cc0a82c31', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:27:33.655761+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6b84a66-a7f4-4ed7-8e12-acce5f6d97ba', '{"action":"user_updated_password","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-15 13:27:33.849185+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1ee6ca5-a8d6-41f7-adaa-e16112243b27', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-15 13:27:33.850349+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bed32310-c7c2-42e0-8272-34034dc20806', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 13:27:34.006478+00', ''), - ('00000000-0000-0000-0000-000000000000', '16bfb6ae-ab23-4906-b20c-c0a6abe921f4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:27:37.870254+00', ''), - ('00000000-0000-0000-0000-000000000000', '336b1382-66f5-4210-b928-4c4ab5ca7a07', '{"action":"user_recovery_requested","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-15 13:30:32.517856+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e1081f7-ab46-492a-8cee-8fcd11f5219e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 13:35:21.384469+00', ''), - ('00000000-0000-0000-0000-000000000000', '8eb9f350-560f-4475-a18c-f1f05c9d9fad', '{"action":"user_recovery_requested","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-15 13:37:48.515381+00', ''), - ('00000000-0000-0000-0000-000000000000', '3bd12afc-4158-4099-9515-89e8ed69e267', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:41:35.803634+00', ''), - ('00000000-0000-0000-0000-000000000000', '64eec653-62d4-46a2-810d-301f9fdf8b7a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 13:41:38.669017+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd4d33dab-0b62-4826-a166-2f2f32f2bcdf', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:42:01.047472+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cfdb21fb-3253-41fb-8b09-58bcfde603d7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 13:45:59.569066+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ab537971-09b1-4e53-a7cb-6feaaec7a30e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 13:46:16.285163+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2bb8dd6-3df5-4042-8d3a-e711240dc36f', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 14:54:31.618608+00', ''), - ('00000000-0000-0000-0000-000000000000', '52eb5312-6d72-440f-bde3-819be2212adf', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 14:54:31.622577+00', ''), - ('00000000-0000-0000-0000-000000000000', '832125d1-5df6-484c-822d-3925629370a3', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 16:39:22.662109+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ea281d97-3d43-43a8-9afe-6e14afa29755', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 16:39:22.663517+00', ''), - ('00000000-0000-0000-0000-000000000000', '94c3948b-8302-47b0-b64e-501f2ddc2c4d', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 20:27:25.779537+00', ''), - ('00000000-0000-0000-0000-000000000000', '6ff3e1bf-7099-4ec9-b7ac-f90c5eba7d75', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 20:27:25.81929+00', ''), - ('00000000-0000-0000-0000-000000000000', '77fe0479-3283-4cb3-a272-0a6a5c469cc7', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 21:47:28.939882+00', ''), - ('00000000-0000-0000-0000-000000000000', '886a1c10-4f53-43a7-92c5-b0e5956df4cb', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 21:47:28.940871+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d62d84d-e9cc-428a-85b5-da1ba3a97a20', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 22:47:13.970356+00', ''), - ('00000000-0000-0000-0000-000000000000', '047cc66e-229f-4734-8326-a2d068232795', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-15 22:47:13.972795+00', ''), - ('00000000-0000-0000-0000-000000000000', '2a41acaa-4b8d-4724-88af-9e94770fe811', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:04:15.30027+00', ''), - ('00000000-0000-0000-0000-000000000000', '483db394-e356-4291-bf1a-3bf8ebfc540f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:04:25.008196+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd29dbd57-e9a3-44f9-9609-b9cf1d0d2957', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:04:28.107079+00', ''), - ('00000000-0000-0000-0000-000000000000', '0b18fde3-b1c5-4401-8910-09ef9f54cec6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:04:34.897255+00', ''), - ('00000000-0000-0000-0000-000000000000', '5fdd92e4-8797-46cc-8490-9e1c4cb9c4c0', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:04:49.090302+00', ''), - ('00000000-0000-0000-0000-000000000000', '89185d2b-80cc-4197-9d5a-8ae531fc6c93', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:04:51.436155+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c9618835-4f88-4a84-a0db-46ead9d1d81c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:05:05.186166+00', ''), - ('00000000-0000-0000-0000-000000000000', '4f342484-0aa5-427f-be62-62cf55ee0886', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:05:14.097119+00', ''), - ('00000000-0000-0000-0000-000000000000', '33261f03-d5e0-410a-8b1f-20ab85e1f1d7', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:05:21.000559+00', ''), - ('00000000-0000-0000-0000-000000000000', '5a0c4109-634c-4ea8-bb7e-ee995c924e8b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:05:28.272856+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c681c28-d3c7-45db-9bd1-498eb017d27b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:12:31.801652+00', ''), - ('00000000-0000-0000-0000-000000000000', '3a954846-3888-4a33-8c02-3f5aa1ff8bd0', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:12:34.326917+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a35fc4c3-da5e-4001-9bed-4e3eb5b72e49', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:12:46.882331+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dff22cc5-2cc3-4d94-9ec7-1ccfc2f131c9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:12:47.380286+00', ''), - ('00000000-0000-0000-0000-000000000000', '567bc720-ff1b-4bb3-b7ba-24a3e0b5d0d1', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:13:02.939327+00', ''), - ('00000000-0000-0000-0000-000000000000', '02ff16ff-3f92-4989-b026-6348eab1e77a', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:13:03.137178+00', ''), - ('00000000-0000-0000-0000-000000000000', '7aabe1e9-d34d-4ff0-9f42-bed04601f71b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:41:15.715891+00', ''), - ('00000000-0000-0000-0000-000000000000', '14c74c2d-6123-4327-828a-17d672303516', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:42:07.716454+00', ''), - ('00000000-0000-0000-0000-000000000000', '01043013-4308-4745-b13c-6fe3b4c97fa0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:42:15.263622+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce393297-8ef3-495f-8a64-339da358f7ff', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:42:25.590249+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a255f9bc-489a-4e53-b3cd-7a9ac31fe946', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:42:33.082187+00', ''), - ('00000000-0000-0000-0000-000000000000', '968364d5-61a5-4329-aa07-55577048acf5', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:46:20.716479+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd5ce8a5d-56c6-4418-8cdf-bfc241215c7f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:46:25.898369+00', ''), - ('00000000-0000-0000-0000-000000000000', '31558d86-139b-4840-800b-e90fd695eac9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:55:11.013768+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cd834d4e-163b-46a0-bbf2-81ad36a8e51f', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:55:16.340947+00', ''), - ('00000000-0000-0000-0000-000000000000', '127573dd-e7c2-4ae3-ad50-1c1a03b21a1d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:56:56.179483+00', ''), - ('00000000-0000-0000-0000-000000000000', '82a86be4-6888-4202-a94f-fe9287d574e2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:56:58.195523+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ad6c293-0674-4697-abf9-22bb16c3496a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:57:52.186446+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c03f266c-0ffa-4f23-b6a5-9fe65604df00', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:57:58.508969+00', ''), - ('00000000-0000-0000-0000-000000000000', '642b67a1-3c6b-4954-a1a3-e03fce623d62', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:58:21.712862+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f62e3ea9-c39c-4f00-bbdf-a7b0bb99d6e3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:58:23.389091+00', ''), - ('00000000-0000-0000-0000-000000000000', '910a95ad-985e-4721-88d8-a1b35fcadd8c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-15 23:58:31.267075+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c8db4b54-1399-4f5f-b9d9-0433a0e660e6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-15 23:58:39.161056+00', ''), - ('00000000-0000-0000-0000-000000000000', '975938c5-cc61-4ff0-92cb-ec8086fdd94d', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 03:50:08.025483+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e94a8b33-666c-45a4-af9a-d62bd2c80cb7', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 03:50:08.026679+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7c38b08-6c9a-42bd-8a03-7f832404f5be', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 10:19:32.113609+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd35f5341-7261-4470-a83b-3e516a6ea101', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 10:19:32.119464+00', ''), - ('00000000-0000-0000-0000-000000000000', 'edfd3207-1178-40aa-979b-6640e65cafff', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 10:19:36.984871+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f77965d6-a86b-4a71-93c3-19221d3fc775', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 10:19:43.973675+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2d2b451-539f-4570-ba0c-3324041e918a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 10:58:53.554944+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6b0b0f1-70a2-41f1-bff8-bdc8b2b3599e', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 10:59:08.283109+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cd05dde3-a0ac-4f6a-956f-d22e67837650', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 10:59:36.928104+00', ''), - ('00000000-0000-0000-0000-000000000000', '876d7968-d361-44b7-9ffc-c53754107668', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 11:21:28.269999+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fad6fb8b-1576-4bbc-a698-3c7fc50fe3d8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 11:48:16.185933+00', ''), - ('00000000-0000-0000-0000-000000000000', '4410d1d2-f60f-4b5d-8aae-6df672b8894b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 11:48:37.177524+00', ''), - ('00000000-0000-0000-0000-000000000000', '3df84085-2280-4545-ba4a-fe0c41ee2dd9', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 12:48:54.531487+00', ''), - ('00000000-0000-0000-0000-000000000000', '90589772-5ae0-4e73-9eac-b2c76cad3700', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 12:48:54.532757+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd3233892-e837-4ab1-84f2-1e84a9ff3800', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 13:47:07.707853+00', ''), - ('00000000-0000-0000-0000-000000000000', '234eb6c7-fb77-415a-b2b2-2df30e1975b2', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 13:47:07.710264+00', ''), - ('00000000-0000-0000-0000-000000000000', '3ef76410-3098-47bc-837c-8dfae2c15650', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 14:46:56.164593+00', ''), - ('00000000-0000-0000-0000-000000000000', '3e73fe56-b221-496f-8205-4e45e59d569d', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 14:46:56.169207+00', ''), - ('00000000-0000-0000-0000-000000000000', '60d03e30-b3d2-49a5-93a0-81fbebecd18b', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 15:47:02.682469+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b9354d82-68c5-4f68-a814-244bab7ce303', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 15:47:02.683814+00', ''), - ('00000000-0000-0000-0000-000000000000', '077f5bc3-acab-4280-a390-34d2d54fcb74', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 16:00:40.609163+00', ''), - ('00000000-0000-0000-0000-000000000000', '2233469d-6469-44b8-936b-d206567c08c2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 16:01:30.339539+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e7cfce2-6c15-4bc1-ac34-0553dba72c20', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 16:02:25.096346+00', ''), - ('00000000-0000-0000-0000-000000000000', '214b0006-41b6-48f6-9a78-7c2d9a045b0a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 16:02:26.626221+00', ''), - ('00000000-0000-0000-0000-000000000000', '22fb4ce1-fd52-4d61-9c38-f9ea686e1768', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 16:02:26.844274+00', ''), - ('00000000-0000-0000-0000-000000000000', '3a037a6f-e046-41f6-9b94-0659875b2572', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 16:06:28.187614+00', ''), - ('00000000-0000-0000-0000-000000000000', '3e636be6-39e2-4781-bef3-dae42d9f6af0', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 16:06:28.393846+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ea9d1e1b-a905-4b99-adcf-45da037cf195', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 16:06:32.71254+00', ''), - ('00000000-0000-0000-0000-000000000000', '943f233e-765b-4c02-b0a9-f5e38e211825', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 16:06:32.87323+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d85f565-db75-459e-9622-007bbe6bc708', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 16:06:38.810432+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f41cce69-bb9f-4a4b-a232-3f5491b1807b', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 17:06:10.187004+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a903e79-00b3-4baf-a308-47338d223f1b', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 17:06:10.188403+00', ''), - ('00000000-0000-0000-0000-000000000000', '9540f1ae-8c54-4130-9f78-ea52d32eb5ac', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 18:22:35.420496+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8b2d35b-73a2-4a01-aea5-06e4ecbdfd11', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 18:22:35.421933+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf3b1946-e0c3-437c-a0d3-69f58d8b6a87', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 18:24:13.415486+00', ''), - ('00000000-0000-0000-0000-000000000000', '0eb1e694-1822-4d23-a9c8-55fee1e6cfef', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 18:24:15.153166+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8f9152c-0c0f-497e-a785-422c8f16abd3', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 20:46:08.128562+00', ''), - ('00000000-0000-0000-0000-000000000000', '17a18dfa-d65c-447f-9640-35f1b7a740f7', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 20:46:08.129948+00', ''), - ('00000000-0000-0000-0000-000000000000', '89776212-d2c8-418f-a84f-f13dd1bb4e62', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 20:49:52.952466+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cf861eb8-6b0e-4d0f-b1f3-18ee06b141b6', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 20:56:17.621208+00', ''), - ('00000000-0000-0000-0000-000000000000', '8cb304af-bdd8-4f24-9ffb-4497dcf46975', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-16 21:46:18.671318+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ce21e68-cff4-445f-98aa-ff8f3b6e51de', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-16 21:46:20.053251+00', ''), - ('00000000-0000-0000-0000-000000000000', '4f59d880-d43f-4489-aa63-318d6fc4acb4', '{"action":"user_recovery_requested","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-16 21:49:10.348924+00', ''), - ('00000000-0000-0000-0000-000000000000', '03f0e7a5-f26d-4ab6-96be-dbe7e7521844', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 22:47:28.776981+00', ''), - ('00000000-0000-0000-0000-000000000000', '1172138d-c1ea-4c69-a62c-4fd85537c700', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 22:47:28.778408+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd709f5e7-fd23-4dd5-b387-ec448eb0c23a', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 23:50:57.332862+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c59fc11-da56-41d6-abd9-7ef5b71666cc', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-16 23:50:57.341772+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dff0b579-dc04-4e30-a0a6-f3418a188ec1', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Léo Nohama","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-17 00:13:44.567025+00', ''), - ('00000000-0000-0000-0000-000000000000', '7681b12c-9410-42dd-a9ba-113dedacc2f7', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Léo Nohama","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-17 00:14:09.386035+00', ''), - ('00000000-0000-0000-0000-000000000000', '851b0a6b-03d5-4d67-9994-5310234d9493', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-17 00:17:45.200061+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b18b52fe-04bb-4d84-b2b8-50563c5f9236', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 00:19:37.290231+00', ''), - ('00000000-0000-0000-0000-000000000000', '864006c2-c632-4b97-843d-ee001c3784c7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 00:19:38.862539+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de34a37e-542e-4f28-a48d-a7526d648baa', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-17 00:20:04.006139+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c37d54d2-5daa-4a77-98c1-55e62b67052a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 00:34:03.543392+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a8199d2-4436-41fc-a594-a88a53fb7492', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 00:36:09.347409+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bfc220f3-a119-43eb-ac34-2ef190314c05', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 10:26:32.739246+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dbcfc601-e87c-4516-8890-afc55a349203', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 10:26:32.746521+00', ''), - ('00000000-0000-0000-0000-000000000000', '37fbad46-e65b-481d-bf10-caa0c3e267ba', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 10:28:18.754521+00', ''), - ('00000000-0000-0000-0000-000000000000', '6d9c7dd0-6cae-41da-ba92-cf95c5f63da5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 10:28:33.840828+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed624eab-e570-4772-92ef-2f84c098f5a6', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 11:27:04.405374+00', ''), - ('00000000-0000-0000-0000-000000000000', '35a48567-bf10-4084-8ecc-4f1025fd5e0e', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 11:27:04.406465+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bce16da8-c300-48e7-bc54-04c8e4fbabfa', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 12:25:13.152413+00', ''), - ('00000000-0000-0000-0000-000000000000', '5628fe4d-bd1f-41f3-a504-cafc802f4839', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 12:25:13.154538+00', ''), - ('00000000-0000-0000-0000-000000000000', '359af896-1444-4adf-99d8-57ae364a696c', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 13:25:39.554654+00', ''), - ('00000000-0000-0000-0000-000000000000', '50ffb2e1-6b84-4b82-9158-680c47a67cd6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 13:25:39.556497+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cc3501ab-275d-438f-9e72-ccc843b19c8a', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 14:22:30.132354+00', ''), - ('00000000-0000-0000-0000-000000000000', '9293997a-0073-434d-b53f-df9f0e600f78', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 14:59:31.589529+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a4dadb0-3c5b-45c8-a77e-15d6824e7117', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 14:59:31.591672+00', ''), - ('00000000-0000-0000-0000-000000000000', '052b51f2-3802-4973-949e-9a8e427a8466', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 14:59:49.640216+00', ''), - ('00000000-0000-0000-0000-000000000000', '9d818e95-3772-4b06-b518-b83138d8fddc', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 15:02:22.422218+00', ''), - ('00000000-0000-0000-0000-000000000000', '823ba019-9656-43fe-be90-18ef01f4a5a0', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 15:05:45.901221+00', ''), - ('00000000-0000-0000-0000-000000000000', '6e61f35b-c11d-4549-9b90-e3d18995de8a', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 15:06:14.804294+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a510ed6d-7ceb-4d62-8a69-917c69d1ee44', '{"action":"user_signedup","actor_id":"834c27d8-9fb6-47fd-b611-1801c7574601","actor_username":"teste@teste.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 15:06:43.427774+00', ''), - ('00000000-0000-0000-0000-000000000000', '8c749c45-56e4-44ae-928a-574e3d483a32', '{"action":"login","actor_id":"834c27d8-9fb6-47fd-b611-1801c7574601","actor_username":"teste@teste.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 15:06:43.445251+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dc36eb0b-236f-4965-8380-334836f40ba9', '{"action":"token_refreshed","actor_id":"834c27d8-9fb6-47fd-b611-1801c7574601","actor_username":"teste@teste.com","actor_via_sso":false,"log_type":"token"}', '2026-02-17 17:04:01.196149+00', ''), - ('00000000-0000-0000-0000-000000000000', '5adfb18d-254f-4548-a086-9f671d497f41', '{"action":"token_revoked","actor_id":"834c27d8-9fb6-47fd-b611-1801c7574601","actor_username":"teste@teste.com","actor_via_sso":false,"log_type":"token"}', '2026-02-17 17:04:01.204286+00', ''), - ('00000000-0000-0000-0000-000000000000', '24ee59a9-b826-4870-baf4-ae976d26ce1f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 17:06:12.443196+00', ''), - ('00000000-0000-0000-0000-000000000000', '69765063-e11e-4995-8202-737eabaf2aa4', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 17:06:16.455718+00', ''), - ('00000000-0000-0000-0000-000000000000', '424e508c-f850-42d8-828f-85a660bb2dbb', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 17:06:33.193269+00', ''), - ('00000000-0000-0000-0000-000000000000', '1059ba70-9206-4bda-8784-7ae1d04ddc2c', '{"action":"user_repeated_signup","actor_id":"834c27d8-9fb6-47fd-b611-1801c7574601","actor_username":"teste@teste.com","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 17:06:57.862247+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e574fef-e1e5-4d95-972c-ac2681824f1e', '{"action":"user_repeated_signup","actor_id":"834c27d8-9fb6-47fd-b611-1801c7574601","actor_username":"teste@teste.com","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 17:07:36.212468+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e6dba45-26bc-4077-a113-528d21700057', '{"action":"token_revoked","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"token"}', '2026-02-22 15:41:15.248818+00', ''), - ('00000000-0000-0000-0000-000000000000', '5e3712df-c6ec-45bf-b69c-843097ce1efb', '{"action":"user_signedup","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 17:12:23.262443+00', ''), - ('00000000-0000-0000-0000-000000000000', '6cc79d0a-a8e0-4220-8b3c-95012792cadc', '{"action":"login","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 17:12:23.325363+00', ''), - ('00000000-0000-0000-0000-000000000000', '4081c296-fc46-4d05-a036-fba6c3762868', '{"action":"token_refreshed","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"token"}', '2026-02-17 18:11:01.872727+00', ''), - ('00000000-0000-0000-0000-000000000000', '8386c194-3344-4470-82e2-aed8b2cfb2b9', '{"action":"token_revoked","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"token"}', '2026-02-17 18:11:01.875041+00', ''), - ('00000000-0000-0000-0000-000000000000', '66a8adf5-f289-4c07-b269-db96804aec44', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 18:14:02.517817+00', ''), - ('00000000-0000-0000-0000-000000000000', '71ab8faf-056f-45c2-85f3-aee3038e2df5', '{"action":"user_signedup","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 18:16:25.309429+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ede51b0d-e9fd-46ac-b76a-3a361023d101', '{"action":"login","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 18:16:25.325909+00', ''), - ('00000000-0000-0000-0000-000000000000', '08750f64-8aa3-471a-81b2-2c9bf50d7e46', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 18:30:34.141927+00', ''), - ('00000000-0000-0000-0000-000000000000', '04aed15a-5084-468d-8611-f72851374d80', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 18:36:33.681107+00', ''), - ('00000000-0000-0000-0000-000000000000', '62f3caac-3e3c-47fe-b59b-ac872f59d09b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 18:36:44.968492+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aafa3b3a-681a-4fe7-a855-8fd74f82ddb9', '{"action":"user_signedup","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 19:29:55.371926+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ffb51bf-c46f-49d5-9774-9045fb7d7fc9', '{"action":"login","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:29:55.387857+00', ''), - ('00000000-0000-0000-0000-000000000000', '8efe1b84-89a7-419c-8316-fa426b392e0e', '{"action":"login","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:30:11.460758+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b5bdf1c-150d-485f-8f38-367c7f6bf266', '{"action":"logout","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:30:11.616708+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ac199286-4b5f-4b37-9f1d-efbb6b48da35', '{"action":"user_repeated_signup","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 19:30:31.233727+00', ''), - ('00000000-0000-0000-0000-000000000000', '5cf49e24-af76-41ec-8133-602402abb4aa', '{"action":"login","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:30:39.233569+00', ''), - ('00000000-0000-0000-0000-000000000000', '98318649-9d6d-4426-98d8-9c39bba4ee28', '{"action":"logout","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:30:39.393484+00', ''), - ('00000000-0000-0000-0000-000000000000', '86d4d98f-5488-473f-895f-9be8a8a7da6a', '{"action":"user_repeated_signup","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-02-17 19:39:55.38772+00', ''), - ('00000000-0000-0000-0000-000000000000', '92f99635-2e53-4a7a-aafd-518e78269b67', '{"action":"user_signedup","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 19:40:17.669185+00', ''), - ('00000000-0000-0000-0000-000000000000', '0b4c399b-38e7-40fd-a8fa-e9ba8249b1d9', '{"action":"login","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:40:17.718048+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6d18d07-db07-4cb0-8182-cbbfd2e3deaa', '{"action":"login","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:40:29.10917+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a150d55-27fa-44f0-bcd7-2dd58a81af41', '{"action":"logout","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:40:29.366601+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e2c22ce1-4d6f-47dc-a448-d02f22585123', '{"action":"login","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:43:08.239515+00', ''), - ('00000000-0000-0000-0000-000000000000', '9a59959f-b780-42cf-b526-a892971dba4d', '{"action":"logout","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:43:14.257742+00', ''), - ('00000000-0000-0000-0000-000000000000', '89916f2b-32bc-45ad-aeab-294b0f88f451', '{"action":"login","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:43:22.362395+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fbfe3cf7-d434-4c22-8e91-f3efe778aa32', '{"action":"logout","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:43:24.287075+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c9343246-db20-4bbd-87b8-8d2d235e5969', '{"action":"user_signedup","actor_id":"16802cd4-3ad9-46ee-b589-53903112902b","actor_username":"teste2@tenantid.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 19:44:48.142858+00', ''), - ('00000000-0000-0000-0000-000000000000', '8821fb7b-aad8-4d1d-8c59-af7a3e3f22be', '{"action":"login","actor_id":"16802cd4-3ad9-46ee-b589-53903112902b","actor_username":"teste2@tenantid.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:44:48.16144+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c788aaef-ad56-482e-b032-c051c1cdef77', '{"action":"login","actor_id":"16802cd4-3ad9-46ee-b589-53903112902b","actor_username":"teste2@tenantid.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:45:04.661899+00', ''), - ('00000000-0000-0000-0000-000000000000', '0be9c1ad-0c7a-4c85-ba6c-b0743a0f4e45', '{"action":"logout","actor_id":"16802cd4-3ad9-46ee-b589-53903112902b","actor_username":"teste2@tenantid.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:50:30.268935+00', ''), - ('00000000-0000-0000-0000-000000000000', '33232c77-753c-4f97-a1e4-f128bba0ca1b', '{"action":"user_signedup","actor_id":"fe93ec60-4a4f-4c0a-b186-aa265031fb6b","actor_username":"teste@teste4.com","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-02-17 19:51:10.670316+00', ''), - ('00000000-0000-0000-0000-000000000000', '5eceef8c-5c12-4106-811d-7f0da5228fb6', '{"action":"login","actor_id":"fe93ec60-4a4f-4c0a-b186-aa265031fb6b","actor_username":"teste@teste4.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:51:10.688083+00', ''), - ('00000000-0000-0000-0000-000000000000', '267fc364-8c57-4f6b-8cf4-dfc2767d8dee', '{"action":"login","actor_id":"fe93ec60-4a4f-4c0a-b186-aa265031fb6b","actor_username":"teste@teste4.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:51:43.738224+00', ''), - ('00000000-0000-0000-0000-000000000000', '095483ac-7d53-431f-af4b-9cdf8341a634', '{"action":"logout","actor_id":"fe93ec60-4a4f-4c0a-b186-aa265031fb6b","actor_username":"teste@teste4.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 19:51:59.864466+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f350a321-895d-4e17-b470-0e952981e335', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 19:52:07.890599+00', ''), - ('00000000-0000-0000-0000-000000000000', '6f3809a5-ccb3-42c4-9239-1eec7a73966e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 20:07:11.621357+00', ''), - ('00000000-0000-0000-0000-000000000000', '72442e76-2746-45f0-99d2-095932ffc6f3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 20:07:38.115777+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e06b218-7c1f-46a8-8cad-b1d5ef1bae43', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 20:09:59.833909+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd5ffe2d7-7314-4dcf-a3b9-61ec7d61702e', '{"action":"login","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 20:10:03.398605+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eb106b8b-349b-4d27-b501-9f944cb5cb29', '{"action":"logout","actor_id":"76343712-9e74-43a8-9d44-fcb221981083","actor_username":"teste@tenantid.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 20:36:14.534013+00', ''), - ('00000000-0000-0000-0000-000000000000', '4fba22a6-4701-4a31-8c1f-ea1ea6165ffb', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 20:36:18.87078+00', ''), - ('00000000-0000-0000-0000-000000000000', '02249c5e-0756-430c-93b2-67e068f53612', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 23:18:14.226162+00', ''), - ('00000000-0000-0000-0000-000000000000', '1286a9fc-0a58-4a89-b9de-bd75d850081d', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-17 23:18:14.22746+00', ''), - ('00000000-0000-0000-0000-000000000000', '2087ac43-8264-4f7f-aaec-c1960b475234', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-17 23:18:17.018777+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b540638a-f5f7-4c43-b9e8-28c9fe0f4ac2', '{"action":"login","actor_id":"fe93ec60-4a4f-4c0a-b186-aa265031fb6b","actor_username":"teste@teste4.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 23:18:38.502264+00', ''), - ('00000000-0000-0000-0000-000000000000', '241862b9-0f0f-4f8b-8c46-4ef4f7f84bbd', '{"action":"logout","actor_id":"fe93ec60-4a4f-4c0a-b186-aa265031fb6b","actor_username":"teste@teste4.com","actor_via_sso":false,"log_type":"account"}', '2026-02-17 23:18:55.754926+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a794bbc5-b868-475b-a147-676ac80619ab', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-17 23:18:57.811998+00', ''), - ('00000000-0000-0000-0000-000000000000', '4cc82c86-9fca-4c03-9ed1-1854953fd5da', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 00:17:05.726442+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f90fec2f-0bfa-4011-9fea-a456282f649b', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 00:17:05.728547+00', ''), - ('00000000-0000-0000-0000-000000000000', '8cf4199e-f3c2-4220-abc0-820c294ec6e2', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 01:43:52.037613+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ad11c165-b0c1-49bc-b296-90a100efb077', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 01:43:52.043042+00', ''), - ('00000000-0000-0000-0000-000000000000', '6801863e-ccc0-421f-b235-a7bc79795334', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-18 01:55:35.411906+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c772ecb7-3f21-4496-a432-5919b76d0b53', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-18 01:55:37.175498+00', ''), - ('00000000-0000-0000-0000-000000000000', '80742cf9-0d0f-4af1-a692-53133d92496a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-18 02:13:51.721481+00', ''), - ('00000000-0000-0000-0000-000000000000', '1543272a-df20-4fd1-9220-af84466816b2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-18 02:13:53.089743+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a4827d10-8af7-4b26-9440-c96638842fb5', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-18 02:14:17.831344+00', ''), - ('00000000-0000-0000-0000-000000000000', '686e4aa4-f5ef-4741-822d-efdcd854ce23', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-18 02:14:19.061461+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e7d1107e-5297-4739-9844-778049d08fa2', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:14:40.161294+00', ''), - ('00000000-0000-0000-0000-000000000000', '4fa9945a-4bdf-41d3-93bf-9f54724b65d7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-18 02:14:43.369853+00', ''), - ('00000000-0000-0000-0000-000000000000', '689f19c6-557f-4a60-a9e4-8ae44166354d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-18 02:14:44.864104+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd313194e-8619-4beb-b60b-2c18728e4e83', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:16:08.242686+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e25659f2-8a09-4c77-ab37-e95266a330fe', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:20:34.077622+00', ''), - ('00000000-0000-0000-0000-000000000000', 'df4d294e-91cc-4d36-afe7-6d5a4a6c1a55', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:27:04.484032+00', ''), - ('00000000-0000-0000-0000-000000000000', '51402391-f18e-4c8a-af2a-2ad4a9231ef7', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:27:13.081854+00', ''), - ('00000000-0000-0000-0000-000000000000', '3489dd54-28f1-458d-b22d-148c131b0046', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:27:19.723063+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a928e04-7873-43d3-b279-8e5b9a4fc9b5', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:27:37.024538+00', ''), - ('00000000-0000-0000-0000-000000000000', '3a61a31f-cb59-4a7f-90fa-d5b683cbcbe9', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 02:27:45.113399+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd439e5a9-1809-448e-a795-0bde447c59f2', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 10:52:55.118332+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b3d0829c-08cc-4541-86a8-ca6354918a62', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 10:52:55.125596+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b7e7c6de-9a75-4e30-9ee7-cbd687f4b227', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 10:56:33.413497+00', ''), - ('00000000-0000-0000-0000-000000000000', '9b1dbbe6-5c04-499f-997d-e45bc6e0dfa4', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 10:56:47.994272+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a62425ac-5a0c-4769-9577-06254fb5db73', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 10:57:52.891641+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd7746c95-278e-44c5-a526-6d27f63e88a7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-18 11:21:24.113887+00', ''), - ('00000000-0000-0000-0000-000000000000', '07bba6e1-15e1-4a17-91e9-ec15b22ba2f6', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-18 11:21:26.124294+00', ''), - ('00000000-0000-0000-0000-000000000000', '3ceca3f1-2db5-4186-b6f2-0d2c1f0e43a0', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 11:32:20.565686+00', ''), - ('00000000-0000-0000-0000-000000000000', '9458af1e-9d78-49cb-9c78-fcfeecd4f4fc', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 11:32:35.501077+00', ''), - ('00000000-0000-0000-0000-000000000000', '33465445-7c3a-4362-9880-4f8f3c09ac11', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-18 11:50:12.228172+00', ''), - ('00000000-0000-0000-0000-000000000000', '375fe4a1-839b-40ab-985d-2ba62ba1ac21', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-18 11:50:13.822574+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd3a4a2b0-86b6-4973-ac8a-2d6aab01382f', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 12:31:16.536865+00', ''), - ('00000000-0000-0000-0000-000000000000', '86cfb0bd-1fcb-4c17-836b-e3bd972bf44e', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 12:51:24.682218+00', ''), - ('00000000-0000-0000-0000-000000000000', '93124d90-d162-4ecb-9f3b-8fb610ce21b7', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 12:51:24.683883+00', ''), - ('00000000-0000-0000-0000-000000000000', '18d55d14-94e6-4f17-943d-3df69c301623', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 12:51:35.854027+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae39fd01-13b0-48de-87c1-5a0066f9547b', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-18 12:51:53.625999+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd724bf68-3006-4510-839f-8014feff501c', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 13:50:37.150673+00', ''), - ('00000000-0000-0000-0000-000000000000', '7d6fa9b8-cba6-4930-a83d-5bffacc18c2f', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 13:50:37.1521+00', ''), - ('00000000-0000-0000-0000-000000000000', '62a7c5b7-bcdc-409d-a19a-788a0f905003', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 17:07:57.130394+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6dd4147-375b-41c1-a8bf-242c0860bd57', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 17:07:57.133422+00', ''), - ('00000000-0000-0000-0000-000000000000', '04096e5e-6461-4063-baa0-881c5772a420', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 19:04:18.271302+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d6cf418-5bb7-4dcd-b66c-ec1b8c0c30b1', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 19:04:18.274226+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a4bee982-cc79-4cce-8739-db34160cc447', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 23:00:51.359781+00', ''), - ('00000000-0000-0000-0000-000000000000', '504b0da3-ada0-4cbe-aba3-933089618a3a', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 23:00:51.390423+00', ''), - ('00000000-0000-0000-0000-000000000000', '987ee4fb-c42a-459e-aa87-48cdd75799f8', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 23:59:12.617549+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7275739-a3ed-47b3-afd5-c4fa7e2773ff', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-18 23:59:12.618657+00', ''), - ('00000000-0000-0000-0000-000000000000', '4b7e2cf9-9ed6-4656-9952-5b8ceecf6bac', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 16:42:13.029285+00', ''), - ('00000000-0000-0000-0000-000000000000', 'da3203ca-fb81-4336-813f-8f0b37e5b126', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 16:42:13.035925+00', ''), - ('00000000-0000-0000-0000-000000000000', '228cbb73-9be4-41bb-b6f2-3c3050cc1583', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-19 16:58:29.739218+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ada69ee7-75f3-4497-9a75-44262a962dc8', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-19 16:58:32.920552+00', ''), - ('00000000-0000-0000-0000-000000000000', '1cf4de73-2f77-4f90-b5f0-ab6c012fc8e1', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-19 16:59:03.622456+00', ''), - ('00000000-0000-0000-0000-000000000000', '291ebcd9-94eb-4033-926d-cd7903e959dd', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 18:34:57.842217+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8a68cdf-4cb9-49f3-b6b5-fd24255824b4', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 18:34:57.847668+00', ''), - ('00000000-0000-0000-0000-000000000000', '89741ac2-9e78-4ea3-a5ae-3630e462b3d1', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 19:39:22.897654+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f5432291-276a-479f-a560-a2d46e187bc5', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 19:39:22.904758+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ee65119d-4d35-4e34-9fee-aa2f6496e68b', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 20:39:04.723811+00', ''), - ('00000000-0000-0000-0000-000000000000', '4560d53a-e5d2-4f66-85da-37703ae0680b', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 20:39:04.724982+00', ''), - ('00000000-0000-0000-0000-000000000000', '68c6b14b-a1ae-4636-97b2-14d3f41b7a2e', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 21:37:29.593455+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c8853a5-3c48-431f-ac4f-c4f61ef68bad', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 21:37:29.594787+00', ''), - ('00000000-0000-0000-0000-000000000000', '801e712d-3915-48a2-a785-6e3b232fb40e', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 22:54:23.671604+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7d5ef02-8ccd-4f1c-9d66-c961fbeb7380', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-19 22:54:23.673523+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d21b7bc-2668-4ebb-8c70-11eea3a2aa86', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 00:00:43.316575+00', ''), - ('00000000-0000-0000-0000-000000000000', '03add2e2-9136-451b-9d5c-35f27cf88b7d', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 00:00:43.321258+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e708351-4299-4aa6-a226-07a6126df864', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-20 00:39:59.78199+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f1d9d95d-b0ac-45e2-957c-a158183005e1', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-20 00:40:00.859877+00', ''), - ('00000000-0000-0000-0000-000000000000', '5dd9e8d6-8cbd-46aa-9eac-6e0c8121ab62', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-20 00:40:11.346637+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f1b91c77-8c88-42c0-bbcf-fa3b4badb3e3', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-20 00:40:11.64105+00', ''), - ('00000000-0000-0000-0000-000000000000', '301d0915-52ff-49d9-a7de-e0cb2813f6b5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-20 00:40:28.59856+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6be4551-f54f-4fbf-9730-893b2c5847ee', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-20 00:40:42.89781+00', ''), - ('00000000-0000-0000-0000-000000000000', '821d5bc8-22f7-4895-8473-a1d5b91070cc', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 02:02:13.119486+00', ''), - ('00000000-0000-0000-0000-000000000000', '743fe5bb-5ae6-43f5-bb79-536fa546d6bf', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 02:02:13.120478+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ab74d4ae-7426-483a-a3e5-de8beb0c1864', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 11:04:52.499118+00', ''), - ('00000000-0000-0000-0000-000000000000', '46d562d0-5b66-4e36-b751-a11336fa42bd', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 11:04:52.540602+00', ''), - ('00000000-0000-0000-0000-000000000000', '08d58edd-36ed-404b-a5f5-5862ec129ad5', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 12:02:54.220349+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c6435a01-8adc-4234-929e-97c6b198aa4c', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 12:02:54.221517+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6c12616-8011-4083-8598-cdb0041f8f14', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 13:01:21.635612+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f226dd8e-d9a4-4ad0-b749-aeca9826c5d2', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 13:01:21.636692+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2b0f3f2-b24c-4983-8c3e-1bc80c184f8f', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 14:13:47.362152+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f36b8161-cac7-459e-97ca-2cc181191eb6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 14:13:47.363435+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b98d167f-d378-49a6-bd8c-2ac9193f4e2c', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 15:12:25.139747+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cb73ad3a-0a32-4cbf-a099-15ff27bf44bd', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 15:12:25.142142+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd17a010a-4fe5-49cb-986c-431e72dca28c', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 16:14:22.811857+00', ''), - ('00000000-0000-0000-0000-000000000000', '91398fd5-23c6-4dc6-b2d5-f21fef5b1847', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 16:14:22.881183+00', ''), - ('00000000-0000-0000-0000-000000000000', '3e99e315-4d3a-43be-8905-0ba73c61b7a2', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 17:19:17.03941+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c69b3e2c-08c0-40a5-8255-96693c2b7bb1', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 17:19:17.043004+00', ''), - ('00000000-0000-0000-0000-000000000000', '789d96e0-8960-4805-850e-57a451a905da', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 18:45:10.259946+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c399ed9b-591a-4434-bb23-818c3111d4b1', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 18:45:10.356621+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f269d038-df5d-4a98-9594-d1320caa8b96', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 21:10:17.390522+00', ''), - ('00000000-0000-0000-0000-000000000000', '89327458-9cc7-4ea6-82dc-ecd50ff338f6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 21:10:17.4391+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a90c487-8a72-415e-9180-64b096fbf775', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 22:11:19.174609+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a0a6c283-529f-4c01-bdbb-09eb29b07362', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 22:11:19.177414+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c385ed8a-e6ff-406a-a98a-94d795935339', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 23:41:39.976324+00', ''), - ('00000000-0000-0000-0000-000000000000', '5f0fda30-06c8-4ac0-8877-a451e2b732e1', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-20 23:41:39.980478+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b4559cff-fc08-4a8e-a19b-16464c0e0ccd', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 01:40:33.526845+00', ''), - ('00000000-0000-0000-0000-000000000000', '58f25c99-de49-4db3-b5de-946c76b5c968', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 01:40:33.528423+00', ''), - ('00000000-0000-0000-0000-000000000000', '0e994521-db97-444d-911f-d5273c73027b', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 10:56:48.829741+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0aee4ee-dec2-42dc-aea8-e501ba6cfa83', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 10:56:48.836591+00', ''), - ('00000000-0000-0000-0000-000000000000', '55ee6073-b7da-45d1-a4c1-058975a92983', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 12:02:22.175279+00', ''), - ('00000000-0000-0000-0000-000000000000', '0cf08140-c4a2-45b7-95b0-8b1c643ad77a', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 12:02:22.176414+00', ''), - ('00000000-0000-0000-0000-000000000000', '644f2929-336b-43ed-a449-8ae965da977c', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"saas@agenciapsi.com.br","user_id":"40a4b683-a0c9-4890-a201-20faf41fca06","user_phone":""}}', '2026-02-21 12:16:21.330905+00', ''), - ('00000000-0000-0000-0000-000000000000', '3dae524c-78af-450d-b3ec-2402dbf4eca4', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:22:33.15338+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2be1815-5424-4f65-a7c2-8fa145c898d4', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:22:40.970638+00', ''), - ('00000000-0000-0000-0000-000000000000', '05b2d0d5-5cd1-465c-acff-776aa3508cee', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:24:38.531036+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dd3b9f11-d7cb-4672-8b78-66f43f2e924c', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:28:55.389413+00', ''), - ('00000000-0000-0000-0000-000000000000', '5f86c4cc-7a92-4583-9973-bef4f494b18f', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:28:57.89616+00', ''), - ('00000000-0000-0000-0000-000000000000', '6d4b692b-ff25-44fa-970d-6ee4d4b70843', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:30:33.330773+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd04e41f3-419c-4c0a-9a02-dc0f7046674a', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:30:34.729398+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce3ccd38-3917-4729-a2f5-9adb2e4e9a0d', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:32:50.984921+00', ''), - ('00000000-0000-0000-0000-000000000000', '9ff1a68b-731e-4540-9a27-6fd11864f52a', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:32:52.411767+00', ''), - ('00000000-0000-0000-0000-000000000000', '082ed106-33ee-421b-a9e5-644dac64e586', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:32:59.713721+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ec84885e-26a3-4e21-b3b1-b1991d41a56b', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:33:07.794059+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f233c57-d2fa-4672-ab2a-62773589837c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:33:11.135412+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4105693-f7bd-4375-96f6-a5aae58cb34d', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:33:22.408328+00', ''), - ('00000000-0000-0000-0000-000000000000', '4b575319-e0ef-48e4-8ff6-d0726dd8c264', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:33:24.893041+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ec368162-df63-40a0-8f08-3774dde55d56', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:44:11.256401+00', ''), - ('00000000-0000-0000-0000-000000000000', '824b6423-b731-4c21-9985-6d9382d2adf1', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:44:15.614618+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd18af043-b493-40b3-a260-a7d1f29efa8c', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:44:17.711938+00', ''), - ('00000000-0000-0000-0000-000000000000', '010483ba-ca1c-4e5d-aad8-77b5428db77c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:44:21.506374+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cf798dc5-4689-4a89-abe7-1aa4b1e7cbc5', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:44:35.701362+00', ''), - ('00000000-0000-0000-0000-000000000000', '2aefdd65-5ee2-4ee7-ba42-8f8c01032f49', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:44:37.885161+00', ''), - ('00000000-0000-0000-0000-000000000000', '6c115c38-d976-49e9-af59-d6c1167a6b68', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:44:59.199971+00', ''), - ('00000000-0000-0000-0000-000000000000', '9fcb71b7-4b98-47e4-8d9d-33e33bbe3f1a', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:45:04.386315+00', ''), - ('00000000-0000-0000-0000-000000000000', '70db5834-a82a-4514-bcb1-d761aeb6e21c', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:45:06.62071+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f36cfe7e-48cb-4dae-8fd2-0aaec7ccc359', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:45:08.458317+00', ''), - ('00000000-0000-0000-0000-000000000000', '78938e23-bd56-429c-8605-835c2453311c', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:45:11.735286+00', ''), - ('00000000-0000-0000-0000-000000000000', '7ff1fdb9-514f-4698-a356-63a7893910d7', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:45:13.563135+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a2bff2e7-e164-4ea5-a16a-f45b35c88107', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 12:45:15.494296+00', ''), - ('00000000-0000-0000-0000-000000000000', '072d23c0-9d1e-469e-b681-583c13773f3f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 12:45:20.065675+00', ''), - ('00000000-0000-0000-0000-000000000000', '9c22d05e-bca9-40aa-8344-eb21f3df0716', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:21:01.201425+00', ''), - ('00000000-0000-0000-0000-000000000000', '7184e5c0-bb04-4ed6-b414-93b9846bfed4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:21:04.164406+00', ''), - ('00000000-0000-0000-0000-000000000000', '4987412d-b403-4a16-9f82-19c0f9a65a79', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:25:04.904053+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d1a83c6-9544-4505-823f-0aa790f95ccf', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:25:08.257691+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0eed23c-f5c0-4e77-895a-793e57e14a9d', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:25:14.761023+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2823829-d086-441f-97b7-8ac5d717330b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:25:17.477761+00', ''), - ('00000000-0000-0000-0000-000000000000', '4fbaf356-3b58-4bfb-8b81-05c38877e95d', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:25:18.985022+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd5bd1915-b2b7-4f18-9667-89f90891a03e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:25:20.914064+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8673afa-d25c-4c34-a5d6-96ebd510d3a7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:27:22.732502+00', ''), - ('00000000-0000-0000-0000-000000000000', '574884e2-253f-41b2-9b7e-d30b91552ddc', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:27:25.241894+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de2b24f8-2572-48a3-9294-ac7354a2f9c4', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:27:27.082766+00', ''), - ('00000000-0000-0000-0000-000000000000', '47ac2bea-3640-4b2c-ad03-e41809e780e3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:27:31.36409+00', ''), - ('00000000-0000-0000-0000-000000000000', '91d63314-d93c-4a6b-be69-016726a97f95', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:29:08.17496+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8316e16-5d4b-4872-a661-8d51d3f40922', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:29:11.209264+00', ''), - ('00000000-0000-0000-0000-000000000000', '059961af-c079-416f-9ef6-037b0dedfbe1', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:32:06.019024+00', ''), - ('00000000-0000-0000-0000-000000000000', '701c6d69-281a-4404-bbf5-5f86dbc2bd42', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:32:08.148219+00', ''), - ('00000000-0000-0000-0000-000000000000', '3df4052d-aea1-4aef-83eb-27829cc30aee', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:32:15.769268+00', ''), - ('00000000-0000-0000-0000-000000000000', '10dc5794-5cde-48f8-a0ba-67dd713ffb09', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:32:18.267944+00', ''), - ('00000000-0000-0000-0000-000000000000', '645a22e9-3609-473f-8f92-3f6970862494', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:37:41.773733+00', ''), - ('00000000-0000-0000-0000-000000000000', '60af6cbf-1926-4353-bc92-edb323cd78ec', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"admin@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:37:44.293001+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed1ec8cb-8877-4d54-8a8f-da5c23e88a64', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 13:41:30.567022+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c74164a1-e4a4-4ba4-8792-b0b34d76685e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 13:41:40.502136+00', ''), - ('00000000-0000-0000-0000-000000000000', '4cce11db-00ac-4e8b-81b5-9c36142ae029', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 18:10:16.763108+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b0f35beb-195e-4acb-9fcd-23928eb4ad90', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 18:10:16.795583+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b77d86d1-6d0a-4f77-9416-6fc91f49bd64', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:10:50.751148+00', ''), - ('00000000-0000-0000-0000-000000000000', '2dc78eb1-1c42-456c-8aa4-d41033f66f69', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:10:58.773764+00', ''), - ('00000000-0000-0000-0000-000000000000', '65da3393-cc62-4d6b-8692-1c55dc362f95', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:11:02.537319+00', ''), - ('00000000-0000-0000-0000-000000000000', '7077d62c-abb6-4c87-b28f-670d69f168e7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:11:08.207766+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af446883-1d51-411f-b9db-ca66e1f4b81b', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:12:04.340486+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b84e5358-582a-4972-a429-03be8469353d', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:12:15.207012+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f7ce5e53-ade9-4c9e-b186-eab458b78278', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:12:19.170207+00', ''), - ('00000000-0000-0000-0000-000000000000', '830830dc-821a-4758-a0ab-1158305cbc9b', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:12:21.105337+00', ''), - ('00000000-0000-0000-0000-000000000000', '857829a9-3b37-4332-9295-5630c3b519fd', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:13:15.565887+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f999e2b6-8fd3-4ee9-baa6-b12bc750d6f6', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:13:18.235878+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e2ea0f5f-f116-4451-bd42-b22342dbbeb8', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:22:51.824924+00', ''), - ('00000000-0000-0000-0000-000000000000', '56ee62c8-246b-4e46-8fc8-9414e1170b65', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:22:55.880074+00', ''), - ('00000000-0000-0000-0000-000000000000', '907dbfb3-cfed-4757-af47-efaae7eaf4cc', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:22:58.559821+00', ''), - ('00000000-0000-0000-0000-000000000000', '7a2b618b-7245-4769-b8a9-211caf778253', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:23:07.343402+00', ''), - ('00000000-0000-0000-0000-000000000000', '385cc255-c7d2-47ea-b8d8-128fbaa4ff53', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:25:05.931098+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd1afbedc-8ec0-4ad0-908c-9c6f021e17b4', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:25:08.755122+00', ''), - ('00000000-0000-0000-0000-000000000000', '3d63befb-e7ca-46cd-a863-d14dade1e4c1', '{"action":"user_modified","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-21 18:30:10.810779+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f627afe6-cab8-40a5-b406-a68a592e3a66', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:30:19.967115+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a92abc1c-c49e-4005-a501-6faea0b53612', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:30:26.930834+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e210fb3-c34f-44c3-949d-2a23ba8cc2cf', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:37:15.473514+00', ''), - ('00000000-0000-0000-0000-000000000000', '61762f8a-b26e-4109-baf1-8cd8cb6c77a6', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:37:21.36661+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a7bac8a-3435-455e-a640-4b68d576ac85', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 18:59:49.357346+00', ''), - ('00000000-0000-0000-0000-000000000000', '9e8022cb-c607-4a40-8dbf-6fb844061eda', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 18:59:53.275633+00', ''), - ('00000000-0000-0000-0000-000000000000', '39338b95-a0c7-4719-96e0-608e3b8869fb', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 19:58:25.723561+00', ''), - ('00000000-0000-0000-0000-000000000000', '50c0f2f1-b903-465f-9c79-b378464fee29', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 19:58:25.724636+00', ''), - ('00000000-0000-0000-0000-000000000000', '37f9bd2b-16a7-413b-a0c3-3143087039c4', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 21:00:54.692766+00', ''), - ('00000000-0000-0000-0000-000000000000', '20504ca7-9978-4afa-84c4-ab97643b06b5', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 21:00:54.694124+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e3dbd9c2-378b-496d-bd5a-74b548a673a2', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 21:14:21.809951+00', ''), - ('00000000-0000-0000-0000-000000000000', 'efc624cb-02f1-4085-98f7-cbea1e37f9d1', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 21:14:28.833775+00', ''), - ('00000000-0000-0000-0000-000000000000', '07c07d9b-62c9-41b6-b82b-ba1331b21b0b', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 21:14:31.76994+00', ''), - ('00000000-0000-0000-0000-000000000000', '3123d342-2c1c-4bab-a8aa-2c5cf3bd8790', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 21:14:34.095195+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8eec5e8-ad27-4f2b-84e1-81427a15c814', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 22:20:16.120775+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e1e9992-cda8-4400-9f1a-f8da70e7f059', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 22:20:16.12206+00', ''), - ('00000000-0000-0000-0000-000000000000', '83044643-4dc4-47c6-8438-7f8ed3c62d08', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 22:24:08.30287+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ee2001dd-6803-4d21-a19b-e4e9719da72e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 22:24:11.540948+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c7fb3243-760d-41e3-98d7-de596f55d857', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 22:28:41.322654+00', ''), - ('00000000-0000-0000-0000-000000000000', '6285df1f-9c44-4132-a6e7-f193066c9fe6', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 22:28:43.594361+00', ''), - ('00000000-0000-0000-0000-000000000000', '930bb285-c1e3-4e83-9347-4c1d8a9ea83f', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 22:28:45.966437+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c3f5f97-5ab1-4ec4-a74d-06bdfa7a1453', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 22:40:36.025055+00', ''), - ('00000000-0000-0000-0000-000000000000', '6de15c2d-d016-4bb6-8e6a-6d2d16d64c4e', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 23:42:55.554286+00', ''), - ('00000000-0000-0000-0000-000000000000', '58bb19c3-e615-438f-9bda-5a51742aa8b3', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-21 23:42:55.555366+00', ''), - ('00000000-0000-0000-0000-000000000000', '06a47ec7-f291-411d-8ce7-09838d8c2c2f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 23:43:07.878798+00', ''), - ('00000000-0000-0000-0000-000000000000', '5a02afcb-f4d9-4691-b307-beac29b4e09f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 23:43:08.031472+00', ''), - ('00000000-0000-0000-0000-000000000000', 'df7d9314-8d33-4667-bb1b-8fe005a8acf6', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 23:43:18.182491+00', ''), - ('00000000-0000-0000-0000-000000000000', '79a49af7-88b9-431c-b5e1-61669343e0ca', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 23:43:20.327329+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6c502d6-a727-4475-9ec5-280050ed6732', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 23:43:22.378528+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0d2227d-3134-4445-b926-061fc40492ac', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 23:43:22.542117+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bc8a8396-d891-4a7e-ae08-9d71d59b754b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 23:46:06.859059+00', ''), - ('00000000-0000-0000-0000-000000000000', '72aa65d4-0b8c-4a92-b004-69528ce231b5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 23:47:03.546972+00', ''), - ('00000000-0000-0000-0000-000000000000', '4f8ffd22-0b41-4429-86e2-68a1a559cb77', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-21 23:47:03.700863+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e4a236a-67e2-458d-b5a5-f8399a443863', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-21 23:47:18.339445+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f5c6555-c2aa-4e23-84fc-900c0d8d5515', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 01:28:13.431578+00', ''), - ('00000000-0000-0000-0000-000000000000', '6f470528-6941-4987-bd2f-b5a14f06e89c', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 01:28:13.433026+00', ''), - ('00000000-0000-0000-0000-000000000000', '6543de86-6f05-4947-8ae0-dbb96dd5f1d1', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 10:17:31.768053+00', ''), - ('00000000-0000-0000-0000-000000000000', '8073bbcc-6d6b-44a5-87af-1beb2cc386b7', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 10:17:31.845698+00', ''), - ('00000000-0000-0000-0000-000000000000', '9503af3b-50bf-4a29-bac4-89380243021f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:17:42.553832+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f1387d49-b955-4567-864a-b1d81e1b47fd', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:17:42.850727+00', ''), - ('00000000-0000-0000-0000-000000000000', '2369cf59-4f28-43db-8db3-0d4ad679c5e0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:21:50.761319+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f44bba92-4d17-4042-a399-171f58a7ea6c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:21:51.059584+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e78aab8-81c8-4afc-b5c3-9c441aa4a64b', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:22:08.951609+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eab0cee1-b9ef-405c-9f86-5ff8f745806e', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:22:13.205795+00', ''), - ('00000000-0000-0000-0000-000000000000', '1777e3a2-38f5-4539-b1bd-cca4d5da1b71', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:22:17.945095+00', ''), - ('00000000-0000-0000-0000-000000000000', '522d06d3-deaf-401c-b0b4-cfa1c33b5383', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:22:18.111239+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae57e909-d1b2-481f-acdb-f7883bc848a9', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:22:50.827144+00', ''), - ('00000000-0000-0000-0000-000000000000', '00b1216c-73e4-49fe-ab84-ba94fd13bd90', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:22:51.051868+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cc0d3bab-dfc6-4da1-9b8d-048710bfee4d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:24:05.969162+00', ''), - ('00000000-0000-0000-0000-000000000000', '6821ea4e-4348-4c8c-86f7-8894a31a1aca', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:26:07.439483+00', ''), - ('00000000-0000-0000-0000-000000000000', '3af12b1a-61f4-4916-999c-4bdfd569a9d2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:26:09.639026+00', ''), - ('00000000-0000-0000-0000-000000000000', '056e3214-c703-4a80-bf6a-5f60eba575b8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:31:56.803867+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3896910-d78c-44dc-8f98-a195ba861ec9', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:31:58.673206+00', ''), - ('00000000-0000-0000-0000-000000000000', '967e090a-929c-4dfa-b75f-66ece570c360', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:33:46.412258+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6e55a48-a7b2-40c5-ac80-52e50c851966', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:33:48.710066+00', ''), - ('00000000-0000-0000-0000-000000000000', '6233a200-0115-47d5-b030-60541be6fe38', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:56:49.635436+00', ''), - ('00000000-0000-0000-0000-000000000000', '8371ad4c-2135-46d2-a05c-1df93d3792dd', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:56:52.264298+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c8515ae2-7b60-4ba3-a47b-6f19b71c6a6a', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:56:54.008304+00', ''), - ('00000000-0000-0000-0000-000000000000', '6cb494e2-3373-4e92-a54e-cb98edb861a7', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:56:55.790459+00', ''), - ('00000000-0000-0000-0000-000000000000', '9f1dada5-9571-4a3f-b7db-8df5c85ea6b9', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 10:56:57.687567+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c4d888f-8f1b-43a2-9e36-3640df8b59e4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 10:57:00.316299+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4c0693a-fce6-4bb9-bc2f-1588d15be217', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 11:58:08.151995+00', ''), - ('00000000-0000-0000-0000-000000000000', '598ea611-c290-45c7-814d-43a91cab8471', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 11:58:08.153265+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e96a094-9c01-4df0-a245-c8d7dce6d374', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 11:58:23.597538+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd1797e6b-fe01-4af1-9010-e8f07ae7512c', '{"action":"login","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 12:56:31.013907+00', ''), - ('00000000-0000-0000-0000-000000000000', '495658b0-22b4-437a-9c34-48f9617d2b41', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 12:57:10.019078+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c4e7635-e70f-4660-b529-71d77d891160', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 12:57:10.02052+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a6d7f6f-489c-40c4-b610-bf1471da5cc7', '{"action":"login","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 13:08:48.088328+00', ''), - ('00000000-0000-0000-0000-000000000000', '0aa38170-34f5-4fa8-b2b4-6ade55183ed2', '{"action":"login","actor_id":"7d566f66-ae88-45d6-b3db-8094fc64fb77","actor_username":"teste@teste2.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 13:18:01.720835+00', ''), - ('00000000-0000-0000-0000-000000000000', '203d6440-06ed-4846-8a65-db12c475144f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 13:50:58.823607+00', ''), - ('00000000-0000-0000-0000-000000000000', '4c64b4e2-796a-449f-b855-a92ead27afb8', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 13:51:01.727663+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf40d10f-4775-40e7-a22a-c0beb39f56ca', '{"action":"login","actor_id":"3947b8fd-f54b-4b67-a40e-d957bb51adef","actor_username":"teste@teste3.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 13:54:33.423572+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b621b0ae-114d-4c97-83a2-2b8c9031d477', '{"action":"login","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 14:35:29.192179+00', ''), - ('00000000-0000-0000-0000-000000000000', '65e80543-9e87-47e8-b40b-29de25e06387', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 14:51:06.120049+00', ''), - ('00000000-0000-0000-0000-000000000000', '48897f10-441c-4bac-8eb0-85b213f8fc3d', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 14:51:06.121281+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6073c51-29a0-40fe-ae89-2a8faa3147e7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 15:32:06.318005+00', ''), - ('00000000-0000-0000-0000-000000000000', '3165c064-4192-4139-b4ca-b9ade004a852', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 15:32:09.27354+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f42e41ac-9f1c-47a5-9aba-5240d62c204a', '{"action":"token_refreshed","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"token"}', '2026-02-22 15:41:15.244057+00', ''), - ('00000000-0000-0000-0000-000000000000', '63b4bed5-f38d-4e64-9153-3752f0c68a09', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 15:42:39.029354+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e2bb790-aa40-4bc0-8b97-55bd05cee6b3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 15:42:41.457152+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a116f1e6-6861-4abf-a3f2-e5523e6a3c81', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 15:52:37.34458+00', ''), - ('00000000-0000-0000-0000-000000000000', '1fbfa227-6305-4c01-968c-91eb80cda260', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 15:52:40.219268+00', ''), - ('00000000-0000-0000-0000-000000000000', '911d7653-ef10-466b-a329-507b1d4aa8ed', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 15:53:07.290888+00', ''), - ('00000000-0000-0000-0000-000000000000', '11c9e455-0a78-4a5d-9b58-a7983a131b16', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 15:53:10.242718+00', ''), - ('00000000-0000-0000-0000-000000000000', '5cd01129-3a44-4d2a-adb3-4f9e384bf69f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-22 16:19:36.58177+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3766ed1-f58f-4e4e-8272-857910eac427', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-22 16:19:39.337886+00', ''), - ('00000000-0000-0000-0000-000000000000', '79bbe7b6-ff37-485f-a604-225f7fc6c5fe', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 19:11:58.215477+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ddbe195c-eadc-4516-9c5b-32bc690ceb57', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 19:11:58.217299+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd90bcca6-8b50-42cc-930e-a4842aa1184a', '{"action":"token_refreshed","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"token"}', '2026-02-22 19:15:41.713707+00', ''), - ('00000000-0000-0000-0000-000000000000', '2de850db-a768-4057-82e9-be5291d69d02', '{"action":"token_revoked","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"token"}', '2026-02-22 19:15:41.715116+00', ''), - ('00000000-0000-0000-0000-000000000000', '8004e4d6-7537-4940-8879-4cd5f3bb0c47', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 20:52:39.196362+00', ''), - ('00000000-0000-0000-0000-000000000000', '01fb88d0-2152-430b-8d53-08724db42961', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-22 20:52:39.249401+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0bf1ede-b4a2-4ffb-a24c-7ccacb2bf00f', '{"action":"token_refreshed","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"token"}', '2026-02-22 20:53:41.863455+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a201e94b-6aa6-4e72-8463-d8ff1753e8c9', '{"action":"token_revoked","actor_id":"eec5fd64-ba68-4181-a27c-75de7f188704","actor_username":"asd@asd.com","actor_via_sso":false,"log_type":"token"}', '2026-02-22 20:53:41.866643+00', ''), - ('00000000-0000-0000-0000-000000000000', '0faed55b-74d3-4b50-a027-0e28205dcb99', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 11:16:30.157519+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a34f41b1-a01a-4161-92e6-0fe1887ac115', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 11:16:30.168358+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c5026d4-e144-4e45-a1e5-3b1a06286323', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 11:19:01.732701+00', ''), - ('00000000-0000-0000-0000-000000000000', '32fec2ba-77f6-4a23-aa0a-3ebd8dd661a4', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 11:19:04.43327+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e3a7d72-0481-4e33-8d56-261025f728d1', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 12:30:08.549705+00', ''), - ('00000000-0000-0000-0000-000000000000', '3370f08b-d64c-43ff-bdfa-e483d4aefd0e', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 12:30:08.55533+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de73e128-caad-4597-9e5d-95efb3b348e5', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 14:06:54.76485+00', ''), - ('00000000-0000-0000-0000-000000000000', '390e1de9-4903-48a4-a60f-6e1d91687b18', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 14:06:54.766717+00', ''), - ('00000000-0000-0000-0000-000000000000', '145e7a9c-ae0a-4192-8d3b-d511d4fe5f91', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 14:34:23.444764+00', ''), - ('00000000-0000-0000-0000-000000000000', '4d61e84d-7fce-4800-a9d8-6990ab2258cb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 14:34:25.780743+00', ''), - ('00000000-0000-0000-0000-000000000000', 'afd75b9c-0b95-4250-ad4b-1028ec5c15a9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 14:48:43.419857+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a9e1959-3897-4b12-875f-2d52488b4478', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 14:48:46.038406+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ae81324-d05f-4862-8fa5-9d4a3c36ff1f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 14:48:56.760632+00', ''), - ('00000000-0000-0000-0000-000000000000', '47781f25-25af-457c-b2c5-2a2a6d01fbb5', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 14:49:00.134569+00', ''), - ('00000000-0000-0000-0000-000000000000', '5fe7a088-e00e-4040-93b0-54f1738d0a70', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 16:31:03.794219+00', ''), - ('00000000-0000-0000-0000-000000000000', '23b41745-ee7e-4a65-9f68-5f6a045b6d67', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 16:31:03.795389+00', ''), - ('00000000-0000-0000-0000-000000000000', '0294dd87-4604-42cb-b891-a76b34e91b22', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 17:43:48.221799+00', ''), - ('00000000-0000-0000-0000-000000000000', '93bd3688-7b7d-4584-b0a1-85279487d64c', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 17:43:48.228813+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f0a69caa-a0b2-4c85-b667-5bff77391353', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 17:58:56.963857+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b9f34b5-0894-4c3f-a4e6-8475856b0ade', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 17:58:59.149215+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ac9bfd76-058c-4650-b3f5-f546a10e917e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 17:59:37.89519+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c19f86c8-c7bc-40ed-97eb-e67c78652354', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 17:59:40.512401+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bedc2038-12a7-44b8-89c9-33f3c13bdd1a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:00:00.041676+00', ''), - ('00000000-0000-0000-0000-000000000000', '686ab11b-3759-40a3-96c2-3ecb5a41c6aa', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:00:03.146318+00', ''), - ('00000000-0000-0000-0000-000000000000', '1502db02-3803-4c1a-9a39-7ed867a7ff64', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:01:47.437114+00', ''), - ('00000000-0000-0000-0000-000000000000', '97ac81c4-7db0-4b1d-aba7-73c8d04ff9c0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:01:49.790912+00', ''), - ('00000000-0000-0000-0000-000000000000', '93ce69fc-bd0b-45c4-be04-ce0e1ec57751', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:02:24.492504+00', ''), - ('00000000-0000-0000-0000-000000000000', '946c759c-3d08-4751-b27c-8c988acb610b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:02:27.268314+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fc9c1aee-ac01-4ae6-a4a1-a6dbd1153723', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:07:14.444717+00', ''), - ('00000000-0000-0000-0000-000000000000', '121a45cd-98e7-4fa0-add2-89f075f50b34', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:07:19.502814+00', ''), - ('00000000-0000-0000-0000-000000000000', '269dddde-7e33-4fc5-a245-ca9f677b7e89', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:49:21.676009+00', ''), - ('00000000-0000-0000-0000-000000000000', '011bab22-ac25-416e-9a2e-b23871294a30', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:49:23.798791+00', ''), - ('00000000-0000-0000-0000-000000000000', '1cef6ed7-6bc9-4035-a3f6-0ca78f827da0', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:49:38.732283+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a8cc5c5f-9831-4268-bed0-c284e3505afc', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:49:41.334899+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d1234d7-fe97-41c3-9a8f-a28fdfe27f3f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:50:04.868663+00', ''), - ('00000000-0000-0000-0000-000000000000', '69725f44-a862-4152-a00b-8ca4723882b2', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:50:08.243985+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fae737cf-0c61-4627-bfa1-ebd10b6cf2de', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:50:16.549476+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bb62870a-9d3b-4682-8ec9-5609f13c8792', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:50:20.225088+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f468efec-3bb7-4dcc-9629-b535abe52f35', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:50:24.822554+00', ''), - ('00000000-0000-0000-0000-000000000000', '3074f275-f367-495e-b4bb-81eee48c0eb4', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:50:27.519184+00', ''), - ('00000000-0000-0000-0000-000000000000', '7fac2d79-a2ed-47aa-ab39-fed74f5bad0f', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 18:50:57.715137+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e549c5d-718a-4e81-9ec5-835f137ef99e', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 18:51:34.715817+00', ''), - ('00000000-0000-0000-0000-000000000000', '17dabd63-7803-481e-8238-63cf2879bbc2', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 19:03:00.76065+00', ''), - ('00000000-0000-0000-0000-000000000000', '796e4d67-2898-4997-bb53-fef22f6eaa78', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 19:03:03.205355+00', ''), - ('00000000-0000-0000-0000-000000000000', 'df6777d2-df93-4ddc-a23c-d4e525cf035c', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 19:10:59.34731+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae62d8e7-e1ae-4a4f-8a21-3edd03dcbc7b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 19:11:03.275293+00', ''), - ('00000000-0000-0000-0000-000000000000', '223910ed-0044-406b-86ac-c4034b1d5bcd', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 19:11:05.950046+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae717474-3de8-408a-ab2e-dc7d60468399', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 19:11:08.316715+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a181cfc5-679d-4663-9663-2ef1823c2dc0', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 19:11:13.250641+00', ''), - ('00000000-0000-0000-0000-000000000000', '0930ea96-81a9-41a8-b446-30c6518b987b', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 19:11:16.295329+00', ''), - ('00000000-0000-0000-0000-000000000000', '840abd37-d551-416a-b836-a9eef0c5c6de', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 19:11:18.589715+00', ''), - ('00000000-0000-0000-0000-000000000000', '53b86dfb-d6b1-44b3-9110-964b9b187496', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 19:11:21.981876+00', ''), - ('00000000-0000-0000-0000-000000000000', '43c33cb2-b9b3-4ca2-95d6-3eb4c217d11c', '{"action":"token_refreshed","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 21:17:32.198382+00', ''), - ('00000000-0000-0000-0000-000000000000', '6514bdbb-70c7-4f09-98e6-cf225206c56e', '{"action":"token_revoked","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 21:17:32.200057+00', ''), - ('00000000-0000-0000-0000-000000000000', '9aa762c1-3b3a-4e5a-ae15-b6f693a2e411', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:17:33.366436+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dc527aff-1bc9-4644-9891-a73a9d0ead01', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:17:48.703932+00', ''), - ('00000000-0000-0000-0000-000000000000', '31438fee-4079-4e6f-ab85-2c2e48eb1543', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:17:56.871714+00', ''), - ('00000000-0000-0000-0000-000000000000', '2cace1a6-8558-4ec9-a636-64cb625b06ed', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:18:01.39349+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aff1411e-6bed-4b4a-835e-800b0805ef44', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:18:15.026801+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c14453e0-03e1-4ae8-a5df-72f263fb3e68', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:18:19.828868+00', ''), - ('00000000-0000-0000-0000-000000000000', '2be29426-45d9-4257-872b-dc1f9f0bbed2', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:18:28.591722+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ee1e05d2-0523-427c-bf68-d761d3711f94', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:18:31.126203+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b3dc6ffd-090d-4723-9a77-e7297212c861', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:18:34.741467+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aa7e859f-ce76-4a1d-873a-d3cd68cb348d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:19:32.173963+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8d6d2d6-32d2-4a54-ba0f-8f9f1809dc08', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:19:40.471352+00', ''), - ('00000000-0000-0000-0000-000000000000', '4086c4df-c3f0-4cf4-a20f-4edec95d5921', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:19:52.426037+00', ''), - ('00000000-0000-0000-0000-000000000000', 'db03a31d-8b9e-4b2c-b6e2-0d284ffd03d0', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:20:41.121101+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a8d177c1-2ff8-4f8a-b7db-127ebecdaffa', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:23:06.967249+00', ''), - ('00000000-0000-0000-0000-000000000000', '947a60ba-2acf-4ce2-a365-8e4da0cd4c55', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:23:37.848867+00', ''), - ('00000000-0000-0000-0000-000000000000', '833c6eb7-e075-4006-9e35-429fcccbf9ed', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:23:40.41165+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e0584e21-3eee-4698-895c-f9af6bff5378', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:24:06.451508+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e21fdb10-2da0-4037-b86d-5739057e2b8c', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:24:10.001807+00', ''), - ('00000000-0000-0000-0000-000000000000', 'caa962ce-da9c-4288-a246-d9b2cac98e89', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:24:28.506495+00', ''), - ('00000000-0000-0000-0000-000000000000', '53ec993c-26c3-4dfa-8b4c-6d1ccea37e38', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:24:38.522316+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c16eafae-38f5-4275-82bf-dff312fd9f34', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:24:51.544796+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e944b5aa-948e-4acd-81f2-f4903c1fa7a3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:24:53.876438+00', ''), - ('00000000-0000-0000-0000-000000000000', '9099c793-6860-4f34-8057-e11eb9288959', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:27:31.020346+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b337d8ff-e54b-4a71-acbf-1cda7225cc5f', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:27:44.92204+00', ''), - ('00000000-0000-0000-0000-000000000000', '76a9649f-e5ce-45c1-960a-fec62738410b', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:28:38.287422+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4a275e4-9f20-4365-894e-56a5981025f5', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:28:41.683194+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7968d81-f032-4266-bd37-252354deb2ce', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:29:11.059408+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f79b64d-0eca-4853-b4c7-978f37b2d538', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:29:13.925334+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b65a8859-5544-491a-a3cf-aa416f31f0b3', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:30:51.813726+00', ''), - ('00000000-0000-0000-0000-000000000000', '960e7d2e-7039-4e94-93fc-08ae26f35ba4', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:30:53.982228+00', ''), - ('00000000-0000-0000-0000-000000000000', '41d08f1b-afce-4235-b59b-910124b008d1', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-23 21:31:03.026406+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f24abccb-f265-4f56-a033-79a5f35786c6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-23 21:31:05.348276+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7710f75-30f8-400e-99d3-7dbf5dfff7e7', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 22:31:12.640981+00', ''), - ('00000000-0000-0000-0000-000000000000', '35ef861a-a0f1-4361-9f98-67b788e1067a', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 22:31:12.642377+00', ''), - ('00000000-0000-0000-0000-000000000000', '5156e778-e3cd-4492-ab24-48f9cd94d49d', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 23:33:08.446006+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d94c305-28a7-44ff-8f29-2cd4e12b74ae', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-23 23:33:08.455926+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fde755a3-ec30-4d16-84d3-d16d357f97e5', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 10:18:34.357024+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af5d49de-db1f-44be-a508-c5ffd62c72aa', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 10:18:34.363922+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c513ee5-e537-4441-b738-f58162391559', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:19:26.010155+00', ''), - ('00000000-0000-0000-0000-000000000000', '5df5005a-17cd-4e9d-af90-97407d9ace84', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:19:28.337993+00', ''), - ('00000000-0000-0000-0000-000000000000', '091727dd-0a88-4b8b-b18f-4ce0e0bba718', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:20:38.790647+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a9dad84-7aa8-4744-a753-c8f6c51838be', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:20:43.730559+00', ''), - ('00000000-0000-0000-0000-000000000000', '38f8f929-b825-494a-944d-64fcd6e07f3b', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:23:48.971061+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf4c76e5-3301-4410-a4b2-d2d6d68b553a', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:23:52.294232+00', ''), - ('00000000-0000-0000-0000-000000000000', '6febc571-acfd-4383-8ebe-554f04575eaa', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:28:52.634591+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a61614ac-6809-4fc6-851f-48accff76d51', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:28:55.50607+00', ''), - ('00000000-0000-0000-0000-000000000000', '3ee5ef68-7744-474b-93ef-ef816c0e6cf7', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:29:07.239167+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a824c4bb-b01e-481b-966c-7370b4de47ab', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:29:11.027114+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bd8582b9-66bb-4105-acc9-8d44e01455ea', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:29:38.879853+00', ''), - ('00000000-0000-0000-0000-000000000000', '35347d24-4b0a-4ab4-a25f-c4267a1174f8', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:29:46.04368+00', ''), - ('00000000-0000-0000-0000-000000000000', '555f5653-d2a0-45ef-8047-37700f4cc5c4', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:31:01.485133+00', ''), - ('00000000-0000-0000-0000-000000000000', '206f2e58-e08b-40b5-9ae4-79fad09a0895', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:31:05.3556+00', ''), - ('00000000-0000-0000-0000-000000000000', '382f4c6e-b796-47c9-be05-04deb84e8c3f', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:44:45.764628+00', ''), - ('00000000-0000-0000-0000-000000000000', '62261a61-254d-42eb-bf9c-738a00c08fde', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:44:51.622214+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a4de7ab1-a022-4718-a786-7dd2cdca979a', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:47:33.765864+00', ''), - ('00000000-0000-0000-0000-000000000000', '708ff9dd-041e-426a-80a6-fe3e23598181', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:47:44.504818+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce17385f-6b67-4cd2-a4a4-d9075512b4f3', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:47:49.683888+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e7b5664-5b80-4961-bc98-99e9454b7c13', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:47:54.34353+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ff01ff7-e16f-442c-a92c-8149392f1764', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:55:22.94101+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cd0632b4-a014-4204-9107-4afdddd5cf16', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:55:25.823146+00', ''), - ('00000000-0000-0000-0000-000000000000', '67fe1a31-bbc8-4b47-a024-a83677455272', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:58:03.828946+00', ''), - ('00000000-0000-0000-0000-000000000000', '6f9b132c-9f4a-4df5-9b7c-a9271054690b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:58:06.688787+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cc1fd905-ea7f-4682-ab8a-8c42e88a8c4a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 10:58:12.576875+00', ''), - ('00000000-0000-0000-0000-000000000000', '2f2d9372-b84c-4807-a03f-80e764056965', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 10:59:05.268468+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fece63b4-3634-46a3-bc9f-96731126367e', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 11:21:26.175364+00', ''), - ('00000000-0000-0000-0000-000000000000', '345dbb24-3ca2-4b4c-b3bf-270d13a90a09', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 11:21:28.911235+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d4486b0-9539-4ad2-94f8-e10cab8c1ef3', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 11:21:33.744259+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a314ff4d-6c43-4a7f-bace-f1e13da5f6f6', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 11:21:35.534248+00', ''), - ('00000000-0000-0000-0000-000000000000', '994a48a9-f53a-400c-8959-dfa368f84410', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 11:21:39.452769+00', ''), - ('00000000-0000-0000-0000-000000000000', '51dd6165-8e91-4b41-adc9-d7196379c9d4', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 11:21:43.007714+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b9f606cc-6db7-4984-bbc7-8c2a65806164', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 11:36:05.077707+00', ''), - ('00000000-0000-0000-0000-000000000000', '579c28a5-7de1-40ed-8e41-5dbf54fb4287', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 11:36:07.271216+00', ''), - ('00000000-0000-0000-0000-000000000000', '52b5f94c-ded2-41b2-8095-d1ba85663499', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 11:36:10.954607+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dc7cde50-e960-4837-99df-4ca81495d16b', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 11:36:13.866219+00', ''), - ('00000000-0000-0000-0000-000000000000', '21c36322-8db6-4211-a6c1-9e67ebd878f6', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 12:16:07.148308+00', ''), - ('00000000-0000-0000-0000-000000000000', '22c05f1e-399e-417d-996c-21b61b580a7e', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 12:17:34.437392+00', ''), - ('00000000-0000-0000-0000-000000000000', '50e991ed-233f-4345-bf05-5623642e97d3', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 12:17:39.465656+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed647f87-8f09-420d-b4a0-c60f037759fb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 12:17:42.831274+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c056ea9a-e411-4eb3-947e-3e4250a51ec9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 12:19:18.701245+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f08f33d-21a0-4ba6-b682-56736160f4ce', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 12:19:25.52714+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed97f97d-ace1-4343-a823-0d2120625e21', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 12:20:26.200158+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce5b76ed-ed1b-48cd-9f94-288cc0f66b93', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 12:20:28.454622+00', ''), - ('00000000-0000-0000-0000-000000000000', '2f29ca5e-ecdd-4371-b6c5-04c142ddd6a3', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 12:20:37.638152+00', ''), - ('00000000-0000-0000-0000-000000000000', '8708803c-25c2-4140-9753-74984a216c71', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 12:21:07.201861+00', ''), - ('00000000-0000-0000-0000-000000000000', '6107f9e3-4cd6-4494-b356-cc89665f5bd2', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 12:21:52.217852+00', ''), - ('00000000-0000-0000-0000-000000000000', '096c6d78-652e-43f4-a463-e54f3ab939e4', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 12:21:55.147135+00', ''), - ('00000000-0000-0000-0000-000000000000', '2378ceeb-6dcf-40fd-959a-45ea576d4cd7', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 15:05:47.330223+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0fe9855-cd83-457f-8d94-2c8a506d3eca', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 15:05:47.340448+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6083eb8-a250-4a83-8005-bd264aa0ade1', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 15:06:21.1011+00', ''), - ('00000000-0000-0000-0000-000000000000', '729e791a-4921-42fa-afa3-59d93e89e1a9', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 15:06:40.163563+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e7a73e64-de01-4552-a15f-9a7d3c3094a9', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 15:06:47.097134+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e3b29dae-a453-4469-aa80-f4c784925096', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 15:06:49.024906+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1f768e1-e2ef-4347-8601-17771d38f076', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 15:46:41.617872+00', ''), - ('00000000-0000-0000-0000-000000000000', '963c224d-8df6-4b13-98f2-7344cb50b45b', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 15:46:45.76313+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b9065b1-cb9d-4cbe-9fa2-82bb673f50cf', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 15:52:17.715427+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f89a88ab-24e0-4aa1-ae34-282c3cbb88ed', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 15:52:21.552364+00', ''), - ('00000000-0000-0000-0000-000000000000', '19603155-ba29-4558-b635-91a202470ad6', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 16:47:07.851758+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eb9aa2f4-9b57-4a6e-bf0e-a68740a5dfa3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 16:47:11.116984+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b0d2110f-19e4-4307-97f9-0e68fa0babf7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 16:47:15.665156+00', ''), - ('00000000-0000-0000-0000-000000000000', '64ff0c6d-cc33-4fbb-8a9d-dfb4ab69e25b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 16:47:19.033666+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d0b5999-df3a-4e71-a093-97d2ccddb00e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 16:57:41.571206+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a113866f-9c79-40e3-bc85-099bbe8d92f3', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 16:57:44.795043+00', ''), - ('00000000-0000-0000-0000-000000000000', '08607f91-a7cc-42bb-abd0-3e40733ea677', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:32:01.010466+00', ''), - ('00000000-0000-0000-0000-000000000000', '4964c619-04bc-40d3-9d5f-6f63129fe32b', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:32:06.149696+00', ''), - ('00000000-0000-0000-0000-000000000000', '68f735e2-5d09-4fc1-bb0c-9b075c1eb011', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:32:08.828211+00', ''), - ('00000000-0000-0000-0000-000000000000', '35b215d6-c86c-4161-8800-ae10d8bc5504', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:32:11.07221+00', ''), - ('00000000-0000-0000-0000-000000000000', '7d86573e-d098-42ea-86d9-8a9ada896b6c', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:32:32.78448+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e185b505-96bc-4f33-aebb-53613cb101bd', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:32:36.404716+00', ''), - ('00000000-0000-0000-0000-000000000000', '87414f11-0b54-441e-b33f-7fce45141cf7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:37:50.597478+00', ''), - ('00000000-0000-0000-0000-000000000000', '94ee07cc-e7b6-4925-aed9-d05200aa3383', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:37:54.126359+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e2d940f3-d1d5-4313-93d3-52bd1a46bc74', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:42:03.87616+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eece737d-ad35-486b-9c4a-d993f52c005a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:42:06.694685+00', ''), - ('00000000-0000-0000-0000-000000000000', '898bb6b6-ae97-4b9b-b20c-b52753537c0a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:43:01.969518+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a9b03c7-0f0f-4397-b0b6-d2022a5b8bef', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:43:06.162017+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b7aeefec-c2d4-47e5-82e4-393d76f0dbe3', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:46:23.197678+00', ''), - ('00000000-0000-0000-0000-000000000000', '0675ad9f-2210-4813-a232-75b9fe283b5c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:46:26.477845+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c39af01c-a107-4b2f-9c75-21733e8ac3f4', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:49:29.9578+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8ce1665-8a23-4b53-9e19-ea6902848adb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:49:33.48408+00', ''), - ('00000000-0000-0000-0000-000000000000', 'addf4108-a7a1-4358-977d-012a559bc877', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 17:49:51.640926+00', ''), - ('00000000-0000-0000-0000-000000000000', '2043c616-a0e5-4cb9-82cd-ab6b503e53f7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 17:49:56.227336+00', ''), - ('00000000-0000-0000-0000-000000000000', '6fa0a2e4-c349-4df3-825c-9541600dc505', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 19:43:15.358235+00', ''), - ('00000000-0000-0000-0000-000000000000', '67d76389-57a9-4a34-bedd-c00dc0984717', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 19:43:15.359314+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f2c3042-cedd-4d8c-ac8c-42d1a9bc2265', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 19:44:01.94158+00', ''), - ('00000000-0000-0000-0000-000000000000', '0059b3f6-00b2-4360-9d16-158a9351bed7', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 19:44:04.162371+00', ''), - ('00000000-0000-0000-0000-000000000000', '061f9440-da7a-4ce1-b3c6-971bf58ada46', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 21:36:06.210964+00', ''), - ('00000000-0000-0000-0000-000000000000', '17ec0e0d-752e-41b9-b816-65f729ae8cb0', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-24 21:36:06.212236+00', ''), - ('00000000-0000-0000-0000-000000000000', '415aef66-08e7-4a70-8924-f8a2f461c855', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:40:59.664227+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd277ca6d-dc7f-4892-af40-309326b5df2b', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:41:05.441078+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd565fdc4-50cd-4656-878d-a6bf706d813d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:41:07.419494+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c9f5262-d2b7-4447-ab91-d19564a0a894', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:41:11.083543+00', ''), - ('00000000-0000-0000-0000-000000000000', 'adc2192f-850c-405c-9de0-2c0ec19522c6', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:41:43.676387+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e017dc3-7870-49bd-9ca3-7fd798bb6744', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:41:46.279633+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a92e926-cbf9-4212-a5d1-f67baa064fe1', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:44:17.224136+00', ''), - ('00000000-0000-0000-0000-000000000000', '3a712d61-d3d7-40d5-ac58-4dae9b868572', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:44:24.063681+00', ''), - ('00000000-0000-0000-0000-000000000000', '57bd6265-fc69-4834-bf31-2a9af2a4f1d9', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:48:02.685961+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e0cddfe-2b5e-4a59-8aa5-50a4cf0cdab0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:48:05.139099+00', ''), - ('00000000-0000-0000-0000-000000000000', '9d44fb9b-c39d-49f6-b427-11871e12566e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:48:12.26553+00', ''), - ('00000000-0000-0000-0000-000000000000', '60766489-b3ef-4f41-8c3e-65ec3a40a9c8', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:48:18.090555+00', ''), - ('00000000-0000-0000-0000-000000000000', '5336885c-4005-4751-817a-7619222f2192', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:48:29.267355+00', ''), - ('00000000-0000-0000-0000-000000000000', '773fa7ab-3cea-4b1e-8fda-93b39fefde6a', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:48:35.104524+00', ''), - ('00000000-0000-0000-0000-000000000000', '3d36276a-0215-4eea-a116-19f86da7167a', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:48:44.449236+00', ''), - ('00000000-0000-0000-0000-000000000000', '43ed831b-09c9-453b-a685-63212d13f7e3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:48:47.74627+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8474c2a-5392-4c77-94df-0154c7809a80', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:51:00.25652+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c0f40ca-4cd5-490c-aa21-e8c21a1b413c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:51:03.602454+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c839e7e6-41d8-47f6-9741-518d4675393d', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 21:51:08.07366+00', ''), - ('00000000-0000-0000-0000-000000000000', '584d2026-da39-4d93-b4cc-3f4a90a73c71', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:51:13.579213+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f06837fa-1cec-4c3c-9f0b-49276e2fdf9e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 21:57:23.953723+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bdd5f680-c67c-4587-a46c-73ebdfbbc080', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:03:17.292839+00', ''), - ('00000000-0000-0000-0000-000000000000', '35a90ff6-7d3a-4a64-8b64-32a741669a8a', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:03:19.87087+00', ''), - ('00000000-0000-0000-0000-000000000000', 'edc66a77-a57c-482c-a9aa-9f1e0bb29654', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:03:23.034427+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d376167-24b1-47c7-9cc1-78d50c37346a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:04:23.08087+00', ''), - ('00000000-0000-0000-0000-000000000000', '0d03a23f-6f03-4b03-a875-423ad30459f0', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:14:05.489248+00', ''), - ('00000000-0000-0000-0000-000000000000', '5a56d657-5fcc-45a3-98be-011535918e4b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:14:07.770505+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e2a9a4d-27d2-4027-b3ae-6bfd99e9c570', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:17:23.342625+00', ''), - ('00000000-0000-0000-0000-000000000000', '6ad90d54-3ea1-426a-8c8a-ed12e0061771', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:17:25.89202+00', ''), - ('00000000-0000-0000-0000-000000000000', '0cc8aaa0-6117-451b-980a-04b56530d323', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:33:59.80969+00', ''), - ('00000000-0000-0000-0000-000000000000', '14c27bfc-38c8-4d82-9276-d42b1a57da74', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:34:06.961454+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b2edfda-7de9-4e2c-aae7-cb5c355cfd2f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:34:15.470962+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c2689031-db05-4736-833d-eca67ec2db26', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:34:17.423106+00', ''), - ('00000000-0000-0000-0000-000000000000', '6501e373-f216-4553-b155-c276a9003696', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:37:09.920826+00', ''), - ('00000000-0000-0000-0000-000000000000', '42d758b6-200b-4be5-b756-bafa7370c2a6', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:37:13.832033+00', ''), - ('00000000-0000-0000-0000-000000000000', '0702f85d-0312-41d9-9ed1-0ec9d07eb5d5', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:37:37.483108+00', ''), - ('00000000-0000-0000-0000-000000000000', '8a62ccdf-2b94-4f74-9711-5cf50599a2d9', '{"action":"user_updated_password","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-24 22:37:37.802344+00', ''), - ('00000000-0000-0000-0000-000000000000', '1dd483ed-2187-452e-94a3-c616854cf6b6', '{"action":"user_modified","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-24 22:37:37.803265+00', ''), - ('00000000-0000-0000-0000-000000000000', '44992288-7e90-4448-9438-c007b4ded5c5', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:37:38.009916+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e4c2bf9b-b733-4769-8937-908baab8326a', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:37:47.142974+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3808580-e421-4a7d-96a8-54f09891a459', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:38:10.366208+00', ''), - ('00000000-0000-0000-0000-000000000000', '9bfe4f41-085d-416b-8b33-3c6cae315c78', '{"action":"user_updated_password","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-24 22:38:10.876944+00', ''), - ('00000000-0000-0000-0000-000000000000', '58bd5219-9f03-4e8d-a0b6-ecceb36611bc', '{"action":"user_modified","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-24 22:38:10.878533+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f393d4e8-efb7-4f66-8121-9419b9274b04', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:38:11.130515+00', ''), - ('00000000-0000-0000-0000-000000000000', '078105a3-a6d6-4787-8401-09911b739d28', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:38:13.439701+00', ''), - ('00000000-0000-0000-0000-000000000000', '745b8f9c-38a5-4526-8bef-941eb9c02e01', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 22:47:04.573216+00', ''), - ('00000000-0000-0000-0000-000000000000', '2d0cef6c-a5a1-4b16-8911-8cccb88a8d69', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 22:47:08.555376+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd5a4bdc4-f384-4acc-9de9-ff7e8a5f8bd9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:18:06.321833+00', ''), - ('00000000-0000-0000-0000-000000000000', '193b5dff-2dd1-48a0-b756-42e3114b4536', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:18:09.175448+00', ''), - ('00000000-0000-0000-0000-000000000000', '6e1271ee-e79a-4222-93f5-f05802d54e6b', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:26:52.028948+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a293ede1-a687-4420-9a92-bd9b046c3036', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:28:34.03684+00', ''), - ('00000000-0000-0000-0000-000000000000', '62566cc7-c127-4ba5-97a4-2a1bd8fb71c3', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:33:07.238632+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c7e00c9-519e-4c34-a1fc-0c7f74949871', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:33:10.305622+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0da29ef-58b8-432f-b794-7af110ae3038', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:33:16.56457+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce8f4fcf-be98-42bb-b6df-9a99c9634ade', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:33:21.913664+00', ''), - ('00000000-0000-0000-0000-000000000000', '67858b0b-f7b9-4796-8b82-749a3a7a2472', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:34:38.874407+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e7fb77c1-6ceb-4999-b36c-c97b4b051660', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:34:41.893759+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a4259386-b912-4ce5-ad2c-ae6e4ed6e1df', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:35:46.963229+00', ''), - ('00000000-0000-0000-0000-000000000000', '7958185d-9fcb-4081-a3f7-c5d65f25f14f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:35:49.329717+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f8c2cae-7ff7-4058-9667-1d4f5b1206b4', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:36:09.131684+00', ''), - ('00000000-0000-0000-0000-000000000000', '4bfc1f1d-9d1c-491a-a49b-a984f1fa0e21', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:36:11.166103+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bdb4c7f2-e906-4cfe-b6c3-5aa951c0d543', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:36:25.598805+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c9d9c51c-328a-4331-8d12-d17d53337ec5', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:36:31.321958+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e4767a08-717a-47bc-86be-e5529e9be28d', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-24 23:37:37.3169+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd34060c9-b5a9-442c-b930-de86ab7b9fb1', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-24 23:37:40.097987+00', ''), - ('00000000-0000-0000-0000-000000000000', '27946c23-3459-4e0e-975a-3c55d9c257ec', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 00:18:35.370382+00', ''), - ('00000000-0000-0000-0000-000000000000', '57b938ef-5490-423f-9581-63d3f2a5f34b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 00:18:46.211417+00', ''), - ('00000000-0000-0000-0000-000000000000', '0ab01a94-2feb-478a-8e46-e55cb3b05d6b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 00:19:22.512295+00', ''), - ('00000000-0000-0000-0000-000000000000', 'baf38444-93c1-4a33-9c05-e947e11da727', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 00:19:34.523483+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae6e5705-6d62-411b-abec-8f8a2d9382f6', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 00:22:59.780723+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eae886ff-0c9a-492a-a1d9-6ac9023e2ebc', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 00:23:09.268561+00', ''), - ('00000000-0000-0000-0000-000000000000', '0cbd4d51-cb89-492d-b47e-677ede7d52cc', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 00:23:11.158251+00', ''), - ('00000000-0000-0000-0000-000000000000', '23c30e00-3d33-455c-80cb-755e0bdcd2b1', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 00:23:19.522589+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b1d7b37c-b930-4214-8f48-66203b896c76', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 00:23:22.193294+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cf61f70a-8acb-449c-b0fd-7b5d7ba55a0e', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 00:23:24.186198+00', ''), - ('00000000-0000-0000-0000-000000000000', '70711006-9768-47e3-9079-078ed4c9240f', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-25 02:16:30.632456+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fb9dc3f1-fe48-466c-9af2-2740dbbd52af', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-25 02:16:30.635762+00', ''), - ('00000000-0000-0000-0000-000000000000', '251cc37d-2d34-41d7-babc-d1f7e6b741e8', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-25 10:19:52.975907+00', ''), - ('00000000-0000-0000-0000-000000000000', '97a93260-b8f9-4dae-89be-24dce3e6ed6a', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-25 10:19:52.990681+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6bfc309-a0bc-4cc9-ae31-c62ac5af07ed', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 10:25:43.430786+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b410dad-cc19-42a7-b510-6f07b5b0c7d4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 10:25:45.798606+00', ''), - ('00000000-0000-0000-0000-000000000000', '918581c1-4718-4bf2-9da2-54244703a0fa', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 10:49:22.681202+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c2f2a4c-1ab8-4f15-8d95-64bdd901ad8f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 10:49:26.715945+00', ''), - ('00000000-0000-0000-0000-000000000000', '62b52c97-f15a-4fd5-adb6-1217a2ba5540', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 11:06:43.889717+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd1218720-f755-46c4-bd08-b2710567cd9b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 11:06:47.119725+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a006679-01d3-42de-8758-6b104f5ed4cc', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 11:12:36.478219+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c4dd3282-d2b6-4637-a8a3-a8adfb03862f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 11:12:39.354564+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d7c5527-9962-4185-9acc-80ef0790d443', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 11:43:49.292781+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b3f5a3f3-5dc5-4968-9af5-368cd7375084', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 11:43:53.825409+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f669b7a-325b-4c53-bc73-bec990247917', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 12:15:26.387023+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd67d256f-4e1f-400e-bd69-ab744b1d5fcb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 12:15:28.835462+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c2bde83b-d462-476f-a374-7032c2ed0a6a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 12:15:43.486238+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1a6022e-fe18-41cd-a992-3f82a76dc3e5', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 12:15:47.01481+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f4720f7-886f-46c6-a848-ab9bcbb8dace', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 12:16:17.710936+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a56fbb6d-f5e6-44ec-8ad4-b79c4abe9d16', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 12:16:20.400866+00', ''), - ('00000000-0000-0000-0000-000000000000', '472fcf66-bdeb-4d4d-b0ed-8d4de9eb5526', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 12:22:53.721634+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c1870ef-8dcb-47df-b923-69717a7e87bc', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 12:22:55.942394+00', ''), - ('00000000-0000-0000-0000-000000000000', '51d03beb-f61a-420f-8696-b19e7109ffa6', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 12:25:14.870961+00', ''), - ('00000000-0000-0000-0000-000000000000', '99c1c1be-542d-450b-8ef1-a93c30f703f5', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 12:33:27.928308+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd755d2a3-6291-4d81-a874-ac4289cb3fd6', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 12:33:39.250213+00', ''), - ('00000000-0000-0000-0000-000000000000', '4b65a6bc-0fe3-4f3d-9003-4962734324ce', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 12:33:40.990433+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd9e2f9c4-e4b2-4a10-9af0-e647d1fa5b8e', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-25 17:13:18.0755+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fed942c5-27ba-49b6-bb6a-a9275839f6df', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-25 17:13:18.077647+00', ''), - ('00000000-0000-0000-0000-000000000000', '1daedb5b-1353-4813-aa7d-e144e6dac1f2', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 17:35:11.734342+00', ''), - ('00000000-0000-0000-0000-000000000000', '142e20db-1c9b-4f9a-b1b5-163b9c0a55ef', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 17:35:14.502471+00', ''), - ('00000000-0000-0000-0000-000000000000', '9ef09fa8-245c-448c-99f7-a707d0faa018', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 17:45:12.492648+00', ''), - ('00000000-0000-0000-0000-000000000000', '1021f52e-62d9-446b-97cd-ab00864038a3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 17:45:14.943065+00', ''), - ('00000000-0000-0000-0000-000000000000', '9e607181-5e95-4630-8126-7d2daf2e6db9', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 17:46:05.987634+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f5638853-2d4b-4207-90d2-98633cbc8b1d', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 17:46:09.393231+00', ''), - ('00000000-0000-0000-0000-000000000000', '12e8f25f-983b-4530-838a-b0ff6823d74b', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 17:46:19.974824+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b49d33e-8b8a-4eb1-85b3-11fe203d0247', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 17:46:23.618715+00', ''), - ('00000000-0000-0000-0000-000000000000', '8bfde3af-e0e6-42b3-8909-2e35e8090d1b', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 17:52:37.930203+00', ''), - ('00000000-0000-0000-0000-000000000000', '01bbd30b-bee4-45f4-80db-4a2d7852cc5d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 17:52:40.438054+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b828eb7-264c-4848-a6c1-18b735cc6441', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 18:02:24.369887+00', ''), - ('00000000-0000-0000-0000-000000000000', '0e2b58af-6dd0-4b26-a7bb-a776e65e9e3e', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 18:02:31.147886+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c478b8d2-db02-4172-ab4e-0c385019504a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 18:36:10.899149+00', ''), - ('00000000-0000-0000-0000-000000000000', 'be4bedbc-4bfa-45fe-a2e0-47f835e920e2', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 18:36:14.174946+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1eae7bf-eddb-446a-8472-db34d1027872', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 18:42:36.249444+00', ''), - ('00000000-0000-0000-0000-000000000000', '96e15e00-806f-4e7f-b951-64de35b73b63', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 18:42:38.870024+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fe117259-7701-4894-b8b9-ddcfbc196de4', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 18:59:22.688865+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cd248636-bfc4-42dc-ba10-9ab16dfa70c5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 18:59:32.090302+00', ''), - ('00000000-0000-0000-0000-000000000000', '264e2f8a-19f1-49fa-b566-80cd029e1e2f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 19:02:34.344072+00', ''), - ('00000000-0000-0000-0000-000000000000', '5fc08aff-3271-4fd0-9053-959ebb5ea6dd', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 19:02:36.615742+00', ''), - ('00000000-0000-0000-0000-000000000000', '9340792e-6bc1-4065-a2e3-56b93992254c', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 19:09:16.115202+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ba18cb74-020b-40c4-b52d-b5320eb15e0e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 19:09:18.757869+00', ''), - ('00000000-0000-0000-0000-000000000000', '8fdccd4b-74c6-4084-89f5-3cccf1cf1040', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 19:11:21.419469+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd9570eeb-431c-4e34-bdd1-01e5d8b718f0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 19:11:24.537831+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf47e26d-8fd7-46de-9007-1b768368bdf7', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 19:11:42.068398+00', ''), - ('00000000-0000-0000-0000-000000000000', 'efcd673c-fd70-4e23-86c4-ca1a80197cd9', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 19:13:02.212335+00', ''), - ('00000000-0000-0000-0000-000000000000', '1253b01e-3e62-410c-a51c-79faf7e750c4', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-25 19:40:43.360921+00', ''), - ('00000000-0000-0000-0000-000000000000', '89d22479-2372-4017-978a-04600038db4c', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-25 19:40:45.192314+00', ''), - ('00000000-0000-0000-0000-000000000000', '13e892e3-a964-4768-a2ad-a5ec67d01b16', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 01:45:33.758738+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e82ae6c-5464-4510-ae97-d5a7fbadfcea', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 01:45:33.764106+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b0f17126-000a-4a43-a210-dbd1de916734', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 02:58:31.515415+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c788fd07-4939-4ece-8109-fe4cbf1e58e2', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 02:58:31.518595+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd23b5335-5dda-4d46-9f10-fe0d10ab639e', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:55:09.952162+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e4096a7-136a-46a0-bb71-66361738cef7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:55:12.320689+00', ''), - ('00000000-0000-0000-0000-000000000000', '647aee52-30c1-438f-8f5d-df6e76f308f6', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:55:21.297123+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f238b87d-ed6b-433e-abe1-fad38b262c50', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:55:26.850149+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2129c82-763e-4a8d-aa79-c21fc5c64657', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:55:38.592166+00', ''), - ('00000000-0000-0000-0000-000000000000', '760a4349-6c56-4d55-b92d-bfceca44fa32', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:55:40.839089+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a426ac4e-b176-4a7a-95f7-f001942206f9', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:55:42.585951+00', ''), - ('00000000-0000-0000-0000-000000000000', '44322eb2-8523-4a00-9e99-bf06601fbe6b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:55:46.290033+00', ''), - ('00000000-0000-0000-0000-000000000000', '5fca2bd4-6c4d-4f2e-9576-6d39b5554315', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:56:52.745694+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ffde8bbe-9a06-49bf-8baf-4d45e67a9307', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:56:57.30382+00', ''), - ('00000000-0000-0000-0000-000000000000', '98840818-685f-4380-bfe2-a23cd1b3273e', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:57:06.322325+00', ''), - ('00000000-0000-0000-0000-000000000000', '8b9001dc-ce51-4309-84b3-5e0761022e41', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:57:34.305747+00', ''), - ('00000000-0000-0000-0000-000000000000', '580576f1-73ca-4bae-9a16-6c86ae069214', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 03:57:51.521511+00', ''), - ('00000000-0000-0000-0000-000000000000', '065de7fd-9bd8-4af9-b1f4-39391db46d8f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 03:57:56.185502+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e40cda43-5a65-48fb-906e-c9c19e7f22c3', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 04:05:36.20369+00', ''), - ('00000000-0000-0000-0000-000000000000', '3546ba00-6bda-42de-a9cc-7a8b4a855093', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 04:05:39.546742+00', ''), - ('00000000-0000-0000-0000-000000000000', '81e9228e-f405-40c5-90f2-4d4f08fb79fa', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 04:06:49.681913+00', ''), - ('00000000-0000-0000-0000-000000000000', '16f7346b-1467-4968-8d96-e095db1697df', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 04:06:53.395866+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bdaad654-f0ee-4835-afd3-b9bea8bd0659', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 05:07:39.540618+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c7931139-c41e-4c15-9d58-2b52f4add074', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 05:07:39.542549+00', ''), - ('00000000-0000-0000-0000-000000000000', '778fc51d-e6e3-458c-9823-0dd386588c2f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 05:39:38.469006+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f55317f0-94c3-483e-aaf0-74f5c50260c0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 05:39:58.384333+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f7a612a9-037c-4fe1-ba62-f34afc2491a8', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 11:05:32.750923+00', ''), - ('00000000-0000-0000-0000-000000000000', '151b8f68-4cbd-42dd-98f7-1c5246e122bb', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 11:05:32.756076+00', ''), - ('00000000-0000-0000-0000-000000000000', '0f770853-dfd3-4570-b2f6-5c7eb4821bbc', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 11:48:08.350542+00', ''), - ('00000000-0000-0000-0000-000000000000', '19672c2f-2eac-47d9-9be4-ab5415e3209b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 11:55:36.333918+00', ''), - ('00000000-0000-0000-0000-000000000000', '80ed73aa-3f46-467b-b5c9-f0f7de29fcd7', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 12:02:26.610163+00', ''), - ('00000000-0000-0000-0000-000000000000', '6d088f30-71d7-43d4-8887-0db1765e6bc8', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 12:02:30.721233+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f5364559-82b1-4180-81e3-1fd28b9b2e07', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 12:52:02.983291+00', ''), - ('00000000-0000-0000-0000-000000000000', '020b5ec3-9d31-421d-a40f-ebe879d6bc1d', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 12:52:21.985907+00', ''), - ('00000000-0000-0000-0000-000000000000', '21989c84-2bd9-45b2-83ef-b322db1e7df5', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 12:53:00.295257+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b836a4e3-fcd4-43e6-9b65-53fb715684a3', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 12:53:02.936717+00', ''), - ('00000000-0000-0000-0000-000000000000', '9901018f-954e-4486-8701-c48a30f33149', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 12:53:40.84589+00', ''), - ('00000000-0000-0000-0000-000000000000', '7a9dcbd6-27c2-48d2-9a30-02619ae45b18', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 12:53:43.66534+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f8f4a0cd-90b4-4804-b9d0-92165eacc61b', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 13:10:49.061582+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b762d34f-b09d-45dd-8d45-f8c04cd683e4', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 13:10:52.180459+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f7359755-2a95-4a14-a07a-ef1e8347ad64', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 13:10:54.782058+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fee08545-98ff-4de2-9025-000823980893', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 13:13:15.689117+00', ''), - ('00000000-0000-0000-0000-000000000000', '15d1aa8f-143a-4a00-b260-f975a5d2ce39', '{"action":"token_refreshed","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 17:33:13.023088+00', ''), - ('00000000-0000-0000-0000-000000000000', '08f54dc3-53eb-473e-9bdd-46763440f127', '{"action":"token_revoked","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 17:33:13.024252+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c799561-81cd-4b75-80fc-0ed1937e95f6', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 17:37:44.114006+00', ''), - ('00000000-0000-0000-0000-000000000000', '68cb6247-8d82-4962-a169-2c3b79a9e3e6', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 17:37:49.170552+00', ''), - ('00000000-0000-0000-0000-000000000000', '16c983ad-0e31-4b7c-a32f-9e6b4346d084', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 17:38:07.252225+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2030150-6748-45a6-86ba-b2fd5cf1d9fa', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 17:38:10.371415+00', ''), - ('00000000-0000-0000-0000-000000000000', '3e776fd1-1e77-4b43-95e5-4adc1ca2b8e8', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 18:08:42.31235+00', ''), - ('00000000-0000-0000-0000-000000000000', '25d9ab4b-98d0-4d19-858a-a595c1757940', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 18:08:44.999518+00', ''), - ('00000000-0000-0000-0000-000000000000', '6788a81c-aa39-4eed-bde0-a1fd8a862b65', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 18:29:18.501329+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b1bbe9e-4092-48ad-992a-2c19cfc7640e', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 18:29:20.909988+00', ''), - ('00000000-0000-0000-0000-000000000000', '8cee2507-1571-411b-9928-01e335fd700f', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 19:29:42.298399+00', ''), - ('00000000-0000-0000-0000-000000000000', '32d98d0f-5b39-4b76-aa42-e253cbf2850f', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 19:29:42.30006+00', ''), - ('00000000-0000-0000-0000-000000000000', '59eb429d-ff30-4ee6-ab57-de72444a4e5f', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 20:29:34.700292+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c1c6f5c-4afe-4315-a00c-5d6561369c77', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 20:29:34.701651+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd7dee6e0-f659-4fd3-b937-7aa6de46f221', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-26 20:31:11.233069+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ead1d74e-c6d5-4b0f-86f6-9040b29592c6', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-26 20:31:14.024847+00', ''), - ('00000000-0000-0000-0000-000000000000', 'edfd080f-f530-48df-9612-f5cc6e958745', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 21:30:01.254828+00', ''), - ('00000000-0000-0000-0000-000000000000', '33b7529c-0643-459e-9de4-04c7786bc69d', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 21:30:01.256618+00', ''), - ('00000000-0000-0000-0000-000000000000', '234045ea-8d53-43d4-ada1-f799d16a007b', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 22:44:07.407116+00', ''), - ('00000000-0000-0000-0000-000000000000', '7ce150ec-53d7-4fca-a97f-7083e45c5d45', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 22:44:07.408279+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ef888ab-8aaa-47c5-bb45-ee811f3e8dd6', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 23:43:22.675033+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af1526fc-238d-46fe-8088-7c17bac4292f', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-26 23:43:22.677235+00', ''), - ('00000000-0000-0000-0000-000000000000', '0517c15c-9821-46df-979c-90ac12559a01', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 00:14:46.716776+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f30f7d0f-ed03-4793-8926-efdf1354f68d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 00:14:50.976483+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ea9fb7df-b5f7-4975-afe9-178e9e2b8d14', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 01:16:45.323007+00', ''), - ('00000000-0000-0000-0000-000000000000', '45337faa-6c20-4606-a677-609644357be5', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 01:16:45.325952+00', ''), - ('00000000-0000-0000-0000-000000000000', '4251272f-cc23-404a-b982-873371d7bb56', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:23:08.882009+00', ''), - ('00000000-0000-0000-0000-000000000000', '3fc96d9b-2d17-4c49-aadd-c3abe6af0856', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:23:11.582459+00', ''), - ('00000000-0000-0000-0000-000000000000', '8aeb64ba-ef90-457f-a6e1-3d16049444dd', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:27:16.329182+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e48b313a-ecb7-4584-9f5e-d5ebaf35c19f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:27:23.185106+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a560779-06c5-4543-9fef-2b300d245da9', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:27:36.122238+00', ''), - ('00000000-0000-0000-0000-000000000000', '50405c6d-f4eb-4c32-b776-903c261e8de4', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:27:38.961633+00', ''), - ('00000000-0000-0000-0000-000000000000', '07f0e7df-05df-489c-8302-7ea6469e54de', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:40:47.994063+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bffe9e41-e868-49b6-918d-8a28cb6250bd', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:40:51.555066+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fbe0f48f-5aeb-4e3d-b847-88c2cef36582', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:41:20.817344+00', ''), - ('00000000-0000-0000-0000-000000000000', '173e91a3-6c86-487a-9f57-23d8ca609ff0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:41:24.590091+00', ''), - ('00000000-0000-0000-0000-000000000000', '37084a24-47b0-42db-9c89-a1401b2e9a51', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:50:34.320129+00', ''), - ('00000000-0000-0000-0000-000000000000', '2811721d-4c37-490f-b809-9271aca3d40e', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:50:37.125082+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a04a3d0b-09f1-46c5-8765-c521602dc7ca', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:53:55.66387+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1754f40-11bd-4f1f-93cc-6684da71e12b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:53:57.782754+00', ''), - ('00000000-0000-0000-0000-000000000000', '11efa555-a62e-41ae-b113-ce1355229d82', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 01:55:04.910456+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a38bfe9-af8c-44cd-b481-b0bd7b3e1513', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 01:55:08.105379+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd4338176-86fc-42bb-8a3e-4b67b1e04f4c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 02:37:06.473795+00', ''), - ('00000000-0000-0000-0000-000000000000', '16f7fedd-9cef-4019-871c-65261a4739dc', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 02:37:08.76448+00', ''), - ('00000000-0000-0000-0000-000000000000', '40bdcffa-f7c6-486d-bcbd-b7c3cbb93f91', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 03:35:18.756343+00', ''), - ('00000000-0000-0000-0000-000000000000', '798a9b2a-17e3-4d01-bc9b-275664e5eaae', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 03:35:21.597316+00', ''), - ('00000000-0000-0000-0000-000000000000', '4604c4e3-3218-44b2-85ea-9ef0e5ffd426', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 03:36:05.09366+00', ''), - ('00000000-0000-0000-0000-000000000000', '650d42af-d846-44de-85ac-bf09a33fce8d', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 03:36:09.246932+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c663f8cc-ef01-4dc6-89f3-6228e8ec3355', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 03:52:37.986243+00', ''), - ('00000000-0000-0000-0000-000000000000', '088a8f5a-5eb1-41d7-9524-a992bbb680e7', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 03:52:40.309026+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de03b54a-baad-44de-af66-47eccd494790', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 03:53:25.319531+00', ''), - ('00000000-0000-0000-0000-000000000000', '4b9090e3-5ae2-4156-aa02-fcd861b31399', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 03:53:28.148288+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bcc1a465-02cd-4d98-80e8-25965c73ef74', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 03:55:33.805483+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ca2738cf-0dad-4ef7-84fa-0c91ef7a6478', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 03:55:36.455876+00', ''), - ('00000000-0000-0000-0000-000000000000', '84375f91-48a5-4316-ae6a-3c23e82d59c5', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 04:10:51.249327+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6ceec31-8ece-4e1b-a80b-bd5f6f8b9a4a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 04:10:54.125292+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e53b741b-804a-49d3-9310-ac2e131b1499', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 10:24:51.403644+00', ''), - ('00000000-0000-0000-0000-000000000000', '66cebb47-170f-4703-ba80-49c02b26f228', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 10:24:51.419923+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e931a5e6-4f6d-426f-aa71-bb55c29e13bc', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 10:37:42.683758+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e56580b7-253b-4159-b55a-cc05926df9b8', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 10:37:45.871861+00', ''), - ('00000000-0000-0000-0000-000000000000', '97deff01-b1eb-4fbf-b1fe-aa2ad5ff81c8', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 11:30:22.270466+00', ''), - ('00000000-0000-0000-0000-000000000000', '09eec610-829f-4629-b498-b5d02b739f31', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 11:30:24.425659+00', ''), - ('00000000-0000-0000-0000-000000000000', '107d14c8-9b6c-42cb-8437-9bda6af128ca', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 11:30:43.626433+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae3598bf-9543-4ae9-9225-687e93183fe4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 11:34:06.361727+00', ''), - ('00000000-0000-0000-0000-000000000000', 'db3bbfc5-6c4c-4e92-b503-6338c0150502', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 11:34:44.55209+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d24a323-3026-4be0-a2ad-269e63275aff', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 11:34:46.73463+00', ''), - ('00000000-0000-0000-0000-000000000000', '88c19176-79be-461d-979d-6f8c0bce295f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 12:09:24.44704+00', ''), - ('00000000-0000-0000-0000-000000000000', '562b0e7f-585f-44aa-b3c9-54b65fb90f38', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 12:09:26.868239+00', ''), - ('00000000-0000-0000-0000-000000000000', '82274b30-4b97-499e-b276-b172483eb0cf', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 12:10:24.993551+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de5427ce-51c5-469a-a05c-fe0e5e1d3365', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 12:10:29.656275+00', ''), - ('00000000-0000-0000-0000-000000000000', '2603d134-58c9-4db0-ac6f-dda8833ffd72', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 12:11:19.272219+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b1e94e36-281c-4c36-95e9-39f829dcce43', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Admin Agência Psi","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 12:11:21.588372+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e5f889a-96e3-4649-8b2b-61fe71ce3093', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-27 13:06:27.984283+00', ''), - ('00000000-0000-0000-0000-000000000000', '22c2b1b2-9777-4ce4-9afc-16335086a0fe', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 13:12:49.683253+00', ''), - ('00000000-0000-0000-0000-000000000000', '3dc0cefd-6286-41a2-ad42-fc4cf6009aa0', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 13:12:49.68464+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ad1fe3ff-b16e-467f-b6ad-dc24d6a25777', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 13:31:10.990792+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd4d89a09-501d-4e03-9892-9bc5ea1c3cbe', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 13:31:13.632089+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c7f2ab2f-6b87-493d-a643-a84b88b20897', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 13:31:19.086724+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ee80aac-57c5-4e89-880e-28443cfa57c7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 13:31:22.01337+00', ''), - ('00000000-0000-0000-0000-000000000000', '157be463-fbd5-4314-b7a7-ee131da7ccee', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 14:30:30.266452+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a15f388a-815e-40ee-9c0b-36228f290a13', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 14:30:30.268817+00', ''), - ('00000000-0000-0000-0000-000000000000', '78bae21c-dc39-4622-b3bb-4a047b24400f', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 14:30:44.264446+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce746bf5-4406-444d-9927-2e6f3ef9f11c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 14:30:46.621621+00', ''), - ('00000000-0000-0000-0000-000000000000', '0aaed62a-7f8b-4b08-bf9a-0e82b638cba4', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 15:11:17.493625+00', ''), - ('00000000-0000-0000-0000-000000000000', '632b3467-9401-43c1-a521-e1c9503640a9', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 15:11:20.36133+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f60e58e4-8193-49b0-9828-cbd3f8b47644', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 16:14:16.028974+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e0342664-0784-498b-a4e3-6199c8a80395', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 16:14:16.030109+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd4f9460d-a6c2-437f-9afe-0f3d147cb33d', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:14:38.622568+00', ''), - ('00000000-0000-0000-0000-000000000000', '7d7c0c65-ae8f-4fe0-ba62-107dff960eac', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:14:41.184538+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c8ea4fc-e539-4179-ad4c-73ba037031d0', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:18:14.965011+00', ''), - ('00000000-0000-0000-0000-000000000000', '5a03e499-2cd8-43f1-9758-9b620a0992ca', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:18:16.587934+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c2bfa90-b3d6-40c5-8bbc-d4600b73e14c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:23:12.552414+00', ''), - ('00000000-0000-0000-0000-000000000000', '5f71f8a5-defb-47e0-a27b-30c44efc587a', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:23:15.201905+00', ''), - ('00000000-0000-0000-0000-000000000000', '682a1adc-8cec-4fca-af89-0982001a5079', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:24:22.323303+00', ''), - ('00000000-0000-0000-0000-000000000000', '36f12c54-240e-4635-be02-a29c4e4134bb', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:24:24.750298+00', ''), - ('00000000-0000-0000-0000-000000000000', '4cab7a13-9417-4fd7-a0b4-f8106150c53a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:25:01.147838+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bfdd517d-2738-4bb7-9e46-4ea4f1a13e52', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:25:03.458329+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e1151bfc-0779-4a8b-9e1c-d86a9576027f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:25:13.734413+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b3be4935-ba1e-423e-a03b-3db27cdd6e1b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:25:15.423098+00', ''), - ('00000000-0000-0000-0000-000000000000', '301dc243-e81c-47d8-a80f-5c12d84b62d8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:29:33.505789+00', ''), - ('00000000-0000-0000-0000-000000000000', '03d7d1dc-9fe1-4d27-8032-fc72a4125658', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:29:36.051807+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6082dfd-3142-42f5-a177-bf27fda388d6', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-27 16:29:47.095814+00', ''), - ('00000000-0000-0000-0000-000000000000', '83d8bdf4-3a5b-4b5e-9629-8e6d6a3d066b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-27 16:29:49.84537+00', ''), - ('00000000-0000-0000-0000-000000000000', '49a1d654-0c65-40a6-9612-9b3d0f5c9594', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 22:22:22.149091+00', ''), - ('00000000-0000-0000-0000-000000000000', '70ae7f17-a210-4d74-a9f1-403a856638dc', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 22:22:22.319051+00', ''), - ('00000000-0000-0000-0000-000000000000', '57fa8bf8-a0ae-4a20-b06b-04fceac777d4', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 23:36:15.625929+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce1b4348-06ab-4481-9f0d-a3eb84132775', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-27 23:36:15.627262+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ade6f22f-cf9d-4c19-836f-395b51dc3e09', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 09:52:16.474151+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a886977-4187-40ea-87fd-e0940bd06441', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 09:52:16.49212+00', ''), - ('00000000-0000-0000-0000-000000000000', 'efb7346a-48c9-47a2-9f5a-bb86a192cf44', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 10:02:13.321794+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ede46890-55aa-44e3-a9a2-ab40e56d0115', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 10:02:16.603225+00', ''), - ('00000000-0000-0000-0000-000000000000', '9278b8ba-8534-43c1-ad21-5dbd2ea9b60c', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 10:15:27.437458+00', ''), - ('00000000-0000-0000-0000-000000000000', '2edb292e-d099-458a-b8d8-625bc33cbf91', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 10:15:30.515228+00', ''), - ('00000000-0000-0000-0000-000000000000', '755817ca-c085-4643-83bf-ab6841731b4e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 10:59:17.345274+00', ''), - ('00000000-0000-0000-0000-000000000000', '5b72ca73-3ae3-4d5a-8a41-2dd65d50c464', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 10:59:19.749207+00', ''), - ('00000000-0000-0000-0000-000000000000', '66bf243f-5d2a-4e99-b905-a649d76c7f6a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:03:32.71322+00', ''), - ('00000000-0000-0000-0000-000000000000', '2f4cdcf3-6d93-4ef4-8df9-7d7282539ea8', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:03:35.72802+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fb630908-da22-4503-a835-6a13078c8fa7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:03:55.788032+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a8759cfd-6212-463b-bf7d-76c122f8a16d', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:04:00.163366+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e46c1d61-2028-41e6-b291-f1beea92b5f7', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:04:02.169009+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b0a43dc5-3d51-4339-85fc-ae0f54b5a5ba', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:04:05.11928+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ee711421-15f7-478e-9dc4-48ecd06343f7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:04:08.961158+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e7991084-66a3-403a-9ef6-02baf6537e1c', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:04:11.477112+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dcf3c248-8973-4a24-ab3b-110324b8815e', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:16:15.68118+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a7535fa2-ff12-445f-926e-13a74dd9c8c8', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:16:21.275303+00', ''), - ('00000000-0000-0000-0000-000000000000', '711b8880-42dd-470b-8eff-c7d5c494b4ff', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:23:38.651345+00', ''), - ('00000000-0000-0000-0000-000000000000', '4b271d0b-a2a3-48d8-876c-0ecfb17e2c29', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:23:41.007626+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b44e4830-18e7-4ba0-9185-4568a2308db2', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 11:24:14.314872+00', ''), - ('00000000-0000-0000-0000-000000000000', '83859073-a4a8-49c2-ba08-f52002c67e05', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 11:24:16.855487+00', ''), - ('00000000-0000-0000-0000-000000000000', 'feb00a01-3320-48e4-b329-35e3285bd63a', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 12:22:46.371539+00', ''), - ('00000000-0000-0000-0000-000000000000', '7ac3749d-20f7-420c-8acf-016d1a0e2904', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 12:22:46.373199+00', ''), - ('00000000-0000-0000-0000-000000000000', '98d83d24-8066-4b3c-a61b-1b23a9ba7637', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:22:48.488677+00', ''), - ('00000000-0000-0000-0000-000000000000', '4f423e5e-9dc3-4613-ad4a-2fc6261bf6a5', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:22:51.420411+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a491ae9a-214f-4662-88ae-f64ad8793c88', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:23:14.726065+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e5946c0c-cb9d-483c-b0d9-441334ebc688', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:23:16.729468+00', ''), - ('00000000-0000-0000-0000-000000000000', '64af0496-cfc6-4ac3-9a99-131d97f37f6a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:23:19.849591+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6916024-f96c-483f-b293-135c62c14c1a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:23:22.682419+00', ''), - ('00000000-0000-0000-0000-000000000000', '2937dcfe-7fb8-43f6-833e-d13b314b4ea5', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:23:24.099219+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f97b999f-5160-460f-ae9d-36a8a9adb64f', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:23:26.005499+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cb192e84-645e-450e-93b8-57bc898238d3', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:23:27.838248+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e0f6071e-2195-4850-8637-29b99bb88cd9', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:23:31.038485+00', ''), - ('00000000-0000-0000-0000-000000000000', '0f4647a0-0b08-4378-a0b3-467a316c0ff9', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:23:32.366889+00', ''), - ('00000000-0000-0000-0000-000000000000', '005d3802-12cd-4498-a56e-758e251af74d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:23:34.270757+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ade50102-9df4-4399-9fe3-1ea5f2be5b6d', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:23:46.753413+00', ''), - ('00000000-0000-0000-0000-000000000000', '8f7ac88e-07f1-4bc8-baae-f25f148074d2', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:23:51.371951+00', ''), - ('00000000-0000-0000-0000-000000000000', '277e55df-8a14-4e38-9db5-94532eb53723', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:24:32.216451+00', ''), - ('00000000-0000-0000-0000-000000000000', '341d8199-a859-47d6-945b-cd56bd05b62b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:24:34.085566+00', ''), - ('00000000-0000-0000-0000-000000000000', '096196ef-22f1-4dc8-9b98-54f83c40c342', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:26:47.322596+00', ''), - ('00000000-0000-0000-0000-000000000000', '645b61f8-28a1-4bdf-97a7-7b337cee3178', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:26:49.334551+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed7435d8-c59e-4207-bbc8-e6dd83734bbb', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 12:27:07.9294+00', ''), - ('00000000-0000-0000-0000-000000000000', '3357838c-029c-47e0-a483-64bc08cedf5e', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 12:29:26.600101+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fa947cf6-3a63-4d1f-8546-b6a17ce4bb6b', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:00:22.236793+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dbe9cba3-ec2a-4ef6-aea5-778064c5fd9c', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:00:24.533901+00', ''), - ('00000000-0000-0000-0000-000000000000', '5f25d2fa-1a97-4ba5-ad0e-01b63e190e37', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:00:28.705589+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6b286b8-9810-4f41-b7c3-be915a8e50a6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:00:30.741492+00', ''), - ('00000000-0000-0000-0000-000000000000', '218db8f9-446e-4110-856f-7c74f517af7a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:00:32.789495+00', ''), - ('00000000-0000-0000-0000-000000000000', '0bf20cd7-42c7-4978-877b-eaf7ea4ce0f1', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:00:35.423203+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f829122f-f9d9-4d5d-8ea8-916fd44bb6ad', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:00:38.920524+00', ''), - ('00000000-0000-0000-0000-000000000000', '44ce74fc-34da-4807-a57c-8e667faa6f3c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:00:42.291436+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e22d01ae-a9a8-451f-ad60-7c1279075b3d', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:00:45.515758+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bb4bf2a5-4cf8-40dc-8912-73dae4c778ab', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:00:47.294021+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c40a3edf-473f-48bb-91af-4d788b1c2d6d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:00:54.0278+00', ''), - ('00000000-0000-0000-0000-000000000000', '2782294b-46dd-47a4-a71c-427b71e31a27', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:00:55.961113+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fa5c62d0-d1d5-4d9e-8466-748cec998a24', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:01:01.572037+00', ''), - ('00000000-0000-0000-0000-000000000000', '611c6eba-784a-4e43-b192-347a5f7ccbe8', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:01:04.371405+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e6a270cb-7e9c-4d87-88bc-74ae15f5d6b3', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:01:06.105276+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b3f02582-a668-478e-af8f-3801ff728db2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:01:07.977979+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a4b81b57-2141-4b66-8ac5-1f69648b724d', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:01:09.518981+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f9c8d6e-a18e-415b-b7ee-bc975ecb6f65', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:01:11.693221+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ddcb239a-6e22-4950-8bdb-248728968468', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:01:13.899742+00', ''), - ('00000000-0000-0000-0000-000000000000', '6cad6e9b-4ca7-4839-a5c0-6fc45e3e0737', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:01:17.470391+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c160cea8-436c-46c0-8355-ca62ea5aac25', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:01:43.788986+00', ''), - ('00000000-0000-0000-0000-000000000000', 'be081d79-6297-4249-b249-205d91d4bbfb', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:01:45.957814+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fab7c43a-89ca-443f-b01c-22b5d312f2c1', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:03:59.954874+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce89c3fb-38da-47b6-9796-00673bb3fb4f', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:04:02.225248+00', ''), - ('00000000-0000-0000-0000-000000000000', '1641708f-a707-46ab-8d79-cf135722f054', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:05:49.192873+00', ''), - ('00000000-0000-0000-0000-000000000000', '9f3a55b0-7208-4c32-b17c-319fb4b78bf0', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:06:12.475065+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c0592b8a-3fa2-4acf-84c3-13d3eb3db476', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:08:36.531569+00', ''), - ('00000000-0000-0000-0000-000000000000', '18eb4b66-9da4-4cdc-85e5-1aa6e3b2bf0f', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:08:41.449023+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ccc00aa-c823-49e6-a335-c3dd4076b697', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:09:16.947909+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e912f8d0-9dcc-4be0-a16c-5fd1f9072a89', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:09:19.932044+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eb1ed43a-d3b2-425e-b323-da0b677c2d25', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:17:02.284723+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b1a891a-ac3d-4a9b-8d35-4b2467d805dd', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:17:04.604935+00', ''), - ('00000000-0000-0000-0000-000000000000', '49712e5f-13fa-40e2-bcc1-de640be9422a', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:17:07.854739+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2d96a68-5adb-4389-967d-05fb68a485e2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:17:12.183919+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aedaf0ad-0421-44b1-80b3-ffd2377396e0', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:17:14.927249+00', ''), - ('00000000-0000-0000-0000-000000000000', '8c583b2c-1776-4d0c-bd67-88b0f6ed2af2', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:17:15.941457+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c92231e-bf02-4c72-932d-cc38fb3564d0', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:17:17.928318+00', ''), - ('00000000-0000-0000-0000-000000000000', '2616df45-a4d2-4c76-9e53-4364fca3123d', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:17:21.639867+00', ''), - ('00000000-0000-0000-0000-000000000000', '3297b979-348b-4d80-a148-6e9f1431bec4', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:17:23.551809+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f3651fa4-2914-4c8f-a590-129ba9c0df57', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:17:27.772664+00', ''), - ('00000000-0000-0000-0000-000000000000', '1647ddb2-fc52-4d82-acb0-92cd4a98f0ea', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:17:29.661353+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c2c1361-7c07-4d32-a769-ab97e3a7f529', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:17:32.573909+00', ''), - ('00000000-0000-0000-0000-000000000000', '79e0b62c-7036-48e6-abb9-7f2c0b2bcf25', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:20:01.319121+00', ''), - ('00000000-0000-0000-0000-000000000000', '6682d983-e31e-41c3-a919-dfbf6768ec05', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:22:00.854574+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c1c55b2-3b9a-46e8-ae67-8a4d5a9c0931', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:22:04.804051+00', ''), - ('00000000-0000-0000-0000-000000000000', '66805919-cb72-401b-85de-86becadc6be2', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:22:12.917806+00', ''), - ('00000000-0000-0000-0000-000000000000', '8015c827-5ff8-445b-9dbe-34bffe4befa7', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:22:45.238216+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f8aac99-68df-4412-ae3a-5d024a395ef2', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:22:47.747604+00', ''), - ('00000000-0000-0000-0000-000000000000', '438fc97e-179d-4c64-886b-226d88908da7', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:22:49.954609+00', ''), - ('00000000-0000-0000-0000-000000000000', '6041624b-25f2-4bd4-b099-9c261e026d65', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:22:53.304795+00', ''), - ('00000000-0000-0000-0000-000000000000', '8bd382dd-78bf-446b-8dfa-dcca2ab98927', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:23:00.239866+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6e9f2fc-2b57-4d89-adab-ba238fe32e1c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:23:02.081785+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dec343a0-405b-4a23-b835-7e09ffeba06b', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:24:40.297514+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4047716-9cf7-499c-9af6-879c40eaac0b', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:24:44.351869+00', ''), - ('00000000-0000-0000-0000-000000000000', '62eb788b-a6c3-4537-b20e-b2cb594c460f', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:26:27.161305+00', ''), - ('00000000-0000-0000-0000-000000000000', '06cf3648-7698-40fb-a914-05151c158197', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:26:28.655701+00', ''), - ('00000000-0000-0000-0000-000000000000', '5056572e-b4db-4833-bcfe-a83fc464a18d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:32:44.445598+00', ''), - ('00000000-0000-0000-0000-000000000000', '05aa1884-807a-4f63-a897-85f575a17791', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:32:46.157061+00', ''), - ('00000000-0000-0000-0000-000000000000', '30d62e3a-5b43-451c-8e31-e6277ed1eb5d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:33:44.160137+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a59e4054-983d-4812-b702-ce855c319714', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:36:11.453239+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e1596e97-2dc3-4653-b79b-29aded51a850', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:44:03.008121+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e0ece76-19a2-4c12-9792-24f8f6bd33bb', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:44:08.567609+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c907164-0c49-445d-95ed-1e928b52c03c', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:44:16.725063+00', ''), - ('00000000-0000-0000-0000-000000000000', '8bc7214b-afd1-4011-8a48-5c6f3a2a2be6', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:44:21.188722+00', ''), - ('00000000-0000-0000-0000-000000000000', '21ba5b04-eaa8-4c0c-a0d2-30f09ed1e464', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:44:26.007515+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b00129cd-adec-48ec-a4b4-d80d48df0161', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:44:30.658968+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ba92a70-fe88-4a66-9031-9906cc4c18c8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:44:33.139629+00', ''), - ('00000000-0000-0000-0000-000000000000', '47e1bf34-11ba-47a0-9c42-e87c9331c518', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:44:36.202352+00', ''), - ('00000000-0000-0000-0000-000000000000', '074b30d7-e6cd-492c-88f8-b04800afb1c7', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:44:38.55665+00', ''), - ('00000000-0000-0000-0000-000000000000', '671d4d58-d981-472a-82d5-94038687e427', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:44:42.414661+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c59150d5-4afb-4119-8968-885dfe03f72d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 13:44:50.53593+00', ''), - ('00000000-0000-0000-0000-000000000000', '9f081ef2-ed4d-41c2-9707-a5066f271142', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 13:44:53.983441+00', ''), - ('00000000-0000-0000-0000-000000000000', '290ac0ab-02aa-4590-a656-336785c7ce0e', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:15.622032+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f60c5f0c-aad4-43ea-94ba-31e015bfbcd8', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:17.513434+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c7209c7b-718b-40f9-b5ce-5aac654f74b5', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:21.052931+00', ''), - ('00000000-0000-0000-0000-000000000000', '78b8923d-9b3f-4498-a210-29b570cdfde1', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:23.947171+00', ''), - ('00000000-0000-0000-0000-000000000000', '3abfdc4f-6d7c-40b0-acda-8d7877bafb4f', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:26.191954+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a4a673b-e26a-46a0-b277-8245b246737e', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:27.173284+00', ''), - ('00000000-0000-0000-0000-000000000000', '398e9ee7-c602-4597-ba24-a8ea0537b3ab', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:28.9625+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a5790f55-f0c1-4035-9582-be1206638bde', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:31.826977+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c36f971-dfcd-4863-b907-76c325c31c62', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:36.794297+00', ''), - ('00000000-0000-0000-0000-000000000000', '5391ef24-c303-466a-b299-98b2a5cc7886', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:38.385267+00', ''), - ('00000000-0000-0000-0000-000000000000', '80ba4d82-e53d-49c0-ab52-a7f703da0852', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:41.71121+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd60ba93f-83c0-47ff-8db2-1be28ec6ffb5', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:46.626842+00', ''), - ('00000000-0000-0000-0000-000000000000', 'afe5b934-5558-442e-94a2-2d0673e3551f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:51.027014+00', ''), - ('00000000-0000-0000-0000-000000000000', '90aa236d-839e-4395-81ef-815335173046', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:54.069549+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e543fae-066a-4ff5-a868-bdf7f9b69004', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:36:55.984747+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b67bcf8-18f0-47e4-b723-48b7a7aaf6a8', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:36:59.676524+00', ''), - ('00000000-0000-0000-0000-000000000000', '3ff9a4ec-7bcf-4dc5-be2b-e7e3fc1350d8', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:37:01.577839+00', ''), - ('00000000-0000-0000-0000-000000000000', '8cea2189-f94a-4ff7-9853-35ff2613f9a0', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:37:06.1239+00', ''), - ('00000000-0000-0000-0000-000000000000', '7badc4e4-fc84-4b3c-9eda-98219c5cd6d6', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:39:09.771959+00', ''), - ('00000000-0000-0000-0000-000000000000', '45e99812-be62-4931-91f2-785b006ef48d', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:39:12.930088+00', ''), - ('00000000-0000-0000-0000-000000000000', '6abd163c-4534-430d-b56a-e8e976ed4c69', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:40:30.196155+00', ''), - ('00000000-0000-0000-0000-000000000000', '30143d1d-df50-47eb-9d87-73b26920751b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:40:33.512909+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cb03a891-ca9f-4b2e-8226-0d1925bbb92f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:48:42.415096+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8a5bd7b-529e-4dad-90c9-d127afd61ea3', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:48:46.02754+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bca538dc-95c5-473e-a68e-1a81a50fa3e9', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:48:47.756911+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a8c5acc9-21c5-413b-a8b2-f8d3caed3f76', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:48:51.188264+00', ''), - ('00000000-0000-0000-0000-000000000000', '9616e381-ea8c-4acd-a468-7b7061541594', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:48:52.944461+00', ''), - ('00000000-0000-0000-0000-000000000000', '32845b68-4654-4983-90ee-812e03ef9830', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:49:01.411739+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9b0c032-c93e-4549-a737-3bc63016fe5c', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:57:24.813353+00', ''), - ('00000000-0000-0000-0000-000000000000', '3594dbc1-14d6-428d-9dc4-80fc310d054f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:57:28.531954+00', ''), - ('00000000-0000-0000-0000-000000000000', '50ad3e82-b898-44b3-9504-367e9ffc1841', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:57:30.204884+00', ''), - ('00000000-0000-0000-0000-000000000000', '605b4edd-044f-427c-a81f-d9abbfaf05a0', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:57:32.902333+00', ''), - ('00000000-0000-0000-0000-000000000000', '45bfd790-9b2a-4947-86e0-9b62423d835d', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:57:34.034196+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fbd705f1-f3dc-49b3-bb58-b8b86cbc06de', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:57:36.973512+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6bd4ce0-9436-41c7-ab06-43236842bffa', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:57:38.928353+00', ''), - ('00000000-0000-0000-0000-000000000000', '6f6cabd9-37e8-429d-87c8-46492c203feb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:57:42.057262+00', ''), - ('00000000-0000-0000-0000-000000000000', '251d02ec-f031-4db2-af58-ff691f98397a', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:57:43.148131+00', ''), - ('00000000-0000-0000-0000-000000000000', '98ae5684-b4a8-4b58-bf10-58e46f52977b', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:57:46.337992+00', ''), - ('00000000-0000-0000-0000-000000000000', '5bc24060-497e-4eb1-8d98-d06388ef4b84', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:57:48.217144+00', ''), - ('00000000-0000-0000-0000-000000000000', '6eb7a004-a985-492a-bd6b-068f73aa172f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:59:36.508175+00', ''), - ('00000000-0000-0000-0000-000000000000', '5605dc03-5b6a-4487-b6c1-90590a33cbb9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:59:42.652551+00', ''), - ('00000000-0000-0000-0000-000000000000', '2d1b01d0-f745-432d-b20f-4152c169843c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:59:44.224679+00', ''), - ('00000000-0000-0000-0000-000000000000', '158d03f1-2023-45d8-a8cb-1b0482a51fa6', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:59:45.800248+00', ''), - ('00000000-0000-0000-0000-000000000000', '02b3f952-ed33-446f-b8d7-28e35b396a12', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:59:49.02916+00', ''), - ('00000000-0000-0000-0000-000000000000', '5842dae2-4768-44b0-abd6-d9cf056d41fd', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:59:50.12533+00', ''), - ('00000000-0000-0000-0000-000000000000', '84108ccc-92bc-4d5f-9919-a6d3692f20fe', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:59:53.499212+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c29160f2-07c5-4469-8a67-a96376fb32ef', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 14:59:55.346504+00', ''), - ('00000000-0000-0000-0000-000000000000', '983a4e91-7314-4856-9fd4-5fcf485aefa6', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 14:59:59.260025+00', ''), - ('00000000-0000-0000-0000-000000000000', '55ed3824-3c20-422c-82c9-2caceeebc9d3', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 15:00:01.736991+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ba302cc-3c7b-48bd-9838-3c3eefb5b405', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 15:00:05.054907+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e825eb5-7c72-4335-83ee-8bfc33583f20', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 15:02:37.507196+00', ''), - ('00000000-0000-0000-0000-000000000000', '36e09919-f873-471f-92d8-2ac8e018ac5f', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 15:14:58.967038+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd537e26b-5b97-46e9-9920-99c381f9b7d9', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 15:15:46.293079+00', ''), - ('00000000-0000-0000-0000-000000000000', '77a490fa-c66a-428e-a428-5549eb20a45e', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 15:15:49.696127+00', ''), - ('00000000-0000-0000-0000-000000000000', '61733b70-4ba1-46a7-8318-51d7c08848b3', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 15:16:43.731613+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b6f2b5d-623d-4f1f-92f9-5ea36d0cefa5', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 15:16:47.480286+00', ''), - ('00000000-0000-0000-0000-000000000000', '95b461f1-b41c-469e-ba91-167a137c1afb', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 15:18:12.542557+00', ''), - ('00000000-0000-0000-0000-000000000000', '9cd524cd-2ce3-4436-9798-1ed76d98af5a', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 15:18:15.889488+00', ''), - ('00000000-0000-0000-0000-000000000000', '25c51682-6fb2-4ec5-869a-c4fe6685b263', '{"action":"token_refreshed","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 18:43:57.321127+00', ''), - ('00000000-0000-0000-0000-000000000000', '4cd159e4-9cd8-4568-9d77-498f2b0010af', '{"action":"token_revoked","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 18:43:57.322484+00', ''), - ('00000000-0000-0000-0000-000000000000', '9dd5ed0b-dcf5-47d6-ab02-18be9d872a1e', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 18:44:12.969322+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d28c619-b8fc-4872-939b-d03a8a35c826', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 18:44:14.691918+00', ''), - ('00000000-0000-0000-0000-000000000000', '97192b4c-b40b-4513-b192-41967e003db8', '{"action":"user_modified","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agencia PSI","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-28 18:44:27.473694+00', ''), - ('00000000-0000-0000-0000-000000000000', '3b75d7ab-50e3-48ad-8c54-6e5c0f570ec7', '{"action":"user_modified","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-28 18:49:30.402384+00', ''), - ('00000000-0000-0000-0000-000000000000', '2aaefbe7-a59a-4df5-b5a6-8ff4b9b262d3', '{"action":"user_modified","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-02-28 18:59:06.822685+00', ''), - ('00000000-0000-0000-0000-000000000000', '9e8e2228-27a2-4836-957b-c97696fd9b8d', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 18:59:24.035823+00', ''), - ('00000000-0000-0000-0000-000000000000', '72dbca5a-2991-4597-a0d7-9baca6df58af', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 18:59:25.608454+00', ''), - ('00000000-0000-0000-0000-000000000000', '171e5c3a-3426-4f1f-91fd-f3dd40880521', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 19:00:40.368376+00', ''), - ('00000000-0000-0000-0000-000000000000', '1c3c26a6-ce9b-4211-8929-0bfe8b48af3c', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 19:00:41.841007+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a9bca34-aaf2-48c5-9113-098ec426d467', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 19:14:04.864257+00', ''), - ('00000000-0000-0000-0000-000000000000', '15ae4ce0-2012-488e-92f9-0b721079503d', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 19:14:06.625023+00', ''), - ('00000000-0000-0000-0000-000000000000', '129c7956-3cad-4250-97d0-06db5d9eeec2', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 19:31:02.156836+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a063e43a-a1ec-49ac-8eea-659c61a577c2', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 19:31:05.597469+00', ''), - ('00000000-0000-0000-0000-000000000000', '30ed9200-0c90-431b-9578-546eb0729bda', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 19:41:46.928265+00', ''), - ('00000000-0000-0000-0000-000000000000', '5172f4a6-53e4-4313-b35d-ea4dacd68aae', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 19:41:48.628121+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd48d1c61-9e48-492b-8435-f71ac7c8a215', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 20:19:06.684512+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f641cb76-0c4c-4237-a1dd-e6e24ebe870b', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 20:19:10.973806+00', ''), - ('00000000-0000-0000-0000-000000000000', '344b34b1-f405-412f-af11-eb50e3bda181', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 20:19:37.775097+00', ''), - ('00000000-0000-0000-0000-000000000000', '314d7d9c-1666-44aa-ad4f-b5c83ebf34af', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 20:19:41.81454+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ceb21e1e-4c9f-42b5-9a82-7624612e99a7', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 20:23:00.574279+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ee191ff1-3774-44e6-b7fd-72c6604572b0', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 20:23:04.280383+00', ''), - ('00000000-0000-0000-0000-000000000000', '4ca2d462-b33b-4578-ae99-e8372a56c3dc', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 20:23:11.653651+00', ''), - ('00000000-0000-0000-0000-000000000000', '08ae37d4-ebf9-4da5-bffa-7cde4f8e5e2c', '{"action":"login","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 20:23:18.262452+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cf2a97e8-27ee-43fd-b580-edf3c21d000f', '{"action":"logout","actor_id":"523003e7-17ab-4375-b912-040027a75c22","actor_name":"Paciente Agência Psi","actor_username":"patient@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 20:23:24.972457+00', ''), - ('00000000-0000-0000-0000-000000000000', '9214ba4e-260f-439e-8e4b-69c99d3c1589', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 20:33:51.035709+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c39b673b-add5-4b28-9cad-4038d64d4a0c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 20:34:44.889938+00', ''), - ('00000000-0000-0000-0000-000000000000', '45196b31-ce64-481b-b518-58abf5ae5e4f', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 20:34:49.332809+00', ''), - ('00000000-0000-0000-0000-000000000000', '84089c1a-ea88-443f-9cb2-dc848b3276ca', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 21:25:38.82085+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf54cf7f-6234-4052-996e-74d1fc0c152b', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 21:25:40.341092+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fd7e8e3a-0700-44e1-880b-25580ad31f00', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 21:25:42.688868+00', ''), - ('00000000-0000-0000-0000-000000000000', '5084f1ea-f09d-4bc3-83b7-fe3fcd5b5aba', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 21:25:45.446186+00', ''), - ('00000000-0000-0000-0000-000000000000', '60b8c517-4342-4cd7-b7aa-806398239b82', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 21:26:52.42682+00', ''), - ('00000000-0000-0000-0000-000000000000', '49c7880f-adf0-4dc4-a76f-98da1b9ba64a', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 21:26:56.639695+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e0cf6e80-04b8-420a-97d5-68314e8be9c8', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 22:27:42.35548+00', ''), - ('00000000-0000-0000-0000-000000000000', '1cdc1c5e-f48c-4455-9a6a-7c8fdb02dc9a', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 22:27:42.356709+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf4912a1-94a1-4747-9eb7-b67bee851bfa', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 23:41:00.673644+00', ''), - ('00000000-0000-0000-0000-000000000000', '8f904088-803c-4b79-bb3d-41717bb7e1b8', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-02-28 23:41:00.674706+00', ''), - ('00000000-0000-0000-0000-000000000000', '70bafbf6-fa3d-4cb4-ba7b-8bffd6918f54', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-02-28 23:58:37.398855+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a4164de-a894-4eb8-961a-5a58c429587d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-02-28 23:58:44.353193+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b73faa16-aa22-4e74-ac94-eea7087713d7', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-03-01 00:39:07.406001+00', ''), - ('00000000-0000-0000-0000-000000000000', '367fc8af-caeb-4190-9b61-22a5b515715c', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 00:39:14.584362+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf627bcf-326b-422f-beaa-c99da9fe4de6', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 00:39:18.362741+00', ''), - ('00000000-0000-0000-0000-000000000000', '798abd86-762f-4feb-b0e7-d9b2a3c2d69d', '{"action":"user_recovery_requested","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-03-01 01:19:02.377332+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bb5f21b9-9a0c-41d0-8182-a91a35bf2c45', '{"action":"user_repeated_signup","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"user","traits":{"provider":"email"}}', '2026-03-01 01:19:25.341017+00', ''), - ('00000000-0000-0000-0000-000000000000', '7fbfd6c7-21d4-46e0-b1f5-33ca9d47e12f', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 01:21:00.326048+00', ''), - ('00000000-0000-0000-0000-000000000000', '99da6675-ce22-465f-89e7-fcf62c1f8657', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 08:54:24.438229+00', ''), - ('00000000-0000-0000-0000-000000000000', '308f0bec-cb4b-49fd-9847-3098ac7a7310', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 08:54:24.454043+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6072c5a-fda7-4460-a312-590030d4ad12', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 08:54:30.648398+00', ''), - ('00000000-0000-0000-0000-000000000000', '6aac0363-5cd1-48f8-a999-d49fa8532d0d', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 09:03:37.740649+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd57b0ba0-867b-40f5-af05-6a48bf0d6e5f', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 10:08:54.838097+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1a02283-5313-4b93-92b2-ccd33346d927', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 10:08:54.840685+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ea1286fa-65b8-4ee9-9613-b17e310b2bce', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 10:52:22.272907+00', ''), - ('00000000-0000-0000-0000-000000000000', '6dfb5e0e-dcd7-4d17-9993-a90a64d352be', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 10:52:26.930845+00', ''), - ('00000000-0000-0000-0000-000000000000', '86e7e2b3-c75a-4272-b92e-e1986e8d27a8', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 10:55:01.595107+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ad27c088-81b8-461a-8df7-efe284e0eb9f', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 10:55:05.674599+00', ''), - ('00000000-0000-0000-0000-000000000000', '403819ba-6fba-4dcd-aaa7-1ed0f378d899', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 11:53:35.919653+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd72a7145-890a-4e09-84d7-c1ecc8c6f849', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 11:53:35.921026+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ab347dde-816c-4662-9a64-1a453c46739d', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 12:23:17.45773+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af953a61-d947-433d-bb1f-660f24912f52', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 12:23:21.566956+00', ''), - ('00000000-0000-0000-0000-000000000000', '9903d070-4608-4da3-9ac4-59493ff81a3e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 12:24:06.561139+00', ''), - ('00000000-0000-0000-0000-000000000000', '3b9f7637-f1f0-4550-b812-b4e5d2283d47', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 12:24:09.203123+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b90cc7ce-12da-458e-b828-fdb9ca873bae', '{"action":"user_signedup","actor_id":"8817508e-548c-427b-9d94-9b0bb9ef4669","actor_username":"teste@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 12:30:19.103479+00', ''), - ('00000000-0000-0000-0000-000000000000', '6bae1b29-5498-4d01-87a7-20696489280b', '{"action":"login","actor_id":"8817508e-548c-427b-9d94-9b0bb9ef4669","actor_username":"teste@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 12:30:19.134602+00', ''), - ('00000000-0000-0000-0000-000000000000', '31d535b3-1b5f-45b9-b3a2-1ec3624232b9', '{"action":"logout","actor_id":"8817508e-548c-427b-9d94-9b0bb9ef4669","actor_username":"teste@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 12:30:43.102607+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b72a01fa-3a41-4663-a311-5358329ff0d1', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 12:33:56.508465+00', ''), - ('00000000-0000-0000-0000-000000000000', '0cb72a31-c84d-45c1-83d8-82a3c38d647a', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 12:41:39.677348+00', ''), - ('00000000-0000-0000-0000-000000000000', '1702d06b-e8c3-48cb-99ef-7f59d843ddfb', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 12:42:15.953205+00', ''), - ('00000000-0000-0000-0000-000000000000', 'acfdfc63-39dd-438e-937a-d16b74f1e539', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 13:00:35.363179+00', ''), - ('00000000-0000-0000-0000-000000000000', '14126cb9-af60-4579-9c61-4c1d1abfa237', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 13:04:29.015824+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c0169a0-672e-4f8e-b33c-c0d6b08e3964', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 13:04:47.759579+00', ''), - ('00000000-0000-0000-0000-000000000000', '87ed2d1b-a3cb-4303-99bb-0555d3b76e73', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 13:05:04.833041+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6139527-6bee-43ac-b5ef-208be3538b7d', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 13:07:00.404849+00', ''), - ('00000000-0000-0000-0000-000000000000', '0197396c-b196-430d-b33f-8a1475027dba', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 13:07:02.063521+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae8840b8-c85e-4409-814f-028a664c7fdd', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 13:07:54.548532+00', ''), - ('00000000-0000-0000-0000-000000000000', '745db5b6-c638-41c8-bc12-8517ab130da5', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 14:12:54.179484+00', ''), - ('00000000-0000-0000-0000-000000000000', '81d1fb4b-efa6-4594-903e-d0d895717cf5', '{"action":"user_signedup","actor_id":"b7e6a203-25f2-4e28-855a-9868c4cc6e74","actor_username":"teste2@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 14:32:55.633169+00', ''), - ('00000000-0000-0000-0000-000000000000', '78e8c32f-e2c3-4c21-a293-6066e7323f3d', '{"action":"login","actor_id":"b7e6a203-25f2-4e28-855a-9868c4cc6e74","actor_username":"teste2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 14:32:55.650972+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd68285d7-affd-4ad3-ac17-f985ff19a4fa', '{"action":"logout","actor_id":"b7e6a203-25f2-4e28-855a-9868c4cc6e74","actor_username":"teste2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 14:33:15.448339+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f5c8fcb8-b6bc-4100-9cec-f8930bfb89cc', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 14:33:18.96013+00', ''), - ('00000000-0000-0000-0000-000000000000', '67f3aa50-523c-467b-a88e-59550642351c', '{"action":"user_signedup","actor_id":"d3cea8c9-5be1-4b41-8907-1ac26e120d74","actor_username":"tera@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 15:00:19.8788+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6991130-96f3-4ec9-b8f7-d5f624c4044f', '{"action":"login","actor_id":"d3cea8c9-5be1-4b41-8907-1ac26e120d74","actor_username":"tera@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 15:00:19.929669+00', ''), - ('00000000-0000-0000-0000-000000000000', '6f2482b8-cb99-4642-8db1-697e6dcb42b4', '{"action":"logout","actor_id":"d3cea8c9-5be1-4b41-8907-1ac26e120d74","actor_username":"tera@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 15:00:28.612619+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c6159d7-ce1a-4317-811f-12b60962646f', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 15:00:34.341737+00', ''), - ('00000000-0000-0000-0000-000000000000', 'be4b9e4e-853b-4c74-8c09-a0fd10c68bed', '{"action":"user_signedup","actor_id":"009d45e1-ebcf-43d9-94d6-ef854b2eb0f1","actor_username":"tera2@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 15:01:36.669837+00', ''), - ('00000000-0000-0000-0000-000000000000', '125dd27b-935a-4290-959f-a9937391f2b2', '{"action":"login","actor_id":"009d45e1-ebcf-43d9-94d6-ef854b2eb0f1","actor_username":"tera2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 15:01:36.691054+00', ''), - ('00000000-0000-0000-0000-000000000000', '4b774e84-a11c-4fd0-bd11-1d9ae2db7cc8', '{"action":"logout","actor_id":"009d45e1-ebcf-43d9-94d6-ef854b2eb0f1","actor_username":"tera2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 15:01:42.78611+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f153fe2f-27da-4fcf-8d23-b4af493c0e71', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 15:01:46.814262+00', ''), - ('00000000-0000-0000-0000-000000000000', '6ed5101d-f1e6-45dd-93c0-23681a150d9b', '{"action":"user_signedup","actor_id":"ff5a39cb-b651-4e42-a0db-ac77295c3370","actor_username":"tera3@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 15:03:56.619593+00', ''), - ('00000000-0000-0000-0000-000000000000', '79a4ff4e-293e-4067-9edb-8cdba9c28b0b', '{"action":"login","actor_id":"ff5a39cb-b651-4e42-a0db-ac77295c3370","actor_username":"tera3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 15:03:56.63565+00', ''), - ('00000000-0000-0000-0000-000000000000', '379f6df6-56ac-401d-98ce-684bdbfec26a', '{"action":"logout","actor_id":"ff5a39cb-b651-4e42-a0db-ac77295c3370","actor_username":"tera3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 15:04:02.194651+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d5ef56e-3924-4d26-b8bb-edf18739998a', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 15:04:05.45582+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e9dd9b2-d1ff-49ab-84a5-84dfa1207e83', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 16:05:56.177741+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f3e984d-6ea3-48bb-91e7-5b5e02356fd4', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 16:05:56.179625+00', ''), - ('00000000-0000-0000-0000-000000000000', '46544c77-818b-42a0-8b74-b532c62c381a', '{"action":"user_signedup","actor_id":"66216eb3-15fc-45a3-b474-c7447901798a","actor_username":"tera4@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 16:06:09.708906+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ff38347a-fdf7-4b8f-9abd-70f2eca5f064', '{"action":"login","actor_id":"66216eb3-15fc-45a3-b474-c7447901798a","actor_username":"tera4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 16:06:09.723821+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c1f51f2-f1e6-425e-9a10-efa2dfb41a70', '{"action":"logout","actor_id":"66216eb3-15fc-45a3-b474-c7447901798a","actor_username":"tera4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 16:06:15.100515+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f71fb237-b908-49a5-8755-4ff6c9cadb36', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 16:06:19.875958+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ce08626-0dde-4bbf-9ec0-192defeb4d02', '{"action":"user_signedup","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"team","traits":{"provider":"email"}}', '2026-03-01 16:09:56.665459+00', ''), - ('00000000-0000-0000-0000-000000000000', '960d571a-8053-4bad-b95b-74ce94cae6d4', '{"action":"login","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 16:09:56.68904+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e08c7a8c-aef3-4847-839b-a8353baefe93', '{"action":"logout","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 16:10:01.045468+00', ''), - ('00000000-0000-0000-0000-000000000000', '55dab635-c81b-44b6-a3cb-3ec499308485', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 16:10:04.927548+00', ''), - ('00000000-0000-0000-0000-000000000000', '7029af2f-b0c9-45b2-8153-b39e1fcf6419', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 16:37:16.19219+00', ''), - ('00000000-0000-0000-0000-000000000000', '313f9b82-a7e8-4a5e-ba10-0211f3c4c741', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 16:37:20.030258+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bb50f7f3-d934-46d3-8d1b-45e3651c1258', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 17:49:53.654352+00', ''), - ('00000000-0000-0000-0000-000000000000', 'de2aac45-5b19-4f8d-aa3f-11ded8bb5433', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 17:49:53.655541+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6761564-fe5a-42dc-82a8-9e34bd7393ae', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 18:11:41.36901+00', ''), - ('00000000-0000-0000-0000-000000000000', '4dd88648-8fd4-4f63-926c-85908bf69e54', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 18:11:44.794363+00', ''), - ('00000000-0000-0000-0000-000000000000', '2e8a8b9f-0d9e-4f07-976e-86d5bd21fb90', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 18:11:52.104945+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f0e95f59-f02f-4007-bb4d-b6f1eacbfee9', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 18:11:53.758547+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd267573a-d651-4c00-85a1-72432a76dc9d', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 18:11:58.257664+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c09aa7e8-7eab-4144-9932-f663bdd71ce3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 18:12:01.875614+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fd95745e-71ad-40f6-8e45-2dfbfe1931c9', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 18:20:14.763539+00', ''), - ('00000000-0000-0000-0000-000000000000', '8de5068f-b68c-43ae-a75f-ecff90b1922f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 18:20:16.439756+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6cf1ba1-eaae-4269-92f3-e186d1c1b4cd', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 22:00:13.159494+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e60ae63c-2275-4143-9942-148d3e317e14', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-01 22:00:13.163108+00', ''), - ('00000000-0000-0000-0000-000000000000', '87466a16-fa6c-4396-b0f9-001daf0e1c1c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:10:01.732879+00', ''), - ('00000000-0000-0000-0000-000000000000', '75faf108-d4d4-476f-96a0-5126cffcd4ff', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:10:03.893518+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e70ce3a-7b2a-4d21-a985-907e5e0fe3bb', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:15:46.768943+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd3590169-4c87-47e5-9760-b5613fe22dda', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:15:51.146333+00', ''), - ('00000000-0000-0000-0000-000000000000', '207a49dd-526e-4cb9-a37c-925ac586a592', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:15:59.378362+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f0239028-2039-44e3-b60c-ff009b1806a5', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:16:01.130045+00', ''), - ('00000000-0000-0000-0000-000000000000', '874f0f3f-d544-40d3-801e-665d4054c51a', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:16:04.204433+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dd4c1932-ba6b-449b-a95d-d147dd495e6f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:16:07.216182+00', ''), - ('00000000-0000-0000-0000-000000000000', '3bc84abc-6518-4157-ab95-ebaf54b20304', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:23:32.220646+00', ''), - ('00000000-0000-0000-0000-000000000000', '1081a12a-d8c5-4b3f-a279-fb9fd461d163', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:23:36.52947+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bad06727-ad6c-4bea-babe-f48bc7ca31b0', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:23:39.934472+00', ''), - ('00000000-0000-0000-0000-000000000000', '53fd7414-a482-4887-8c15-c63e070d74ed', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:23:41.280521+00', ''), - ('00000000-0000-0000-0000-000000000000', '880752df-a25e-46ca-b3c1-4ac3e8549708', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:23:43.050537+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f64bec23-f5b9-4222-8afc-8b140c498c8c', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:23:45.436171+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ab05aff-2fe4-4275-8371-fbeb9f6a958f', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:23:55.342038+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8276a1f-523a-44c0-be53-7c1774611a1a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:24:00.094766+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e068b04f-27d4-44f8-8af1-ab1d24fbd675', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:34:23.164772+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e13d9ec7-cfda-4d62-b393-4ee5b6cc40c7', '{"action":"login","actor_id":"009d45e1-ebcf-43d9-94d6-ef854b2eb0f1","actor_username":"tera2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:34:28.09426+00', ''), - ('00000000-0000-0000-0000-000000000000', '3cd6034e-bfd3-4e17-b4d0-f24c71814a72', '{"action":"logout","actor_id":"009d45e1-ebcf-43d9-94d6-ef854b2eb0f1","actor_username":"tera2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:35:13.184635+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b71f2bfb-e0dc-4e73-a3f6-6442d0dd919c', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:35:16.614498+00', ''), - ('00000000-0000-0000-0000-000000000000', '99c07020-e6bb-4679-8bdf-2b6c1bacb609', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:35:20.405777+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf757128-24b0-4d65-b96f-02161f5b71aa', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:35:22.315696+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b8f4fab-b93c-486e-ba56-5f5df1e37aaa', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:35:25.649806+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b5806b68-255f-485f-96e4-c57337bec0e3', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:35:28.232506+00', ''), - ('00000000-0000-0000-0000-000000000000', '445bc6b4-76fc-40e9-a23e-b72897c3ff54', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:36:04.726302+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c919f468-7276-4ecf-b3b5-0c564f945cac', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:36:12.602044+00', ''), - ('00000000-0000-0000-0000-000000000000', '0fe25e27-90f7-4c9d-97cc-d28f3a7b7442', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:43:29.826961+00', ''), - ('00000000-0000-0000-0000-000000000000', '5923fd1d-7f87-4f38-84dc-d196453fb4c1', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:43:51.698441+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c986df2-41db-45bd-8c3f-41498100cf84', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:45:25.416039+00', ''), - ('00000000-0000-0000-0000-000000000000', '226ae811-587a-4444-a67e-3885b7e5cf17', '{"action":"login","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:45:36.086953+00', ''), - ('00000000-0000-0000-0000-000000000000', '7688a704-6f63-4c54-b36d-cd523778a3fd', '{"action":"logout","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:51:09.63634+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f6a73cf9-9d91-4a74-a7a0-7efc42a58438', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:51:12.859207+00', ''), - ('00000000-0000-0000-0000-000000000000', '1eb8dbf4-f34c-4da7-a70b-027a46fd56f5', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:56:03.400742+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e5c85fd3-1a16-4479-a559-3a08492ef710', '{"action":"login","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:56:12.738569+00', ''), - ('00000000-0000-0000-0000-000000000000', '56bce4bf-1f62-4757-96d8-5337afe361da', '{"action":"logout","actor_id":"1715ec83-9a30-4dce-b73a-2deb66dcfb13","actor_username":"clinic4@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:56:16.898809+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9af633f-2e35-4f79-bb23-d51edf972d05', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 22:56:21.332858+00', ''), - ('00000000-0000-0000-0000-000000000000', '014d0dd1-465b-475d-859e-e47ed3b3cd93', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-01 22:56:25.136021+00', ''), - ('00000000-0000-0000-0000-000000000000', '660f4936-670e-462f-99c4-2475ca6e7269', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-01 23:00:21.530587+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d984189-d10d-4d59-b46a-bbce6f6402ee', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 09:46:19.469613+00', ''), - ('00000000-0000-0000-0000-000000000000', '846d985f-0577-496b-b18d-ba96037be6a6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 09:46:19.52171+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eb2e016c-7b0e-4ec6-8708-8c50cc516522', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 10:09:00.616761+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bcf9d5ab-4f90-4937-b99d-88feeb038595', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 10:09:06.86502+00', ''), - ('00000000-0000-0000-0000-000000000000', '89f43394-d62a-4fbc-a374-d192bd990046', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 10:12:57.474387+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fa0d7aa6-1f6d-43f9-9b2f-8c6c5d22b188', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 10:13:00.618426+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f561ddd-730f-4b9e-8fad-3ff61e5229e2', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 10:20:55.661057+00', ''), - ('00000000-0000-0000-0000-000000000000', '0b2bf7fb-5d17-46a3-8272-214c060cfab7', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 10:20:59.411948+00', ''), - ('00000000-0000-0000-0000-000000000000', '3253a116-70ca-4ff8-b966-2b33b4dcd4cf', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 10:56:47.124677+00', ''), - ('00000000-0000-0000-0000-000000000000', '093be4f3-005a-4a06-ba68-1969bcb7784f', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 10:56:50.610808+00', ''), - ('00000000-0000-0000-0000-000000000000', '9aed0208-3257-4d8b-9524-37588e65a1bc', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 10:59:52.862913+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a9c49db-78e7-48da-a109-86088bf157d9', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 10:59:55.880143+00', ''), - ('00000000-0000-0000-0000-000000000000', '5c6847f3-e251-4d06-b0ce-624a0da66bc7', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:00:06.14305+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e18c02df-2a0e-4a7e-9940-1fd1962689ca', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:00:07.560286+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4543f99-40f8-454f-82a0-b934143bf0db', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:00:09.33977+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e46d8c1c-c23c-4244-be16-d8555ea51ac4', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:02:17.632996+00', ''), - ('00000000-0000-0000-0000-000000000000', '68ccb03b-fec7-495d-93cb-fd003da7a928', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:12:18.608671+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bedd992c-d795-4fab-96bd-cfadfd10967f', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:12:21.706142+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c5d8d9ca-8666-4004-938b-7a7c4266b1fe', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:12:28.41355+00', ''), - ('00000000-0000-0000-0000-000000000000', '8338ae70-3ebe-4e01-8545-5f2f060ed20b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:12:31.94452+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd55c3791-47b3-4544-a681-691250260d26', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:15:44.581469+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c2a85fa6-c157-47b4-8758-5a368f5814ed', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:15:48.643176+00', ''), - ('00000000-0000-0000-0000-000000000000', 'db6f2a42-2975-4362-a231-55f50b48a8c6', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:15:53.792045+00', ''), - ('00000000-0000-0000-0000-000000000000', '48819629-72c1-454e-8dc9-01cff915eb7d', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:15:56.76263+00', ''), - ('00000000-0000-0000-0000-000000000000', '787061f6-6822-4232-8daa-87a0f375bdeb', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:31:19.375285+00', ''), - ('00000000-0000-0000-0000-000000000000', '09ce687a-98ff-4521-81d1-65c0d3e2f011', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:31:23.233327+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd35fe1a1-d54f-4974-b1f5-4156ef04c2e6', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:31:58.782817+00', ''), - ('00000000-0000-0000-0000-000000000000', '1498e713-2ed0-416b-9c0a-239a53f89d06', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:32:02.187033+00', ''), - ('00000000-0000-0000-0000-000000000000', 'db87ed28-e740-461d-9b29-6c565fe7e4ad', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:57:04.634975+00', ''), - ('00000000-0000-0000-0000-000000000000', '0830fe7a-a155-43ed-8e83-0124c61bba20', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:57:09.273065+00', ''), - ('00000000-0000-0000-0000-000000000000', '123fc874-1ebd-40a6-b1e6-3820b35b77b1', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 11:57:28.32404+00', ''), - ('00000000-0000-0000-0000-000000000000', '9f76412d-f20e-4adc-b235-df4d04878e16', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 11:57:31.544829+00', ''), - ('00000000-0000-0000-0000-000000000000', '84f8a0a2-e2d8-4e26-a14f-0a4254f75b3a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:03:17.450743+00', ''), - ('00000000-0000-0000-0000-000000000000', '8afaf675-3eba-4db8-83c9-a8fb60433aff', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:03:21.249345+00', ''), - ('00000000-0000-0000-0000-000000000000', '6e2f7dd1-8b93-4604-a1fc-78c29dde460e', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:13:01.126043+00', ''), - ('00000000-0000-0000-0000-000000000000', '6cb3fa72-524a-46b5-889a-2d868d00e056', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:13:04.144075+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ef744da9-4b05-46f6-94b3-9cab2a5a9cb9', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:20:40.792218+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e426ec03-98b4-4324-b96e-fae3313cd05c', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:20:44.091845+00', ''), - ('00000000-0000-0000-0000-000000000000', '6ee30b62-284e-42d3-8a5e-0f4602abb315', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:21:08.809741+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e6d936fb-0607-4b0a-9d87-64ef0bb01f7f', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:21:10.125733+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c7aa6310-cf2e-40df-8e87-5993d109d0b4', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:21:12.026698+00', ''), - ('00000000-0000-0000-0000-000000000000', '8a51419d-fc95-4df3-8535-c298dda3d7c0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:21:18.051337+00', ''), - ('00000000-0000-0000-0000-000000000000', '743b9530-9f0c-4ac5-9dee-a63a74df35b4', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:21:24.324471+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ec950e23-980e-4780-aca5-e452f33f92b3', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:21:27.746371+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fb8c3afb-d280-42bb-b684-8935f03d9ab6', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 12:21:49.650648+00', ''), - ('00000000-0000-0000-0000-000000000000', '7820c5aa-adcb-4da3-a210-6a6de78fd23b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 12:21:54.043977+00', ''), - ('00000000-0000-0000-0000-000000000000', '93defe86-eefd-4b16-890f-5cb766776bc0', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 13:00:17.695982+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd26405d7-ed96-421b-a608-39b36cf6c5ae', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 13:00:20.839559+00', ''), - ('00000000-0000-0000-0000-000000000000', '38ac9557-2015-494d-891c-27a9e0617e81', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 14:00:46.686093+00', ''), - ('00000000-0000-0000-0000-000000000000', '20d5a36a-9a17-48a0-ba42-0bf91d99d5d6', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 14:00:46.687937+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eacee0aa-e1bc-4dcc-a386-2480191408fb', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 14:00:47.691903+00', ''), - ('00000000-0000-0000-0000-000000000000', '0ef8c032-67ae-42f5-bd0c-bc08856cca8b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 14:03:10.42021+00', ''), - ('00000000-0000-0000-0000-000000000000', '97a151b8-f571-4246-87fb-ac3038d0801c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 14:58:47.499625+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cfe55760-a335-4d20-8e62-070ade2d4bc0', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 14:58:47.81612+00', ''), - ('00000000-0000-0000-0000-000000000000', '44aaa2f2-3fa1-4104-9bfe-c79d54028deb', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 14:58:49.147199+00', ''), - ('00000000-0000-0000-0000-000000000000', '85e950d2-e824-4549-b5fb-4442a2cd980b', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 14:58:58.825179+00', ''), - ('00000000-0000-0000-0000-000000000000', '5925c9d9-f238-462e-9825-6342c93ca005', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 14:59:00.184553+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6ff49a3-7ca2-4d1c-8677-a4147ceb7fae', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 16:32:51.525203+00', ''), - ('00000000-0000-0000-0000-000000000000', '5ab24a96-fec2-4b08-a79e-75c89507ec1d', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 16:32:51.526778+00', ''), - ('00000000-0000-0000-0000-000000000000', '5630270d-cc2a-4d4e-a717-6adca9d52615', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:32:57.002635+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cbf516fb-737a-4d98-aac4-386f7cf18b2a', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:33:05.456688+00', ''), - ('00000000-0000-0000-0000-000000000000', '38a83924-3651-4e4e-9ffd-714ce2a740bc', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:33:15.19498+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ff8856f-a153-43bd-b52f-351b73f8b3a6', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:33:20.565269+00', ''), - ('00000000-0000-0000-0000-000000000000', '2a9eca2b-113a-43cc-a06a-5951eb2a9e2c', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:33:26.095626+00', ''), - ('00000000-0000-0000-0000-000000000000', '0d7387ba-fe94-429e-8ca3-1b50a988a12b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:33:26.394508+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ec731f1c-36df-47c5-a190-335dc43fcd16', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:33:43.600238+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c9890b0d-938a-4caa-96aa-a7b9300a99fc', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:33:49.893693+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f635ff84-0e84-45b0-a211-b041a9f44c45', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:34:58.551233+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e33c087f-9f8a-47a3-96af-c6be6bf8fb3b', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:47:42.281742+00', ''), - ('00000000-0000-0000-0000-000000000000', '3c2aa6a8-457c-436c-9aec-e2a0beff4800', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:47:46.364725+00', ''), - ('00000000-0000-0000-0000-000000000000', '9866ae75-6b71-490b-8423-3adb08172792', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:47:49.0171+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ebae6d6b-9f0e-4791-ae9b-db916fa038da', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:47:56.363194+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd49e2232-d777-4826-9284-92a9358ad3ce', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:48:12.926848+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd4323b61-baf9-42b2-8f9e-3d433d0e4aab', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:48:24.722835+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c66e4d4-4fee-40a0-bbd4-503e29c27635', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:48:31.762221+00', ''), - ('00000000-0000-0000-0000-000000000000', '8c6ce8bd-f6ea-4121-bbdd-f15198d1ba28', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:48:38.656002+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fae81753-c7f1-46e3-9379-8873200d2842', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:48:59.675342+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f192319-6f2c-480c-990f-32713cb292f6', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"therapist2@agenciapsi.com.br","user_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","user_phone":""}}', '2026-03-02 16:52:40.586088+00', ''), - ('00000000-0000-0000-0000-000000000000', '1be8f772-cb92-49ef-812a-cfc5b13ae017', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"therapist3@agenciapsi.com.br","user_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","user_phone":""}}', '2026-03-02 16:52:54.452873+00', ''), - ('00000000-0000-0000-0000-000000000000', 'efbbdfc7-9e1d-43d5-8833-35fa2f3199e6', '{"action":"user_signedup","actor_id":"00000000-0000-0000-0000-000000000000","actor_username":"service_role","actor_via_sso":false,"log_type":"team","traits":{"provider":"email","user_email":"secretary@agenciapsi.com.br","user_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","user_phone":""}}', '2026-03-02 16:53:24.125034+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c47a3615-f3bc-4473-afaa-f4da209adc61', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:53:40.770222+00', ''), - ('00000000-0000-0000-0000-000000000000', '7da71d92-d9e9-4119-a826-e847d6dd61e3', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 16:53:45.649165+00', ''), - ('00000000-0000-0000-0000-000000000000', '8dde4788-0bf1-4401-a69a-742512b23c31', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:54:46.266455+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f3bb2fec-4681-4495-b5f6-d4dbc85fc726', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:55:44.837771+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c9daa131-505e-4a90-9cf8-94c3cfe7e523', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 16:56:49.748705+00', ''), - ('00000000-0000-0000-0000-000000000000', '6d417ebd-8a10-4668-b9d6-99d95e496869', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 19:11:09.539778+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f59a41f-753f-479f-97d9-c10802306945', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-02 19:11:09.544072+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9424af9-0ee9-4b79-8bb3-13a6ea2fe4ab', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:11:54.847802+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e0013846-1345-41e1-ba71-f57943450cfa', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:12:07.77069+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bba965c4-5d30-4cf2-a0f3-ed1077570539', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:12:17.729279+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a056ef75-abed-4879-9ea1-546051844652', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:12:25.45797+00', ''), - ('00000000-0000-0000-0000-000000000000', '236e95ff-cd9f-4266-abff-4e1793728ead', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:12:29.493757+00', ''), - ('00000000-0000-0000-0000-000000000000', '3795268d-59ef-45ff-9fd8-bffadb18a505', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:20:49.021157+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e8522f3f-92a6-40f9-87df-d49ce3432eb5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:21:16.876461+00', ''), - ('00000000-0000-0000-0000-000000000000', '52068936-e611-4de6-8de4-a3bdd763cc2a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:21:19.093746+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bc206f1a-01f8-469f-a6d7-1aa1513d55e2', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:21:20.834442+00', ''), - ('00000000-0000-0000-0000-000000000000', '00a56de1-4d52-492a-93a0-1ef3f2b8c5cc', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:21:22.418082+00', ''), - ('00000000-0000-0000-0000-000000000000', '521eb5e4-ad7a-465e-8043-a8c4f4727cab', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:28:51.854558+00', ''), - ('00000000-0000-0000-0000-000000000000', '546ac30b-f930-417a-a349-d1f6520de2cb', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:28:56.788135+00', ''), - ('00000000-0000-0000-0000-000000000000', '995c43f3-ab3d-4567-bf96-d919e1dd3b35', '{"action":"login","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:29:01.830236+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a69cc831-f8f4-46d2-bf2d-66d268a4d01f', '{"action":"logout","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:29:15.197317+00', ''), - ('00000000-0000-0000-0000-000000000000', 'db6320b7-a9ba-463d-a846-a5f34a919ce1', '{"action":"login","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:29:15.453486+00', ''), - ('00000000-0000-0000-0000-000000000000', '1d89d5ee-c0df-4599-9eb1-8f4ed419b413', '{"action":"logout","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:29:19.896748+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c05a1ea7-8cfd-4515-9337-51bd94d9bd6f', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:29:20.14867+00', ''), - ('00000000-0000-0000-0000-000000000000', '6783e247-5490-4bde-8ff3-cdb722f6ef2b', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:29:23.243876+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b690970b-5e94-4f67-a0c8-f02dcfe1847b', '{"action":"login","actor_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:29:39.329906+00', ''), - ('00000000-0000-0000-0000-000000000000', '0d72fd0a-f9f4-4e2c-9133-943dc9450a1d', '{"action":"logout","actor_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:40:07.828366+00', ''), - ('00000000-0000-0000-0000-000000000000', '04609547-e1df-4ee4-a9ab-c33d40e5c5d2', '{"action":"login","actor_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:40:16.176121+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a1f43853-e683-4f8f-a916-badb20934e54', '{"action":"logout","actor_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:40:18.824318+00', ''), - ('00000000-0000-0000-0000-000000000000', '16afd841-c70f-4778-9d07-9f9f31636dfb', '{"action":"login","actor_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:40:23.841115+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eac9e585-2702-4788-b4d3-170f5e91ffa0', '{"action":"logout","actor_id":"019d28c7-960a-4911-a93b-a2ff5ab17877","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:40:26.323897+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ef5af21-e2d7-4f0a-b177-2ba726d488bc', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:43:28.607389+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c6e85915-27dc-4827-a46f-f80dec2a9d60', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-02 19:52:45.735722+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d2cee17-9304-4bf2-bc54-e2278ef33d4b', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-02 19:52:52.611224+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cd73fb7c-97a8-47d0-bb16-870389f773bd', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 10:00:50.889217+00', ''), - ('00000000-0000-0000-0000-000000000000', '033d9d17-7faf-4f8c-b8c3-38dc859024ca', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 10:00:50.898773+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e253e552-eabb-47fe-b718-04ba391de606', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 10:00:56.377769+00', ''), - ('00000000-0000-0000-0000-000000000000', '920e2ac6-764b-43a8-bedd-a217b59f98fa', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 10:01:08.631632+00', ''), - ('00000000-0000-0000-0000-000000000000', '983ff34c-9130-4e03-850d-0c3a6ed0d18f', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 10:02:24.44399+00', ''), - ('00000000-0000-0000-0000-000000000000', '6643d86c-1cdb-4254-b885-ba3ba492ea9e', '{"action":"token_refreshed","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 11:02:45.137927+00', ''), - ('00000000-0000-0000-0000-000000000000', '224d90e8-373d-455c-ada1-7b3838b93cff', '{"action":"token_revoked","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 11:02:45.139001+00', ''), - ('00000000-0000-0000-0000-000000000000', '0241eb43-5c92-475c-b4f6-090ff57b4209', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 11:08:39.313009+00', ''), - ('00000000-0000-0000-0000-000000000000', '7972baac-0a5c-43bf-844a-4c327deabffa', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Essa é a clinica","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 11:08:39.314117+00', ''), - ('00000000-0000-0000-0000-000000000000', '8930a7c3-1556-4b38-9ec0-57d8abc08fc7', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 11:10:57.907795+00', ''), - ('00000000-0000-0000-0000-000000000000', '2931a1c5-a44c-4ea3-a2c2-14f980fab409', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 11:11:06.336891+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f5096629-9da2-4a9f-af8b-41c650b8cc13', '{"action":"user_modified","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-03-03 11:27:19.769482+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fb356db1-291a-4e8b-94fb-072f9c62d1fc', '{"action":"user_modified","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-03-03 11:30:53.429902+00', ''), - ('00000000-0000-0000-0000-000000000000', 'edd943ef-81df-4666-8c01-8e438cc3c6ae', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 11:38:47.225224+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e761010-decd-4559-9d1c-2d17c98b2a04', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 11:43:17.458077+00', ''), - ('00000000-0000-0000-0000-000000000000', '41968510-b8fe-46ff-a83f-8f4443f111a2', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 12:18:14.452235+00', ''), - ('00000000-0000-0000-0000-000000000000', '84c7afbd-c488-42e1-a1c0-6897d862814d', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 12:18:14.453876+00', ''), - ('00000000-0000-0000-0000-000000000000', '23cd6e79-23b0-4f65-88e4-95416b5b2e1e', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 16:28:36.434366+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e407b64f-b6f5-4a6d-96cc-55c01f79864b', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 16:28:36.446352+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b7d2441-3ad4-4ae3-8df5-23401c94d6a0', '{"action":"token_refreshed","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 17:30:13.56956+00', ''), - ('00000000-0000-0000-0000-000000000000', '1bb30947-93f4-4083-ba1b-d31797d36734', '{"action":"token_revoked","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 17:30:13.572203+00', ''), - ('00000000-0000-0000-0000-000000000000', 'edf4a0be-90f5-4000-b642-f52472f97ee3', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 17:36:02.638184+00', ''), - ('00000000-0000-0000-0000-000000000000', '0a889348-d234-4a2c-9970-62f66c05dbee', '{"action":"login","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 17:36:07.984675+00', ''), - ('00000000-0000-0000-0000-000000000000', '41a76b4e-9709-437e-809a-b288e91e0062', '{"action":"logout","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 17:40:24.81181+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c15aa65e-e19f-454c-8be0-d1fc605bce09', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 17:40:32.1017+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae97034e-7d69-41c7-98c8-8d5581fc5ae3', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 17:46:45.27952+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bc7d9681-6926-4f07-a500-48c2d2a4f0a8', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 17:46:52.916237+00', ''), - ('00000000-0000-0000-0000-000000000000', '77adbd2c-7ce2-45ef-8606-82fd215d6bd9', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 17:50:11.341572+00', ''), - ('00000000-0000-0000-0000-000000000000', '78914aae-7f54-402c-8336-294f6ac349d8', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 17:50:15.698519+00', ''), - ('00000000-0000-0000-0000-000000000000', '72c25b96-ec07-41b5-83f2-884d6af31e5a', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 17:50:46.521401+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3125ec5-385c-4ffe-a71e-1c0f4ee543f5', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 17:50:58.316639+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fe90f265-896c-4702-a425-851c62a4c2d5', '{"action":"login","actor_id":"b1ebe52f-f0d6-42f7-ac1c-b45cb37353db","actor_username":"therapist3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 17:51:02.071571+00', ''), - ('00000000-0000-0000-0000-000000000000', '5769da65-4646-4dc5-9ba8-a1c661852981', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:29:57.858009+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b0140424-a98d-4eca-91ab-0e8d0acd9af3', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:30:06.579204+00', ''), - ('00000000-0000-0000-0000-000000000000', '4519e7b2-6e50-4d5d-9aab-632d44524977', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:30:15.983902+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a50a53a5-2970-4f34-8d1e-a61ac4c0f560', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:43:52.364351+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed0b342b-1f4a-442e-b8f7-135149ca91e0', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:43:58.471629+00', ''), - ('00000000-0000-0000-0000-000000000000', '66b08f78-bacd-48d6-9e6d-a6d5e9f2524d', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:44:04.064349+00', ''), - ('00000000-0000-0000-0000-000000000000', '0fe2b212-eaa3-4f60-9e61-ebdd7ad81767', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:44:07.605468+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ed066f7-50c3-4449-b49f-9e61c3ce670a', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:44:23.717539+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e182a959-2740-487a-aa44-f311610a6b14', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:44:27.44311+00', ''), - ('00000000-0000-0000-0000-000000000000', '16908adf-030d-4b7e-8f1a-4c4e3444fe77', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:45:17.178871+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c54702a9-d85d-4b10-b388-c9013f565159', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:45:20.878359+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2a91f40-bc48-461a-9a56-5f648701585f', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:45:31.644098+00', ''), - ('00000000-0000-0000-0000-000000000000', '6abafcfb-4588-401e-8be7-3934ee052a9c', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:45:35.909503+00', ''), - ('00000000-0000-0000-0000-000000000000', '24740173-b33a-42a4-b656-7a64420a57d6', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:45:55.45554+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b71f3c0e-acba-4457-b831-5226c6c133c0', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:45:59.042949+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bf5f4af9-f1b6-41fb-a1c8-90cc70543d3f', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:50:37.186567+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ebd151e-dc81-4ea8-963c-fdc57e152ea2', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:50:41.701719+00', ''), - ('00000000-0000-0000-0000-000000000000', '45ea0140-a8c1-441f-845b-c4e2ac1a77e8', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:51:35.16508+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a15bbf44-0646-4a13-872e-c0f13be30eca', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 18:52:43.56576+00', ''), - ('00000000-0000-0000-0000-000000000000', '121b2414-f0d8-4300-91d3-c4eeb82049af', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 18:52:50.171258+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b543091-0d5a-4e7c-9fc5-991dd5877126', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 19:23:48.912599+00', ''), - ('00000000-0000-0000-0000-000000000000', '0f9b488c-7d87-4ad0-b28b-5df210cd4bd6', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:23:52.746909+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9d36f2c-fd8c-4127-983d-002c025bcb55', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 19:23:55.613325+00', ''), - ('00000000-0000-0000-0000-000000000000', '6f849ca8-b68a-4584-b491-fd32caa75fc5', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:23:58.908318+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d2874ab-0ff2-4551-b896-9a8e32f9424e', '{"action":"logout","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 19:24:03.769879+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f818043-dec9-44e6-848a-dd478a36c93d', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:24:11.381689+00', ''), - ('00000000-0000-0000-0000-000000000000', '07890f78-6112-4449-b98f-d53abf0332c4', '{"action":"logout","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 19:26:22.985006+00', ''), - ('00000000-0000-0000-0000-000000000000', '48283387-a701-419b-8525-3d3e11d387ee', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:26:27.289755+00', ''), - ('00000000-0000-0000-0000-000000000000', '129d1d3e-8743-4f62-8d33-2758d8995855', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 19:26:32.907979+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a2b8804d-d3e1-4228-a9b7-2f095d57d244', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:26:35.995866+00', ''), - ('00000000-0000-0000-0000-000000000000', '08b7dbcb-9575-40ab-8be0-2806c3dca286', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 19:26:39.764489+00', ''), - ('00000000-0000-0000-0000-000000000000', '9dd5625c-ddf9-4324-bb7a-edd1c5908e5b', '{"action":"login","actor_id":"93ac96ab-d9d7-422b-81de-ae2fd4449fe3","actor_name":"Terapeuta 2","actor_username":"therapist2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:34:31.720489+00', ''), - ('00000000-0000-0000-0000-000000000000', '0e2899f6-9a1c-4aa1-8e10-0c6b54358efb', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 19:41:13.319235+00', ''), - ('00000000-0000-0000-0000-000000000000', '554413a2-d008-4d2a-84e9-c8f9addb6434', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 20:25:22.112707+00', ''), - ('00000000-0000-0000-0000-000000000000', '36b32715-109f-4063-931f-a12641db7688', '{"action":"logout","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 20:25:23.874349+00', ''), - ('00000000-0000-0000-0000-000000000000', '2d40034d-3d16-450a-ba45-d5275a204416', '{"action":"login","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 20:25:27.617975+00', ''), - ('00000000-0000-0000-0000-000000000000', '0e2a2b0a-16c8-4e20-a692-bd282101fa1b', '{"action":"login","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 20:58:03.014899+00', ''), - ('00000000-0000-0000-0000-000000000000', '30f68994-d2c3-44bc-b0f0-6a28a2f21021', '{"action":"token_refreshed","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 21:25:31.634679+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4f8ff09-c6a7-4c3d-a9d4-e72cd12f8a71', '{"action":"token_revoked","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 21:25:31.636369+00', ''), - ('00000000-0000-0000-0000-000000000000', '0bcdd36b-f820-4556-aa4f-9bca7e9cedbf', '{"action":"logout","actor_id":"40a4b683-a0c9-4890-a201-20faf41fca06","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-03 22:12:27.241752+00', ''), - ('00000000-0000-0000-0000-000000000000', '39ca0111-6e3a-49b3-a6b3-089eafce99d7', '{"action":"login","actor_id":"816b24fe-a0c3-4409-b79b-c6c0a6935d03","actor_name":"Clinica Teste","actor_username":"clinic@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-03 22:12:30.698162+00', ''), - ('00000000-0000-0000-0000-000000000000', '309dbddf-9e04-4862-8b6e-64951ac03136', '{"action":"token_refreshed","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 22:24:52.430099+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ac861dce-b2d1-44e7-95d3-8e0684f8d1e3', '{"action":"token_revoked","actor_id":"824f125c-55bb-40f5-a8c4-7a33618b91c7","actor_username":"therapist@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-03 22:24:52.458818+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e53b7772-ecde-498f-9a42-665505a7ae24', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:38.0028+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cd06d3e2-3a9b-46fc-b328-fb47a0282dc9', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:48.184382+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f489940d-72f2-4fdc-8aa4-75704d679bb5', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:48.302972+00', ''), - ('00000000-0000-0000-0000-000000000000', '51fa9f9d-51a4-4bea-8cd7-29ce52638b27', '{"action":"login","actor_id":"aaaaaaaa-0003-0003-0003-000000000003","actor_username":"clinica1@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:48.404986+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b1c91ef0-9f2b-47ab-951f-97b76167071e', '{"action":"login","actor_id":"aaaaaaaa-0004-0004-0004-000000000004","actor_username":"clinica2@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:48.503548+00', ''), - ('00000000-0000-0000-0000-000000000000', 'cdadf972-422d-490b-8709-32375f6eb9c7', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:48.615085+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ca548791-f1cb-4bbd-a729-cabc3dba0c5a', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:41:48.711987+00', ''), - ('00000000-0000-0000-0000-000000000000', '5273b48b-f50b-4a9b-8d29-be933a593bde', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:42:05.72076+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ddb27ea8-ef83-4335-a1c0-a4630ba2bc30', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 02:42:10.114726+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eb2f1477-f2da-4c7d-b9fc-bcc7b51931fc', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:43:09.947101+00', ''), - ('00000000-0000-0000-0000-000000000000', '38408946-984c-4212-9e72-020b8e83d895', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 02:43:12.495671+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e05b5e03-3e0e-4fab-9db5-e394b4fcd027', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 02:43:17.671671+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6a55d8a-9a78-498a-92c5-172c960dbfa3', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 02:43:20.719518+00', ''), - ('00000000-0000-0000-0000-000000000000', '54accf1e-76e6-4416-82e4-20b324c98778', '{"action":"user_recovery_requested","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-03-04 02:49:22.880271+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aeebc6c3-444a-4aea-bcbf-d0f32a5458b6', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 03:02:27.926263+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b8608577-6f42-4eb2-952d-0519b62b8fcc', '{"action":"user_recovery_requested","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-03-04 03:02:38.355161+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f47b5738-6836-4af6-91d6-2c0d1dbcf625', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 03:04:59.62038+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bd5dda17-4064-43fa-a09f-17951bd39fb4', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 03:05:01.501546+00', ''), - ('00000000-0000-0000-0000-000000000000', '924dd94b-d280-4341-bf95-615589ec3ea3', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 03:16:35.424593+00', ''), - ('00000000-0000-0000-0000-000000000000', '27579058-c4e8-4dbd-9819-e2f4ffa4e2a6', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 03:16:37.266938+00', ''), - ('00000000-0000-0000-0000-000000000000', '457b13ae-aa50-4e36-9714-d8f3c42d6088', '{"action":"user_modified","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"user"}', '2026-03-04 03:17:57.516404+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b71c3176-213e-4886-86d0-c65c86c79a0a', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 03:19:13.57808+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eeb586ac-a854-405c-8e3e-9e168bd64a8c', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 03:19:15.158422+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a8c15e34-ae37-4c7b-8f48-7d4e07bfc947', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 04:33:17.943416+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c41d25a6-5112-4690-8fba-9c936e4d81b3', '{"action":"token_revoked","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 04:33:17.960736+00', ''), - ('00000000-0000-0000-0000-000000000000', '069145ae-4c4a-4265-8de5-0fc3f83c7acd', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 04:33:33.827384+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e770613f-d7fe-4f3e-9599-5ba908b84707', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 04:33:35.365849+00', ''), - ('00000000-0000-0000-0000-000000000000', '7c844441-cda7-4bec-ac4c-ca504521ecfe', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 04:33:52.432914+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b19e8616-0c9c-4e02-bc2f-5686a4beffa9', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 04:33:53.977161+00', ''), - ('00000000-0000-0000-0000-000000000000', '67422472-6059-4e4d-9165-c9a41cfa8c3f', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 10:06:56.344466+00', ''), - ('00000000-0000-0000-0000-000000000000', '35be386f-ca01-4d48-a8ee-019831272b1e', '{"action":"token_revoked","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 10:06:56.366945+00', ''), - ('00000000-0000-0000-0000-000000000000', '4072bf1e-83cd-419b-883a-2e4a44ed07d9', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 10:12:18.864916+00', ''), - ('00000000-0000-0000-0000-000000000000', '04e69f1d-1cef-4c9e-a670-80f6b83eae9c', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 10:12:29.668071+00', ''), - ('00000000-0000-0000-0000-000000000000', '2da42f24-096d-415f-91c9-df7cbf2f53f2', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 10:14:10.256401+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f789d2e1-2889-450f-856c-31ff809083ef', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 10:14:15.152156+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e043f174-a7ab-49e6-aa7e-e15d107b02e5', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 10:17:22.72875+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ebac653-f865-41e3-8f0c-3b03b6b7b9d7', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 10:17:25.416384+00', ''), - ('00000000-0000-0000-0000-000000000000', '663e707a-dffd-4857-b96d-a28aa47da2e1', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 11:03:29.784379+00', ''), - ('00000000-0000-0000-0000-000000000000', '085c5fc9-3cd8-471b-9cbb-ebe6a09a6abf', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 11:03:31.547854+00', ''), - ('00000000-0000-0000-0000-000000000000', '5091d29e-82a0-4645-a618-f55e322a87bf', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 12:02:27.545134+00', ''), - ('00000000-0000-0000-0000-000000000000', '62c4128f-6b63-43a8-9977-a1871ed82953', '{"action":"token_revoked","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 12:02:27.546629+00', ''), - ('00000000-0000-0000-0000-000000000000', '47e15e76-33a8-4623-844a-805037a47acf', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 12:35:30.078034+00', ''), - ('00000000-0000-0000-0000-000000000000', '80c75a13-b19c-4d97-931b-f58793341fd7', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 12:35:49.229853+00', ''), - ('00000000-0000-0000-0000-000000000000', '2048e22c-f8e1-404c-8f6a-c31a64888ed3', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 15:07:00.907129+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a824180b-5905-4be2-9af1-76456c967fca', '{"action":"token_revoked","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 15:07:00.917006+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8a5a933-2037-416f-93bc-c0fc2353b49f', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:01:08.490509+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c5a75f91-b8a4-4909-a86e-0ab3978fcdd4', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:01:44.809266+00', ''), - ('00000000-0000-0000-0000-000000000000', '7a11d97c-a02f-4634-a1a8-15b6e65fd872', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:01:54.960672+00', ''), - ('00000000-0000-0000-0000-000000000000', '22b8e1b2-c4dd-4ab9-b204-a6de7761954d', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:23:09.169799+00', ''), - ('00000000-0000-0000-0000-000000000000', '4781ded2-ff29-4a72-b009-1013ca78a561', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:25:15.298632+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c922298f-ae07-4d98-8b0c-96051fef4402', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 16:25:19.453569+00', ''), - ('00000000-0000-0000-0000-000000000000', '58e492be-475a-49fc-a2ce-7abd42f95087', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:58:58.444164+00', ''), - ('00000000-0000-0000-0000-000000000000', '9583096e-c3dd-4818-9409-a3367396bf18', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 16:59:01.261697+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ce3dcfad-0c51-4436-a428-b7414c852917', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 16:59:19.908917+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f11fa2b-86f5-4803-aa67-116dc5ac6e03', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 16:59:29.438994+00', ''), - ('00000000-0000-0000-0000-000000000000', '1454bcef-d7b7-4da0-95fb-9ec33a57437c', '{"action":"login","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:02:41.461736+00', ''), - ('00000000-0000-0000-0000-000000000000', '789ec04b-cfd8-48ac-bd75-99d1d40cd112', '{"action":"logout","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:02:45.213812+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c7a6bf45-60f7-4e0c-b7a9-d64dfe72571e', '{"action":"login","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:02:50.860191+00', ''), - ('00000000-0000-0000-0000-000000000000', '7f5fe823-ad36-48e8-a65e-7d89bbbee9f0', '{"action":"logout","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:02:57.867694+00', ''), - ('00000000-0000-0000-0000-000000000000', '2615a8ca-65c2-4399-985b-93c410ed78c8', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:03:12.134508+00', ''), - ('00000000-0000-0000-0000-000000000000', '8698944d-5644-4c12-b843-ee2ae898ee37', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:03:34.598481+00', ''), - ('00000000-0000-0000-0000-000000000000', '0d2f2a7a-92e9-4490-9706-309a6945315c', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:03:40.003109+00', ''), - ('00000000-0000-0000-0000-000000000000', '1ab3bf18-da11-45a8-8ed5-1ff6141e7b77', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:03:59.444781+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd9c383b1-cd70-4c97-81c9-310fbc25372d', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:04:04.307236+00', ''), - ('00000000-0000-0000-0000-000000000000', '6b801a5d-4c13-4dd6-b16e-f0c163dc912a', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:24:20.026354+00', ''), - ('00000000-0000-0000-0000-000000000000', '484ff838-4e27-40e9-96e1-54a7c7d7f828', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:24:24.302588+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f93f48f6-317d-4da8-90fa-e354d2079922', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:25:02.439105+00', ''), - ('00000000-0000-0000-0000-000000000000', '4348c91b-9bbe-4325-b9d4-e545f3dc91a6', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:25:07.522916+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aa644a34-e8f9-4d61-b1c0-38281388c0a9', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:25:15.530218+00', ''), - ('00000000-0000-0000-0000-000000000000', '3b3fb390-0b42-4959-9597-9a9b7d22e144', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:25:19.031705+00', ''), - ('00000000-0000-0000-0000-000000000000', '2b629256-5052-4c4a-ad11-a03f4db8ac0d', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:25:44.305627+00', ''), - ('00000000-0000-0000-0000-000000000000', '5f101cf8-49ba-4736-9f4f-ad668cf23b2f', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:25:46.008754+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a16e7cce-b820-4e16-b902-134b9a9c8d92', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:25:48.274667+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c2901803-5508-4868-8ba0-513e72ca270d', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:25:52.363204+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ab9ad97c-d5a3-4f19-a6b3-e6ccd35ea4e4', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:31:01.393925+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1d9db72-003c-4a0b-8ec0-92e1d04f20c8', '{"action":"login","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:31:09.768742+00', ''), - ('00000000-0000-0000-0000-000000000000', '41a75c88-36e8-40f6-a27e-461f7f9ec645', '{"action":"logout","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:31:13.6896+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e68c3e2-b3fc-4c30-95f8-e0d624f08d89', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:31:43.956535+00', ''), - ('00000000-0000-0000-0000-000000000000', '9c1d5868-7f29-41eb-9568-8ea77c5a3a1c', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:31:52.433306+00', ''), - ('00000000-0000-0000-0000-000000000000', '65e4039c-0470-41f4-8d8e-730e56e880d9', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:31:58.445183+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ed1c1aae-8f16-4b0c-aa21-7bfdf539ca3a', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:32:03.518528+00', ''), - ('00000000-0000-0000-0000-000000000000', '97334c85-9ded-44aa-8e38-0e0422cab977', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:33:07.526517+00', ''), - ('00000000-0000-0000-0000-000000000000', '4822a80a-af0d-4782-be06-27e79afe0da5', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:33:11.416367+00', ''), - ('00000000-0000-0000-0000-000000000000', '4d6fbf0f-a9e9-40e8-a783-add461690ce3', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 17:33:22.33534+00', ''), - ('00000000-0000-0000-0000-000000000000', '5eb9d023-ef5b-4024-9914-6b904f01cd6d', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 17:33:26.172182+00', ''), - ('00000000-0000-0000-0000-000000000000', '0c760bec-b6ec-4fbe-a98e-7f2a1ac2e413', '{"action":"login","actor_id":"aaaaaaaa-0011-0011-0011-000000000011","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 19:40:22.60634+00', ''), - ('00000000-0000-0000-0000-000000000000', '831cf980-5522-4c4d-9bf0-7e0935c3add8', '{"action":"logout","actor_id":"aaaaaaaa-0011-0011-0011-000000000011","actor_username":"secretary@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 19:42:35.3752+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a54b679f-e1bc-4c77-a1dd-69712ce40063', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 19:42:41.259044+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3775973-98dd-4db5-b3e5-4d3a3e781647', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 19:55:13.021164+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a50476e2-8b8b-4c13-bee4-49a203a71a82', '{"action":"login","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 19:55:19.668684+00', ''), - ('00000000-0000-0000-0000-000000000000', '55110eb7-b71d-49b5-a337-430654d97ec6', '{"action":"logout","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 20:05:33.813715+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aeb7c71a-cd74-404c-9853-5f1a9700ef06', '{"action":"login","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 20:05:36.610905+00', ''), - ('00000000-0000-0000-0000-000000000000', '4442eba4-0edd-4ee4-a537-fa99aad9a514', '{"action":"logout","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 20:06:40.529401+00', ''), - ('00000000-0000-0000-0000-000000000000', '87b7c25b-efe6-4251-a1b1-2077eb4a187c', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 20:06:55.817888+00', ''), - ('00000000-0000-0000-0000-000000000000', '94b79280-64f4-441e-9c85-fd057f531614', '{"action":"logout","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 20:07:00.093868+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d53bf1c-2276-4c08-8740-d72671690114', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 20:07:01.824568+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2bf2d02-358a-4988-bc6e-762eb404b935', '{"action":"logout","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 20:07:05.280198+00', ''), - ('00000000-0000-0000-0000-000000000000', '7ec6fdec-21aa-431a-9f39-4c0f7fee2ac7', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 20:07:11.901975+00', ''), - ('00000000-0000-0000-0000-000000000000', '9c950175-667d-410b-becf-89c80d295ea3', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 23:41:26.625246+00', ''), - ('00000000-0000-0000-0000-000000000000', '22befc41-8e27-4931-93aa-65781373d918', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-04 23:41:26.631046+00', ''), - ('00000000-0000-0000-0000-000000000000', '1095844b-7140-485c-8412-9a82a5a90cb2', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:41:44.165071+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a00201b7-5133-4f06-8ea2-af82febc836e', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:42:10.05407+00', ''), - ('00000000-0000-0000-0000-000000000000', '548706a7-7eb1-4cf6-b784-6e8d0ffe5657', '{"action":"logout","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:45:08.915382+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6cfb44d-600f-4c31-8a97-1ee9ad92bc3a', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:45:13.501367+00', ''), - ('00000000-0000-0000-0000-000000000000', '57e043fa-aa1d-49e9-a7f4-d81a960f4f35', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:45:58.74416+00', ''), - ('00000000-0000-0000-0000-000000000000', '9f3a41d6-b6e5-4147-80b7-3c8bf08dbd92', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:46:02.744136+00', ''), - ('00000000-0000-0000-0000-000000000000', '2c130d46-a151-4215-99e6-e9140a3e52fb', '{"action":"logout","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:47:06.140464+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fe826cf2-3033-433e-87c7-a21a3a989b89', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:47:10.760866+00', ''), - ('00000000-0000-0000-0000-000000000000', '4367d373-97a9-49eb-bde7-1865e90d336d', '{"action":"logout","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:47:47.987798+00', ''), - ('00000000-0000-0000-0000-000000000000', '05c7dcd7-f05f-4ec8-bd4e-a2084df6b84e', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:47:52.530848+00', ''), - ('00000000-0000-0000-0000-000000000000', '70afd0a2-0f05-4b94-8ead-3340c5afdc22', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:47:54.945367+00', ''), - ('00000000-0000-0000-0000-000000000000', '2ec0f98d-59fa-4e0c-9e61-eb67eee80356', '{"action":"login","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:47:58.781785+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd47da344-bd6d-4570-bbdd-4acbde790d3c', '{"action":"logout","actor_id":"aaaaaaaa-0001-0001-0001-000000000001","actor_username":"paciente@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:49:51.073061+00', ''), - ('00000000-0000-0000-0000-000000000000', '5204deaa-8803-4f43-a917-a3fa907d75c0', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:49:58.920671+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b265d3b2-009e-4a59-b6f0-f8adb9902948', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:50:03.629185+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e83dc7e-a94c-4e43-a582-65174af00947', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:50:07.332142+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bef618a6-f988-4543-9d08-17ee8601a08b', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:50:50.111388+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a4e70ed2-8088-4b56-92c5-645d1d92fd27', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:50:54.188996+00', ''), - ('00000000-0000-0000-0000-000000000000', '60cb71e7-6647-425f-b695-21ed7598daa1', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:53:15.025198+00', ''), - ('00000000-0000-0000-0000-000000000000', '44cf704a-d087-41ab-b68d-bcf5d4438273', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:53:19.117295+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c04c111f-1743-4d10-84b9-05119f891198', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:53:34.643401+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a817116-df66-4ea1-9c3d-f0642a044a46', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:53:39.52857+00', ''), - ('00000000-0000-0000-0000-000000000000', '53ba7d18-cccf-4077-b95e-90a055735cb7', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-04 23:56:00.429686+00', ''), - ('00000000-0000-0000-0000-000000000000', 'aa9fd694-49e6-4f43-b153-07819de92b73', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-04 23:56:03.494841+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6374add-5f08-41ac-a83e-524ecfa8a1e3', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 00:18:07.78462+00', ''), - ('00000000-0000-0000-0000-000000000000', '012b4625-eadf-4436-95ba-332145ef8b1f', '{"action":"login","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 00:18:12.579449+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c4a263d5-9187-47f7-8abd-3060aad16027', '{"action":"logout","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 00:20:15.40936+00', ''), - ('00000000-0000-0000-0000-000000000000', '4a8c855b-6429-4884-8d7d-827afe6ab27c', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 00:20:19.983643+00', ''), - ('00000000-0000-0000-0000-000000000000', '54050392-3d12-4df3-8a00-d9bd0ae3eed5', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 00:29:08.803551+00', ''), - ('00000000-0000-0000-0000-000000000000', '3d6f5900-24fa-463f-9397-e9ef28ab6cd4', '{"action":"login","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 00:29:35.02273+00', ''), - ('00000000-0000-0000-0000-000000000000', '7b733d8e-0f5f-49ad-992b-e5403c6926ad', '{"action":"logout","actor_id":"aaaaaaaa-0008-0008-0008-000000000008","actor_username":"editor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 00:55:06.04362+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e61fba95-309c-472b-8e50-8050ff289955', '{"action":"login","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 00:55:14.985811+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ff3363dd-9e01-4dd3-9c40-6e73b7ce9e57', '{"action":"logout","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 00:55:29.424544+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b03413bd-5955-451e-a493-91b6dcaed324', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 00:55:40.654808+00', ''), - ('00000000-0000-0000-0000-000000000000', '23f61c92-1c48-4d4f-8e2a-c31ccdad1add', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 01:15:55.985109+00', ''), - ('00000000-0000-0000-0000-000000000000', '6b3325a5-293e-49dd-b30f-559a1ddd56ed', '{"action":"login","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 01:15:59.907249+00', ''), - ('00000000-0000-0000-0000-000000000000', '25e5fc48-a3d0-443f-8bf4-6bbd95b99bfe', '{"action":"logout","actor_id":"aaaaaaaa-0007-0007-0007-000000000007","actor_username":"supervisor@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 01:16:28.564056+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e31e28f-590d-40aa-b2ea-ee4f6a8d32ef', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 01:17:49.383694+00', ''), - ('00000000-0000-0000-0000-000000000000', '8d098de1-f782-4ebb-83bd-af8098f4705c', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 01:26:56.644417+00', ''), - ('00000000-0000-0000-0000-000000000000', '8634cbf0-c002-4e04-9633-2850737a48a4', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 01:27:29.709467+00', ''), - ('00000000-0000-0000-0000-000000000000', '8c37ef39-6a4e-44fa-9dce-9d3850a77168', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 01:27:56.206473+00', ''), - ('00000000-0000-0000-0000-000000000000', '415d96ba-8982-4326-ad62-7affe738031b', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 01:28:16.667864+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dc6c16bc-bfbb-44c4-b23b-1fb59bb5057b', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 02:37:43.022909+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd0df36b7-d1b3-49eb-9d9d-47c5aa11f2f6', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 02:37:43.024229+00', ''), - ('00000000-0000-0000-0000-000000000000', '28dbadea-d7a4-4c52-8856-2e4db5f0c27b', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 10:18:29.735555+00', ''), - ('00000000-0000-0000-0000-000000000000', '502656bd-dcc2-415f-bb0e-57a6dd7bde05', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 10:18:29.749107+00', ''), - ('00000000-0000-0000-0000-000000000000', '90c565e0-c50f-4c27-a5cb-a50df69d3926', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 11:16:33.563056+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9e4a9a7-8b68-4e08-81e8-bd171a513065', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 11:16:33.573485+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6d9f407-9c71-46bd-9e60-169a114c7c14', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 12:14:59.301987+00', ''), - ('00000000-0000-0000-0000-000000000000', '97f03158-8018-4e18-be7a-d0adbe2f80a7', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 12:14:59.30411+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e580593c-6541-48ed-a828-8797be0a3122', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 13:15:03.467978+00', ''), - ('00000000-0000-0000-0000-000000000000', '71879e3e-37cd-43e5-a082-c8bdb0d241bc', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 13:15:03.471719+00', ''), - ('00000000-0000-0000-0000-000000000000', '631446d9-54a1-4dfd-ac20-71bd68153e86', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 14:14:51.055942+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f602ac2-edc1-49e9-8ee8-ec8bc751413c', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 14:14:51.067052+00', ''), - ('00000000-0000-0000-0000-000000000000', '780fc612-caab-40e8-913a-c62b9d53e93d', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 15:13:17.637095+00', ''), - ('00000000-0000-0000-0000-000000000000', 'db143659-cd6d-4ec6-ac88-1ffd6d93bf7f', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 15:13:17.638152+00', ''), - ('00000000-0000-0000-0000-000000000000', '270585b8-3815-43ed-91fc-d8961e935c2d', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 16:11:29.646589+00', ''), - ('00000000-0000-0000-0000-000000000000', '5db5dacc-404e-47db-8baa-7d3b441e2c57', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 16:11:29.650704+00', ''), - ('00000000-0000-0000-0000-000000000000', '594c1acc-49a1-4d41-96a2-f0a46dc18824', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 17:10:30.975452+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae3b8797-0bab-444b-9693-60672aca8f44', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 17:10:30.997114+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bc64c7ff-b46e-49ef-b331-d78a997b0e1e', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 18:09:04.159021+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eb483677-2955-43b1-a277-e502acd57761', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 18:09:04.16057+00', ''), - ('00000000-0000-0000-0000-000000000000', '554963c6-9236-4f12-8b6a-686cddcdefe5', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 19:07:37.418342+00', ''), - ('00000000-0000-0000-0000-000000000000', '099edcf2-86e0-4157-992c-1c38876b30f3', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 19:07:37.419833+00', ''), - ('00000000-0000-0000-0000-000000000000', '899b47e1-6b3e-4bf2-91d5-b2db29848ac5', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-05 19:26:57.695289+00', ''), - ('00000000-0000-0000-0000-000000000000', '3945fd81-9a52-48a4-b2c4-a961e3d63743', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-05 19:26:59.104599+00', ''), - ('00000000-0000-0000-0000-000000000000', '693adef8-245f-4f21-9b4e-a9e30e354dee', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 23:14:29.283618+00', ''), - ('00000000-0000-0000-0000-000000000000', '852b7932-691f-4a95-b9a7-fda1278b6e21', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-05 23:14:29.290393+00', ''), - ('00000000-0000-0000-0000-000000000000', '5f9eeef4-fa7a-4a5f-b33c-4db0f5fb6912', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 00:12:48.125268+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a6983d12-2c28-464f-a624-0f21b392724f', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 00:12:48.128205+00', ''), - ('00000000-0000-0000-0000-000000000000', '4937d2ab-3688-4b34-b883-04c700e2d199', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 01:13:05.985232+00', ''), - ('00000000-0000-0000-0000-000000000000', 'bbc1d9b3-4319-4da7-bddd-3375551b04a6', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 01:13:05.987464+00', ''), - ('00000000-0000-0000-0000-000000000000', '8f50dd92-51fb-4103-bcbe-706520e8646a', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 02:13:08.038749+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f7ec9312-bb9c-4336-8e3f-15756171ba84', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 02:13:08.041342+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ccd04687-304a-43df-9106-ee1fe7b11ce8', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 02:52:40.033489+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a2dffd7f-6776-4af3-809e-742c20384e94', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 02:52:47.628867+00', ''), - ('00000000-0000-0000-0000-000000000000', '73a508e7-f616-4afe-8269-b464aaaf9d73', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 02:52:49.578679+00', ''), - ('00000000-0000-0000-0000-000000000000', '604d2e2c-41ac-4a7f-8880-3307b6e6e165', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 02:52:56.401429+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af5c67eb-c073-4426-8a45-4dab384fd9ee', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 02:53:05.920536+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd81964f7-f57f-490e-abe6-8e614b3e4ad4', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 02:53:11.815169+00', ''), - ('00000000-0000-0000-0000-000000000000', '6a9e180d-2d78-402e-addf-28579640f9d1', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 02:54:35.151828+00', ''), - ('00000000-0000-0000-0000-000000000000', 'af6d249b-05c6-44f0-89c5-acbf71dec791', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 02:54:39.603503+00', ''), - ('00000000-0000-0000-0000-000000000000', '6132d58b-5a1c-48c1-bedf-1cac30551b44', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 02:55:44.286585+00', ''), - ('00000000-0000-0000-0000-000000000000', '822181e7-22d6-493f-9088-33a5f64e2523', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 02:55:50.848408+00', ''), - ('00000000-0000-0000-0000-000000000000', '7559f256-0576-47ea-9f09-622e1e920177', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 09:39:34.303149+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f32a70e4-8ed8-4d41-a55f-26743a7e4e68', '{"action":"token_revoked","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 09:39:34.308249+00', ''), - ('00000000-0000-0000-0000-000000000000', '13830322-e52b-4cb3-ba21-b4ae28df6d76', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 09:39:57.440216+00', ''), - ('00000000-0000-0000-0000-000000000000', '20db5fa8-19b8-4d26-9348-534fc6bb8c81', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 09:40:03.751488+00', ''), - ('00000000-0000-0000-0000-000000000000', '18c5c859-2f27-4d54-b6ae-f95495d4e8eb', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 10:08:40.678365+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f4f907a2-ee24-4882-a95a-2dcf066cf0da', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 10:08:45.247117+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e2eb4c4e-e4b5-4305-9f43-e8751b46c8fe', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 10:13:04.934486+00', ''), - ('00000000-0000-0000-0000-000000000000', '568123c8-974d-4f7c-b218-4a10b27bf205', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 10:13:09.549339+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e01b3e07-46c3-4302-bd84-a7ceb00b7d8f', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 10:24:21.665904+00', ''), - ('00000000-0000-0000-0000-000000000000', '7ad1caff-83c7-490b-9ea9-e46a76c01ba6', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 10:24:26.514559+00', ''), - ('00000000-0000-0000-0000-000000000000', '77a513b8-0fe3-46ab-a740-0c39fe7081e7', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 10:33:16.258109+00', ''), - ('00000000-0000-0000-0000-000000000000', '306f36db-cdc8-4bfc-b74e-d100a3987651', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 10:33:20.421549+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a46ad44c-296f-430a-9a80-9a5e1abce5f3', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 10:35:54.852603+00', ''), - ('00000000-0000-0000-0000-000000000000', '43cfdf6b-53ea-4bf3-80dc-ae1a79476794', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 10:36:05.661899+00', ''), - ('00000000-0000-0000-0000-000000000000', '9713c966-773c-4c27-9d1e-d5ac64adcc5c', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 10:52:58.017442+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ff790455-5630-4540-875c-883b2a6b2afa', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 10:53:01.853459+00', ''), - ('00000000-0000-0000-0000-000000000000', '4bff2cdc-68ee-4f0a-a8a4-5cd0a56b8ea0', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:02:14.097648+00', ''), - ('00000000-0000-0000-0000-000000000000', '2092ae7f-4b3a-48d9-a1b7-3d24ff6feb51', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:02:21.563959+00', ''), - ('00000000-0000-0000-0000-000000000000', '6cc8b951-0bde-4ecf-a91a-b1e8dd28c7ff', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:06:16.516485+00', ''), - ('00000000-0000-0000-0000-000000000000', '08ea4d88-bab0-45fa-a1be-1754b15966be', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:06:20.894516+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd5c25908-9f6d-4e7f-bc36-0f9e52dcfe25', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:06:52.809235+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd6a6efcf-2ce5-4fd2-8388-dbad794376de', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:06:56.154711+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f369f83d-1761-4e12-b699-e320555aae74', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:12:13.027754+00', ''), - ('00000000-0000-0000-0000-000000000000', '385da3f0-8387-4191-b62a-24a9f3f4f685', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:12:20.3665+00', ''), - ('00000000-0000-0000-0000-000000000000', 'fba24172-2be5-4e61-992e-54b97b8f04dd', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:14:18.46917+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e2bf079e-c9ba-47cb-83cd-7cf1205b1f25', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:14:24.51527+00', ''), - ('00000000-0000-0000-0000-000000000000', '3cdc98f2-8688-4b9e-afd3-5f525ad04b10', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:30:23.629023+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c39d4083-0aed-460a-b7a1-7dcc5b43b9c2', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:30:27.972331+00', ''), - ('00000000-0000-0000-0000-000000000000', '1baec019-34cb-467c-bf07-81da6ff33710', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:31:00.673027+00', ''), - ('00000000-0000-0000-0000-000000000000', '9e491e30-6664-4116-adff-2d1b6389e65f', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:31:06.32495+00', ''), - ('00000000-0000-0000-0000-000000000000', '75d5c7d7-5b8f-4b24-a3d5-fe0b96d0eb6d', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:40:45.170851+00', ''), - ('00000000-0000-0000-0000-000000000000', '1f7eb3b2-c35d-496a-876d-cb683b6d2670', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:40:49.394703+00', ''), - ('00000000-0000-0000-0000-000000000000', 'df5c26af-029a-41dc-bf0c-a8f122f4fbea', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 11:47:11.661424+00', ''), - ('00000000-0000-0000-0000-000000000000', '7def0827-543c-4aa1-b625-67907f4bbad6', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 11:47:34.377275+00', ''), - ('00000000-0000-0000-0000-000000000000', '0540c6a8-8fc6-465f-8be8-a74602c17315', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 12:50:40.198013+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3e7ddf8-563d-44be-9851-00a009996071', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 12:50:40.20124+00', ''), - ('00000000-0000-0000-0000-000000000000', 'eab51f4f-bdc8-47e5-af40-487535a60122', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 14:13:09.768437+00', ''), - ('00000000-0000-0000-0000-000000000000', '734ce988-091c-482b-bd02-962010d654eb', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 14:13:09.769648+00', ''), - ('00000000-0000-0000-0000-000000000000', '71f8ab88-0304-412c-8430-839c665c79d0', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 14:39:49.013259+00', ''), - ('00000000-0000-0000-0000-000000000000', '40170695-aa26-4149-b5eb-3d811c231d94', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 14:40:00.268392+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c3357fda-5932-4cda-8265-f0e878576d69', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 15:38:26.921398+00', ''), - ('00000000-0000-0000-0000-000000000000', '5d2ad55e-ab14-492f-9b36-a06ff70784e0', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 15:38:26.922605+00', ''), - ('00000000-0000-0000-0000-000000000000', 'dd14eb08-30d1-4218-b353-c0f6ce884f4c', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 17:02:20.51497+00', ''), - ('00000000-0000-0000-0000-000000000000', '45b313bc-851c-45ba-bffa-c45c63a689c2', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 17:02:20.515966+00', ''), - ('00000000-0000-0000-0000-000000000000', '4cd88f56-3b7a-4b4b-9988-62d2f2f1ec50', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 17:28:13.450304+00', ''), - ('00000000-0000-0000-0000-000000000000', '2223e4ab-756d-49f3-adcf-7aaec6299302', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 17:28:18.874916+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c6f88323-f15c-4c40-ad57-89e26380a605', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 17:29:11.828754+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e30f933-4770-4163-9f88-6c90983ab170', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 17:29:13.819487+00', ''), - ('00000000-0000-0000-0000-000000000000', '49a358ed-09f6-46b8-8a09-0bf35cbc5ea0', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-06 17:44:04.422545+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f59cc97d-d87b-4ceb-8a44-7e35581816fb', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-06 17:44:10.165639+00', ''), - ('00000000-0000-0000-0000-000000000000', '6c42d8d5-87a0-4085-b58e-969c138016c3', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 22:15:39.766513+00', ''), - ('00000000-0000-0000-0000-000000000000', '4e41a1f5-affd-4e49-864e-543ea1ec9461', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-06 22:15:39.772958+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ac8cff9f-409e-49fc-9b39-4f1ce0dab511', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-07 01:43:33.135289+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b0ba1021-d5bd-413d-a4d8-c1a373ebbd78', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-07 01:43:33.138473+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a5205f11-f69c-42f2-a63b-95da513186ec', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-07 11:36:16.609709+00', ''), - ('00000000-0000-0000-0000-000000000000', '56537283-2309-4aea-983a-74754fcb78e7', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-07 11:36:16.630978+00', ''), - ('00000000-0000-0000-0000-000000000000', '9bf73b65-f70a-4dff-836b-eaab64bbe02f', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-07 11:58:43.765837+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a665360f-0e2c-4f94-a2a8-acd5372b5996', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-07 11:58:48.557821+00', ''), - ('00000000-0000-0000-0000-000000000000', '8e602772-aba8-4850-bfcb-2892db0514af', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-07 12:22:59.82665+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b6094beb-5099-41fa-8977-83a8b0b08c7c', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-07 12:23:03.701871+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b84f978c-2ff4-4d95-9015-eb2af13dd462', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-07 23:47:44.020021+00', ''), - ('00000000-0000-0000-0000-000000000000', '66df0118-8981-408c-a0bb-4d2ef1dadbf1', '{"action":"token_revoked","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-07 23:47:44.034096+00', ''), - ('00000000-0000-0000-0000-000000000000', 'e62a2c78-bff5-444a-8d7d-ba5db1aa3f04', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-07 23:59:44.581133+00', ''), - ('00000000-0000-0000-0000-000000000000', '6152b522-1e2a-44b6-9a63-f2c0711c6527', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-07 23:59:49.142815+00', ''), - ('00000000-0000-0000-0000-000000000000', '45f64df3-bd6d-48ca-8ed1-8ce218cd24d4', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 00:11:45.570713+00', ''), - ('00000000-0000-0000-0000-000000000000', '3afa780b-573a-4053-8d1c-88873648de7b', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 00:11:50.903797+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a319aeaf-efef-47d6-ba48-bd051894d099', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 00:57:08.192178+00', ''), - ('00000000-0000-0000-0000-000000000000', '988d70e8-b3f1-4b66-95ec-1311c6b07070', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 00:57:11.888591+00', ''), - ('00000000-0000-0000-0000-000000000000', '58655838-64c7-45e0-971b-de6bb1b4a2c7', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:01:15.862222+00', ''), - ('00000000-0000-0000-0000-000000000000', '801af629-1ffb-4284-a390-9cf6da548127', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:01:24.944488+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9b04ee8-b114-4acb-8f0a-cd2c777b83c5', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:33:51.549249+00', ''), - ('00000000-0000-0000-0000-000000000000', '68945cbd-2c01-4093-97ac-152539d919bc', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:34:02.803539+00', ''), - ('00000000-0000-0000-0000-000000000000', '89330b74-399c-4510-a2e0-7509fe19f36a', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:36:21.461288+00', ''), - ('00000000-0000-0000-0000-000000000000', 'df459094-82c1-43a9-960f-d3827a662069', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:36:25.13264+00', ''), - ('00000000-0000-0000-0000-000000000000', '623e9a7c-dcec-488f-9ac4-a8f95c3ecacd', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:36:52.308983+00', ''), - ('00000000-0000-0000-0000-000000000000', '7e355e8d-2975-467d-916f-edbdcd632f5c', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:36:55.962855+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd10638f1-3810-4831-b169-e7a35f490ecd', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:43:08.550195+00', ''), - ('00000000-0000-0000-0000-000000000000', '9af38dea-327a-49b0-82f1-f31c3ddaf0f8', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:43:11.584162+00', ''), - ('00000000-0000-0000-0000-000000000000', '3f10df3b-18ad-48cc-8ed9-9a46e830edd9', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:43:19.362395+00', ''), - ('00000000-0000-0000-0000-000000000000', '63c61fce-c992-443e-800b-765eb74f236c', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:43:23.323956+00', ''), - ('00000000-0000-0000-0000-000000000000', '5e70ae13-7d4e-4fc7-a7ad-77d5fefdbfec', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:43:43.786859+00', ''), - ('00000000-0000-0000-0000-000000000000', '948c18b9-0fef-47fd-8909-c9458c9c64a0', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:43:47.692969+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd668db87-66a4-4a13-bdee-e6a5ded7124f', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:43:50.295887+00', ''), - ('00000000-0000-0000-0000-000000000000', '160d70e5-aa7a-4db9-963f-f5911c992b86', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:43:53.456256+00', ''), - ('00000000-0000-0000-0000-000000000000', '727a97d0-bd7f-4123-8fbe-b61438632665', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:44:05.41453+00', ''), - ('00000000-0000-0000-0000-000000000000', '8c7ba7b9-f587-4fe9-bc92-42d59a3d3e55', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:44:35.231985+00', ''), - ('00000000-0000-0000-0000-000000000000', '67968f85-d092-4698-9739-14300bb845ad', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 01:45:39.617284+00', ''), - ('00000000-0000-0000-0000-000000000000', 'd8b4be78-023e-4dd5-9d7a-957f39e0eec9', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 01:45:42.709506+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f0d23759-67a8-40a9-b8fc-3619e0e4221d', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 02:06:06.172105+00', ''), - ('00000000-0000-0000-0000-000000000000', '0034299c-509b-4d14-ae88-9677de49f3da', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 02:06:10.461879+00', ''), - ('00000000-0000-0000-0000-000000000000', '74a3530b-226a-4bd2-a666-d1e120260b62', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 02:06:32.31749+00', ''), - ('00000000-0000-0000-0000-000000000000', '030a63d0-4abb-4166-828d-787d7d1cff26', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 02:06:36.370126+00', ''), - ('00000000-0000-0000-0000-000000000000', '4de4a0f4-7a8f-4773-a16c-8e41b36a351c', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 02:20:51.891097+00', ''), - ('00000000-0000-0000-0000-000000000000', '0dc94867-442c-4483-834e-ac6b66046542', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 02:20:56.465462+00', ''), - ('00000000-0000-0000-0000-000000000000', '209e8780-3472-486a-97c4-83fdbadaa9c3', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 02:21:19.996115+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b99ef265-fbe0-4dc9-aed5-290f835a76e3', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 02:21:25.69477+00', ''), - ('00000000-0000-0000-0000-000000000000', '19f064c9-fbe6-4f02-a7c3-63f4349cccf7', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 02:21:40.313901+00', ''), - ('00000000-0000-0000-0000-000000000000', '015cf009-d1e9-4bb3-ba58-ebcd7f7c413d', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 02:21:44.020311+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2c5adb0-dcc8-4fb9-a281-00c259571c2b', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 02:28:56.448558+00', ''), - ('00000000-0000-0000-0000-000000000000', '26d2a5a9-5f22-4c23-ad86-176436c3955e', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 02:29:00.231605+00', ''), - ('00000000-0000-0000-0000-000000000000', '89439658-d546-44f9-8dde-5916cd3e5845', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-08 08:47:58.268719+00', ''), - ('00000000-0000-0000-0000-000000000000', 'ae562fb6-cc7d-40ce-af63-0bce77cb9d91', '{"action":"token_revoked","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-08 08:47:58.284798+00', ''), - ('00000000-0000-0000-0000-000000000000', '1e4c190e-39be-4ede-aabf-1857b7ed08da', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 08:57:13.071097+00', ''), - ('00000000-0000-0000-0000-000000000000', '6beaf6b7-e313-4517-8f12-d0289002f218', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 08:57:19.91982+00', ''), - ('00000000-0000-0000-0000-000000000000', '72a493d6-2098-423f-abbe-d1443a1c3a86', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 09:11:47.193277+00', ''), - ('00000000-0000-0000-0000-000000000000', '6384f6e2-1ad4-46f1-9241-da645f788d0f', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 09:11:54.818565+00', ''), - ('00000000-0000-0000-0000-000000000000', '28fb7bf4-eada-4ddc-9f1b-8729e779b7ab', '{"action":"token_refreshed","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-08 10:09:57.53813+00', ''), - ('00000000-0000-0000-0000-000000000000', '78c860b8-91e3-4ad6-a627-452cac38bc92', '{"action":"token_revoked","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"token"}', '2026-03-08 10:09:57.53935+00', ''), - ('00000000-0000-0000-0000-000000000000', 'a9e49110-fa04-401b-b20f-f4007e4a136d', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:01:10.168132+00', ''), - ('00000000-0000-0000-0000-000000000000', '4acd5fe0-f8cc-46a0-ac68-d80257273a7a', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:01:14.759718+00', ''), - ('00000000-0000-0000-0000-000000000000', '8467e638-d3ec-4596-b94c-c51d56df6051', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:02:08.120478+00', ''), - ('00000000-0000-0000-0000-000000000000', '20aba551-acac-437b-ad4c-3955b7f6d241', '{"action":"login","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:02:13.113658+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f8bfbc80-ae84-426c-aa3b-fea094672aee', '{"action":"logout","actor_id":"aaaaaaaa-0006-0006-0006-000000000006","actor_username":"saas@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:02:19.15885+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c48d6b43-f30e-4c6f-8112-1fcf17d675cb', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:02:23.116433+00', ''), - ('00000000-0000-0000-0000-000000000000', '1b19522a-11f8-4a45-8849-aeecf952b520', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:15:37.185761+00', ''), - ('00000000-0000-0000-0000-000000000000', '9a6ea825-3712-4dd8-a73c-0ce27f039444', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:15:41.876378+00', ''), - ('00000000-0000-0000-0000-000000000000', '9e2ecc99-f29d-4267-b57d-676c54a2d439', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:19:36.881502+00', ''), - ('00000000-0000-0000-0000-000000000000', 'b2476484-4622-4fb2-a242-35d637f88d17', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:19:41.887366+00', ''), - ('00000000-0000-0000-0000-000000000000', '9cb5f754-6681-47a2-9491-d58b9716b6fd', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:19:49.3653+00', ''), - ('00000000-0000-0000-0000-000000000000', 'f2c786ee-9d9f-4358-a56f-6ff4ad30bb7b', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:19:57.516863+00', ''), - ('00000000-0000-0000-0000-000000000000', 'c1dd432a-6160-4498-a41e-33d097092ce7', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:23:47.026117+00', ''), - ('00000000-0000-0000-0000-000000000000', '781092b9-3a86-46a0-9320-4ffe066d9438', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:23:54.635838+00', ''), - ('00000000-0000-0000-0000-000000000000', '437e2ffd-8ec0-45c6-80da-270b52f23d86', '{"action":"logout","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:24:01.942578+00', ''), - ('00000000-0000-0000-0000-000000000000', '8fba6dd9-b41d-44d5-b399-217667ede6d6', '{"action":"login","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:24:07.837913+00', ''), - ('00000000-0000-0000-0000-000000000000', '3b26e958-7094-42c8-8da0-d805e0cbd144', '{"action":"logout","actor_id":"aaaaaaaa-0002-0002-0002-000000000002","actor_username":"terapeuta@agenciapsi.com.br","actor_via_sso":false,"log_type":"account"}', '2026-03-08 11:31:35.960041+00', ''), - ('00000000-0000-0000-0000-000000000000', '4013b0d5-61c1-4b6c-b157-35123a727351', '{"action":"login","actor_id":"aaaaaaaa-0005-0005-0005-000000000005","actor_name":"","actor_username":"clinica3@agenciapsi.com.br","actor_via_sso":false,"log_type":"account","traits":{"provider":"email"}}', '2026-03-08 11:31:42.108511+00', ''); - - --- --- Data for Name: flow_state; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: users; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."users" ("instance_id", "id", "aud", "role", "email", "encrypted_password", "email_confirmed_at", "invited_at", "confirmation_token", "confirmation_sent_at", "recovery_token", "recovery_sent_at", "email_change_token_new", "email_change", "email_change_sent_at", "last_sign_in_at", "raw_app_meta_data", "raw_user_meta_data", "is_super_admin", "created_at", "updated_at", "phone", "phone_confirmed_at", "phone_change", "phone_change_token", "phone_change_sent_at", "email_change_token_current", "email_change_confirm_status", "banned_until", "reauthentication_token", "reauthentication_sent_at", "is_sso_user", "deleted_at", "is_anonymous") VALUES - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0001-0001-0001-000000000001', 'authenticated', 'authenticated', 'paciente@agenciapsi.com.br', '$2a$06$yBRr6ad8.KS.l/7DlNFjDO2qj/hSq2WLOpCf/G84/z72XtUUfdCiq', '2026-03-03 22:43:41.705072+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-04 23:47:58.784948+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Ana Paciente"}', NULL, '2026-03-03 22:43:41.705072+00', '2026-03-04 23:47:58.789642+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0003-0003-0003-000000000003', 'authenticated', 'authenticated', 'clinica1@agenciapsi.com.br', '$2a$06$2N.aga9dkI4DukpXo/7Fy.qjJZlGMkVpYKqlpR9TUQBZv7rG4awYG', '2026-03-03 22:43:41.705072+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-04 02:41:48.406838+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Clinica Espaco Psi"}', NULL, '2026-03-03 22:43:41.705072+00', '2026-03-04 02:41:48.411798+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0004-0004-0004-000000000004', 'authenticated', 'authenticated', 'clinica2@agenciapsi.com.br', '$2a$06$LurSJnAFMoUB.dXskXCKIOyi8/mKytQ7Niw/crGrJsT74nRUYQVEm', '2026-03-03 22:43:41.705072+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-04 02:41:48.505796+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Clinica Mente Sa"}', NULL, '2026-03-03 22:43:41.705072+00', '2026-03-04 02:41:48.513956+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0008-0008-0008-000000000008', 'authenticated', 'authenticated', 'editor@agenciapsi.com.br', '$2a$06$TAH7SLKE2tRq5QqSlBd3XeBA6/Uk5oihsCHhstbDYpL6fUawvGijm', '2026-03-04 17:02:37.208401+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-05 00:29:35.0247+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Diana Editora"}', NULL, '2026-03-04 17:02:37.208401+00', '2026-03-05 00:29:35.030493+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0002-0002-0002-000000000002', 'authenticated', 'authenticated', 'terapeuta@agenciapsi.com.br', '$2a$06$zpJeCiIawfZQw/7iQkNODOA9C1uaS3hvsM/rXyrbv78taampQmMqS', '2026-03-03 22:43:41.705072+00', NULL, '', NULL, '94eac86a5c20f3acc17521e339c4a22720da469d97cf5ca6fc1d9055', '2026-03-04 02:49:22.882115+00', '', '', NULL, '2026-03-08 11:24:07.840329+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Bruno Terapeuta"}', NULL, '2026-03-03 22:43:41.705072+00', '2026-03-08 11:24:07.844392+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0006-0006-0006-000000000006', 'authenticated', 'authenticated', 'saas@agenciapsi.com.br', '$2a$06$dJ7U9KRmCzbsOaSVOI1sy.RQ6j8Ifbq5BGtbSZqpivWZG997wFc5e', '2026-03-03 22:43:41.705072+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-08 11:02:13.118363+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Admin Plataforma"}', NULL, '2026-03-03 22:43:41.705072+00', '2026-03-08 11:02:13.123593+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0007-0007-0007-000000000007', 'authenticated', 'authenticated', 'supervisor@agenciapsi.com.br', '$2a$06$nHaseLQF/5OCWhVP1nxSp.lbcI5jQfN4lHvqEB73cjrFarKoL83lm', '2026-03-04 17:02:37.208401+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-05 01:15:59.908757+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Carlos Supervisor"}', NULL, '2026-03-04 17:02:37.208401+00', '2026-03-05 01:15:59.914341+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0005-0005-0005-000000000005', 'authenticated', 'authenticated', 'clinica3@agenciapsi.com.br', '$2a$06$rm6M14DhRVomu5GGjxvjVuCxiEG9Y.nJcAtX9/DKlZ43KOt9KUmuq', '2026-03-03 22:43:41.705072+00', NULL, '', NULL, 'a9f8b1671686f69839b425f1e6cbd0cc0178db5a79724b700aa734a2', '2026-03-04 03:02:38.357935+00', '', '', NULL, '2026-03-08 11:31:42.110616+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Clinica Bem Estar", "full_name": "", "avatar_url": "http://127.0.0.1:54321/storage/v1/object/public/avatars/aaaaaaaa-0005-0005-0005-000000000005/avatar-1772594277231.png"}', NULL, '2026-03-03 22:43:41.705072+00', '2026-03-08 11:31:42.138765+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0009-0009-0009-000000000009', 'authenticated', 'authenticated', 'therapist2@agenciapsi.com.br', '$2a$06$eq0UJnfWqFgjbHclNl5Mb.TkgGANlUqN0mr9Bs1.pOIM8E2VcKOea', '2026-03-04 19:40:17.694488+00', NULL, '', NULL, '', NULL, '', '', NULL, NULL, '{"provider": "email", "providers": ["email"]}', '{"name": "Eva Terapeuta"}', NULL, '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0010-0010-0010-000000000010', 'authenticated', 'authenticated', 'therapist3@agenciapsi.com.br', '$2a$06$6S8SW6I.BKbpI8hb1x2wAeRDE4NQH703nClTkPhhjfBCvYSmqVxGW', '2026-03-04 19:40:17.694488+00', NULL, '', NULL, '', NULL, '', '', NULL, NULL, '{"provider": "email", "providers": ["email"]}', '{"name": "Felipe Terapeuta"}', NULL, '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false), - ('00000000-0000-0000-0000-000000000000', 'aaaaaaaa-0011-0011-0011-000000000011', 'authenticated', 'authenticated', 'secretary@agenciapsi.com.br', '$2a$06$J1WcUDJpC/99GD2nZGwsbuJpXPv46wwllVSqa55mmNJoDiRbsuYRi', '2026-03-04 19:40:17.694488+00', NULL, '', NULL, '', NULL, '', '', NULL, '2026-03-04 19:40:22.615368+00', '{"provider": "email", "providers": ["email"]}', '{"name": "Gabriela Secretária"}', NULL, '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:22.626376+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL, false, NULL, false); - - --- --- Data for Name: identities; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."identities" ("provider_id", "user_id", "identity_data", "provider", "last_sign_in_at", "created_at", "updated_at", "id") VALUES - ('paciente@agenciapsi.com.br', 'aaaaaaaa-0001-0001-0001-000000000001', '{"sub": "aaaaaaaa-0001-0001-0001-000000000001", "email": "paciente@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '511fe017-2acf-4446-b8a9-44f9f08a0adb'), - ('terapeuta@agenciapsi.com.br', 'aaaaaaaa-0002-0002-0002-000000000002', '{"sub": "aaaaaaaa-0002-0002-0002-000000000002", "email": "terapeuta@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '86e114da-ac71-47ec-ae2b-a019a41dadf1'), - ('clinica1@agenciapsi.com.br', 'aaaaaaaa-0003-0003-0003-000000000003', '{"sub": "aaaaaaaa-0003-0003-0003-000000000003", "email": "clinica1@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', 'd544f125-1950-4360-85cf-24f1baf1643d'), - ('clinica2@agenciapsi.com.br', 'aaaaaaaa-0004-0004-0004-000000000004', '{"sub": "aaaaaaaa-0004-0004-0004-000000000004", "email": "clinica2@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', 'e6889ee3-7583-4fd3-9f7b-a7a35d639eb1'), - ('clinica3@agenciapsi.com.br', 'aaaaaaaa-0005-0005-0005-000000000005', '{"sub": "aaaaaaaa-0005-0005-0005-000000000005", "email": "clinica3@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', 'b87db98b-3463-49f2-a577-473b8cfb456f'), - ('saas@agenciapsi.com.br', 'aaaaaaaa-0006-0006-0006-000000000006', '{"sub": "aaaaaaaa-0006-0006-0006-000000000006", "email": "saas@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', '2026-03-04 02:40:18.743194+00', 'cf968d7b-ec46-433b-a045-a25ba81e320e'), - ('supervisor@agenciapsi.com.br', 'aaaaaaaa-0007-0007-0007-000000000007', '{"sub": "aaaaaaaa-0007-0007-0007-000000000007", "email": "supervisor@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 17:02:37.208401+00', '2026-03-04 17:02:37.208401+00', '2026-03-04 17:02:37.208401+00', 'ee52f423-a24a-4f6b-bbb8-dafd161895a1'), - ('editor@agenciapsi.com.br', 'aaaaaaaa-0008-0008-0008-000000000008', '{"sub": "aaaaaaaa-0008-0008-0008-000000000008", "email": "editor@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 17:02:37.208401+00', '2026-03-04 17:02:37.208401+00', '2026-03-04 17:02:37.208401+00', '6cecd0ba-8afa-4e4d-94f7-10f492a4f120'), - ('therapist2@agenciapsi.com.br', 'aaaaaaaa-0009-0009-0009-000000000009', '{"sub": "aaaaaaaa-0009-0009-0009-000000000009", "email": "therapist2@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', 'f2cbfef8-bfe1-4adb-9568-16e3f81a44ee'), - ('therapist3@agenciapsi.com.br', 'aaaaaaaa-0010-0010-0010-000000000010', '{"sub": "aaaaaaaa-0010-0010-0010-000000000010", "email": "therapist3@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', 'c0607663-b2a2-44d2-9068-6e6ab7763924'), - ('secretary@agenciapsi.com.br', 'aaaaaaaa-0011-0011-0011-000000000011', '{"sub": "aaaaaaaa-0011-0011-0011-000000000011", "email": "secretary@agenciapsi.com.br", "email_verified": true}', 'email', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', 'f4f9c215-69f5-490c-b241-f16c1ee8f867'); - - --- --- Data for Name: instances; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: oauth_clients; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: sessions; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."sessions" ("id", "user_id", "created_at", "updated_at", "factor_id", "aal", "not_after", "refreshed_at", "user_agent", "ip", "tag", "oauth_client_id", "refresh_token_hmac_key", "refresh_token_counter", "scopes") VALUES - ('c6416e64-5b29-4806-baab-659f7241519c', 'aaaaaaaa-0003-0003-0003-000000000003', '2026-03-04 02:41:48.406928+00', '2026-03-04 02:41:48.406928+00', NULL, 'aal1', NULL, NULL, 'node', '172.19.0.1', NULL, NULL, NULL, NULL, NULL), - ('1b4fddbc-2eac-42d2-8256-1863b47efa37', 'aaaaaaaa-0004-0004-0004-000000000004', '2026-03-04 02:41:48.505875+00', '2026-03-04 02:41:48.505875+00', NULL, 'aal1', NULL, NULL, 'node', '172.19.0.1', NULL, NULL, NULL, NULL, NULL), - ('f346cfed-b148-4b8a-b993-7a2d5c96aa65', 'aaaaaaaa-0005-0005-0005-000000000005', '2026-03-08 11:31:42.110699+00', '2026-03-08 11:31:42.110699+00', NULL, 'aal1', NULL, NULL, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36', '172.19.0.1', NULL, NULL, NULL, NULL, NULL); - - --- --- Data for Name: mfa_amr_claims; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."mfa_amr_claims" ("session_id", "created_at", "updated_at", "authentication_method", "id") VALUES - ('c6416e64-5b29-4806-baab-659f7241519c', '2026-03-04 02:41:48.412708+00', '2026-03-04 02:41:48.412708+00', 'password', '34bb0a03-77dd-4e94-a3a0-0be553278279'), - ('1b4fddbc-2eac-42d2-8256-1863b47efa37', '2026-03-04 02:41:48.514972+00', '2026-03-04 02:41:48.514972+00', 'password', '9e01f0fc-484e-40c1-b6c0-10a2d26b405e'), - ('f346cfed-b148-4b8a-b993-7a2d5c96aa65', '2026-03-08 11:31:42.139623+00', '2026-03-08 11:31:42.139623+00', 'password', '634c9988-7422-4806-bc32-211191cbd7be'); - - --- --- Data for Name: mfa_factors; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: mfa_challenges; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: oauth_authorizations; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: oauth_client_states; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: oauth_consents; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: one_time_tokens; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."one_time_tokens" ("id", "user_id", "token_type", "token_hash", "relates_to", "created_at", "updated_at") VALUES - ('373a8930-2505-4591-a048-ef06a560f67a', 'aaaaaaaa-0002-0002-0002-000000000002', 'recovery_token', '94eac86a5c20f3acc17521e339c4a22720da469d97cf5ca6fc1d9055', 'terapeuta@agenciapsi.com.br', '2026-03-04 02:49:22.895933', '2026-03-04 02:49:22.895933'), - ('3e108985-639e-4ebf-b97a-b6827cfa1ce1', 'aaaaaaaa-0005-0005-0005-000000000005', 'recovery_token', 'a9f8b1671686f69839b425f1e6cbd0cc0178db5a79724b700aa734a2', 'clinica3@agenciapsi.com.br', '2026-03-04 03:02:38.364651', '2026-03-04 03:02:38.364651'); - - --- --- Data for Name: refresh_tokens; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - -INSERT INTO "auth"."refresh_tokens" ("instance_id", "id", "token", "user_id", "revoked", "created_at", "updated_at", "parent", "session_id") VALUES - ('00000000-0000-0000-0000-000000000000', 988, 'pqyjkaqizjec', 'aaaaaaaa-0003-0003-0003-000000000003', false, '2026-03-04 02:41:48.410184+00', '2026-03-04 02:41:48.410184+00', NULL, 'c6416e64-5b29-4806-baab-659f7241519c'), - ('00000000-0000-0000-0000-000000000000', 989, 'fw2mfwws4sv6', 'aaaaaaaa-0004-0004-0004-000000000004', false, '2026-03-04 02:41:48.511721+00', '2026-03-04 02:41:48.511721+00', NULL, '1b4fddbc-2eac-42d2-8256-1863b47efa37'), - ('00000000-0000-0000-0000-000000000000', 1204, 'gbhvbbz7kr4f', 'aaaaaaaa-0005-0005-0005-000000000005', false, '2026-03-08 11:31:42.133511+00', '2026-03-08 11:31:42.133511+00', NULL, 'f346cfed-b148-4b8a-b993-7a2d5c96aa65'); - - --- --- Data for Name: sso_providers; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: saml_providers; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: saml_relay_states; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: sso_domains; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin --- - - - --- --- Data for Name: tenants; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."tenants" ("id", "name", "created_at", "kind") VALUES - ('bbbbbbbb-0002-0002-0002-000000000002', 'Bruno Terapeuta', '2026-03-03 22:43:41.705072+00', 'therapist'), - ('bbbbbbbb-0003-0003-0003-000000000003', 'Clinica Espaco Psi', '2026-03-03 22:43:41.705072+00', 'clinic_coworking'), - ('bbbbbbbb-0004-0004-0004-000000000004', 'Clinica Mente Sa', '2026-03-03 22:43:41.705072+00', 'clinic_reception'), - ('bbbbbbbb-0005-0005-0005-000000000005', 'Clinica Bem Estar', '2026-03-03 22:43:41.705072+00', 'clinic_full'), - ('7e8b1272-0ba5-497a-afad-a2db1533e300', 'Carlos Supervisor', '2026-03-04 17:02:41.588972+00', 'therapist'), - ('349933ee-8902-4041-b4c2-9ee690f5d3a0', 'Diana Editora', '2026-03-04 17:02:51.022501+00', 'therapist'), - ('bbbbbbbb-0009-0009-0009-000000000009', 'Eva Terapeuta', '2026-03-04 19:40:17.694488+00', 'therapist'), - ('bbbbbbbb-0010-0010-0010-000000000010', 'Felipe Terapeuta', '2026-03-04 19:40:17.694488+00', 'therapist'), - ('402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'Gabriela Secretária', '2026-03-04 19:40:23.077765+00', 'therapist'), - ('0ad37cd5-d5fc-4926-a323-cdeafc10ae23', 'Supervisão — supervisor@agenciapsi.com.br', '2026-03-05 01:15:36.377017+00', 'supervisor'); - - --- --- Data for Name: agenda_bloqueios; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."agenda_bloqueios" ("id", "owner_id", "tenant_id", "tipo", "titulo", "data_inicio", "data_fim", "hora_inicio", "hora_fim", "recorrente", "dia_semana", "observacao", "origem", "created_at") VALUES - ('b425aaa2-9390-4a65-bc25-e2b921090991', 'aaaaaaaa-0002-0002-0002-000000000002', 'bbbbbbbb-0002-0002-0002-000000000002', 'bloqueio', 'Feriado: Aniversário da Cidade', '2026-03-19', '2026-03-19', NULL, NULL, false, NULL, NULL, 'agenda_feriado', '2026-03-07 01:52:59.706314+00'), - ('965beb32-d688-4bb2-8cb4-170a779466f3', 'aaaaaaaa-0005-0005-0005-000000000005', 'bbbbbbbb-0005-0005-0005-000000000005', 'bloqueio', 'Feriado: Aniversário da Cidade', '2026-03-19', '2026-03-19', NULL, NULL, false, NULL, NULL, 'agenda_feriado', '2026-03-08 09:18:21.26035+00'), - ('0765cf05-2c76-41de-866e-3e3c70f5f27b', 'aaaaaaaa-0005-0005-0005-000000000005', 'bbbbbbbb-0005-0005-0005-000000000005', 'bloqueio', 'Feriado: Sexta-feira Santa', '2026-04-03', '2026-04-03', NULL, NULL, false, NULL, NULL, 'agenda_feriado', '2026-03-08 10:11:48.251162+00'), - ('3ac9540c-f12e-4f3d-9e34-5c353f010745', 'aaaaaaaa-0005-0005-0005-000000000005', 'bbbbbbbb-0005-0005-0005-000000000005', 'bloqueio', 'Feriado: Sexta-feira Santa', '2026-04-03', '2026-04-03', NULL, NULL, false, NULL, NULL, 'agenda_feriado', '2026-03-08 10:12:42.023574+00'), - ('c3c3ece4-f3b1-4a39-84a9-96fe5c3a5017', 'aaaaaaaa-0005-0005-0005-000000000005', 'bbbbbbbb-0005-0005-0005-000000000005', 'bloqueio', 'Feriado: Sexta-feira Santa', '2026-04-03', '2026-04-03', NULL, NULL, false, NULL, NULL, 'agenda_feriado', '2026-03-08 10:13:44.045443+00'); - - --- --- Data for Name: agenda_configuracoes; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."agenda_configuracoes" ("owner_id", "duracao_padrao_minutos", "intervalo_padrao_minutos", "timezone", "usar_horario_admin_custom", "admin_inicio_visualizacao", "admin_fim_visualizacao", "admin_slot_visual_minutos", "online_ativo", "online_min_antecedencia_horas", "online_max_dias_futuro", "online_cancelar_ate_horas", "online_reagendar_ate_horas", "online_limite_agendamentos_futuros", "online_modo", "online_buffer_antes_min", "online_buffer_depois_min", "online_modalidade", "created_at", "updated_at", "usar_granularidade_custom", "granularidade_min", "setup_concluido", "setup_concluido_em", "agenda_view_mode", "agenda_custom_start", "agenda_custom_end", "session_duration_min", "session_break_min", "session_start_offset_min", "pausas_semanais", "setup_clinica_concluido", "setup_clinica_concluido_em", "tenant_id", "jornada_igual_todos") VALUES - ('aaaaaaaa-0005-0005-0005-000000000005', 50, 0, 'America/Sao_Paulo', false, NULL, NULL, 30, true, 24, 60, 12, 12, 1, 'automatico', 0, 0, 'ambos', '2026-03-06 09:50:39.454393+00', '2026-03-06 09:52:39.425873+00', false, NULL, false, NULL, 'full_24h', NULL, NULL, 50, 10, 0, '[{"id": "88031ae4d7a7d819cc28f3fbd", "fim": "13:00", "label": "Almoço", "inicio": "12:00", "dia_semana": 1}, {"id": "662a5b6eb4a89819cc28f676c", "fim": "19:00", "label": "Janta", "inicio": "18:00", "dia_semana": 1}, {"id": "47a973cd8e8ee819cc28f4597", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 2}, {"id": "9665e490bbe5f19cc28f64e7", "fim": "19:00", "label": "Janta", "inicio": "18:00", "dia_semana": 2}, {"id": "d35bdfd948adf819cc28f4a92", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 3}, {"id": "658d153ac410c19cc28f5f0a", "fim": "19:00", "label": "Janta", "inicio": "18:00", "dia_semana": 3}, {"id": "127928e112cf8819cc28f8251", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 4}, {"id": "978aea97b88f619cc28f4de8", "fim": "19:00", "label": "Janta", "inicio": "18:00", "dia_semana": 4}, {"id": "489d97183077d819cc28f7502", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 5}, {"id": "c3968fd7a0fe19cc28f6c01", "fim": "19:00", "label": "Janta", "inicio": "18:00", "dia_semana": 5}]', true, '2026-03-06 09:51:53.566+00', 'bbbbbbbb-0005-0005-0005-000000000005', false), - ('aaaaaaaa-0002-0002-0002-000000000002', 50, 0, 'America/Sao_Paulo', false, NULL, NULL, 30, true, 24, 60, 12, 12, 1, 'automatico', 0, 0, 'ambos', '2026-03-05 01:55:59.188538+00', '2026-03-06 14:54:52.451672+00', false, NULL, false, NULL, 'full_24h', NULL, NULL, 50, 10, 0, '[{"id": "9a486452309cd19cc3806b69", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 1}, {"id": "9a486452309cd19cc3806b69", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 2}, {"id": "9a486452309cd19cc3806b69", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 3}, {"id": "9a486452309cd19cc3806b69", "fim": "14:00", "label": "Almoço", "inicio": "13:00", "dia_semana": 4}]', true, '2026-03-05 03:00:19.579+00', 'bbbbbbbb-0002-0002-0002-000000000002', true); - - --- --- Data for Name: determined_commitments; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."determined_commitments" ("id", "tenant_id", "created_by", "is_native", "native_key", "is_locked", "active", "name", "description", "created_at", "updated_at", "bg_color", "text_color") VALUES - ('a7316fc9-c24e-469c-b6f2-75c467a303e2', '349933ee-8902-4041-b4c2-9ee690f5d3a0', NULL, true, 'class', false, false, 'Aula', 'Dar aula', '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00', NULL, NULL), - ('74797cdd-2c96-4035-b406-a534f102b051', '349933ee-8902-4041-b4c2-9ee690f5d3a0', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00', NULL, NULL), - ('0501c0c7-2390-420b-b53e-bdc09475dee3', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00', NULL, NULL), - ('eabb297e-1e71-427c-90e6-28b6b98e904b', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00', NULL, NULL), - ('c7234876-bae4-4178-abae-24187ef90d5d', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00', NULL, NULL), - ('25a04a15-11b3-471b-8944-0fbd7aca2843', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', NULL, true, 'class', false, false, 'Aula', 'Dar aula', '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00', NULL, NULL), - ('f3cee12c-530c-4efd-a128-a01017baca89', 'bbbbbbbb-0002-0002-0002-000000000002', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('cc8e6cfd-6d48-4645-89e6-dd1e776eed48', 'bbbbbbbb-0002-0002-0002-000000000002', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('fc50b3a5-463a-42a5-bb92-95b543ef332a', 'bbbbbbbb-0003-0003-0003-000000000003', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('277fb576-5801-4dcc-8642-e79184f2b4fa', 'bbbbbbbb-0003-0003-0003-000000000003', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('c493b9db-37c1-4402-a732-d64cf5891a01', 'bbbbbbbb-0003-0003-0003-000000000003', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('800b9565-f68e-46f2-8a54-e76f01cc502f', 'bbbbbbbb-0003-0003-0003-000000000003', NULL, true, 'class', false, false, 'Aula', 'Dar aula', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('f1220b5c-f5b2-420f-84b5-cb525876200a', 'bbbbbbbb-0003-0003-0003-000000000003', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('4c7bd615-ef45-454c-a3bd-61c244a397f2', 'bbbbbbbb-0004-0004-0004-000000000004', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('fc27d2a2-be03-41cb-9b95-9a03e9edc96b', 'bbbbbbbb-0004-0004-0004-000000000004', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('b1d318bf-8561-40d8-8cd3-e3ca715d80c8', 'bbbbbbbb-0004-0004-0004-000000000004', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('03c38d95-ed9e-4d42-8e10-4f8705462774', 'bbbbbbbb-0004-0004-0004-000000000004', NULL, true, 'class', false, false, 'Aula', 'Dar aula', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('15806ba6-483f-4e1e-80fc-81c14b511c43', 'bbbbbbbb-0004-0004-0004-000000000004', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL), - ('3a6b4506-ed57-4fa0-8d70-d53f2288abf8', '7e8b1272-0ba5-497a-afad-a2db1533e300', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00', NULL, NULL), - ('0d93b6cd-01fe-42db-a27d-caa0c98b97ef', '7e8b1272-0ba5-497a-afad-a2db1533e300', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00', NULL, NULL), - ('644eb2f7-73b3-4147-a52f-484c24516712', '7e8b1272-0ba5-497a-afad-a2db1533e300', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00', NULL, NULL), - ('af04bf86-3167-4dd2-bdfd-a985070ac031', '7e8b1272-0ba5-497a-afad-a2db1533e300', NULL, true, 'class', false, false, 'Aula', 'Dar aula', '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00', NULL, NULL), - ('9dfa0f46-54c7-4bfe-8721-55969eab665f', '7e8b1272-0ba5-497a-afad-a2db1533e300', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00', NULL, NULL), - ('85813e74-6364-4f5e-ae44-67acf99c8f3f', '349933ee-8902-4041-b4c2-9ee690f5d3a0', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00', NULL, NULL), - ('d1aa13ec-c628-4a16-82f8-d4503dec5e97', '349933ee-8902-4041-b4c2-9ee690f5d3a0', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00', NULL, NULL), - ('3a9ba018-21e4-4c9e-9c23-fe5d0fde50c2', '349933ee-8902-4041-b4c2-9ee690f5d3a0', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00', NULL, NULL), - ('f600aaa1-427a-4a5a-ab8b-3cfd561a7269', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00', NULL, NULL), - ('4b52db75-9f5e-4a8a-9fe9-1433b25b360c', 'bbbbbbbb-0002-0002-0002-000000000002', NULL, true, 'class', false, false, 'Aula', 'Dar aula', '2026-03-03 22:43:41.705072+00', '2026-03-05 13:38:43.819417+00', NULL, NULL), - ('3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', 'bbbbbbbb-0002-0002-0002-000000000002', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-03 22:43:41.705072+00', '2026-03-05 19:51:28.994753+00', '6366f1', '#ffffff'), - ('7e08480b-93a5-4081-865a-75d1f255c0c4', 'bbbbbbbb-0002-0002-0002-000000000002', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-03 22:43:41.705072+00', '2026-03-05 19:55:18.181619+00', '49def5', '#000000'), - ('5449605e-3f6e-4e2d-b7e4-caad0c3036c6', 'bbbbbbbb-0005-0005-0005-000000000005', NULL, true, 'session', true, true, 'Sessão', 'Sessão com paciente', '2026-03-03 22:43:41.705072+00', '2026-03-06 10:13:43.701557+00', '3b82f6', '#ffffff'), - ('a0947ddc-f062-4d46-afb8-5b30a25097dc', 'bbbbbbbb-0005-0005-0005-000000000005', NULL, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal', '2026-03-03 22:43:41.705072+00', '2026-03-06 10:17:23.599882+00', 'ec4899', '#ffffff'), - ('33aa916c-247a-4a30-bf11-8742fd37039f', 'bbbbbbbb-0005-0005-0005-000000000005', NULL, true, 'class', false, true, 'Aula', 'Dar aula', '2026-03-03 22:43:41.705072+00', '2026-03-06 10:17:24.142236+00', 'f97316', '#ffffff'), - ('fca90568-1535-4625-87d5-107b9bb5dafc', 'bbbbbbbb-0005-0005-0005-000000000005', NULL, true, 'reading', false, true, 'Leitura', 'Praticar leitura', '2026-03-03 22:43:41.705072+00', '2026-03-06 10:17:24.613911+00', '22c55e', '#ffffff'), - ('1632e283-7294-46c6-94ab-4f2c3508a4a6', 'bbbbbbbb-0005-0005-0005-000000000005', NULL, true, 'supervision', false, true, 'Supervisão', 'Supervisão', '2026-03-03 22:43:41.705072+00', '2026-03-06 10:17:25.296446+00', '64748b', '#ffffff'); - - --- --- Data for Name: tenant_members; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."tenant_members" ("id", "tenant_id", "user_id", "role", "status", "created_at") VALUES - ('e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', 'bbbbbbbb-0002-0002-0002-000000000002', 'aaaaaaaa-0002-0002-0002-000000000002', 'tenant_admin', 'active', '2026-03-03 22:43:41.705072+00'), - ('9e112385-a34c-4ec8-828b-8a3591e590fe', 'bbbbbbbb-0003-0003-0003-000000000003', 'aaaaaaaa-0003-0003-0003-000000000003', 'tenant_admin', 'active', '2026-03-03 22:43:41.705072+00'), - ('306b5a3a-2084-49a7-b653-39f9a84564cd', 'bbbbbbbb-0004-0004-0004-000000000004', 'aaaaaaaa-0004-0004-0004-000000000004', 'tenant_admin', 'active', '2026-03-03 22:43:41.705072+00'), - ('d334aa94-077c-4138-93f5-56db82233589', 'bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0005-0005-0005-000000000005', 'tenant_admin', 'active', '2026-03-03 22:43:41.705072+00'), - ('c5bce530-07b6-4aaa-a885-0cd34447f91b', 'bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0002-0002-0002-000000000002', 'therapist', 'active', '2026-03-03 22:43:41.705072+00'), - ('d6c9f516-4082-4153-b45c-6161b36dc15a', 'bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0007-0007-0007-000000000007', 'supervisor', 'active', '2026-03-04 17:02:37.208401+00'), - ('7002c366-6c74-4a7e-8c2d-c51f0e42b389', 'bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0008-0008-0008-000000000008', 'therapist', 'active', '2026-03-04 17:02:37.208401+00'), - ('3f35202d-5c3b-4947-803b-79a0d38cef68', '7e8b1272-0ba5-497a-afad-a2db1533e300', 'aaaaaaaa-0007-0007-0007-000000000007', 'tenant_admin', 'active', '2026-03-04 17:02:41.588972+00'), - ('95c9f66c-0399-4021-ba46-8ff8ffc203d7', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'aaaaaaaa-0008-0008-0008-000000000008', 'tenant_admin', 'active', '2026-03-04 17:02:51.022501+00'), - ('88385aba-523e-402b-aa24-df39c7f6937c', 'bbbbbbbb-0009-0009-0009-000000000009', 'aaaaaaaa-0009-0009-0009-000000000009', 'tenant_admin', 'active', '2026-03-04 19:40:17.694488+00'), - ('9416a7f1-05f2-4833-8297-69670d0f6284', 'bbbbbbbb-0010-0010-0010-000000000010', 'aaaaaaaa-0010-0010-0010-000000000010', 'tenant_admin', 'active', '2026-03-04 19:40:17.694488+00'), - ('fcdbb825-f131-46fe-a6ac-0f2a48b8a6fd', 'bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0009-0009-0009-000000000009', 'therapist', 'active', '2026-03-04 19:40:17.694488+00'), - ('1a0af8de-c5ef-4549-83ac-741b336e9fe8', 'bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0010-0010-0010-000000000010', 'therapist', 'active', '2026-03-04 19:40:17.694488+00'), - ('8f9f2c6e-2fb9-4d4d-8a85-55ee6df8e3d9', 'bbbbbbbb-0004-0004-0004-000000000004', 'aaaaaaaa-0011-0011-0011-000000000011', 'clinic_admin', 'active', '2026-03-04 19:40:17.694488+00'), - ('ddacd18f-242c-4af6-85aa-386b1b054751', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'aaaaaaaa-0011-0011-0011-000000000011', 'tenant_admin', 'active', '2026-03-04 19:40:23.077765+00'), - ('363a1ff5-62d3-4e40-9d92-fb20c7314603', '0ad37cd5-d5fc-4926-a323-cdeafc10ae23', 'aaaaaaaa-0007-0007-0007-000000000007', 'supervisor', 'active', '2026-03-05 01:15:36.377017+00'); - - --- --- Data for Name: patients; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patients" ("id", "nome_completo", "email_principal", "telefone", "created_at", "owner_id", "avatar_url", "status", "last_attended_at", "is_native", "naturalidade", "data_nascimento", "rg", "cpf", "identification_color", "genero", "estado_civil", "email_alternativo", "pais", "cep", "cidade", "estado", "endereco", "numero", "bairro", "complemento", "escolaridade", "profissao", "nome_parente", "grau_parentesco", "telefone_alternativo", "onde_nos_conheceu", "encaminhado_por", "nome_responsavel", "telefone_responsavel", "cpf_responsavel", "observacao_responsavel", "cobranca_no_responsavel", "observacoes", "notas_internas", "updated_at", "telefone_parente", "tenant_id", "responsible_member_id", "user_id", "patient_scope", "therapist_member_id") VALUES - ('d8260f48-5616-4f18-b77a-a52a4bd24e9f', 'Henrique Souza Carvalho', 'henrique.souza.carvalho.833@email.com', '55639462415', '2026-03-06 02:06:36.082996+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Sorocaba', '1951-05-23', '904308928', '73530725129', NULL, 'Masculino', 'Viúvo(a)', 'alt.356@email.com', 'Brasil', '34347-421', 'Sorocaba', 'PE', 'Rua das Acácias', '739', 'Centro', 'Apto 496', 'Pós-graduação', 'Estudante', 'Sabrina Silva', 'Avó', '55565622336', 'Indicação', 'Rafael Gomes', 'Rafael Oliveira Pereira', '55999428932', '28074120503', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:36.082996+00', '55919174574', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('0ef7d831-3bc7-4e1c-948b-35b40bee1ed3', 'Yasmin Ribeiro Barbosa 2', 'yasmin.ribeiro.barbosa.554@email.com', '55699366162', '2026-03-05 13:44:02.332332+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'http://127.0.0.1:54321/storage/v1/object/public/avatars/owners/aaaaaaaa-0002-0002-0002-000000000002/patients/0ef7d831-3bc7-4e1c-948b-35b40bee1ed3/avatar.png', 'Ativo', NULL, false, 'Araraquara', '2018-03-10', '283367158', '11207635413', NULL, 'Feminino', 'Viúvo(a)', 'alt.737@email.com', 'Brasil', '86219-976', 'Araraquara', 'PE', 'Av. São Carlos', '4089', 'Santa Felícia', 'Apto 850', 'Ensino Fundamental', 'Autônomo', 'Felipe Souza', 'Cônjuge', '55629538769', 'Indicação', 'Rafael Almeida', 'Henrique Carvalho Barbosa', '55899410021', '86867538096', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-05 14:52:36.298049+00', '55349988158', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('8f00663b-9234-44fd-bdc1-8c1a1d8d8762', 'Carla Santos Oliveira', 'carla.santos.oliveira.12@email.com', '13951182892', '2026-03-05 15:02:17.744426+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Ribeirão Preto', '1983-01-05', '68.484.108-8', '93951183187', NULL, 'non_binary', 'single', NULL, 'Brasil', '13561260', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '7644', 'Parque Santa Mônica', NULL, 'Pós-graduação', 'Professora', NULL, NULL, NULL, 'Site', 'Yasmin Gomes', NULL, NULL, NULL, NULL, false, 'Tenho disponibilidade no período da noite.', NULL, '2026-03-05 15:02:17.744426+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('a2f6f07e-0ff1-403f-ba22-67eac989b7cc', 'João Costa Barbosa', 'joao.costa.barbosa.555@email.com', '76948155255', '2026-03-05 15:04:29.543641+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Sorocaba', '1991-09-01', '67.628.680-1', '16602041517', NULL, 'other', 'divorced', NULL, 'Brasil', '13561260', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '5807', 'Parque Santa Mônica', NULL, 'Superior completo', 'Estudante', NULL, NULL, NULL, 'Outro', 'Larissa Souza', NULL, NULL, NULL, NULL, false, 'Cadastro realizado via link externo.', NULL, '2026-03-05 15:04:29.543641+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('67beb18d-14a1-49f2-9f85-3c42634a1790', 'Rafael Pereira Ribeiro', 'rafael.pereira.ribeiro.358@email.com', '67975758463', '2026-03-05 15:05:30.289217+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'http://127.0.0.1:54321/storage/v1/object/public/avatars/intakes/b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348/1772723113160.png', 'Ativo', NULL, false, 'Sorocaba', '2002-08-13', '62.571.088-6', '74006061234', NULL, 'other', 'married', NULL, 'Brasil', '13561260', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '1164', 'Parque Santa Mônica', NULL, 'Superior incompleto', 'Autônomo', NULL, NULL, NULL, 'Indicação', 'Henrique Santos', NULL, NULL, NULL, NULL, false, 'Cadastro realizado via link externo.', NULL, '2026-03-05 15:05:30.289217+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('514ea533-2354-4f87-bbf6-fffa584eb9fd', 'Rafael Pereira Pereira', 'rafael.pereira.pereira.454@email.com', '55119708959', '2026-03-06 02:06:10.654289+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Campinas', '2003-10-27', '689212935', '01320794700', NULL, 'Outro', 'Casado(a)', 'alt.735@email.com', 'Brasil', '20712-119', 'Campinas', 'SP', 'Rua XV de Novembro', '7278', 'Santa Felícia', 'Apto 229', 'Ensino Médio', 'Servidor público', 'Otávio Gomes', 'Avô', '55531536379', 'Instagram', 'Sabrina Oliveira', 'Giovana Ribeiro Pereira', '55689891058', '06212395853', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:10.654289+00', '55989548378', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('3e452920-c7cd-4905-8725-5c53f6c34be8', 'João Souza Lima', 'joao.souza.lima.460@email.com', '55579914593', '2026-03-06 02:06:15.264152+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Bauru', '1961-04-21', '546510733', '13030018962', NULL, 'Não-binário', 'Solteiro(a)', 'alt.923@email.com', 'Brasil', '53113-864', 'Bauru', 'SC', 'Av. São Carlos', '6900', 'Jardim Paulista', 'Apto 411', 'Ensino Médio', 'Desenvolvedor', 'Henrique Lima', 'Pai', '55409939819', 'Site', 'Larissa Lima', 'Marcos Costa Oliveira', '55379332498', '89319259801', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:15.264152+00', '55959682017', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('c769884e-f01d-40bd-9ab8-956936c7ddc1', 'Marcos Ribeiro Almeida', 'marcos.ribeiro.almeida.214@email.com', '55249154572', '2026-03-06 02:06:39.955461+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Ribeirão Preto', '2007-06-23', '332827908', '93829448007', NULL, 'Outro', 'Divorciado(a)', 'alt.557@email.com', 'Brasil', '47318-330', 'Ribeirão Preto', 'SC', 'Rua XV de Novembro', '4803', 'Centro', 'Apto 762', 'Ensino Médio', 'Enfermeira', 'Felipe Lima', 'Avó', '55759290461', 'Instagram', 'Isabela Araújo', 'Bruno Oliveira Oliveira', '55262641374', '51265333041', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:39.955461+00', '55949726617', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('4ad04965-a983-46e5-9208-1b876365e63c', 'Nathalia Silva Almeida', 'nathalia.silva.almeida.847@email.com', '55735854901', '2026-03-06 02:06:19.333101+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'São Carlos', '1986-03-01', '380595372', '43990888005', NULL, 'Prefere não informar', 'Separado(a)', 'alt.94@email.com', 'Brasil', '76390-507', 'São Carlos', 'SC', 'Rua das Acácias', '3792', 'Cidade Jardim', 'Apto 322', 'Ensino Fundamental', 'Autônomo', 'Carla Santos', 'Avó', '55719326773', 'Threads', 'Yasmin Lima', 'Marcos Pereira Pereira', '55189710183', '37988019082', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:19.333101+00', '55539552938', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('bb33e7df-7888-454d-b309-7f3982382821', 'Larissa Barbosa Souza', 'larissa.barbosa.souza.317@email.com', '55519919318', '2026-03-06 02:06:23.406901+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'Santos', '1957-02-28', '84567706', '30537490760', NULL, 'Prefere não informar', 'Casado(a)', 'alt.860@email.com', 'Brasil', '29343-374', 'Santos', 'RJ', 'Rua das Acácias', '8048', 'Jardim Paulista', 'Apto 586', 'Ensino Médio', 'Professora', 'João Santos', 'Mãe', '55129685131', 'Outro', 'Marcos Araújo', 'João Costa Costa', '55449412498', '99719153326', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:23.406901+00', '55796825443', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('3e27b78b-7976-4537-a35b-4be1d8b3bd63', 'Larissa Costa Ferreira', 'larissa.costa.ferreira.428@email.com', '55995004829', '2026-03-06 02:06:27.619702+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'São Carlos', '2012-09-15', '699892219', '34887254482', NULL, 'Feminino', 'Casado(a)', 'alt.17@email.com', 'Brasil', '87028-516', 'São Carlos', 'SP', 'Av. São Carlos', '1985', 'Santa Felícia', 'Apto 591', 'Ensino Médio', 'Servidor público', 'Larissa Ribeiro', 'Pai', '55769596263', 'Google', 'Thiago Lima', 'Vanessa Silva Oliveira', '55669218981', '05232893165', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:27.619702+00', '55969412429', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('fb7a67f1-131c-4493-be18-37046ca98a65', 'Paula Ribeiro Martins', 'paula.ribeiro.martins.896@email.com', '55179560348', '2026-03-06 02:06:31.869099+00', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'Ativo', NULL, false, 'São Paulo', '1950-01-04', '887973635', '96269118328', NULL, 'Feminino', 'Solteiro(a)', 'alt.176@email.com', 'Brasil', '13687-652', 'São Paulo', 'SC', 'Rua das Acácias', '3055', 'Centro', 'Apto 334', 'Superior completo', 'Vendedor', 'Nathalia Almeida', 'Pai', '55169744610', 'Threads', 'Otávio Ferreira', 'Paula Pereira Ribeiro', '55489491330', '90703901915', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 02:06:31.869099+00', '55689456613', 'bbbbbbbb-0002-0002-0002-000000000002', 'e45f4f8c-54f2-4fb5-b3e8-aad65ae8f0fb', NULL, 'clinic', NULL), - ('70b17b2e-b637-4d6e-ae87-62c81cc34e9f', 'Thiago Araújo Ferreira', 'thiago.araujo.ferreira.137@email.com', '55979568126', '2026-03-06 10:04:19.04287+00', 'aaaaaaaa-0005-0005-0005-000000000005', 'http://127.0.0.1:54321/storage/v1/object/public/avatars/owners/aaaaaaaa-0005-0005-0005-000000000005/patients/70b17b2e-b637-4d6e-ae87-62c81cc34e9f/avatar.webp', 'Ativo', NULL, false, 'Ribeirão Preto', '1998-09-25', '189022988', '76639305500', NULL, 'Não-binário', 'Divorciado(a)', 'alt.227@email.com', 'Brasil', '48262-591', 'Ribeirão Preto', 'RJ', 'Av. Brasil', '9618', 'Vila Prado', 'Apto 417', 'Ensino Fundamental', 'Estudante', 'Paula Barbosa', 'Tia', '55281483867', 'Threads', 'Giovana Ribeiro', 'Felipe Barbosa Carvalho', '55119912235', '50305460307', 'Responsável ciente do contrato.', true, 'Paciente relata ansiedade e sobrecarga emocional.', 'Paciente apresenta discurso organizado. Acompanhar evolução clínica.', '2026-03-06 10:04:19.196224+00', '55149788615', 'bbbbbbbb-0005-0005-0005-000000000005', 'd334aa94-077c-4138-93f5-56db82233589', NULL, 'clinic', NULL); - - --- --- Data for Name: agenda_eventos; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."agenda_eventos" ("id", "owner_id", "paciente_id", "tipo", "status", "titulo", "observacoes", "inicio_em", "fim_em", "created_at", "updated_at", "terapeuta_id", "tenant_id", "visibility_scope", "mirror_of_event_id", "mirror_source", "patient_id", "determined_commitment_id", "link_online", "titulo_custom", "extra_fields") VALUES - ('a0278145-d262-4d58-9bdb-3f11ffa7bbed', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'sessao', 'agendado', '1', 'obs 25', '2026-03-05 04:19:00+00', '2026-03-05 04:49:00+00', '2026-03-05 23:54:21.675555+00', '2026-03-06 00:06:47.290689+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, 'f3cee12c-530c-4efd-a128-a01017baca89', NULL, NULL, NULL), - ('41d757b6-4473-4ddc-addc-d6facbf22fcf', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'sessao', 'agendado', '1', '5', '2026-03-05 05:30:00+00', '2026-03-05 06:38:00+00', '2026-03-06 00:07:25.851724+00', '2026-03-06 00:10:16.104132+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', NULL, '1', '{"focus": "3", "notes": "4", "analyst": "2"}'), - ('4d82137a-1eb4-41e6-9eca-030ab9eb7a2e', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'sessao', 'agendado', '1', '5', '2026-03-05 07:00:00+00', '2026-03-05 08:08:00+00', '2026-03-06 00:10:29.249327+00', '2026-03-06 00:10:29.249327+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', NULL, '1', '{"focus": "3", "notes": "4", "analyst": "2"}'), - ('4455a888-7c9f-4468-9dd3-24aad2f6ead9', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'sessao', 'agendado', 'livro', '22', '2026-03-06 00:16:00+00', '2026-03-06 01:24:00+00', '2026-03-06 00:16:58.833665+00', '2026-03-06 00:16:58.833665+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, 'f3cee12c-530c-4efd-a128-a01017baca89', NULL, 'livro', '{"book": "11", "notes": "22", "author": "22"}'), - ('5166f6ed-6e2f-4f2c-abd8-1a321e811e2d', 'aaaaaaaa-0002-0002-0002-000000000002', '67beb18d-14a1-49f2-9f85-3c42634a1790', 'sessao', 'agendado', 'Rafael Pereira Ribeiro [Sessão]', NULL, '2026-03-05 12:00:00+00', '2026-03-05 12:50:00+00', '2026-03-05 17:11:52.646957+00', '2026-03-05 17:11:52.646957+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('2ef97d93-33be-43fa-888f-408cb7131570', 'aaaaaaaa-0002-0002-0002-000000000002', 'a2f6f07e-0ff1-403f-ba22-67eac989b7cc', 'sessao', 'agendado', 'João Costa Barbosa [Sessão]', NULL, '2026-03-05 13:00:00+00', '2026-03-05 13:50:00+00', '2026-03-05 17:12:23.235706+00', '2026-03-05 17:12:23.235706+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('994edbc4-482f-4b33-b789-53111aedfec6', 'aaaaaaaa-0002-0002-0002-000000000002', '67beb18d-14a1-49f2-9f85-3c42634a1790', 'sessao', 'agendado', 'Rafael Pereira Ribeiro [Sessão]', NULL, '2026-03-05 14:00:00+00', '2026-03-05 15:08:00+00', '2026-03-05 17:15:46.734079+00', '2026-03-05 17:15:46.734079+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('30548662-8a52-41ca-8c2e-cf26b9fa0f5b', 'aaaaaaaa-0002-0002-0002-000000000002', '67beb18d-14a1-49f2-9f85-3c42634a1790', 'sessao', 'agendado', 'Rafael Pereira Ribeiro [Sessão]', NULL, '2026-03-05 11:00:00+00', '2026-03-05 11:50:00+00', '2026-03-05 17:16:11.141968+00', '2026-03-05 17:16:11.141968+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('8b01d7d8-23a3-4ae2-8bde-c1f8f950246b', 'aaaaaaaa-0002-0002-0002-000000000002', '0ef7d831-3bc7-4e1c-948b-35b40bee1ed3', 'sessao', 'agendado', 'Yasmin Ribeiro Barbosa 2 [Sessão]', 'observacao', '2026-03-05 15:30:00+00', '2026-03-05 16:38:00+00', '2026-03-05 17:25:41.925051+00', '2026-03-05 17:25:41.925051+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('ab0f8638-65f2-4f34-9039-3c60785414f5', 'aaaaaaaa-0002-0002-0002-000000000002', '67beb18d-14a1-49f2-9f85-3c42634a1790', 'sessao', 'agendado', 'Rafael Pereira Ribeiro [Sessão]', NULL, '2026-03-05 10:00:00+00', '2026-03-05 10:40:00+00', '2026-03-05 17:29:31.055937+00', '2026-03-05 17:29:31.055937+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('f00c3b61-313f-4abc-9ff6-f7cebe360d12', 'aaaaaaaa-0002-0002-0002-000000000002', '0ef7d831-3bc7-4e1c-948b-35b40bee1ed3', 'sessao', 'agendado', 'Yasmin Ribeiro Barbosa 2 [Sessão]', NULL, '2026-03-05 17:00:00+00', '2026-03-05 18:08:00+00', '2026-03-05 17:30:06.854021+00', '2026-03-05 17:30:06.854021+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '7e08480b-93a5-4081-865a-75d1f255c0c4', NULL, NULL, NULL), - ('eed1684b-14ed-428f-863a-f2b2904a9d17', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'sessao', 'agendado', 'Análise Pessoal', NULL, '2026-03-05 23:00:00+00', '2026-03-06 00:08:00+00', '2026-03-05 23:15:21.129535+00', '2026-03-05 23:15:21.129535+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, '3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', NULL, NULL, NULL), - ('1b9b60e4-ebd7-4ec0-bc4f-a556fdd08c59', 'aaaaaaaa-0002-0002-0002-000000000002', NULL, 'sessao', 'agendado', 'teste', NULL, '2026-03-06 02:00:00+00', '2026-03-06 03:08:00+00', '2026-03-05 23:55:01.668398+00', '2026-03-05 23:55:01.668398+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002', 'public', NULL, NULL, NULL, 'f3cee12c-530c-4efd-a128-a01017baca89', NULL, NULL, NULL); - - --- --- Data for Name: agenda_excecoes; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: agenda_online_slots; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."agenda_online_slots" ("id", "owner_id", "weekday", "time", "enabled", "created_at", "updated_at", "tenant_id") VALUES - (64, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '08:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (65, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '09:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (66, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '10:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (67, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '11:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (68, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '13:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (69, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '14:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (70, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '15:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (71, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '16:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (72, 'aaaaaaaa-0005-0005-0005-000000000005', 1, '17:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (73, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '09:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (74, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '10:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (75, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '11:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (76, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '12:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (77, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '14:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (78, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '15:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (79, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '16:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (80, 'aaaaaaaa-0005-0005-0005-000000000005', 2, '17:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (81, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '10:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (82, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '11:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (83, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '12:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (84, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '14:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (85, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '15:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (86, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '16:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (87, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '17:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (88, 'aaaaaaaa-0005-0005-0005-000000000005', 3, '19:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (89, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '11:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (90, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '12:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (91, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '14:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (92, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '15:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (93, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '16:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (94, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '17:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (95, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '19:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (96, 'aaaaaaaa-0005-0005-0005-000000000005', 4, '20:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (97, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '12:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (98, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '14:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (99, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '15:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (100, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '16:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (101, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '17:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (102, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '19:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (103, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '20:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (104, 'aaaaaaaa-0005-0005-0005-000000000005', 5, '21:00:00', true, '2026-03-06 09:52:39.473197+00', '2026-03-06 09:52:39.473197+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - (105, 'aaaaaaaa-0002-0002-0002-000000000002', 1, '08:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (106, 'aaaaaaaa-0002-0002-0002-000000000002', 1, '09:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (107, 'aaaaaaaa-0002-0002-0002-000000000002', 1, '11:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (108, 'aaaaaaaa-0002-0002-0002-000000000002', 1, '12:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (109, 'aaaaaaaa-0002-0002-0002-000000000002', 4, '10:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (110, 'aaaaaaaa-0002-0002-0002-000000000002', 4, '09:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (111, 'aaaaaaaa-0002-0002-0002-000000000002', 4, '11:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (112, 'aaaaaaaa-0002-0002-0002-000000000002', 6, '13:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - (113, 'aaaaaaaa-0002-0002-0002-000000000002', 6, '14:00:00', true, '2026-03-06 14:18:42.272452+00', '2026-03-06 14:18:42.272452+00', 'bbbbbbbb-0002-0002-0002-000000000002'); - - --- --- Data for Name: agenda_regras_semanais; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."agenda_regras_semanais" ("id", "owner_id", "dia_semana", "hora_inicio", "hora_fim", "modalidade", "ativo", "created_at", "updated_at", "tenant_id") VALUES - ('55e5ff22-b5d0-4bcb-9ddc-11e96dac3a8c', 'aaaaaaaa-0005-0005-0005-000000000005', 1, '08:00:00', '18:00:00', 'ambos', true, '2026-03-06 09:51:53.646377+00', '2026-03-06 09:51:53.646377+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('648a19bb-9c83-40d2-a749-8626d2d764c2', 'aaaaaaaa-0005-0005-0005-000000000005', 2, '09:00:00', '19:00:00', 'ambos', true, '2026-03-06 09:51:53.646377+00', '2026-03-06 09:51:53.646377+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('45786b7d-8726-4c4e-880d-1cd23784d252', 'aaaaaaaa-0005-0005-0005-000000000005', 3, '10:00:00', '20:00:00', 'ambos', true, '2026-03-06 09:51:53.646377+00', '2026-03-06 09:51:53.646377+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('cd245432-6860-4e79-b550-0d0d77cd0955', 'aaaaaaaa-0005-0005-0005-000000000005', 4, '11:00:00', '21:00:00', 'ambos', true, '2026-03-06 09:51:53.646377+00', '2026-03-06 09:51:53.646377+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('a9ab9ba1-e307-40fe-86af-e66408da14d3', 'aaaaaaaa-0005-0005-0005-000000000005', 5, '12:00:00', '22:00:00', 'ambos', true, '2026-03-06 09:51:53.646377+00', '2026-03-06 09:51:53.646377+00', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('85ec5d56-0e3a-44a5-83d7-bc354533d2c3', 'aaaaaaaa-0002-0002-0002-000000000002', 1, '08:00:00', '21:00:00', 'ambos', true, '2026-03-06 14:54:52.524628+00', '2026-03-06 14:54:52.524628+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('391a6f5e-2d6a-4e44-bc7e-a6a9523e8f6d', 'aaaaaaaa-0002-0002-0002-000000000002', 2, '08:00:00', '21:00:00', 'ambos', true, '2026-03-06 14:54:52.524628+00', '2026-03-06 14:54:52.524628+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('4f0015ce-ffb5-4b0b-9154-e2837eee557c', 'aaaaaaaa-0002-0002-0002-000000000002', 3, '08:00:00', '21:00:00', 'ambos', true, '2026-03-06 14:54:52.524628+00', '2026-03-06 14:54:52.524628+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('7b33f6d4-f904-4560-9ad9-3b8f5739187a', 'aaaaaaaa-0002-0002-0002-000000000002', 4, '08:00:00', '21:00:00', 'ambos', true, '2026-03-06 14:54:52.524628+00', '2026-03-06 14:54:52.524628+00', 'bbbbbbbb-0002-0002-0002-000000000002'); - - --- --- Data for Name: agenda_slots_bloqueados_semanais; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: agenda_slots_regras; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: commitment_time_logs; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: determined_commitment_fields; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."determined_commitment_fields" ("id", "tenant_id", "commitment_id", "key", "label", "field_type", "required", "sort_order", "created_at", "updated_at") VALUES - ('cd36d430-a4b5-4545-9624-77b79d15ee31', 'bbbbbbbb-0002-0002-0002-000000000002', 'f3cee12c-530c-4efd-a128-a01017baca89', 'book', 'Livro', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('6fa5eab8-6494-4893-83ec-b3c27725e6b2', 'bbbbbbbb-0002-0002-0002-000000000002', 'f3cee12c-530c-4efd-a128-a01017baca89', 'author', 'Autor', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('d9d38c75-1958-47f6-9d9c-b081c9b2de5b', 'bbbbbbbb-0002-0002-0002-000000000002', 'f3cee12c-530c-4efd-a128-a01017baca89', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('ab428eec-e8b9-4cc4-a466-d6779b008ff0', 'bbbbbbbb-0002-0002-0002-000000000002', 'cc8e6cfd-6d48-4645-89e6-dd1e776eed48', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('de13f18f-4324-4823-aff8-c3a33dd3b2a2', 'bbbbbbbb-0002-0002-0002-000000000002', 'cc8e6cfd-6d48-4645-89e6-dd1e776eed48', 'topic', 'Assunto', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('8d6ad9b3-6340-4348-903d-95ae7e629fb4', 'bbbbbbbb-0002-0002-0002-000000000002', 'cc8e6cfd-6d48-4645-89e6-dd1e776eed48', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('ae63775f-c4f8-4bff-a5d8-0ed29e7bce70', 'bbbbbbbb-0002-0002-0002-000000000002', '4b52db75-9f5e-4a8a-9fe9-1433b25b360c', 'theme', 'Tema', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('8ff31172-4a4f-4aeb-bac9-c2d1a3b5ad27', 'bbbbbbbb-0002-0002-0002-000000000002', '4b52db75-9f5e-4a8a-9fe9-1433b25b360c', 'group', 'Turma', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('72bf7657-d65b-4d90-a782-cd87671375e8', 'bbbbbbbb-0002-0002-0002-000000000002', '4b52db75-9f5e-4a8a-9fe9-1433b25b360c', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('d2c1754a-e123-4385-90ff-173e5b8f9f2a', 'bbbbbbbb-0003-0003-0003-000000000003', '277fb576-5801-4dcc-8642-e79184f2b4fa', 'book', 'Livro', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('b8ce30ae-f953-40ba-a4c3-ab6a18a1421a', 'bbbbbbbb-0003-0003-0003-000000000003', '277fb576-5801-4dcc-8642-e79184f2b4fa', 'author', 'Autor', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('4660f633-4558-434a-826b-cb54abeb8f51', 'bbbbbbbb-0003-0003-0003-000000000003', '277fb576-5801-4dcc-8642-e79184f2b4fa', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('971519db-b319-487b-b05c-42f5b8562ea5', 'bbbbbbbb-0003-0003-0003-000000000003', 'c493b9db-37c1-4402-a732-d64cf5891a01', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('961da45e-d56d-48d2-ba22-c7ae2bd05be6', 'bbbbbbbb-0003-0003-0003-000000000003', 'c493b9db-37c1-4402-a732-d64cf5891a01', 'topic', 'Assunto', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('63a9ed59-0930-49d3-814d-db4862dc9a60', 'bbbbbbbb-0003-0003-0003-000000000003', 'c493b9db-37c1-4402-a732-d64cf5891a01', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('79a0b97b-c3d8-4e1f-9cd1-027f5402a14c', 'bbbbbbbb-0003-0003-0003-000000000003', '800b9565-f68e-46f2-8a54-e76f01cc502f', 'theme', 'Tema', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('a63a6058-d46e-4ddb-b4ba-8339a1477529', 'bbbbbbbb-0003-0003-0003-000000000003', '800b9565-f68e-46f2-8a54-e76f01cc502f', 'group', 'Turma', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('a4de587b-13fb-4274-bb49-1905d89cd304', 'bbbbbbbb-0003-0003-0003-000000000003', '800b9565-f68e-46f2-8a54-e76f01cc502f', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('c33d442a-bb57-4ec4-b321-56f2aa7159bc', 'bbbbbbbb-0003-0003-0003-000000000003', 'f1220b5c-f5b2-420f-84b5-cb525876200a', 'analyst', 'Analista', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('92ca9b88-2d34-4e0b-bad1-dfcb206fead3', 'bbbbbbbb-0003-0003-0003-000000000003', 'f1220b5c-f5b2-420f-84b5-cb525876200a', 'focus', 'Foco', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('e97def28-a2b2-4baf-b4b1-7342b7b79bde', 'bbbbbbbb-0003-0003-0003-000000000003', 'f1220b5c-f5b2-420f-84b5-cb525876200a', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('4b318da9-5fe9-41b0-bb09-5b969c241443', 'bbbbbbbb-0004-0004-0004-000000000004', 'fc27d2a2-be03-41cb-9b95-9a03e9edc96b', 'book', 'Livro', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('109193f8-62ad-4825-a964-017eb4c88d0c', 'bbbbbbbb-0004-0004-0004-000000000004', 'fc27d2a2-be03-41cb-9b95-9a03e9edc96b', 'author', 'Autor', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('681480e2-059b-4fe5-bc71-6a5c5548caa5', 'bbbbbbbb-0004-0004-0004-000000000004', 'fc27d2a2-be03-41cb-9b95-9a03e9edc96b', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('940fcae6-626f-43f8-803c-9935c551d3cb', 'bbbbbbbb-0004-0004-0004-000000000004', 'b1d318bf-8561-40d8-8cd3-e3ca715d80c8', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('6d7e386e-64d8-47c5-85c6-04f1fd349341', 'bbbbbbbb-0004-0004-0004-000000000004', 'b1d318bf-8561-40d8-8cd3-e3ca715d80c8', 'topic', 'Assunto', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('e071e5f5-dc03-42d3-89a8-e87b85e516ed', 'bbbbbbbb-0004-0004-0004-000000000004', 'b1d318bf-8561-40d8-8cd3-e3ca715d80c8', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('61299e6d-d59f-4823-8740-a56205dbb763', 'bbbbbbbb-0004-0004-0004-000000000004', '03c38d95-ed9e-4d42-8e10-4f8705462774', 'theme', 'Tema', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('28fc3fad-8951-40b9-a0ac-e6c025d5357e', 'bbbbbbbb-0004-0004-0004-000000000004', '03c38d95-ed9e-4d42-8e10-4f8705462774', 'group', 'Turma', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('254b5bad-a780-413c-854a-cde186ee288f', 'bbbbbbbb-0004-0004-0004-000000000004', '03c38d95-ed9e-4d42-8e10-4f8705462774', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('52c8de37-9e01-4322-a8ca-f408a7fa7cf1', 'bbbbbbbb-0004-0004-0004-000000000004', '15806ba6-483f-4e1e-80fc-81c14b511c43', 'analyst', 'Analista', 'text', false, 10, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('2bdc9380-9794-44b7-ba94-5a9059ad54a5', 'bbbbbbbb-0004-0004-0004-000000000004', '15806ba6-483f-4e1e-80fc-81c14b511c43', 'focus', 'Foco', 'text', false, 20, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('97f76f02-5618-4f42-ab78-1dfc8e3f4351', 'bbbbbbbb-0004-0004-0004-000000000004', '15806ba6-483f-4e1e-80fc-81c14b511c43', 'notes', 'Observação', 'textarea', false, 30, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00'), - ('b8dff0b5-be75-4c5a-b518-1c04eca1098e', '7e8b1272-0ba5-497a-afad-a2db1533e300', '0d93b6cd-01fe-42db-a27d-caa0c98b97ef', 'book', 'Livro', 'text', false, 10, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('dcda9f1a-0cb8-459a-9bbf-cff335d2749e', '7e8b1272-0ba5-497a-afad-a2db1533e300', '0d93b6cd-01fe-42db-a27d-caa0c98b97ef', 'author', 'Autor', 'text', false, 20, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('eca08b7b-589a-4bb2-9a73-ba6fbc9eac71', '7e8b1272-0ba5-497a-afad-a2db1533e300', '0d93b6cd-01fe-42db-a27d-caa0c98b97ef', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('d49079dc-a5ff-484d-b205-ebab0effdb03', '7e8b1272-0ba5-497a-afad-a2db1533e300', '644eb2f7-73b3-4147-a52f-484c24516712', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('ec075cd8-cc8c-4f74-8f93-a4a6ed5bd1cb', '7e8b1272-0ba5-497a-afad-a2db1533e300', '644eb2f7-73b3-4147-a52f-484c24516712', 'topic', 'Assunto', 'text', false, 20, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('8f71399a-5ba1-481d-9171-ee36595277fa', '7e8b1272-0ba5-497a-afad-a2db1533e300', '644eb2f7-73b3-4147-a52f-484c24516712', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('cae172f0-a3de-45be-ad8d-ceada553b0d2', '7e8b1272-0ba5-497a-afad-a2db1533e300', 'af04bf86-3167-4dd2-bdfd-a985070ac031', 'theme', 'Tema', 'text', false, 10, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('c37998a1-265f-4958-801c-cac89823a6bd', '7e8b1272-0ba5-497a-afad-a2db1533e300', 'af04bf86-3167-4dd2-bdfd-a985070ac031', 'group', 'Turma', 'text', false, 20, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('692a2eac-6a32-4c5c-b48c-42c01ebe27b6', '7e8b1272-0ba5-497a-afad-a2db1533e300', 'af04bf86-3167-4dd2-bdfd-a985070ac031', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('1f1b25d8-08de-4eaa-aa9f-41d740366672', '7e8b1272-0ba5-497a-afad-a2db1533e300', '9dfa0f46-54c7-4bfe-8721-55969eab665f', 'analyst', 'Analista', 'text', false, 10, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('e4b8953e-3d2f-49a4-ae50-a8c0752512cf', '7e8b1272-0ba5-497a-afad-a2db1533e300', '9dfa0f46-54c7-4bfe-8721-55969eab665f', 'focus', 'Foco', 'text', false, 20, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('180befd9-a3bd-4916-a524-2330046941d7', '7e8b1272-0ba5-497a-afad-a2db1533e300', '9dfa0f46-54c7-4bfe-8721-55969eab665f', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:41.588972+00', '2026-03-04 17:02:41.588972+00'), - ('7b2804ea-5e90-4276-94ce-e2a7ffe58777', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'd1aa13ec-c628-4a16-82f8-d4503dec5e97', 'book', 'Livro', 'text', false, 10, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('c1816769-fd4b-487a-a031-41128d5afdf5', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'd1aa13ec-c628-4a16-82f8-d4503dec5e97', 'author', 'Autor', 'text', false, 20, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('7916a22f-3fb0-4bd9-85af-1d85ea36cfe3', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'd1aa13ec-c628-4a16-82f8-d4503dec5e97', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('fe337062-b7fd-4807-b790-4be7c57af51b', '349933ee-8902-4041-b4c2-9ee690f5d3a0', '3a9ba018-21e4-4c9e-9c23-fe5d0fde50c2', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('c103c37e-b998-4804-839c-4fa7f25d4e3a', '349933ee-8902-4041-b4c2-9ee690f5d3a0', '3a9ba018-21e4-4c9e-9c23-fe5d0fde50c2', 'topic', 'Assunto', 'text', false, 20, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('6f6be10a-36c9-43c1-8bcd-0dfe4b98b875', '349933ee-8902-4041-b4c2-9ee690f5d3a0', '3a9ba018-21e4-4c9e-9c23-fe5d0fde50c2', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('f65465ff-f143-4f08-bfb4-9d8f01558c32', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'a7316fc9-c24e-469c-b6f2-75c467a303e2', 'theme', 'Tema', 'text', false, 10, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('b258e368-0275-4f3a-8c81-5d7df00987b6', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'a7316fc9-c24e-469c-b6f2-75c467a303e2', 'group', 'Turma', 'text', false, 20, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('fde3ab89-9563-4854-9b2b-8a5d85c9f967', '349933ee-8902-4041-b4c2-9ee690f5d3a0', 'a7316fc9-c24e-469c-b6f2-75c467a303e2', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('1c336347-5990-4014-91bf-5b95765a8e5a', '349933ee-8902-4041-b4c2-9ee690f5d3a0', '74797cdd-2c96-4035-b406-a534f102b051', 'analyst', 'Analista', 'text', false, 10, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('c2fabdf9-40d6-4104-8d7a-9aed4ad7bcfe', '349933ee-8902-4041-b4c2-9ee690f5d3a0', '74797cdd-2c96-4035-b406-a534f102b051', 'focus', 'Foco', 'text', false, 20, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('9298274e-22ee-4a07-a567-7e9fac24910c', '349933ee-8902-4041-b4c2-9ee690f5d3a0', '74797cdd-2c96-4035-b406-a534f102b051', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 17:02:51.022501+00', '2026-03-04 17:02:51.022501+00'), - ('13c2a59a-947d-4d2a-be39-587d2ae63350', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'eabb297e-1e71-427c-90e6-28b6b98e904b', 'book', 'Livro', 'text', false, 10, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('adecdd42-28ae-4767-8179-1346e0aad3a3', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'eabb297e-1e71-427c-90e6-28b6b98e904b', 'author', 'Autor', 'text', false, 20, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('8a8220d8-3c3e-4972-a4f5-355537a7a2ef', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'eabb297e-1e71-427c-90e6-28b6b98e904b', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('a2284cba-5c2a-44aa-a212-18739e5ed415', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'c7234876-bae4-4178-abae-24187ef90d5d', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('fb7a4b10-084a-4ef2-b360-93322aa47375', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'c7234876-bae4-4178-abae-24187ef90d5d', 'topic', 'Assunto', 'text', false, 20, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('23ca87d3-cbcc-46d4-91c7-40a201b5106f', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'c7234876-bae4-4178-abae-24187ef90d5d', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('41620d8c-e0f3-4843-b704-8a97aac037e3', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', '25a04a15-11b3-471b-8944-0fbd7aca2843', 'theme', 'Tema', 'text', false, 10, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('dfd8d401-1fc7-4556-abc6-c6c9c6cf0de7', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', '25a04a15-11b3-471b-8944-0fbd7aca2843', 'group', 'Turma', 'text', false, 20, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('5830b84d-3e44-4ea9-be66-0713e0ca9430', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', '25a04a15-11b3-471b-8944-0fbd7aca2843', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('256e9db0-6af4-494e-b64e-c2c8144a798c', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'f600aaa1-427a-4a5a-ab8b-3cfd561a7269', 'analyst', 'Analista', 'text', false, 10, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('62d41439-e456-4ccd-b3ec-bfff55fee884', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'f600aaa1-427a-4a5a-ab8b-3cfd561a7269', 'focus', 'Foco', 'text', false, 20, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('37dd36b2-cee8-4f93-8315-e19eee1aad8c', '402a470b-0a2c-4da0-9b1d-6646b362f4d9', 'f600aaa1-427a-4a5a-ab8b-3cfd561a7269', 'notes', 'Observação', 'textarea', false, 30, '2026-03-04 19:40:23.077765+00', '2026-03-04 19:40:23.077765+00'), - ('f433963e-75f7-4754-85f8-cdfc3893e69e', 'bbbbbbbb-0002-0002-0002-000000000002', '3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', 'analyst', 'Analista', 'text', false, 10, '2026-03-05 19:51:29.066132+00', '2026-03-05 19:51:29.066132+00'), - ('1f6b513c-9211-44a0-bd4f-3d03abde6384', 'bbbbbbbb-0002-0002-0002-000000000002', '3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', 'focus', 'Foco', 'text', false, 20, '2026-03-05 19:51:29.066132+00', '2026-03-05 19:51:29.066132+00'), - ('d11ef072-e15d-49ca-8ea6-7070c4ddec42', 'bbbbbbbb-0002-0002-0002-000000000002', '3fa224bf-c3af-49f3-b7c0-d8ad149fbdff', 'notes', 'Observação', 'textarea', false, 30, '2026-03-05 19:51:29.066132+00', '2026-03-05 19:51:29.066132+00'), - ('51e4efa6-c31e-4d4a-9f43-20c1044dd26e', 'bbbbbbbb-0005-0005-0005-000000000005', 'a0947ddc-f062-4d46-afb8-5b30a25097dc', 'analyst', 'Analista', 'text', false, 10, '2026-03-06 10:13:23.626395+00', '2026-03-06 10:13:23.626395+00'), - ('7319f3a1-ff88-41ba-b70a-05bd69fb3c34', 'bbbbbbbb-0005-0005-0005-000000000005', 'a0947ddc-f062-4d46-afb8-5b30a25097dc', 'focus', 'Foco', 'text', false, 20, '2026-03-06 10:13:23.626395+00', '2026-03-06 10:13:23.626395+00'), - ('92e00438-0501-405f-b5fc-56da96cf91eb', 'bbbbbbbb-0005-0005-0005-000000000005', 'a0947ddc-f062-4d46-afb8-5b30a25097dc', 'notes', 'Observação', 'textarea', false, 30, '2026-03-06 10:13:23.626395+00', '2026-03-06 10:13:23.626395+00'), - ('0c5e8d7d-9a6b-4071-864f-93a4a7710149', 'bbbbbbbb-0005-0005-0005-000000000005', '33aa916c-247a-4a30-bf11-8742fd37039f', 'theme', 'Tema', 'text', false, 10, '2026-03-06 10:13:29.459047+00', '2026-03-06 10:13:29.459047+00'), - ('2b07cf4a-0214-4c06-a350-82f030a95006', 'bbbbbbbb-0005-0005-0005-000000000005', '33aa916c-247a-4a30-bf11-8742fd37039f', 'group', 'Turma', 'text', false, 20, '2026-03-06 10:13:29.459047+00', '2026-03-06 10:13:29.459047+00'), - ('70f00a10-e3b6-4d41-9e0c-0e0b64dbc578', 'bbbbbbbb-0005-0005-0005-000000000005', '33aa916c-247a-4a30-bf11-8742fd37039f', 'notes', 'Observação', 'textarea', false, 30, '2026-03-06 10:13:29.459047+00', '2026-03-06 10:13:29.459047+00'), - ('fc52b68e-ad49-4402-9c95-c0a7502e8aa4', 'bbbbbbbb-0005-0005-0005-000000000005', 'fca90568-1535-4625-87d5-107b9bb5dafc', 'book', 'Livro', 'text', false, 10, '2026-03-06 10:13:36.448621+00', '2026-03-06 10:13:36.448621+00'), - ('9aa22a01-91bd-45cb-b796-c2e05353ef20', 'bbbbbbbb-0005-0005-0005-000000000005', 'fca90568-1535-4625-87d5-107b9bb5dafc', 'author', 'Autor', 'text', false, 20, '2026-03-06 10:13:36.448621+00', '2026-03-06 10:13:36.448621+00'), - ('c672473d-8261-45f1-9692-e325d26283f5', 'bbbbbbbb-0005-0005-0005-000000000005', 'fca90568-1535-4625-87d5-107b9bb5dafc', 'notes', 'Observação', 'textarea', false, 30, '2026-03-06 10:13:36.448621+00', '2026-03-06 10:13:36.448621+00'), - ('6fae65da-852b-433b-827a-4df84aaecc5b', 'bbbbbbbb-0005-0005-0005-000000000005', '1632e283-7294-46c6-94ab-4f2c3508a4a6', 'supervisor', 'Supervisor', 'text', false, 10, '2026-03-06 10:13:50.100528+00', '2026-03-06 10:13:50.100528+00'), - ('c6a55a2a-de2f-47d3-a3c8-866e6f0d1a37', 'bbbbbbbb-0005-0005-0005-000000000005', '1632e283-7294-46c6-94ab-4f2c3508a4a6', 'topic', 'Assunto', 'text', false, 20, '2026-03-06 10:13:50.100528+00', '2026-03-06 10:13:50.100528+00'), - ('b2818086-4a68-4c0d-8111-452e5dac831f', 'bbbbbbbb-0005-0005-0005-000000000005', '1632e283-7294-46c6-94ab-4f2c3508a4a6', 'notes', 'Observação', 'textarea', false, 30, '2026-03-06 10:13:50.100528+00', '2026-03-06 10:13:50.100528+00'); - - --- --- Data for Name: dev_user_credentials; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: entitlements_invalidation; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."entitlements_invalidation" ("owner_id", "changed_at") VALUES - ('e8b10543-fb36-4e75-9d37-6fece9745637', '2026-02-24 23:35:59.37248+00'), - ('01b89c85-8e1b-43e2-bf10-77f4428ea582', '2026-03-01 22:46:06.127205+00'), - ('816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-03-02 13:23:55.426163+00'), - ('51a475d2-7f11-43d7-b47d-3e78dcd3bd16', '2026-03-03 19:36:32.24533+00'), - ('824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-03-03 19:58:57.723908+00'), - ('aaaaaaaa-0001-0001-0001-000000000001', '2026-03-04 17:24:56.964418+00'), - ('aaaaaaaa-0008-0008-0008-000000000008', '2026-03-04 20:06:18.002704+00'), - ('aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 10:18:46.485009+00'), - ('bbbbbbbb-0005-0005-0005-000000000005', '2026-03-06 02:53:19.171984+00'); - - --- --- Data for Name: features; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."features" ("id", "key", "description", "created_at", "descricao", "name") VALUES - ('336aeeba-b18e-4e68-8303-d42ba09f4b20', 'secretary', 'Secretary features (clinic)', '2026-03-01 09:59:15.432733+00', 'Secretaria', 'Secretaria'), - ('30c9cdd5-7c8c-44d9-8c0b-614165bb9496', 'shared_reception', 'Shared reception / secretary', '2026-03-02 12:35:19.955748+00', 'Recepção / Secretária', 'Recepção Compartilhada'), - ('8cc81988-d02a-4542-9cb2-ce2ed7c18d60', 'sms_reminder', 'Lembretes por SMS (confirmações e avisos)', '2026-02-15 23:29:55.845638+00', 'Lembretes por SMS', 'Lembretes por SMS'), - ('9ab8bdbb-838b-4946-aa5d-fd9cfdd257b3', 'supervisor.access', NULL, '2026-03-05 00:58:17.218326+00', 'Acesso básico ao espaço de supervisão (sala, lista de supervisionados).', 'Acesso à Supervisão'), - ('1167b54a-0e93-43a2-94d7-c12e64eb56de', 'supervisor.invite', NULL, '2026-03-05 00:58:17.218326+00', 'Permite convidar terapeutas para participar da sala de supervisão.', 'Convidar Supervisionados'), - ('5e539124-630f-4c2a-a9de-7999317085e6', 'agenda.view', NULL, '2026-02-21 02:36:01.562728+00', 'Visualizar agenda', 'Visualizar Agenda'), - ('a74fef14-c9d9-4884-ba45-f81c60e0783a', 'agenda.manage', NULL, '2026-02-21 02:35:50.629667+00', 'Adicionar Compromissos na agenda', 'Gerenciar Agenda'), - ('5739aa27-b089-4b15-b149-31b13d768825', 'online_scheduling.manage', 'Gerenciar agendamento online (config/admin)', '2026-02-15 21:50:02.056357+00', 'Gerenciar agendamento online (admin)', 'Agendamento Online'), - ('0bfe0b1c-8c3d-4c0c-af29-2ddc24f31bc7', 'online_scheduling.public', 'Página pública de agendamento', '2026-02-15 21:50:02.056357+00', 'Página pública de agendamento', 'Página Pública de Agendamento'), - ('b3efa25d-60a4-4974-8153-6ec098b3d477', 'reports_basic', 'Basic reports', '2026-03-01 09:59:15.432733+00', 'Relatórios básicos', 'Relatórios Básicos'), - ('f5d66212-fd73-4472-a306-07928e5deaec', 'reminders', 'Notifications/reminders capability', '2026-03-01 09:59:15.432733+00', 'Lembretes', 'Lembretes'), - ('53a48c3b-0617-4618-adf8-f3a255c51ee4', 'online_scheduling', 'Online scheduling capability', '2026-03-01 09:59:15.432733+00', 'Agendamento online', 'Agendamento Online (Público)'), - ('a830e45b-3bb4-4b17-812d-fe83777a2377', 'advanced_reports', 'Relatórios avançados (KPIs, filtros e exportações)', '2026-02-15 23:29:55.845638+00', 'Relatórios avançados', 'Relatórios Avançados'), - ('d6f54674-ea8b-484b-af0e-99127a510da2', 'api_access', 'API/Integrations access', '2026-03-01 09:59:15.432733+00', 'Integrações/API', 'Acesso à API'), - ('a5593d96-dd95-46bb-bef0-bd379b56ad50', 'audit_log', 'Audit log capability', '2026-03-01 09:59:15.432733+00', 'Auditoria', 'Log de Auditoria'), - ('9b36c65d-b3b3-4bed-b6d5-f7ee8c087c80', 'clinic_calendar', 'Clinic calendar / admin view', '2026-03-01 09:59:15.432733+00', 'Agenda da clínica', 'Agenda da Clínica'), - ('f393178c-284d-422f-b096-8793f85428d5', 'custom_branding', 'Custom branding', '2026-03-01 09:59:15.432733+00', 'Personalização de marca', 'Marca Personalizada'), - ('c109ad27-0edf-4774-91a7-94dac4faab49', 'intake_public', 'Public intake link', '2026-03-02 12:35:19.955748+00', 'Link externo de cadastro', 'Link Externo de Cadastro'), - ('90e92108-8124-40ee-88a0-f0ecafb57d76', 'intakes_pro', 'Cadastros/Intakes PRO (fluxos avançados e automações)', '2026-02-15 23:29:55.845638+00', 'Formulários PRO', 'Formulários PRO'), - ('a56482a1-0787-49da-90a7-e1857488734a', 'patients', 'Patients module', '2026-03-02 12:35:19.955748+00', 'Pacientes', 'Pacientes'), - ('4e5bc50b-e339-42fe-9d91-61e8555f83e7', 'patients.manage', NULL, '2026-02-28 11:15:14.275572+00', 'Gerenciar pacientes', 'Gerenciar Pacientes'), - ('57f631a1-9ebe-480b-a2cb-144ad32ff5f0', 'patients.view', NULL, '2026-02-28 11:15:14.275572+00', 'Visualizar pacientes', 'Visualizar Pacientes'), - ('bf133ad1-da8e-4ea9-bd66-21901cb50075', 'reports_advanced', 'Advanced reports', '2026-03-01 09:59:15.432733+00', 'Relatórios avançados', 'Relatórios Avançados (v2)'), - ('74fc1321-4d17-49c3-b72e-db3a7f4be451', 'rooms', 'Rooms / coworking', '2026-03-02 12:35:19.955748+00', 'Salas / Coworking', 'Salas / Coworking'), - ('761e4495-b46a-4791-9519-86ffe48dc47f', 'supervisor.sessions', NULL, '2026-03-05 00:58:17.218326+00', 'Agendamento e registro de sessões de supervisão.', 'Sessões de Supervisão'), - ('7e82ee01-44f6-4b3f-9861-840c58e13f58', 'supervisor.reports', NULL, '2026-03-05 00:58:17.218326+00', 'Relatórios avançados de progresso e evolução dos supervisionados.', 'Relatórios de Supervisão'); - - --- --- Data for Name: feriados; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."feriados" ("id", "tenant_id", "owner_id", "tipo", "nome", "data", "cidade", "estado", "observacao", "bloqueia_sessoes", "criado_em") VALUES - ('55f5eaca-e8f9-43c7-956a-a1c82caea287', NULL, NULL, 'municipal', 'São Sebastião do Rio de Janeiro', '2026-01-20', 'Rio de Janeiro', 'RJ', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('58659516-ee29-4795-a259-cb3177bed5dd', NULL, NULL, 'municipal', 'Aniversário de Praia Grande', '2026-01-19', 'Praia Grande', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('a478f88e-bba9-45e2-b346-5f79f031fe4a', NULL, NULL, 'municipal', 'Aniversário de São Vicente', '2026-01-22', 'São Vicente', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('779a47cd-08b4-46ba-9c15-2f800801e652', NULL, NULL, 'municipal', 'Aniversário da Cidade de São Paulo', '2026-01-25', 'São Paulo', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('089ac7d0-0a6f-44c1-8ece-e6c1cd7e00d6', NULL, NULL, 'municipal', 'Aniversário de Itu', '2026-02-02', 'Itu', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('a59bd863-9b2b-4edb-8bd0-f1683a9e6b21', NULL, NULL, 'municipal', 'Aniversário de Embu das Artes', '2026-02-18', 'Embu das Artes', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('e72da1ee-3010-4421-abe8-58bc5618d7d9', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-03-19', 'São José do Rio Preto', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('4e406ec4-2938-4d32-b180-b067efe87722', NULL, NULL, 'municipal', 'Aniversário de Jacareí', '2026-04-03', 'Jacareí', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('0155e502-bf6c-4281-8542-4116588a5a4a', NULL, NULL, 'municipal', 'Aniversário de Marília', '2026-04-04', 'Marília', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('d3506698-3a8f-4a72-83f3-4e6ed1ff30c3', NULL, NULL, 'municipal', 'Aniversário de Santo André', '2026-04-08', 'Santo André', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('c71ae316-aa84-41dd-b95a-475d2bf23fa9', NULL, NULL, 'municipal', 'Aniversário de Botucatu', '2026-04-14', 'Botucatu', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('ecf3cf27-2f02-4a03-ad65-4c49f7561494', NULL, NULL, 'municipal', 'Aniversário de Catanduva', '2026-04-14', 'Catanduva', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('aea9d7fe-b4cd-4689-94fa-947493e93193', NULL, NULL, 'municipal', 'Nossa Senhora Auxiliadora', '2026-05-24', 'Goiânia', 'GO', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('7ccf4989-9917-4b6f-99a5-98e024efd2d5', NULL, NULL, 'municipal', 'Santo Antônio (Padroeiro)', '2026-06-13', 'Piracicaba', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('6005bea6-491e-4376-b6cc-9ffff6b3de1f', NULL, NULL, 'municipal', 'Aniversário de Atibaia', '2026-06-24', 'Atibaia', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('fd469894-c45f-485c-9895-caabda0cfe5b', NULL, NULL, 'municipal', 'Nossa Senhora do Carmo', '2026-07-16', 'Recife', 'PE', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('0bf2cc43-0533-4f7a-830c-04b91d0523f6', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-07-27', 'São José dos Campos', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('c54f0ae9-0737-4966-9d3e-4165032b9565', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-07-28', 'São Caetano do Sul', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('48c489f7-1f2f-432c-92f6-369839102745', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-08-01', 'Bauru', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('5467b84b-cb0a-4249-9137-9cd2e118e846', NULL, NULL, 'municipal', 'Assunção de Nossa Senhora', '2026-08-15', 'Belo Horizonte', 'MG', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('3b019a91-2b5d-42f3-9cae-34f345d7ecb7', NULL, NULL, 'municipal', 'Nossa Senhora da Assunção', '2026-08-15', 'Fortaleza', 'CE', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('42f55844-4337-4190-9893-39a3f1ce4b14', NULL, NULL, 'municipal', 'Nossa Senhora do Desterro', '2026-08-15', 'Jundiaí', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('bc2f1ba6-9631-4bfe-9006-f8a3fce73a6c', NULL, NULL, 'municipal', 'Aniversário de Sorocaba', '2026-08-15', 'Sorocaba', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('e430e2b5-d4ba-4474-9d9d-6e8db612e07d', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-08-27', 'Americana', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('fab3a430-9340-4bc3-b702-aed8375f9f8e', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-09-01', 'Mogi das Cruzes', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('329e9270-1c79-4f1c-b640-96476bda73ac', NULL, NULL, 'municipal', 'Nossa Senhora da Luz dos Pinhais', '2026-09-08', 'Curitiba', 'PR', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('c83ed3f7-3eb2-4cc5-ba69-aa6762907e25', NULL, NULL, 'municipal', 'Nossa Senhora do Monte Serrat', '2026-09-08', 'Santos', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('bea14dc8-9bc5-4c59-9b7d-2ffb76953aac', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-09-08', 'São Luís', 'MA', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('1ae520fd-d8d7-47ba-8f56-28c016ad4f05', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-09-14', 'Presidente Prudente', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('5893c031-2ae3-4e1e-ae90-6d4b376d3b70', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-09-15', 'Limeira', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('8ef353cc-ed40-49fa-a8a0-68085c04f4e0', NULL, NULL, 'municipal', 'Elevação de Manaus à categoria de cidade', '2026-10-24', 'Manaus', 'AM', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('08d9e6bf-c8db-4fae-896a-400efd454783', NULL, NULL, 'municipal', 'Nossa Senhora da Imaculada Conceição', '2026-12-08', 'Campinas', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('5a1544df-0ac9-408e-9b5f-056245b5dc2f', NULL, NULL, 'municipal', 'Nossa Senhora da Conceição', '2026-12-08', 'Guarulhos', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('d1bd6326-35dc-4ded-9682-8ac9e98b7f91', NULL, NULL, 'municipal', 'Imaculada Conceição', '2026-12-08', 'Bragança Paulista', 'SP', NULL, false, '2026-03-06 17:42:40.678233+00'), - ('4ad77519-5bd0-4e3d-9c18-cae116eead8f', NULL, NULL, 'municipal', 'Aniversário de São Carlos', '2026-11-04', 'São Carlos', 'SP', NULL, false, '2026-03-06 17:43:18.732849+00'), - ('dd16e99d-1ca5-40fc-8e57-19b466e8f032', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-11-28', 'Franca', 'SP', NULL, false, '2026-03-06 17:43:18.732849+00'), - ('eeef681b-3a7c-459c-a765-54b705c717f8', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-12-02', 'Araçatuba', 'SP', NULL, false, '2026-03-06 17:43:18.732849+00'), - ('6b5a49fe-8489-4e70-864d-1d0300028fc7', NULL, NULL, 'municipal', 'Aniversário da Cidade', '2026-12-09', 'Indaiatuba', 'SP', NULL, false, '2026-03-06 17:43:18.732849+00'); - - --- --- Data for Name: modules; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."modules" ("id", "key", "name", "description", "is_active", "created_at") VALUES - ('1c824c73-1745-4c88-87ea-b5760764abbf', 'online_scheduling', 'Agendamento Online', 'Módulo de agendamento online para pacientes', true, '2026-02-15 21:50:02.056357+00'), - ('70233e26-4502-4835-94c2-8d96f23cc3ef', 'rooms', 'Salas / Coworking', NULL, true, '2026-03-02 12:42:17.658171+00'), - ('0299ff83-7ff6-4ff3-a00d-6674472ca24c', 'patients', 'Pacientes', NULL, true, '2026-03-02 12:42:17.658171+00'), - ('e67efec2-a1e0-402a-b8a1-551a219647af', 'intake_public', 'Link externo de cadastro', NULL, true, '2026-03-02 12:42:17.658171+00'), - ('2e24cc79-796d-4f5f-9c3d-8e4161e1422b', 'shared_reception', 'Recepção / Secretária', NULL, true, '2026-03-02 12:42:17.658171+00'); - - --- --- Data for Name: module_features; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."module_features" ("module_id", "feature_id", "enabled", "limits", "created_at") VALUES - ('1c824c73-1745-4c88-87ea-b5760764abbf', '5739aa27-b089-4b15-b149-31b13d768825', true, NULL, '2026-02-15 21:50:02.056357+00'), - ('1c824c73-1745-4c88-87ea-b5760764abbf', '0bfe0b1c-8c3d-4c0c-af29-2ddc24f31bc7', true, NULL, '2026-02-15 21:50:02.056357+00'), - ('70233e26-4502-4835-94c2-8d96f23cc3ef', '74fc1321-4d17-49c3-b72e-db3a7f4be451', true, NULL, '2026-03-02 12:42:36.836957+00'), - ('0299ff83-7ff6-4ff3-a00d-6674472ca24c', 'a56482a1-0787-49da-90a7-e1857488734a', true, NULL, '2026-03-02 12:42:36.836957+00'), - ('e67efec2-a1e0-402a-b8a1-551a219647af', 'c109ad27-0edf-4774-91a7-94dac4faab49', true, NULL, '2026-03-02 12:42:36.836957+00'), - ('2e24cc79-796d-4f5f-9c3d-8e4161e1422b', '30c9cdd5-7c8c-44d9-8c0b-614165bb9496', true, NULL, '2026-03-02 12:42:36.836957+00'); - - --- --- Data for Name: owner_users; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: patient_group_patient; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patient_group_patient" ("patient_group_id", "patient_id", "created_at", "tenant_id") VALUES - ('fd1ea020-7c63-455f-9a10-a535433884c4', '0ef7d831-3bc7-4e1c-948b-35b40bee1ed3', '2026-03-05 14:52:36.770537+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('ad030819-38c2-4757-97ec-a68b103963f7', '514ea533-2354-4f87-bbf6-fffa584eb9fd', '2026-03-06 02:06:10.87017+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('620d1b34-ff84-47e4-97be-32df4988fd6b', '3e452920-c7cd-4905-8725-5c53f6c34be8', '2026-03-06 02:06:15.460264+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('3a119ddf-b65f-4158-90c1-c1ccc9d45d5b', '4ad04965-a983-46e5-9208-1b876365e63c', '2026-03-06 02:06:19.559002+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('ad030819-38c2-4757-97ec-a68b103963f7', 'bb33e7df-7888-454d-b309-7f3982382821', '2026-03-06 02:06:23.584054+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('620d1b34-ff84-47e4-97be-32df4988fd6b', '3e27b78b-7976-4537-a35b-4be1d8b3bd63', '2026-03-06 02:06:27.915542+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('3a119ddf-b65f-4158-90c1-c1ccc9d45d5b', 'fb7a67f1-131c-4493-be18-37046ca98a65', '2026-03-06 02:06:32.110541+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('ad030819-38c2-4757-97ec-a68b103963f7', 'd8260f48-5616-4f18-b77a-a52a4bd24e9f', '2026-03-06 02:06:36.288507+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('620d1b34-ff84-47e4-97be-32df4988fd6b', 'c769884e-f01d-40bd-9ab8-956936c7ddc1', '2026-03-06 02:06:40.15804+00', 'bbbbbbbb-0002-0002-0002-000000000002'); - - --- --- Data for Name: patient_groups; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patient_groups" ("id", "nome", "descricao", "cor", "is_active", "is_system", "owner_id", "created_at", "updated_at", "therapist_id", "tenant_id") VALUES - ('3a119ddf-b65f-4158-90c1-c1ccc9d45d5b', 'teste', NULL, '#6339e3', true, false, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:37:31.722429+00', '2026-03-05 14:37:39.24561+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('e134974b-6f9b-4ad7-91ba-d2677a0b12c8', 'teste 2', NULL, '#6366F1', true, false, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:38:58.434688+00', '2026-03-05 14:38:58.434688+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('620d1b34-ff84-47e4-97be-32df4988fd6b', 'Adulto', 'Pacientes adultos em atendimento clínico', NULL, true, true, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:18:44.429853+00', '2026-03-05 14:18:44.429853+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('07e5d72f-6f28-44bf-8cc3-a2e50c73b8d6', 'Adolescente', 'Pacientes entre 12 e 17 anos', NULL, true, true, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:18:44.429853+00', '2026-03-05 14:18:44.429853+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('6f4f4ff5-a4ef-4f77-87cb-5b7e55a3fec6', 'Infantil', 'Pacientes - crianças', NULL, true, true, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:18:44.429853+00', '2026-03-05 14:18:44.429853+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('fd1ea020-7c63-455f-9a10-a535433884c4', 'Casal', 'Atendimento - terapêutico para casais', NULL, true, true, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:18:44.429853+00', '2026-03-05 14:18:44.429853+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('ad030819-38c2-4757-97ec-a68b103963f7', 'Família', 'Atendimento - terapêutico familiar', NULL, true, true, 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 14:18:44.429853+00', '2026-03-05 14:18:44.429853+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'); - - --- --- Data for Name: patient_intake_requests; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patient_intake_requests" ("id", "owner_id", "token", "consent", "status", "created_at", "converted_patient_id", "rejected_reason", "updated_at", "cpf", "rg", "cep", "nome_completo", "email_principal", "telefone", "pais", "cidade", "estado", "endereco", "numero", "bairro", "complemento", "data_nascimento", "naturalidade", "genero", "estado_civil", "onde_nos_conheceu", "encaminhado_por", "observacoes", "notas_internas", "email_alternativo", "telefone_alternativo", "profissao", "escolaridade", "nacionalidade", "avatar_url", "tenant_id") VALUES - ('4161f4aa-36b2-417b-beed-de3500afbc96', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'new', '2026-02-15 10:32:59.252357+00', NULL, NULL, '2026-02-15 10:40:02.208433+00', '71373575395', '43.198.918-4', '13561260', 'Otávio Silva Araújo', 'otavio.silva.araujo.852@email.com', '18998353190', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '6707', 'Parque Santa Mônica', NULL, '1996-09-23', 'Bauru', 'male', 'widowed', 'Indicação', 'Carla Oliveira', 'Cadastro realizado via link externo.', NULL, 'alt.257@gmail.com', NULL, 'Desenvolvedor', 'Pós-graduação', NULL, NULL, NULL), - ('23c0b714-d6e6-41d6-af9f-789099bd1a87', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'new', '2026-02-15 10:35:02.401731+00', NULL, NULL, '2026-02-15 10:40:02.208433+00', '94211482904', '72.959.330-4', '13561260', 'Yasmin Silva Souza', 'yasmin.silva.souza.973@email.com', '81920616912', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '3765', 'Parque Santa Mônica', 'complemento', '1980-10-11', 'São Carlos', 'na', 'na', 'Instagram', 'emcaninhado por', 'Tenho disponibilidade no período da noite.', NULL, 'alt.578@gmail.com', '99999999999', 'Desenvolvedor', 'Superior incompleto', NULL, NULL, NULL), - ('7489da97-7c43-407c-9855-ded4355e36f7', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'new', '2026-02-15 11:00:14.207698+00', NULL, NULL, '2026-02-15 11:00:14.207698+00', '56877860071', '49.732.360-5', '13561260', 'Giovana Lima Souza', 'giovana.lima.souza.350@email.com', '66901559302', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '8466', 'Parque Santa Mônica', NULL, '1991-07-24', 'Bauru', 'male', 'divorced', 'Indicação', NULL, 'Cadastro realizado via link externo.', NULL, 'alt.138@hotmail.com', NULL, 'Vendedor', 'Pós-graduação', NULL, NULL, NULL), - ('75f82235-635b-432f-821a-bec583757203', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'new', '2026-02-15 11:00:53.075213+00', NULL, NULL, '2026-02-15 11:00:53.075213+00', '80312691653', '22.488.379-8', '13561260', 'Rafael Ferreira Silva 888', 'rafael.ferreira.silva.381@email.com', '70904319028', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '9090', 'Parque Santa Mônica', 'asd', '2007-09-08', 'Santos', 'female', 'single', 'Indicação', 'Daniel Oliveira', 'Tenho disponibilidade no período da noite.', 'asdasdasd', 'alt.184@gmail.com', '99999999999', 'Servidor público', 'Superior incompleto', 'asd', NULL, NULL), - ('bb5c4415-bee8-414d-b51f-b5365491fbc4', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'converted', '2026-02-15 11:03:59.471421+00', '775fd57e-aa2e-4b8e-9336-515b6ce283b7', NULL, '2026-02-15 11:11:53.821746+00', '33559195195', '46.869.944-9', '13561260', 'Giovana Oliveira Ferreira', 'giovana.oliveira.ferreira.320@email.com', '72994698104', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '9506', 'Parque Santa Mônica', 'Apto 387', '1996-08-13', 'Bauru', 'na', 'married', 'Site', NULL, 'Cadastro realizado via link externo.', 'Paciente demonstrou interesse em iniciar nas próximas semanas.', NULL, NULL, 'Estudante', 'Ensino Fundamental', NULL, 'http://127.0.0.1:54321/storage/v1/object/public/avatars/intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771153439377.png', NULL), - ('54daa09a-b2cb-4a0b-91aa-e4cea1915efe', 'e8b10543-fb36-4e75-9d37-6fece9745637', 'dd2862f6-9436-4905-ae79-a606f9a740b6', true, 'new', '2026-02-26 04:14:24.11383+00', NULL, NULL, '2026-02-26 05:26:14.37419+00', '50275677745', '30.331.938-0', '13561260', 'Daniel Almeida Silva aaa', 'daniel.almeida.silva.182@email.com', '71917738107', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '8975', 'Parque Santa Mônica', NULL, '1973-02-28', 'Campinas', 'other', 'single', 'Google', 'Marcos Ferreira', 'Tenho disponibilidade no período da noite.', 'Paciente demonstrou interesse em iniciar nas próximas semanas.', NULL, NULL, 'Desenvolvedor', 'Superior completo', NULL, 'http://127.0.0.1:54321/storage/v1/object/public/avatars/intakes/dd2862f6-9436-4905-ae79-a606f9a740b6/1772079264021.webp', NULL), - ('f86a3c93-dbff-4fcc-a6d3-aaf1e27457ba', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'new', '2026-02-26 12:03:00.038061+00', NULL, NULL, '2026-02-26 12:03:00.038061+00', '27703835072', '05.170.765-9', '13561260', 'Ana Oliveira Almeida', 'ana.oliveira.almeida.921@email.com', '36940651231', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '4900', 'Parque Santa Mônica', 'Apto 394', '1996-04-24', 'São Carlos', 'male', 'divorced', 'Threads', 'Bruno Lima', 'Cadastro realizado via link externo.', NULL, NULL, NULL, 'Professora', 'Pós-graduação', NULL, NULL, NULL), - ('4e0cd37a-e227-4c9b-9ac4-f99b5052def8', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, 'converted', '2026-02-26 12:05:13.421024+00', '92ce6ae5-f7a7-46ab-86ec-12259a7e92a8', NULL, '2026-02-26 12:05:22.396633+00', '26664657058', '10.602.419-1', '13561260', 'Giovana Costa Araújo 33333333333 - Clinica', 'giovana.costa.araujo.276@email.com', '33976187007', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '3544', 'Parque Santa Mônica', NULL, '1998-06-23', 'Santos', 'other', 'widowed', 'Outro', 'Larissa Silva', 'Tenho disponibilidade no período da noite.', NULL, NULL, NULL, 'Vendedor', 'Superior incompleto', NULL, 'http://127.0.0.1:54321/storage/v1/object/public/avatars/intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1772107513331.jpg', NULL), - ('c15afc63-fdd9-4510-b620-61b3632290a3', 'aaaaaaaa-0002-0002-0002-000000000002', 'b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348', true, 'converted', '2026-03-05 14:59:03.353464+00', '8f00663b-9234-44fd-bdc1-8c1a1d8d8762', NULL, '2026-03-05 15:02:17.766695+00', '93951183187', '68.484.108-8', '13561260', 'Carla Santos Oliveira', 'carla.santos.oliveira.12@email.com', '13951182892', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '7644', 'Parque Santa Mônica', NULL, '1983-01-05', 'Ribeirão Preto', 'non_binary', 'single', 'Site', 'Yasmin Gomes', 'Tenho disponibilidade no período da noite.', NULL, NULL, NULL, 'Professora', 'Pós-graduação', NULL, NULL, NULL), - ('3bd81319-46d4-4bbe-a492-e2dff9d8b1e6', 'aaaaaaaa-0002-0002-0002-000000000002', 'b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348', true, 'converted', '2026-03-05 15:02:26.027358+00', 'a2f6f07e-0ff1-403f-ba22-67eac989b7cc', NULL, '2026-03-05 15:04:30.270726+00', '16602041517', '67.628.680-1', '13561260', 'João Costa Barbosa', 'joao.costa.barbosa.555@email.com', '76948155255', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '5807', 'Parque Santa Mônica', NULL, '1991-09-01', 'Sorocaba', 'other', 'divorced', 'Outro', 'Larissa Souza', 'Cadastro realizado via link externo.', NULL, NULL, NULL, 'Estudante', 'Superior completo', NULL, NULL, NULL), - ('e4de4a41-a4f6-4e81-b35a-488e77fbb44b', 'aaaaaaaa-0002-0002-0002-000000000002', 'b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348', true, 'converted', '2026-03-05 15:05:13.28983+00', '67beb18d-14a1-49f2-9f85-3c42634a1790', NULL, '2026-03-05 15:05:30.307355+00', '74006061234', '62.571.088-6', '13561260', 'Rafael Pereira Ribeiro', 'rafael.pereira.ribeiro.358@email.com', '67975758463', 'Brasil', 'São Carlos', 'SP', 'Avenida Tancredo de Almeida Neves', '1164', 'Parque Santa Mônica', NULL, '2002-08-13', 'Sorocaba', 'other', 'married', 'Indicação', 'Henrique Santos', 'Cadastro realizado via link externo.', NULL, NULL, NULL, 'Autônomo', 'Superior incompleto', NULL, 'http://127.0.0.1:54321/storage/v1/object/public/avatars/intakes/b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348/1772723113160.png', NULL); - - --- --- Data for Name: patient_invites; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patient_invites" ("id", "owner_id", "token", "active", "expires_at", "max_uses", "uses", "created_at", "tenant_id") VALUES - ('b4dd66bf-0d25-43bf-b199-8072e264aa1d', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '202c7181-9d25-4fb7-9c90-e0fc6503a277', false, NULL, NULL, 0, '2026-02-13 12:52:08.642831+00', NULL), - ('53447157-9868-4fee-9be1-fdecb1e6517e', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '3188fdca-0314-4fcb-b95d-0aebe4c83ee6', false, NULL, NULL, 0, '2026-02-13 12:53:30.099066+00', NULL), - ('4a7a3fd8-d751-47d6-8aa9-160ebb121089', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'd08c9ded-8707-4029-9b3b-bdda1806cbf4', false, NULL, NULL, 13, '2026-02-13 13:01:23.100384+00', NULL), - ('e45d1de0-4037-4e91-b9c9-55aec0daef6e', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'd8e36584-bad9-4282-8ecc-85d11ef32ddf', false, NULL, NULL, 3, '2026-02-13 22:58:42.072767+00', NULL), - ('53a6c339-f5fd-4fe8-a1df-4c2eadec853b', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'b49f3c84-6b07-4d1f-bc7e-82353518871f', true, NULL, NULL, 0, '2026-02-15 04:03:31.287563+00', NULL), - ('dec8f9e0-9fa6-4ffc-85c4-22a863c5e07d', '40a4b683-a0c9-4890-a201-20faf41fca06', 'e3abed8b-36d0-4f4c-a06f-a055e2cf9b09', true, NULL, NULL, 0, '2026-02-28 11:24:22.533995+00', NULL), - ('25aa7e20-89a2-467f-8771-8c3af7074328', 'aaaaaaaa-0002-0002-0002-000000000002', 'd0d93a51-bfb1-4f0d-b97e-fcab1fca39e2', false, NULL, NULL, 0, '2026-03-05 14:58:48.494658+00', NULL), - ('18f35685-f76a-4a9c-90ec-6d02e8449255', 'aaaaaaaa-0002-0002-0002-000000000002', 'b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348', true, NULL, NULL, 0, '2026-03-05 14:58:53.658323+00', NULL), - ('1db4c803-904c-4ccc-bf8a-37d99171438d', 'aaaaaaaa-0005-0005-0005-000000000005', '16b6d335-1e01-4e9c-8752-baf1f5acd147', true, NULL, NULL, 0, '2026-03-06 02:56:03.567268+00', NULL); - - --- --- Data for Name: patient_tags; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patient_tags" ("id", "owner_id", "nome", "cor", "is_padrao", "created_at", "updated_at", "tenant_id") VALUES - ('de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', 'aaaaaaaa-0002-0002-0002-000000000002', 'teste', '#22C55E', false, '2026-03-05 14:52:32.895944+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'), - ('4c203254-8962-479b-97ec-a15a8eb855a6', 'aaaaaaaa-0002-0002-0002-000000000002', 'teste2', '#14b8a6', false, '2026-03-06 01:46:54.968309+00', NULL, 'bbbbbbbb-0002-0002-0002-000000000002'); - - --- --- Data for Name: patient_patient_tag; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."patient_patient_tag" ("owner_id", "patient_id", "tag_id", "created_at", "tenant_id") VALUES - ('aaaaaaaa-0002-0002-0002-000000000002', '0ef7d831-3bc7-4e1c-948b-35b40bee1ed3', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-05 14:52:37.229893+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '514ea533-2354-4f87-bbf6-fffa584eb9fd', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:11.16161+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '3e452920-c7cd-4905-8725-5c53f6c34be8', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:15.687569+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '3e452920-c7cd-4905-8725-5c53f6c34be8', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:15.687569+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '4ad04965-a983-46e5-9208-1b876365e63c', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:19.927565+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '4ad04965-a983-46e5-9208-1b876365e63c', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:19.927565+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'bb33e7df-7888-454d-b309-7f3982382821', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:23.84635+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'bb33e7df-7888-454d-b309-7f3982382821', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:23.84635+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '3e27b78b-7976-4537-a35b-4be1d8b3bd63', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:28.39488+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', '3e27b78b-7976-4537-a35b-4be1d8b3bd63', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:28.39488+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'fb7a67f1-131c-4493-be18-37046ca98a65', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:32.452568+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'fb7a67f1-131c-4493-be18-37046ca98a65', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:32.452568+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'd8260f48-5616-4f18-b77a-a52a4bd24e9f', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:36.646167+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'd8260f48-5616-4f18-b77a-a52a4bd24e9f', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:36.646167+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'c769884e-f01d-40bd-9ab8-956936c7ddc1', 'de2bb4c7-98ed-4cfc-bf9e-e4a953a709fe', '2026-03-06 02:06:40.548463+00', 'bbbbbbbb-0002-0002-0002-000000000002'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'c769884e-f01d-40bd-9ab8-956936c7ddc1', '4c203254-8962-479b-97ec-a15a8eb855a6', '2026-03-06 02:06:40.548463+00', 'bbbbbbbb-0002-0002-0002-000000000002'); - - --- --- Data for Name: plans; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."plans" ("id", "key", "name", "description", "is_active", "created_at", "price_cents", "currency", "billing_interval", "target", "max_supervisees") VALUES - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'therapist_pro', 'THERAPIST PRO', 'Plano completo para terapeutas.', true, '2026-03-01 09:25:03.878498+00', 4900, 'BRL', 'month', 'therapist', NULL), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'clinic_pro', 'CLINIC PRO', 'Plano completo para clínicas.', true, '2026-03-01 09:30:06.50975+00', 14900, 'BRL', 'month', 'clinic', NULL), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'therapist_free', 'THERAPIST FREE', 'Plano gratuito para terapeutas.', true, '2026-03-01 09:40:48.439668+00', 0, 'BRL', 'month', 'therapist', NULL), - ('01a5867f-0705-4714-ac97-a23470949157', 'clinic_free', 'CLINIC FREE', 'Plano gratuito para clínicas iniciarem.', true, '2026-03-01 09:25:03.878498+00', 0, 'BRL', 'month', 'clinic', NULL), - ('984c1f29-a975-4208-93ac-2118ed1039b7', 'patient_free', 'Paciente Free', 'Plano gratuito para pacientes', true, '2026-03-03 22:40:11.413107+00', 0, 'BRL', 'month', 'patient', NULL), - ('8c4895a3-e12d-48de-a078-efb8a4ea2eb2', 'supervisor_free', 'Supervisor Free', 'Plano gratuito de supervisão. Até 3 terapeutas supervisionados.', true, '2026-03-05 00:58:17.218326+00', 0, 'BRL', 'month', 'supervisor', 3), - ('ca28e46c-0687-45d5-9406-0a0f56a5b625', 'supervisor_pro', 'Supervisor PRO', 'Plano profissional de supervisão. Até 20 terapeutas supervisionados.', true, '2026-03-05 00:58:17.218326+00', 0, 'BRL', 'month', 'supervisor', 20); - - --- --- Data for Name: plan_features; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."plan_features" ("plan_id", "feature_id", "enabled", "limits", "created_at") VALUES - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '5e539124-630f-4c2a-a9de-7999317085e6', true, NULL, '2026-03-02 11:31:55.803241+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'a830e45b-3bb4-4b17-812d-fe83777a2377', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'a74fef14-c9d9-4884-ba45-f81c60e0783a', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '90e92108-8124-40ee-88a0-f0ecafb57d76', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '5739aa27-b089-4b15-b149-31b13d768825', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '0bfe0b1c-8c3d-4c0c-af29-2ddc24f31bc7', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '4e5bc50b-e339-42fe-9d91-61e8555f83e7', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '57f631a1-9ebe-480b-a2cb-144ad32ff5f0', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '8cc81988-d02a-4542-9cb2-ce2ed7c18d60', true, NULL, '2026-03-02 11:57:24.738773+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'a830e45b-3bb4-4b17-812d-fe83777a2377', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'a74fef14-c9d9-4884-ba45-f81c60e0783a', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '5e539124-630f-4c2a-a9de-7999317085e6', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '9b36c65d-b3b3-4bed-b6d5-f7ee8c087c80', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '90e92108-8124-40ee-88a0-f0ecafb57d76', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '5739aa27-b089-4b15-b149-31b13d768825', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '0bfe0b1c-8c3d-4c0c-af29-2ddc24f31bc7', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '4e5bc50b-e339-42fe-9d91-61e8555f83e7', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '57f631a1-9ebe-480b-a2cb-144ad32ff5f0', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '336aeeba-b18e-4e68-8303-d42ba09f4b20', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '8cc81988-d02a-4542-9cb2-ce2ed7c18d60', true, NULL, '2026-03-02 12:21:05.305341+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'a56482a1-0787-49da-90a7-e1857488734a', true, NULL, '2026-03-02 12:35:39.702533+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '30c9cdd5-7c8c-44d9-8c0b-614165bb9496', true, NULL, '2026-03-02 12:35:39.702533+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '74fc1321-4d17-49c3-b72e-db3a7f4be451', true, NULL, '2026-03-02 12:35:39.702533+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'c109ad27-0edf-4774-91a7-94dac4faab49', true, NULL, '2026-03-02 12:35:39.702533+00'), - ('8c4895a3-e12d-48de-a078-efb8a4ea2eb2', '9ab8bdbb-838b-4946-aa5d-fd9cfdd257b3', true, NULL, '2026-03-05 00:58:17.218326+00'), - ('8c4895a3-e12d-48de-a078-efb8a4ea2eb2', '1167b54a-0e93-43a2-94d7-c12e64eb56de', true, NULL, '2026-03-05 00:58:17.218326+00'), - ('ca28e46c-0687-45d5-9406-0a0f56a5b625', '9ab8bdbb-838b-4946-aa5d-fd9cfdd257b3', true, NULL, '2026-03-05 00:58:17.218326+00'), - ('ca28e46c-0687-45d5-9406-0a0f56a5b625', '1167b54a-0e93-43a2-94d7-c12e64eb56de', true, NULL, '2026-03-05 00:58:17.218326+00'), - ('ca28e46c-0687-45d5-9406-0a0f56a5b625', '761e4495-b46a-4791-9519-86ffe48dc47f', true, NULL, '2026-03-05 00:58:17.218326+00'), - ('ca28e46c-0687-45d5-9406-0a0f56a5b625', '7e82ee01-44f6-4b3f-9861-840c58e13f58', true, NULL, '2026-03-05 00:58:17.218326+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '9b36c65d-b3b3-4bed-b6d5-f7ee8c087c80', true, '{"max_patients": 9999, "max_therapists": 999}', '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '53a48c3b-0617-4618-adf8-f3a255c51ee4', true, '{"sessions_per_month": 9999}', '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'f5d66212-fd73-4472-a306-07928e5deaec', true, '{"reminders_per_month": 9999}', '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'b3efa25d-60a4-4974-8153-6ec098b3d477', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'bf133ad1-da8e-4ea9-bd66-21901cb50075', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '336aeeba-b18e-4e68-8303-d42ba09f4b20', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'f393178c-284d-422f-b096-8793f85428d5', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'd6f54674-ea8b-484b-af0e-99127a510da2', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'a5593d96-dd95-46bb-bef0-bd379b56ad50', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '53a48c3b-0617-4618-adf8-f3a255c51ee4', true, '{"sessions_per_month": 40}', '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'f5d66212-fd73-4472-a306-07928e5deaec', true, '{"reminders_per_month": 50}', '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'b3efa25d-60a4-4974-8153-6ec098b3d477', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'bf133ad1-da8e-4ea9-bd66-21901cb50075', false, NULL, '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'f393178c-284d-422f-b096-8793f85428d5', false, NULL, '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'd6f54674-ea8b-484b-af0e-99127a510da2', false, NULL, '2026-03-01 09:59:49.472081+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'a5593d96-dd95-46bb-bef0-bd379b56ad50', false, NULL, '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', '53a48c3b-0617-4618-adf8-f3a255c51ee4', true, '{"sessions_per_month": 9999}', '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'f5d66212-fd73-4472-a306-07928e5deaec', true, '{"reminders_per_month": 9999}', '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'b3efa25d-60a4-4974-8153-6ec098b3d477', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'bf133ad1-da8e-4ea9-bd66-21901cb50075', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'f393178c-284d-422f-b096-8793f85428d5', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'd6f54674-ea8b-484b-af0e-99127a510da2', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'a5593d96-dd95-46bb-bef0-bd379b56ad50', true, NULL, '2026-03-01 09:59:49.472081+00'), - ('01a5867f-0705-4714-ac97-a23470949157', 'd6f54674-ea8b-484b-af0e-99127a510da2', true, NULL, '2026-03-01 10:59:37.826931+00'), - ('01a5867f-0705-4714-ac97-a23470949157', 'a5593d96-dd95-46bb-bef0-bd379b56ad50', true, NULL, '2026-03-01 10:59:38.824235+00'), - ('01a5867f-0705-4714-ac97-a23470949157', '9b36c65d-b3b3-4bed-b6d5-f7ee8c087c80', true, NULL, '2026-03-01 10:59:39.704203+00'); - - --- --- Data for Name: plan_prices; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."plan_prices" ("id", "plan_id", "currency", "interval", "amount_cents", "is_active", "active_from", "active_to", "source", "provider", "provider_price_id", "created_at") VALUES - ('37510504-4617-4421-9979-4249778bd5ae', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'BRL', 'month', 4900, true, '2026-03-01 09:25:03.878498+00', NULL, 'manual', NULL, NULL, '2026-03-01 09:25:03.878498+00'), - ('225afd5a-9f30-46bc-a0df-5eb8f91660cb', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'BRL', 'year', 49000, true, '2026-03-01 09:25:03.878498+00', NULL, 'manual', NULL, NULL, '2026-03-01 09:25:03.878498+00'), - ('124779b4-362d-4890-9631-747021ecc1c0', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'BRL', 'month', 14900, true, '2026-03-01 09:30:06.50975+00', NULL, 'manual', NULL, NULL, '2026-03-01 09:30:06.50975+00'), - ('73908784-6299-45c8-b547-e1556b45c292', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'BRL', 'year', 149000, true, '2026-03-01 09:30:06.50975+00', NULL, 'manual', NULL, NULL, '2026-03-01 09:30:06.50975+00'); - - --- --- Data for Name: plan_public; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."plan_public" ("plan_id", "public_name", "public_description", "badge", "is_featured", "is_visible", "sort_order", "created_at", "updated_at") VALUES - ('01a5867f-0705-4714-ac97-a23470949157', 'Clínica — Free', 'Para clínicas pequenas começarem sem cartão.', 'Grátis', false, true, 10, '2026-03-01 09:25:03.878498+00', '2026-03-01 09:25:03.878498+00'), - ('82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'Terapeuta — PRO', 'Para expandir com automações e escala.', NULL, true, true, 20, '2026-03-01 09:25:03.878498+00', '2026-03-01 09:25:03.878498+00'), - ('a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'Clínica — PRO', 'Para clínicas que querem recursos completos.', NULL, true, true, 20, '2026-03-01 09:30:06.50975+00', '2026-03-01 09:30:06.50975+00'), - ('c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'Terapeuta — Free', 'Para começar e organizar sua prática.', 'Grátis', false, true, 10, '2026-03-01 09:40:48.439668+00', '2026-03-01 09:40:48.439668+00'); - - --- --- Data for Name: plan_public_bullets; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."plan_public_bullets" ("id", "plan_id", "text", "sort_order", "highlight", "created_at") VALUES - ('bfe8418a-6c00-43e7-9386-9bf158ce2670', '01a5867f-0705-4714-ac97-a23470949157', '1 terapeuta incluído', 10, false, '2026-03-01 09:25:03.878498+00'), - ('e98a2bea-34a6-44b0-a55b-02c13a46beb0', '01a5867f-0705-4714-ac97-a23470949157', 'Até 30 pacientes', 20, false, '2026-03-01 09:25:03.878498+00'), - ('cc3ac3e5-1204-4717-bb5c-7c54c5aaf778', '01a5867f-0705-4714-ac97-a23470949157', 'Até 100 sessões/mês', 30, false, '2026-03-01 09:25:03.878498+00'), - ('60863f04-83cb-4ef1-a550-45cbbf47518d', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'Pacientes ilimitados', 10, true, '2026-03-01 09:25:03.878498+00'), - ('ebdb350c-7212-487d-9e97-56c17eec86fd', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'Sessões ilimitadas', 20, true, '2026-03-01 09:25:03.878498+00'), - ('644e69e5-909d-49ac-9c0a-189b4a75a735', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'Relatórios e lembretes', 30, false, '2026-03-01 09:25:03.878498+00'), - ('46e62597-9e0f-4983-91cf-d926649f82e0', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'Até 10 pacientes', 10, false, '2026-03-01 09:40:48.439668+00'), - ('66377882-a252-45a5-a9ea-66928e975294', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'Até 40 sessões/mês', 20, false, '2026-03-01 09:40:48.439668+00'), - ('a6b0b894-c45d-4109-8a68-f613b4932a83', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'Portal do paciente', 30, false, '2026-03-01 09:40:48.439668+00'); - - --- --- Data for Name: profiles; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."profiles" ("id", "role", "full_name", "created_at", "updated_at", "avatar_url", "phone", "bio", "language", "timezone", "notify_system_email", "notify_reminders", "notify_news", "account_type", "platform_roles") VALUES - ('aaaaaaaa-0011-0011-0011-000000000011', 'tenant_member', 'Gabriela Secretária', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:23.077765+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'therapist', '{}'), - ('aaaaaaaa-0001-0001-0001-000000000001', 'portal_user', 'Ana Paciente', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'patient', '{}'), - ('aaaaaaaa-0006-0006-0006-000000000006', 'saas_admin', 'Admin Plataforma', '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'free', '{}'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'tenant_member', 'Bruno Terapeuta', '2026-03-03 22:43:41.705072+00', '2026-03-04 02:40:31.718611+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'therapist', '{}'), - ('aaaaaaaa-0003-0003-0003-000000000003', 'tenant_member', 'Clinica Espaco Psi', '2026-03-03 22:43:41.705072+00', '2026-03-04 02:40:31.718611+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'clinic', '{}'), - ('aaaaaaaa-0004-0004-0004-000000000004', 'tenant_member', 'Clinica Mente Sa', '2026-03-03 22:43:41.705072+00', '2026-03-04 02:40:31.718611+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'clinic', '{}'), - ('aaaaaaaa-0005-0005-0005-000000000005', 'tenant_member', '', '2026-03-03 22:43:41.705072+00', '2026-03-04 03:17:57.589646+00', 'http://127.0.0.1:54321/storage/v1/object/public/avatars/aaaaaaaa-0005-0005-0005-000000000005/avatar-1772594277231.png', NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'clinic', '{}'), - ('aaaaaaaa-0007-0007-0007-000000000007', 'tenant_member', 'Carlos Supervisor', '2026-03-04 17:02:37.208401+00', '2026-03-04 17:02:41.588972+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'therapist', '{}'), - ('aaaaaaaa-0008-0008-0008-000000000008', 'tenant_member', 'Diana Editora', '2026-03-04 17:02:37.208401+00', '2026-03-04 17:02:51.022501+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'therapist', '{editor}'), - ('aaaaaaaa-0009-0009-0009-000000000009', 'tenant_member', 'Eva Terapeuta', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'therapist', '{}'), - ('aaaaaaaa-0010-0010-0010-000000000010', 'tenant_member', 'Felipe Terapeuta', '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', NULL, NULL, NULL, 'pt-BR', 'America/Sao_Paulo', true, true, false, 'therapist', '{}'); - - --- --- Data for Name: saas_admins; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."saas_admins" ("user_id", "created_at") VALUES - ('aaaaaaaa-0006-0006-0006-000000000006', '2026-03-03 22:43:41.705072+00'); - - --- --- Data for Name: saas_docs; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."saas_docs" ("id", "titulo", "conteudo", "medias", "tipo_acesso", "pagina_path", "docs_relacionados", "ativo", "ordem", "created_at", "updated_at", "categoria", "exibir_no_faq", "votos_util", "votos_nao_util") VALUES - ('df9f0cac-a8c8-4459-befd-74bf061a2903', 'teste 3', '

teste 3 de redirecionamento e relacionados

', '[]', 'usuario', '/therapist/agenda', '{bcc67ff3-89a1-41e6-9dc9-b1bb95f3d14b,f7d8bf29-0849-4966-ac79-90d14e64a2b9}', true, 0, '2026-03-08 00:11:34.853254+00', '2026-03-08 00:11:34.826+00', NULL, false, 0, 0), - ('f7d8bf29-0849-4966-ac79-90d14e64a2b9', 'Titulo do documento', '

Agência PSI nasce da convergência entre tecnologia, clínica e pensamento psicanalítico. Trata-se de uma iniciativa voltada ao desenvolvimento de soluções digitais para profissionais da saúde mental, especialmente psicólogos e psicanalistas, com o objetivo de simplificar a gestão clínica sem reduzir a complexidade do cuidado humano.

Mais do que um simples software, a Agência PSI busca construir um ecossistema que integra agenda clínica, prontuário, gestão de pacientes e recursos administrativos em uma plataforma intuitiva e segura. A proposta central é permitir que o profissional concentre sua energia na escuta e no trabalho clínico, enquanto as tarefas operacionais se tornam mais organizadas e eficientes.

Inspirada na ideia de que a clínica contemporânea também se encontra atravessada pela tecnologia, a Agência PSI procura equilibrar dois campos que, muitas vezes, parecem distantes: a subjetividade humana e a lógica dos sistemas digitais. Nesse sentido, a plataforma foi pensada para respeitar a ética, o sigilo e a singularidade do atendimento psicológico.

Assim, a Agência PSI se apresenta como uma ferramenta de apoio ao trabalho clínico, promovendo autonomia, organização e profissionalização para terapeutas que desejam atuar de forma mais estruturada no cenário atual.

', '[]', 'usuario', '/therapist', '{}', true, 0, '2026-03-07 12:14:32.505605+00', '2026-03-08 02:06:21.461347+00', NULL, false, 1, 0), - ('bcc67ff3-89a1-41e6-9dc9-b1bb95f3d14b', 'Documento 2', '

teste

', '[]', 'usuario', '/therapist', '{f7d8bf29-0849-4966-ac79-90d14e64a2b9}', true, 0, '2026-03-08 00:11:04.207625+00', '2026-03-08 02:21:02.279369+00', NULL, false, 1, 0), - ('08db54a3-4601-4708-bb07-3c2efe84f132', 'Teste - Titulo do conteudo com Faq', '

Conteúdo com faq

', '[{"url": "http://127.0.0.1:54321/storage/v1/object/public/saas-docs/doc-images/6ba2a9e3-b4b8-447d-b1fa-2c746f15e55e.png", "tipo": "imagem"}, {"url": "https://www.youtube.com/embed/IIqR2zk7aKY", "tipo": "video"}]', 'usuario', '/therapist', '{bcc67ff3-89a1-41e6-9dc9-b1bb95f3d14b}', true, 0, '2026-03-08 01:01:03.605111+00', '2026-03-08 02:21:15.978317+00', 'Dashboard', true, 0, 1); - - --- --- Data for Name: saas_doc_votos; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."saas_doc_votos" ("id", "doc_id", "user_id", "util", "created_at", "updated_at") VALUES - ('2a3169d2-20b7-49d9-8e11-8b4f40e5bdfe', 'f7d8bf29-0849-4966-ac79-90d14e64a2b9', 'aaaaaaaa-0002-0002-0002-000000000002', true, '2026-03-08 02:06:21.461347+00', '2026-03-08 02:06:21.461347+00'), - ('55b43fc2-d59c-45da-a78e-85b4297b7c8f', 'bcc67ff3-89a1-41e6-9dc9-b1bb95f3d14b', 'aaaaaaaa-0002-0002-0002-000000000002', true, '2026-03-08 02:21:02.279369+00', '2026-03-08 02:21:02.279369+00'), - ('017fe60d-d16d-4ef0-abb1-2caea3d43374', '08db54a3-4601-4708-bb07-3c2efe84f132', 'aaaaaaaa-0002-0002-0002-000000000002', false, '2026-03-08 02:21:13.879568+00', '2026-03-08 02:21:15.978317+00'); - - --- --- Data for Name: saas_faq; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: saas_faq_itens; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."saas_faq_itens" ("id", "doc_id", "pergunta", "resposta", "ordem", "ativo", "created_at", "updated_at") VALUES - ('643e1f7c-c419-47ec-81e2-2ed8641338c8', '08db54a3-4601-4708-bb07-3c2efe84f132', 'Como entender o Dashboard?', '

Resposta 1

', 0, true, '2026-03-08 01:01:03.726348+00', '2026-03-08 01:43:41.088+00'), - ('bce71119-22a9-49a7-ae4e-d6fbe42eee27', '08db54a3-4601-4708-bb07-3c2efe84f132', 'E agora, vem a pergunta 2?', '

Sim.

', 1, true, '2026-03-08 01:01:03.758901+00', '2026-03-08 01:43:41.137+00'); - - --- --- Data for Name: subscriptions; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."subscriptions" ("id", "user_id", "plan_id", "status", "current_period_start", "current_period_end", "cancel_at_period_end", "provider", "provider_customer_id", "provider_subscription_id", "created_at", "updated_at", "tenant_id", "plan_key", "interval", "source", "started_at", "canceled_at", "activated_at", "past_due_since", "suspended_at", "suspended_reason", "cancelled_at", "cancel_reason", "expired_at") VALUES - ('14a232bb-95da-400b-8547-df33e3acb2cb', NULL, 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'active', '2026-03-01 16:10:28.586893+00', '2027-03-01 16:10:28.586893+00', false, 'manual', NULL, NULL, '2026-03-01 16:10:28.586893+00', '2026-03-01 22:46:06.127205+00', '01b89c85-8e1b-43e2-bf10-77f4428ea582', 'clinic_pro', 'year', 'manual', '2026-03-01 16:10:28.586893+00', NULL, '2026-03-01 16:10:28.586893+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('c700073d-35cc-4bd9-9bea-113dd87a1b76', NULL, 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'active', '2026-03-01 14:17:25.099539+00', '2027-03-01 14:17:25.099539+00', false, 'manual', NULL, NULL, '2026-03-01 14:17:25.099539+00', '2026-03-01 14:17:25.099539+00', 'f491f4d4-7801-4f80-bd01-1ba18f647034', 'clinic_pro', 'year', 'manual', '2026-03-01 14:17:25.099539+00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - ('29e61e41-090a-4367-b0f7-33fea2a65736', NULL, 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'active', '2026-03-01 23:00:29.467613+00', '2027-03-01 23:00:29.467613+00', false, 'manual', NULL, NULL, '2026-03-01 23:00:29.467613+00', '2026-03-02 13:23:55.426163+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'clinic_pro', 'year', 'manual', '2026-03-01 23:00:29.467613+00', NULL, '2026-03-01 23:00:29.467613+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('a78efb68-d773-4a52-9140-ed4c74152bd7', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', NULL, NULL, false, 'manual', NULL, NULL, '2026-03-03 19:34:19.756429+00', '2026-03-03 19:34:19.756429+00', '29686ba1-6c57-49e0-9a6d-d0ddfff3b41a', 'clinic_free', NULL, 'manual', '2026-03-03 19:34:19.756429+00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - ('42abc1c8-922b-428c-82d3-7bf3d7cd92ad', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', NULL, NULL, false, 'manual', NULL, NULL, '2026-03-03 19:34:19.756429+00', '2026-03-03 19:34:19.756429+00', 'ee7d5c69-52bc-4875-826b-5f6c9561bc6b', 'clinic_free', NULL, 'manual', '2026-03-03 19:34:19.756429+00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - ('12f90a1c-9699-4990-b327-10a5c5774428', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', NULL, NULL, false, 'manual', NULL, NULL, '2026-03-03 19:34:19.756429+00', '2026-03-03 19:34:19.756429+00', 'dfd3f623-7ac7-4b07-af4d-5ad7c3ba0a87', 'clinic_free', NULL, 'manual', '2026-03-03 19:34:19.756429+00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - ('04994df5-5b28-476e-b5fa-8855816931f5', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', NULL, NULL, false, 'manual', NULL, NULL, '2026-03-03 19:34:19.756429+00', '2026-03-03 19:34:19.756429+00', '60fc942e-fd6d-428a-b125-82190d92e4ac', 'clinic_free', NULL, 'manual', '2026-03-03 19:34:19.756429+00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - ('6b73333a-2cd2-4584-ac2f-75e51e9d6b0b', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', NULL, NULL, false, 'manual', NULL, NULL, '2026-03-03 19:34:19.756429+00', '2026-03-03 19:34:19.756429+00', 'bc4902c5-09bc-40ad-8f05-10bbeee1c073', 'clinic_free', NULL, 'manual', '2026-03-03 19:34:19.756429+00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), - ('9879b74d-ce28-4c51-8470-513650e8aa46', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', '2026-03-01 23:00:05.767711+00', '2027-03-01 23:00:05.767711+00', false, 'manual', NULL, NULL, '2026-03-01 23:00:05.767711+00', '2026-03-03 19:36:32.24533+00', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16', 'clinic_free', 'year', 'manual', '2026-03-01 23:00:05.767711+00', NULL, '2026-03-01 23:00:05.767711+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('3f8f521f-c394-4798-b58d-029937dab649', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', '2026-03-03 22:43:41.705072+00', '2026-04-02 22:43:41.705072+00', false, 'manual', NULL, NULL, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', 'bbbbbbbb-0003-0003-0003-000000000003', 'clinic_free', 'month', 'seed', '2026-03-03 22:43:41.705072+00', NULL, '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('2cdf8eb9-8561-47af-b05e-f395e02d0aa5', NULL, '01a5867f-0705-4714-ac97-a23470949157', 'active', '2026-03-03 22:43:41.705072+00', '2026-04-02 22:43:41.705072+00', false, 'manual', NULL, NULL, '2026-03-03 22:43:41.705072+00', '2026-03-03 22:43:41.705072+00', 'bbbbbbbb-0004-0004-0004-000000000004', 'clinic_free', 'month', 'seed', '2026-03-03 22:43:41.705072+00', NULL, '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('112cb9f5-3120-49e5-886d-4346ccb27edd', 'aaaaaaaa-0001-0001-0001-000000000001', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'active', '2026-03-03 22:43:41.705072+00', '2026-04-02 22:43:41.705072+00', false, 'manual', NULL, NULL, '2026-03-03 22:43:41.705072+00', '2026-03-04 17:24:56.964418+00', NULL, 'therapist_free', 'month', 'seed', '2026-03-03 22:43:41.705072+00', NULL, '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('d4a09e95-eeb7-40ee-b737-3d762a6ba8da', 'aaaaaaaa-0009-0009-0009-000000000009', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'active', '2026-03-04 19:40:17.694488+00', '2026-04-03 19:40:17.694488+00', false, 'manual', NULL, NULL, '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', NULL, 'therapist_free', 'month', 'seed', '2026-03-04 19:40:17.694488+00', NULL, '2026-03-04 19:40:17.694488+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('99da40c5-81d9-4560-8a7f-811203314547', 'aaaaaaaa-0010-0010-0010-000000000010', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'active', '2026-03-04 19:40:17.694488+00', '2026-04-03 19:40:17.694488+00', false, 'manual', NULL, NULL, '2026-03-04 19:40:17.694488+00', '2026-03-04 19:40:17.694488+00', NULL, 'therapist_free', 'month', 'seed', '2026-03-04 19:40:17.694488+00', NULL, '2026-03-04 19:40:17.694488+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', 'active', '2026-03-04 17:23:46.708711+00', '2026-04-03 17:23:46.708711+00', false, 'manual', NULL, NULL, '2026-03-04 17:23:46.708711+00', '2026-03-04 20:06:18.002704+00', NULL, 'therapist_free', 'month', 'fix_seed', '2026-03-04 17:23:46.708711+00', NULL, '2026-03-04 17:23:46.708711+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('ca490958-d557-4407-ad04-fdfb134675f6', 'aaaaaaaa-0007-0007-0007-000000000007', 'ca28e46c-0687-45d5-9406-0a0f56a5b625', 'active', '2026-03-05 01:15:36.377017+00', '2027-03-05 01:15:36.377017+00', false, 'manual', NULL, NULL, '2026-03-04 17:23:46.708711+00', '2026-03-05 01:15:36.377017+00', NULL, 'supervisor_pro', 'year', 'manual', '2026-03-04 17:23:46.708711+00', NULL, '2026-03-04 17:23:46.708711+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('5688fed8-1dc5-4bc1-9d19-91562c10a310', 'aaaaaaaa-0002-0002-0002-000000000002', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'active', '2026-03-03 22:43:41.705072+00', '2026-04-02 22:43:41.705072+00', false, 'manual', NULL, NULL, '2026-03-03 22:43:41.705072+00', '2026-03-05 10:18:46.485009+00', NULL, 'therapist_pro', 'month', 'seed', '2026-03-03 22:43:41.705072+00', NULL, '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, NULL, NULL, NULL), - ('d2bd838f-5ac6-46f9-9282-4ddd0378e0a0', NULL, 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'active', '2026-03-03 22:43:41.705072+00', '2026-04-02 22:43:41.705072+00', false, 'manual', NULL, NULL, '2026-03-03 22:43:41.705072+00', '2026-03-06 02:53:19.171984+00', 'bbbbbbbb-0005-0005-0005-000000000005', 'clinic_pro', 'month', 'seed', '2026-03-03 22:43:41.705072+00', NULL, '2026-03-03 22:43:41.705072+00', NULL, NULL, NULL, NULL, NULL, NULL); - - --- --- Data for Name: subscription_events; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."subscription_events" ("id", "subscription_id", "owner_id", "event_type", "old_plan_id", "new_plan_id", "created_at", "created_by", "source", "reason", "metadata", "owner_type", "owner_ref") VALUES - ('0ac1b150-4918-4f39-9606-d22a0355a7d6', '14a232bb-95da-400b-8547-df33e3acb2cb', '01b89c85-8e1b-43e2-bf10-77f4428ea582', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-01 22:46:00.062729+00', '1715ec83-9a30-4dce-b73a-2deb66dcfb13', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145"}', 'clinic', '01b89c85-8e1b-43e2-bf10-77f4428ea582'), - ('7b1abd18-2502-4a0c-ab99-8e896949ba70', '14a232bb-95da-400b-8547-df33e3acb2cb', '01b89c85-8e1b-43e2-bf10-77f4428ea582', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-01 22:46:06.127205+00', '1715ec83-9a30-4dce-b73a-2deb66dcfb13', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157"}', 'clinic', '01b89c85-8e1b-43e2-bf10-77f4428ea582'), - ('ee58e94b-956d-499d-ba8e-fcd96ce67f71', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 10:16:25.756235+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('4476c2e4-3d80-4f89-9dbd-348a3ef0c24f', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 10:16:30.237286+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('f442c7dc-9f84-48d6-ae94-91d20b584600', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 10:16:36.794144+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('d9f6da69-82e4-420a-b635-7ad387d78eb1', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 10:16:42.129262+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('24b0d04e-5aec-4a0f-97e3-5f7233ac4b34', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 10:16:55.626723+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('500b4aa4-720a-4c09-a0f7-15eba88cefb2', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 10:17:03.115842+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'admin_panel', 'Plan change via admin panel', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('22ca6007-d165-4766-965c-ac7108c1613a', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:15:14.983937+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('f059a638-4fa9-429b-a3ca-b14e4737ed9c', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:15:20.239736+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('700479d6-c51f-4440-a269-2606240627b5', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:16:02.350846+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('aa3b2ae1-21c1-4da1-90a1-739d26cc7321', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:16:08.189127+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('7aa3c6e8-0ad2-492a-9ff6-2caf0d9476a2', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:17:11.939539+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('5b09a306-1dc3-410e-b2dc-04b7fd2721de', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:17:18.090643+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('0f380398-3958-4852-9c24-1d5688609428', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:24:51.887608+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('5ffe2a58-64f0-4178-956c-c89bf2c28525', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:24:59.680817+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('50e7dec7-875b-4a63-861c-a37f8d5e68fa', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:25:06.579127+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('5ad68a8a-3bea-4d0f-80f3-077b1f11cd9b', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:25:35.147684+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('e35f9408-7cfb-4ab4-8ef1-7df333fc9ca8', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:25:41.854726+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('47b626fe-e46e-4b8a-abd8-cdfe0202547b', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:25:17.872637+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('8d968f3d-fa72-4c1f-9fad-6cca3f0c74d3', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:29:29.235947+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('3ca36bc3-ef72-4a3f-b398-24ad2140ae1d', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:29:39.054035+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('fcec216c-256b-4913-b963-12b8c49df4e3', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:29:44.115983+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('b1400d45-cd0a-4e3b-abcc-4de042c5004a', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:29:49.528958+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('6f200e77-04d3-4c01-8f62-8e41a8353805', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:29:54.178414+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('d871aceb-6f44-4a45-b8d5-77ed63054bb4', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:29:59.720946+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('55d09484-3181-45e1-8895-a8fbbc6e2b91', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:32:07.989229+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('a1f9b8e7-897f-4df9-9513-c2fc6a789b23', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:38:11.905472+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('f8f34136-eb64-48c0-adbc-0c4f11b81728', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:42:55.486033+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('f8d73fff-971a-4708-830d-97f7277d9b1d', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:43:02.514543+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('adf177c9-efe9-4ae1-a9fd-9c9931f8ee2e', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:53:02.703275+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('8c5b9772-951c-4af5-a35b-2f6e5c21ff8c', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:53:10.454794+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('a2d06936-d15f-4955-a534-4d2aa62c4a7f', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:56:37.131664+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('223f3a89-cc98-4660-8ff6-1a278eedba84', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:56:42.104606+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('11635205-cc2a-4af0-80c9-c270b9c01422', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 11:58:10.972092+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('36b3c5d6-3161-41ce-948c-8b7b9a89bece', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 11:58:18.01086+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('cbe9a080-276f-48f2-a0c6-777081c07d22', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 12:00:58.336294+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('c68c2422-f793-4a50-91b6-f0e44ebdf255', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 12:01:06.833943+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('b24b0f0e-7874-437d-a3cd-4b73a8609a00', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 12:01:12.161814+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('2128e7f1-550d-4df0-9f2a-3640de02f19b', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 12:01:20.473071+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('96f19a2b-6276-42b3-ad51-faffc7849650', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 12:02:01.959145+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('361140f4-5bc2-4b54-82e1-079831d9d2f1', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 12:02:07.315773+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('da19d476-abc8-4f90-8d83-70298dc0da20', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 12:17:38.864724+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('cc83e64d-6076-4a85-a2cb-ca1c5e95a7df', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 12:17:46.462048+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('6e076b81-1689-4a95-8de9-8bcc2fe2625a', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 12:19:13.253056+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('ac1ff98d-589c-43a5-890b-c2699ca3fbed', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 12:19:24.11638+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('8ff6d815-075d-4632-baac-66aa4fabcc58', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-02 13:23:49.772165+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('331df305-0c3c-48cf-bf7b-19dda81a9a5d', '29e61e41-090a-4367-b0f7-33fea2a65736', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-02 13:23:55.426163+00', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '816b24fe-a0c3-4409-b79b-c6c0a6935d03'), - ('913d001f-8cc3-4f32-a71f-decfc8f03119', '9879b74d-ce28-4c51-8470-513650e8aa46', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-03 18:52:25.662322+00', '93ac96ab-d9d7-422b-81de-ae2fd4449fe3', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16'), - ('8d53dddc-099a-4f36-a6ba-a8a1359a494a', '9879b74d-ce28-4c51-8470-513650e8aa46', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-03 18:52:33.027523+00', '93ac96ab-d9d7-422b-81de-ae2fd4449fe3', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16'), - ('51e66650-cc8f-42df-aa2c-def6e03873d5', '9879b74d-ce28-4c51-8470-513650e8aa46', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-03 19:36:32.24533+00', '93ac96ab-d9d7-422b-81de-ae2fd4449fe3', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', '51a475d2-7f11-43d7-b47d-3e78dcd3bd16'), - ('6fb7cd22-5bf0-4e6d-8b30-c03179051933', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-04 12:35:57.962865+00', 'aaaaaaaa-0005-0005-0005-000000000005', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('5e923d5a-1b87-4993-a1f7-b3150ed86557', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-04 12:36:02.521585+00', 'aaaaaaaa-0005-0005-0005-000000000005', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('d0a0c6ea-6839-409c-b50c-14ac3760111a', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-04 12:36:34.297781+00', 'aaaaaaaa-0005-0005-0005-000000000005', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('7c023264-c2b2-4413-a7f0-4b8a3a5f3728', '112cb9f5-3120-49e5-886d-4346ccb27edd', 'aaaaaaaa-0001-0001-0001-000000000001', 'plan_changed', '984c1f29-a975-4208-93ac-2118ed1039b7', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '2026-03-04 17:24:56.964418+00', 'aaaaaaaa-0006-0006-0006-000000000006', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_key": "therapist_free", "previous_plan": "984c1f29-a975-4208-93ac-2118ed1039b7", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0001-0001-0001-000000000001'), - ('5b8c01ed-e846-4751-8d8a-7838b18a1789', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-04 19:55:59.843618+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('3fbb8cfb-3aeb-4332-8e7e-4184f1a75705', 'fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'plan_changed', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', '2026-03-04 19:56:17.664639+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_key": "therapist_pro", "previous_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0008-0008-0008-000000000008'), - ('c4dde348-b6ba-4588-9071-5650b074f4b4', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-04 19:56:31.853191+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('92670ac5-e24f-4e89-83c1-52da4ddf008d', 'fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'plan_changed', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '2026-03-04 19:56:49.08429+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_key": "therapist_free", "previous_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0008-0008-0008-000000000008'), - ('6d94c18d-b062-4db1-9d73-f747ae1bb29a', 'fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'plan_changed', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', '2026-03-04 20:05:46.201601+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_key": "therapist_pro", "previous_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0008-0008-0008-000000000008'), - ('d0bd6dfb-ace7-423d-a37d-1992f96c0e88', 'fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'plan_changed', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '2026-03-04 20:05:54.037686+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_key": "therapist_free", "previous_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0008-0008-0008-000000000008'), - ('405d716c-0b0b-42d1-b427-90b741fd4d21', 'fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'plan_changed', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', '2026-03-04 20:06:11.300988+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_key": "therapist_pro", "previous_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0008-0008-0008-000000000008'), - ('5b9adeab-64de-4da5-84d5-19d7c6fc2144', 'fe15888b-60b3-4ae2-bc33-3febf6b7dff9', 'aaaaaaaa-0008-0008-0008-000000000008', 'plan_changed', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '2026-03-04 20:06:18.002704+00', 'aaaaaaaa-0008-0008-0008-000000000008', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_key": "therapist_free", "previous_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0008-0008-0008-000000000008'), - ('c7d31fd7-3777-4dea-ae54-453b74ef6a2e', '5688fed8-1dc5-4bc1-9d19-91562c10a310', 'aaaaaaaa-0002-0002-0002-000000000002', 'plan_changed', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', '2026-03-04 20:07:20.982706+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_key": "therapist_pro", "previous_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0002-0002-0002-000000000002'), - ('51d2a479-25b6-4b72-9600-8d824ee1dbf3', '5688fed8-1dc5-4bc1-9d19-91562c10a310', 'aaaaaaaa-0002-0002-0002-000000000002', 'plan_changed', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '2026-03-05 00:18:00.527748+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_key": "therapist_free", "previous_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0002-0002-0002-000000000002'), - ('c4b00864-bc89-4338-98a9-a429ec723143', '5688fed8-1dc5-4bc1-9d19-91562c10a310', 'aaaaaaaa-0002-0002-0002-000000000002', 'plan_changed', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', '2026-03-05 00:18:03.728382+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_key": "therapist_pro", "previous_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0002-0002-0002-000000000002'), - ('3c10ace6-e687-45f3-856f-8382b698d4d5', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-05 00:18:20.9309+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('e477faad-fd05-43d5-848f-6818f9210190', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-05 00:18:26.781326+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('9d4ac1c4-171d-4668-afd5-5c08a17d80bc', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-05 00:18:37.931971+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('b349466b-7606-49c6-8355-3c6623bccc09', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-05 00:18:46.62777+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('e6fb9c99-9a80-4769-9b4b-b175d7826c8b', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-05 00:19:51.700295+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('0bbaa541-a039-488c-913d-d5158652b980', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-05 00:55:23.989399+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('cc6c0214-9069-49de-8ab5-1974c8ea9e95', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '01a5867f-0705-4714-ac97-a23470949157', '2026-03-05 00:55:27.507279+00', 'aaaaaaaa-0007-0007-0007-000000000007', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_key": "clinic_free", "previous_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'), - ('4f8177fb-c9a5-4d63-8455-988aa2d9f452', '5688fed8-1dc5-4bc1-9d19-91562c10a310', 'aaaaaaaa-0002-0002-0002-000000000002', 'plan_changed', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '2026-03-05 10:18:42.036561+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_key": "therapist_free", "previous_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0002-0002-0002-000000000002'), - ('5ccbf2b5-c323-4300-b74c-51817c5fd4db', '5688fed8-1dc5-4bc1-9d19-91562c10a310', 'aaaaaaaa-0002-0002-0002-000000000002', 'plan_changed', 'c56fe2a8-2c17-4048-adc7-ff7fbd89461a', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', '2026-03-05 10:18:46.485009+00', 'aaaaaaaa-0002-0002-0002-000000000002', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "82067ba7-16f0-4803-b36f-4c4e8919d4b4", "new_plan_key": "therapist_pro", "previous_plan": "c56fe2a8-2c17-4048-adc7-ff7fbd89461a", "new_plan_target": "therapist"}', 'therapist', 'aaaaaaaa-0002-0002-0002-000000000002'), - ('362484d9-cce1-472c-9d7f-fd943051ae77', 'd2bd838f-5ac6-46f9-9282-4ddd0378e0a0', 'bbbbbbbb-0005-0005-0005-000000000005', 'plan_changed', '01a5867f-0705-4714-ac97-a23470949157', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', '2026-03-06 02:53:19.171984+00', 'aaaaaaaa-0005-0005-0005-000000000005', 'dev_menu', 'Plan change via DEV menu', '{"new_plan": "a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145", "new_plan_key": "clinic_pro", "previous_plan": "01a5867f-0705-4714-ac97-a23470949157", "new_plan_target": "clinic"}', 'clinic', 'bbbbbbbb-0005-0005-0005-000000000005'); - - --- --- Data for Name: subscription_intents_legacy; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."subscription_intents_legacy" ("id", "user_id", "email", "plan_key", "interval", "amount_cents", "currency", "status", "source", "notes", "created_at", "paid_at", "tenant_id", "created_by_user_id") VALUES - ('c03472bd-558a-4070-9b85-dd8fa9d865f5', NULL, 'teste@agenciapsi.com.br', 'clinic_pro', 'year', 149000, 'BRL', 'canceled', 'landing', NULL, '2026-03-01 12:30:19.324037+00', '2026-03-01 14:17:25.052+00', 'f491f4d4-7801-4f80-bd01-1ba18f647034', '8817508e-548c-427b-9d94-9b0bb9ef4669'), - ('b9e19fa8-e5e5-4d46-ac4c-7565d0466b6d', NULL, 'teste2@agenciapsi.com.br', 'therapist_pro', 'year', 49000, 'BRL', 'paid', 'landing', NULL, '2026-03-01 14:32:55.799941+00', '2026-03-01 14:34:01.372+00', '60fc942e-fd6d-428a-b125-82190d92e4ac', 'b7e6a203-25f2-4e28-855a-9868c4cc6e74'); - - --- --- Data for Name: subscription_intents_personal; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."subscription_intents_personal" ("id", "user_id", "created_by_user_id", "email", "plan_id", "plan_key", "interval", "amount_cents", "currency", "status", "source", "notes", "created_at", "paid_at", "subscription_id") VALUES - ('b9e19fa8-e5e5-4d46-ac4c-7565d0466b6d', 'b7e6a203-25f2-4e28-855a-9868c4cc6e74', 'b7e6a203-25f2-4e28-855a-9868c4cc6e74', 'teste2@agenciapsi.com.br', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'therapist_pro', 'year', 49000, 'BRL', 'paid', 'landing', NULL, '2026-03-01 14:32:55.799941+00', '2026-03-01 14:34:01.372+00', NULL), - ('3ac8e889-adcc-4d6f-a7fe-57ad72fdde9a', 'ff5a39cb-b651-4e42-a0db-ac77295c3370', 'ff5a39cb-b651-4e42-a0db-ac77295c3370', 'tera3@agenciapsi.com.br', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'therapist_pro', 'year', 49000, 'BRL', 'paid', 'landing', NULL, '2026-03-01 15:03:56.75232+00', '2026-03-01 15:09:08.381+00', NULL), - ('00ef890b-c3a0-4882-a536-54f998395c94', '66216eb3-15fc-45a3-b474-c7447901798a', '66216eb3-15fc-45a3-b474-c7447901798a', 'tera4@agenciapsi.com.br', '82067ba7-16f0-4803-b36f-4c4e8919d4b4', 'therapist_pro', 'year', 49000, 'BRL', 'paid', 'landing', NULL, '2026-03-01 16:06:09.937903+00', '2026-03-01 16:07:26.95+00', NULL); - - --- --- Data for Name: subscription_intents_tenant; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."subscription_intents_tenant" ("id", "user_id", "created_by_user_id", "email", "plan_id", "plan_key", "interval", "amount_cents", "currency", "status", "source", "notes", "created_at", "paid_at", "tenant_id", "subscription_id") VALUES - ('c03472bd-558a-4070-9b85-dd8fa9d865f5', '8817508e-548c-427b-9d94-9b0bb9ef4669', '8817508e-548c-427b-9d94-9b0bb9ef4669', 'teste@agenciapsi.com.br', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'clinic_pro', 'year', 149000, 'BRL', 'canceled', 'landing', NULL, '2026-03-01 12:30:19.324037+00', '2026-03-01 14:17:25.052+00', 'f491f4d4-7801-4f80-bd01-1ba18f647034', NULL), - ('3812bf8b-49e3-45d9-b1cc-e78bf4e8b0f6', '1715ec83-9a30-4dce-b73a-2deb66dcfb13', '1715ec83-9a30-4dce-b73a-2deb66dcfb13', 'clinic4@agenciapsi.com.br', 'a74bc2d4-88c6-4cc6-b004-ef2bcb1b5145', 'clinic_pro', 'year', 149000, 'BRL', 'paid', 'landing', NULL, '2026-03-01 16:09:56.843502+00', '2026-03-01 16:10:28.563+00', '01b89c85-8e1b-43e2-bf10-77f4428ea582', '14a232bb-95da-400b-8547-df33e3acb2cb'); - - --- --- Data for Name: tenant_feature_exceptions_log; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: tenant_features; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: tenant_invites; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: tenant_modules; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - - - --- --- Data for Name: user_settings; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -INSERT INTO "public"."user_settings" ("user_id", "theme_mode", "preset", "primary_color", "surface_color", "menu_mode", "created_at", "updated_at") VALUES - ('aaaaaaaa-0005-0005-0005-000000000005', 'light', 'Aura', 'emerald', 'slate', 'static', '2026-03-04 03:17:57.617227+00', '2026-03-04 03:17:57.606+00'); - - --- --- Data for Name: buckets; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - -INSERT INTO "storage"."buckets" ("id", "name", "owner", "created_at", "updated_at", "public", "avif_autodetection", "file_size_limit", "allowed_mime_types", "owner_id", "type") VALUES - ('avatars', 'avatars', NULL, '2026-02-13 10:57:15.112446+00', '2026-02-13 10:57:15.112446+00', true, false, NULL, NULL, NULL, 'STANDARD'), - ('saas-docs', 'saas-docs', NULL, '2026-03-07 12:18:17.11377+00', '2026-03-07 12:18:17.11377+00', true, false, NULL, NULL, NULL, 'STANDARD'); - - --- --- Data for Name: buckets_analytics; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: buckets_vectors; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: iceberg_namespaces; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: iceberg_tables; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: objects; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - -INSERT INTO "storage"."objects" ("id", "bucket_id", "name", "owner", "created_at", "updated_at", "last_accessed_at", "metadata", "version", "owner_id", "user_metadata") VALUES - ('50e11318-aa1b-49b1-838c-0d72d602381b', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/feb4adf6-1c9a-4b26-9a36-a115eb913491/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-13 10:59:56.62912+00', '2026-02-13 10:59:56.62912+00', '2026-02-13 10:59:56.62912+00', '{"eTag": "\"e8298226e90e0720ff95c90c5b61e08c\"", "size": 53065, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-13T10:59:56.614Z", "contentLength": 53065, "httpStatusCode": 200}', '54d59a6b-6c83-4cf1-a035-60673d3db77a', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('844ea52c-97f9-48b2-b6ff-819cbbf20632', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/855a710d-8e38-4573-8628-d0da761880d3/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-13 11:00:14.880981+00', '2026-02-13 11:00:14.880981+00', '2026-02-13 11:00:14.880981+00', '{"eTag": "\"e8298226e90e0720ff95c90c5b61e08c\"", "size": 53065, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-13T11:00:14.873Z", "contentLength": 53065, "httpStatusCode": 200}', 'f16ae449-1a78-48bb-b8f3-fe1808a1ac3e', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('06b0429c-6637-4412-9cff-0d5507a4209b', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/185f674e-c11c-4b54-817f-78b57bf60ebd/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-13 11:04:11.155662+00', '2026-02-13 11:04:11.155662+00', '2026-02-13 11:04:11.155662+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-13T11:04:11.137Z", "contentLength": 48710, "httpStatusCode": 200}', '04cfaa5c-83d1-491b-898e-9a8337304d3d', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('e940a717-5e89-40f7-b955-64acf085117f', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/a33dfec0-c954-467f-99a6-5f859b8d5168/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-13 11:28:36.307652+00', '2026-02-13 11:28:36.307652+00', '2026-02-13 11:28:36.307652+00', '{"eTag": "\"60d363c60025fd47681d9b9d50939a8d\"", "size": 158427, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-13T11:28:36.296Z", "contentLength": 158427, "httpStatusCode": 200}', '77921ca7-ac84-4217-be5d-f1bfcbed9f12', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('565e79e7-998a-4e14-a930-5dc80d0ea229', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/073566cb-8848-4cc0-9799-63821721301a/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-14 10:45:41.332186+00', '2026-02-14 10:45:41.332186+00', '2026-02-14 10:45:41.332186+00', '{"eTag": "\"1b4616f55d72d416d545f16b064e11cb\"", "size": 11068, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-14T10:45:41.322Z", "contentLength": 11068, "httpStatusCode": 200}', '245717d3-d822-461c-8c63-ed61b2b6e7c5', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('29bbc519-9640-43d0-8793-f5c720cc1cf7', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/41a9dea9-6b78-4935-b130-f12a401e524b/avatar.jpg', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-14 22:49:41.773524+00', '2026-02-14 22:49:41.773524+00', '2026-02-14 22:49:41.773524+00', '{"eTag": "\"a52df9c148a23f1940ad5342f23d4c02\"", "size": 46616, "mimetype": "image/jpeg", "cacheControl": "max-age=3600", "lastModified": "2026-02-14T22:49:41.766Z", "contentLength": 46616, "httpStatusCode": 200}', 'c80f9964-7edd-462d-8978-ff275b03ddb8', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('7f643c66-dca6-4a7a-877f-6f95aed37333', 'avatars', 'intakes/d8e36584-bad9-4282-8ecc-85d11ef32ddf/1771113052395.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-14 23:50:52.468498+00', '2026-02-14 23:50:52.468498+00', '2026-02-14 23:50:52.468498+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-14T23:50:52.460Z", "contentLength": 48710, "httpStatusCode": 200}', '7b0ec2d7-3311-482d-808f-ac2ed5cd8382', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('9611f77f-6ddf-4686-9553-a2958dc4c0b4', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/41a9dea9-6b78-4935-b130-f12a401e524b/avatar.webp', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-14 22:41:18.666508+00', '2026-02-14 22:51:13.970348+00', '2026-02-14 22:41:18.666508+00', '{"eTag": "\"af758fda0f2989c0fe7e39c321769aae\"", "size": 62662, "mimetype": "image/webp", "cacheControl": "max-age=3600", "lastModified": "2026-02-14T22:51:13.964Z", "contentLength": 62662, "httpStatusCode": 200}', '32fb3e00-753f-4ee7-86a5-25d5080c61ce', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('099c0773-5d11-4d2a-a211-888665730eae', 'avatars', 'intakes/d8e36584-bad9-4282-8ecc-85d11ef32ddf/1771112303349.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-14 23:38:23.455894+00', '2026-02-14 23:38:23.455894+00', '2026-02-14 23:38:23.455894+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-14T23:38:23.441Z", "contentLength": 163818, "httpStatusCode": 200}', 'b4c571de-82a4-4bf0-8dc2-3b01f3f787ad', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('22c6f5ed-2e0e-45e8-aed9-141dd0e8f8f7', 'avatars', 'intakes/d8e36584-bad9-4282-8ecc-85d11ef32ddf/1771114348468.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 00:12:28.566767+00', '2026-02-15 00:12:28.566767+00', '2026-02-15 00:12:28.566767+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T00:12:28.545Z", "contentLength": 163818, "httpStatusCode": 200}', '2adbac99-15a5-4b25-a62e-59e8752fd05f', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('5e223e52-2e7e-42a5-b2bc-9842e324102b', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/41a9dea9-6b78-4935-b130-f12a401e524b/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-14 21:55:49.427204+00', '2026-02-15 03:28:17.452824+00', '2026-02-14 21:55:49.427204+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T03:28:17.435Z", "contentLength": 48710, "httpStatusCode": 200}', 'b827ddef-3858-43dc-8c67-4856682a9e62', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('adaca36b-0e67-491b-bd5e-65b629d8fd94', 'avatars', 'intakes/d8e36584-bad9-4282-8ecc-85d11ef32ddf/1771115670697.jpg', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 00:34:30.75628+00', '2026-02-15 00:34:30.75628+00', '2026-02-15 00:34:30.75628+00', '{"eTag": "\"ef32cf7cfbb4f5f02cf6232c16eab2d5\"", "size": 81994, "mimetype": "image/jpeg", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T00:34:30.743Z", "contentLength": 81994, "httpStatusCode": 200}', 'f7b66f46-3eb4-49b8-b5cf-5a88de726bc1', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('3325a9e2-388e-4d50-b43f-5a15b3d431d4', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/c6d73ef9-d0f5-4f3b-8113-e06b1e0d2ed1/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 03:44:03.89885+00', '2026-02-15 03:44:03.89885+00', '2026-02-15 03:44:03.89885+00', '{"eTag": "\"7b64ce3cc393706c34f9717d7e37d19f\"", "size": 48619, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T03:44:03.892Z", "contentLength": 48619, "httpStatusCode": 200}', '18d424a8-ceaf-47ff-a77e-b174dd58e573', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('bf8becb8-d2ac-405e-8625-7b3caf34dac5', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771128971606.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 04:16:11.704431+00', '2026-02-15 04:16:11.704431+00', '2026-02-15 04:16:11.704431+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T04:16:11.692Z", "contentLength": 163818, "httpStatusCode": 200}', '26e1e831-fed6-4aaa-8abf-175d7d6693f1', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('6d88e419-dbba-4b22-8188-293bcbfcfb29', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771129446221.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 04:24:06.331623+00', '2026-02-15 04:24:06.331623+00', '2026-02-15 04:24:06.331623+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T04:24:06.318Z", "contentLength": 48710, "httpStatusCode": 200}', '24f41446-456f-49d1-b4bd-df6ffd31943f', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('9adcb0e7-0383-441a-a884-992d771f871c', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771129756674.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 04:29:16.785291+00', '2026-02-15 04:29:16.785291+00', '2026-02-15 04:29:16.785291+00', '{"eTag": "\"d261f9999980baf36dc11dba9bddcc34\"", "size": 1093361, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T04:29:16.768Z", "contentLength": 1093361, "httpStatusCode": 200}', '72d36469-fab3-4f4b-ab45-ee501cb4a7e5', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('36055339-9426-4b60-a8c6-8c9f0efa5fdb', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771130629382.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 04:43:49.458561+00', '2026-02-15 04:43:49.458561+00', '2026-02-15 04:43:49.458561+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T04:43:49.449Z", "contentLength": 48710, "httpStatusCode": 200}', '72c41d69-16fc-4ca8-9ab0-37be981d3298', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('d9566165-66f7-4700-a89a-ab495ed7d55e', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771130649087.jpg', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 04:44:09.152935+00', '2026-02-15 04:44:09.152935+00', '2026-02-15 04:44:09.152935+00', '{"eTag": "\"7956953d5fe6ad5eab52078fb0ea6e02\"", "size": 179152, "mimetype": "image/jpeg", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T04:44:09.140Z", "contentLength": 179152, "httpStatusCode": 200}', 'f5f626a1-37f2-4615-b838-db8dbbdde529', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('29bb63f7-6436-49fe-aba8-c90d3565fc9a', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771151412345.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 10:30:12.47715+00', '2026-02-15 10:30:12.47715+00', '2026-02-15 10:30:12.47715+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T10:30:12.462Z", "contentLength": 48710, "httpStatusCode": 200}', '5b5d5c81-6405-4bc2-9c8e-e1a0786d62bf', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('e64c973d-8728-4af1-af79-81e807daf9fd', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771151517004.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 10:31:57.105174+00', '2026-02-15 10:31:57.105174+00', '2026-02-15 10:31:57.105174+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T10:31:57.089Z", "contentLength": 163818, "httpStatusCode": 200}', 'e3e2e3f7-bcfc-4826-b93c-ec1eb04fb060', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('dbca50d8-f019-4583-9ecc-5452d8200d68', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771151579058.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 10:32:59.171248+00', '2026-02-15 10:32:59.171248+00', '2026-02-15 10:32:59.171248+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T10:32:59.162Z", "contentLength": 48710, "httpStatusCode": 200}', '90e4e84e-0d73-4351-b383-af6d293d5421', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('5f20a0c6-850a-4f94-94e6-cc63f4abcb40', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771151702285.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 10:35:02.361515+00', '2026-02-15 10:35:02.361515+00', '2026-02-15 10:35:02.361515+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T10:35:02.354Z", "contentLength": 48710, "httpStatusCode": 200}', 'c528b58a-28e1-4c2b-9cc7-90cc4a6c159c', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('01518d2f-b58e-4385-8936-ca9b22acbf2e', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771152194733.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 10:43:14.814797+00', '2026-02-15 10:43:14.814797+00', '2026-02-15 10:43:14.814797+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T10:43:14.803Z", "contentLength": 163818, "httpStatusCode": 200}', 'cc9db17e-f3a9-4ff9-a7c7-ec54da6f732d', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('d87241ad-c417-4c5d-9aac-00e987975bc4', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771152585748.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 10:49:45.814249+00', '2026-02-15 10:49:45.814249+00', '2026-02-15 10:49:45.814249+00', '{"eTag": "\"e8298226e90e0720ff95c90c5b61e08c\"", "size": 53065, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T10:49:45.806Z", "contentLength": 53065, "httpStatusCode": 200}', 'b2225e51-4b4b-477f-af8c-92cf179d38f2', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('05a13d1c-0bdf-47ae-a645-0f5175edaa87', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771153252909.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 11:00:53.010494+00', '2026-02-15 11:00:53.010494+00', '2026-02-15 11:00:53.010494+00', '{"eTag": "\"60d363c60025fd47681d9b9d50939a8d\"", "size": 158427, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T11:00:53.000Z", "contentLength": 158427, "httpStatusCode": 200}', 'dda4b152-6a84-48ea-8b28-b829d78e55b0', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('75097354-fd27-4ef5-a54b-eb4e79da908a', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1771153439377.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-15 11:03:59.450908+00', '2026-02-15 11:03:59.450908+00', '2026-02-15 11:03:59.450908+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-15T11:03:59.441Z", "contentLength": 48710, "httpStatusCode": 200}', '212ffa33-f392-4a8b-a35d-64a7ab4bf9bc', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('b2071532-a0de-46be-856b-cc6e48c71a83', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/de1076a9-f4eb-4de6-9394-2225eb82bc2a/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-16 21:26:42.194776+00', '2026-02-16 21:26:42.194776+00', '2026-02-16 21:26:42.194776+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-16T21:26:42.182Z", "contentLength": 48710, "httpStatusCode": 200}', 'db34d7c5-bd0d-4694-a00b-487fc4e911a0', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('62e5bb58-eae4-41d3-90b0-55287b2edfcf', 'avatars', '816b24fe-a0c3-4409-b79b-c6c0a6935d03/avatar-1771287464893.jpg', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-17 00:17:45.046809+00', '2026-02-17 00:17:45.046809+00', '2026-02-17 00:17:45.046809+00', '{"eTag": "\"786fd3a000090ec8eada2f124aa702c8\"", "size": 902895, "mimetype": "image/jpeg", "cacheControl": "max-age=3600", "lastModified": "2026-02-17T00:17:45.029Z", "contentLength": 902895, "httpStatusCode": 200}', 'e98e9299-5240-4db1-90ed-6a62f7c799b5', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('31251500-6f03-4ac7-bce5-f4474157ed9b', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/d736bf55-3905-4db3-b2d4-38ad8c06c957/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-21 20:14:20.585086+00', '2026-02-21 20:14:20.585086+00', '2026-02-21 20:14:20.585086+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-21T20:14:20.573Z", "contentLength": 163818, "httpStatusCode": 200}', 'c344dade-8b93-4243-9c38-ae571b5eae64', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('2fdbffe6-0bf0-472e-89d4-03da0e100ebd', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/d4d4c55e-a076-4af4-bb66-b136bfc20719/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-24 15:13:45.0233+00', '2026-02-24 15:13:45.0233+00', '2026-02-24 15:13:45.0233+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-24T15:13:45.011Z", "contentLength": 48710, "httpStatusCode": 200}', 'acb8140d-a26c-4bd5-9320-205ae0429582', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('bf5ae728-1478-4951-8016-e839ddfe06f6', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/ec16fb50-9c13-4bc0-8ff4-28124c195062/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-24 16:40:23.194179+00', '2026-02-24 16:40:23.194179+00', '2026-02-24 16:40:23.194179+00', '{"eTag": "\"7acd7fe015d57168c9d1f740e6ef9dca\"", "size": 120039, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-24T16:40:23.181Z", "contentLength": 120039, "httpStatusCode": 200}', '2a828e73-38f9-4160-adb9-f9a97ef338b7', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('30257c7b-6505-4a26-a406-d09a34850219', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/f7f51807-ab84-4fc4-a345-1d5b2de094c4/avatar.webp', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-24 16:44:05.35217+00', '2026-02-24 16:44:05.35217+00', '2026-02-24 16:44:05.35217+00', '{"eTag": "\"7d090e1ccd302488cb8ac03ea09e5354\"", "size": 94090, "mimetype": "image/webp", "cacheControl": "max-age=3600", "lastModified": "2026-02-24T16:44:05.337Z", "contentLength": 94090, "httpStatusCode": 200}', 'f31ba834-e1aa-4e19-a6ae-c9152c223e01', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('842c95a4-dbb6-489b-83d3-074fdbebe251', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/965e2f5e-9d4f-4044-ae09-1caaf21d5c5e/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-24 17:32:26.591942+00', '2026-02-24 17:32:26.591942+00', '2026-02-24 17:32:26.591942+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-24T17:32:26.587Z", "contentLength": 48710, "httpStatusCode": 200}', '649e45b0-e23a-4e92-8015-8250835dd0f6', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('43ee8347-87c7-478f-baeb-594261328de5', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/9285890e-e35d-47ac-b553-9b469c85762b/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-24 17:43:23.948616+00', '2026-02-24 17:43:23.948616+00', '2026-02-24 17:43:23.948616+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-24T17:43:23.934Z", "contentLength": 48710, "httpStatusCode": 200}', 'c0c9963a-463a-4f8d-ad3c-b18d32c2baf3', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('0d5a672f-8a6f-4938-b191-2b588a4a6fa8', 'avatars', 'owners/816b24fe-a0c3-4409-b79b-c6c0a6935d03/patients/fe32e8e4-fd5e-43e9-a1a3-8337f9354f1d/avatar.png', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-24 17:48:16.389014+00', '2026-02-24 17:48:16.389014+00', '2026-02-24 17:48:16.389014+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-24T17:48:16.380Z", "contentLength": 48710, "httpStatusCode": 200}', '7650379e-4566-4e01-9599-03cc57cd3e01', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('2855dba0-3482-4c04-ace2-001e52c99d4f', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/89bb79c8-5b30-4218-a912-4ae5a8304d1c/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-26 04:12:57.005928+00', '2026-02-26 04:12:57.005928+00', '2026-02-26 04:12:57.005928+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-26T04:12:56.969Z", "contentLength": 48710, "httpStatusCode": 200}', '6946c28b-6cc7-47fe-8f71-e5dbce38cdbd', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('895d2975-5b0a-4af1-8df7-b055939af665', 'avatars', 'owners/824f125c-55bb-40f5-a8c4-7a33618b91c7/patients/1ae4b29d-d5fd-4490-b775-ad260ef0b74d/avatar.png', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-26 04:13:20.962471+00', '2026-02-26 04:13:20.962471+00', '2026-02-26 04:13:20.962471+00', '{"eTag": "\"74507674e136ced661770458c66ae98f\"", "size": 163818, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-02-26T04:13:20.944Z", "contentLength": 163818, "httpStatusCode": 200}', '46c51cbc-2075-4d76-bf1d-4d6a3bc118ae', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('98bef170-3669-429f-9e9f-2f7062fd396d', 'avatars', 'intakes/dd2862f6-9436-4905-ae79-a606f9a740b6/1772079264021.webp', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-26 04:14:24.079966+00', '2026-02-26 04:14:24.079966+00', '2026-02-26 04:14:24.079966+00', '{"eTag": "\"af758fda0f2989c0fe7e39c321769aae\"", "size": 62662, "mimetype": "image/webp", "cacheControl": "max-age=3600", "lastModified": "2026-02-26T04:14:24.069Z", "contentLength": 62662, "httpStatusCode": 200}', '449142b8-9056-4851-b22e-72c8ae2b9ed0', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('db8022ee-9a06-4add-929f-d6a876b7988d', 'avatars', 'intakes/dd2862f6-9436-4905-ae79-a606f9a740b6/1772107266247.webp', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '2026-02-26 12:01:06.345089+00', '2026-02-26 12:01:06.345089+00', '2026-02-26 12:01:06.345089+00', '{"eTag": "\"af758fda0f2989c0fe7e39c321769aae\"", "size": 62662, "mimetype": "image/webp", "cacheControl": "max-age=3600", "lastModified": "2026-02-26T12:01:06.336Z", "contentLength": 62662, "httpStatusCode": 200}', '0d559524-67a3-4973-965e-62d766d7dc60', '824f125c-55bb-40f5-a8c4-7a33618b91c7', '{}'), - ('a169dac1-45e5-4fb1-aded-94e773cb334a', 'avatars', 'intakes/b49f3c84-6b07-4d1f-bc7e-82353518871f/1772107513331.jpg', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '2026-02-26 12:05:13.392687+00', '2026-02-26 12:05:13.392687+00', '2026-02-26 12:05:13.392687+00', '{"eTag": "\"9f79c57a730113d50d24036ee9716a27\"", "size": 22299, "mimetype": "image/jpeg", "cacheControl": "max-age=3600", "lastModified": "2026-02-26T12:05:13.382Z", "contentLength": 22299, "httpStatusCode": 200}', 'c8ea0eab-017e-42ec-ae8d-f16fcd5a741f', '816b24fe-a0c3-4409-b79b-c6c0a6935d03', '{}'), - ('5b498420-915e-4b23-8772-fa0d58c52b12', 'avatars', 'aaaaaaaa-0005-0005-0005-000000000005/avatar-1772594277231.png', 'aaaaaaaa-0005-0005-0005-000000000005', '2026-03-04 03:17:57.367822+00', '2026-03-04 03:17:57.367822+00', '2026-03-04 03:17:57.367822+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-03-04T03:17:57.356Z", "contentLength": 48710, "httpStatusCode": 200}', 'ee1d7b94-43f9-480b-8824-85da41a99994', 'aaaaaaaa-0005-0005-0005-000000000005', '{}'), - ('b739f56c-e5a1-41c5-a094-2147c4a874c1', 'avatars', 'owners/aaaaaaaa-0002-0002-0002-000000000002/patients/0ef7d831-3bc7-4e1c-948b-35b40bee1ed3/avatar.png', 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 13:44:23.70851+00', '2026-03-05 13:44:23.70851+00', '2026-03-05 13:44:23.70851+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-03-05T13:44:23.686Z", "contentLength": 48710, "httpStatusCode": 200}', '85d47e0e-7dd2-4b7c-b634-3e081b3e0a21', 'aaaaaaaa-0002-0002-0002-000000000002', '{}'), - ('cd4130ea-4af6-4e48-97ee-635c058ac966', 'avatars', 'intakes/b1ab9b79-7cee-4c2f-8f35-ac6bbb0f7348/1772723113160.png', 'aaaaaaaa-0002-0002-0002-000000000002', '2026-03-05 15:05:13.258881+00', '2026-03-05 15:05:13.258881+00', '2026-03-05 15:05:13.258881+00', '{"eTag": "\"60d363c60025fd47681d9b9d50939a8d\"", "size": 158427, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-03-05T15:05:13.245Z", "contentLength": 158427, "httpStatusCode": 200}', '490e6713-7c03-4ef4-8ae5-1476b383c62f', 'aaaaaaaa-0002-0002-0002-000000000002', '{}'), - ('01ffed61-9d1f-4880-b9e7-b7d8ae029ae9', 'avatars', 'owners/aaaaaaaa-0005-0005-0005-000000000005/patients/70b17b2e-b637-4d6e-ae87-62c81cc34e9f/avatar.webp', 'aaaaaaaa-0005-0005-0005-000000000005', '2026-03-06 10:04:19.126607+00', '2026-03-06 10:04:19.126607+00', '2026-03-06 10:04:19.126607+00', '{"eTag": "\"14165413138636ce45667eb0c485528a\"", "size": 48808, "mimetype": "image/webp", "cacheControl": "max-age=3600", "lastModified": "2026-03-06T10:04:19.115Z", "contentLength": 48808, "httpStatusCode": 200}', '002747b3-a587-40ca-a5f9-072e8224b488', 'aaaaaaaa-0005-0005-0005-000000000005', '{}'), - ('6cf2f3e0-6652-432f-80a6-60a9ab5bb8ca', 'saas-docs', 'doc-images/6ba2a9e3-b4b8-447d-b1fa-2c746f15e55e.png', 'aaaaaaaa-0006-0006-0006-000000000006', '2026-03-08 01:00:01.166001+00', '2026-03-08 01:00:01.166001+00', '2026-03-08 01:00:01.166001+00', '{"eTag": "\"8ff97e8238a368c6f59596d7a8b9e052\"", "size": 48710, "mimetype": "image/png", "cacheControl": "max-age=3600", "lastModified": "2026-03-08T01:00:01.145Z", "contentLength": 48710, "httpStatusCode": 200}', 'c8861454-7c78-4634-96e4-1e0be16e3439', 'aaaaaaaa-0006-0006-0006-000000000006', '{}'); - - --- --- Data for Name: s3_multipart_uploads; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: s3_multipart_uploads_parts; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: vector_indexes; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - - - --- --- Data for Name: hooks; Type: TABLE DATA; Schema: supabase_functions; Owner: supabase_functions_admin --- - - - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE SET; Schema: auth; Owner: supabase_auth_admin --- - -SELECT pg_catalog.setval('"auth"."refresh_tokens_id_seq"', 1204, true); - - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE SET; Schema: public; Owner: supabase_admin --- - -SELECT pg_catalog.setval('"public"."agenda_online_slots_id_seq"', 113, true); - - --- --- Name: hooks_id_seq; Type: SEQUENCE SET; Schema: supabase_functions; Owner: supabase_functions_admin --- - -SELECT pg_catalog.setval('"supabase_functions"."hooks_id_seq"', 1, false); - - --- --- PostgreSQL database dump complete --- - --- \unrestrict W3AlCqJoixQ6XbedqdnuDvY0yTRx6OcqqCIS8MVAvJRGtliRjQ8MiBhgEM6GeE6 - -RESET ALL; diff --git a/DBS/2026-03-11/root/full_dump.sql b/DBS/2026-03-11/root/full_dump.sql deleted file mode 100644 index e1df45b..0000000 --- a/DBS/2026-03-11/root/full_dump.sql +++ /dev/null @@ -1,10622 +0,0 @@ - - - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - - -CREATE EXTENSION IF NOT EXISTS "pg_net" WITH SCHEMA "extensions"; - - - - - - -COMMENT ON SCHEMA "public" IS 'standard public schema'; - - - -CREATE EXTENSION IF NOT EXISTS "btree_gist" WITH SCHEMA "public"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "citext" WITH SCHEMA "public"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "pg_graphql" WITH SCHEMA "graphql"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "pg_stat_statements" WITH SCHEMA "extensions"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "pg_trgm" WITH SCHEMA "public"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "pgcrypto" WITH SCHEMA "extensions"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "supabase_vault" WITH SCHEMA "vault"; - - - - - - -CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA "extensions"; - - - - - - -CREATE TYPE "public"."commitment_log_source" AS ENUM ( - 'manual', - 'auto' -); - - -ALTER TYPE "public"."commitment_log_source" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."determined_field_type" AS ENUM ( - 'text', - 'textarea', - 'number', - 'date', - 'select', - 'boolean' -); - - -ALTER TYPE "public"."determined_field_type" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."recurrence_exception_type" AS ENUM ( - 'cancel_session', - 'reschedule_session', - 'patient_missed', - 'therapist_canceled', - 'holiday_block' -); - - -ALTER TYPE "public"."recurrence_exception_type" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."recurrence_type" AS ENUM ( - 'weekly', - 'biweekly', - 'monthly', - 'yearly', - 'custom_weekdays' -); - - -ALTER TYPE "public"."recurrence_type" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."status_agenda_serie" AS ENUM ( - 'ativo', - 'pausado', - 'cancelado' -); - - -ALTER TYPE "public"."status_agenda_serie" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."status_evento_agenda" AS ENUM ( - 'agendado', - 'realizado', - 'faltou', - 'cancelado', - 'remarcar' -); - - -ALTER TYPE "public"."status_evento_agenda" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."status_excecao_agenda" AS ENUM ( - 'pendente', - 'ativo', - 'arquivado' -); - - -ALTER TYPE "public"."status_excecao_agenda" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."tipo_evento_agenda" AS ENUM ( - 'sessao', - 'bloqueio' -); - - -ALTER TYPE "public"."tipo_evento_agenda" OWNER TO "supabase_admin"; - - -CREATE TYPE "public"."tipo_excecao_agenda" AS ENUM ( - 'bloqueio', - 'horario_extra' -); - - -ALTER TYPE "public"."tipo_excecao_agenda" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."__rls_ping"() RETURNS "text" - LANGUAGE "sql" STABLE - AS $$ - select 'ok'::text; -$$; - - -ALTER FUNCTION "public"."__rls_ping"() OWNER TO "supabase_admin"; - -SET default_tablespace = ''; - -SET default_table_access_method = "heap"; - - -CREATE TABLE IF NOT EXISTS "public"."subscriptions" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "user_id" "uuid", - "plan_id" "uuid" NOT NULL, - "status" "text" DEFAULT 'active'::"text" NOT NULL, - "current_period_start" timestamp with time zone, - "current_period_end" timestamp with time zone, - "cancel_at_period_end" boolean DEFAULT false NOT NULL, - "provider" "text" DEFAULT 'manual'::"text" NOT NULL, - "provider_customer_id" "text", - "provider_subscription_id" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid", - "plan_key" "text", - "interval" "text", - "source" "text" DEFAULT 'manual'::"text" NOT NULL, - "started_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "canceled_at" timestamp with time zone, - "activated_at" timestamp with time zone, - "past_due_since" timestamp with time zone, - "suspended_at" timestamp with time zone, - "suspended_reason" "text", - "cancelled_at" timestamp with time zone, - "cancel_reason" "text", - "expired_at" timestamp with time zone, - CONSTRAINT "subscriptions_interval_check" CHECK (("interval" = ANY (ARRAY['month'::"text", 'year'::"text"]))), - CONSTRAINT "subscriptions_owner_xor" CHECK (((("tenant_id" IS NOT NULL) AND ("user_id" IS NULL)) OR (("tenant_id" IS NULL) AND ("user_id" IS NOT NULL)))), - CONSTRAINT "subscriptions_status_check" CHECK (("status" = ANY (ARRAY['pending'::"text", 'active'::"text", 'past_due'::"text", 'suspended'::"text", 'cancelled'::"text", 'expired'::"text"]))) -); - - -ALTER TABLE "public"."subscriptions" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."activate_subscription_from_intent"("p_intent_id" "uuid") RETURNS "public"."subscriptions" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_intent record; - v_sub public.subscriptions; - v_days int; - v_user_id uuid; - v_plan_id uuid; - v_target text; -begin - -- lê pela VIEW unificada - select * into v_intent - from public.subscription_intents - where id = p_intent_id; - - if not found then - raise exception 'Intent não encontrado: %', p_intent_id; - end if; - - if v_intent.status <> 'paid' then - raise exception 'Intent precisa estar paid para ativar assinatura'; - end if; - - -- resolve target e plan_id via plans.key - select p.id, p.target - into v_plan_id, v_target - from public.plans p - where p.key = v_intent.plan_key - limit 1; - - if v_plan_id is null then - raise exception 'Plano não encontrado em plans.key = %', v_intent.plan_key; - end if; - - v_target := lower(coalesce(v_target, '')); - - -- ✅ supervisor adicionado - if v_target not in ('clinic', 'therapist', 'supervisor') then - raise exception 'Target inválido em plans.target: %', v_target; - end if; - - -- regra por target - if v_target = 'clinic' then - if v_intent.tenant_id is null then - raise exception 'Intent sem tenant_id'; - end if; - else - -- therapist ou supervisor: vinculado ao user - v_user_id := v_intent.user_id; - if v_user_id is null then - v_user_id := v_intent.created_by_user_id; - end if; - end if; - - if v_target in ('therapist', 'supervisor') and v_user_id is null then - raise exception 'Não foi possível determinar user_id para assinatura %.', v_target; - end if; - - -- cancela assinatura ativa anterior - if v_target = 'clinic' then - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where tenant_id = v_intent.tenant_id - and plan_id = v_plan_id - and status = 'active'; - else - -- therapist ou supervisor - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where user_id = v_user_id - and plan_id = v_plan_id - and status = 'active' - and tenant_id is null; - end if; - - -- duração do plano (30 dias para mensal) - v_days := case - when lower(coalesce(v_intent.interval, 'month')) = 'year' then 365 - else 30 - end; - - -- cria nova assinatura - insert into public.subscriptions ( - user_id, - plan_id, - status, - started_at, - expires_at, - cancelled_at, - activated_at, - tenant_id, - plan_key, - interval, - source, - created_at, - updated_at - ) - values ( - case when v_target = 'clinic' then null else v_user_id end, - v_plan_id, - 'active', - now(), - now() + make_interval(days => v_days), - null, - now(), - case when v_target = 'clinic' then v_intent.tenant_id else null end, - v_intent.plan_key, - v_intent.interval, - 'manual', - now(), - now() - ) - returning * into v_sub; - - -- grava vínculo intent → subscription - if v_target = 'clinic' then - update public.subscription_intents_tenant - set subscription_id = v_sub.id - where id = p_intent_id; - else - update public.subscription_intents_personal - set subscription_id = v_sub.id - where id = p_intent_id; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION "public"."activate_subscription_from_intent"("p_intent_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- (opcional) restringe targets válidos - if p_new_target not in ('clinic','therapist') then - raise exception 'Target inválido: %', p_new_target using errcode='P0001'; - end if; - - -- trava o plano - select id into v_plan_id - from public.plans - where key = p_plan_key - for update; - - if v_plan_id is null then - raise exception 'Plano não encontrado: %', p_plan_key using errcode='P0001'; - end if; - - -- segurança: não mexer se existe subscription - if exists (select 1 from public.subscriptions s where s.plan_id = v_plan_id) then - raise exception 'Plano % possui subscriptions. Migração bloqueada.', p_plan_key using errcode='P0001'; - end if; - - -- liga bypass SOMENTE nesta transação - perform set_config('app.plan_migration_bypass', '1', true); - - update public.plans - set target = p_new_target - where id = v_plan_id; - -end -$$; - - -ALTER FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."agenda_cfg_sync"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - if new.agenda_view_mode = 'custom' then - new.usar_horario_admin_custom := true; - new.admin_inicio_visualizacao := new.agenda_custom_start; - new.admin_fim_visualizacao := new.agenda_custom_end; - else - new.usar_horario_admin_custom := false; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION "public"."agenda_cfg_sync"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."agendador_dias_disponiveis"("p_slug" "text", "p_ano" integer, "p_mes" integer) RETURNS TABLE("data" "date", "tem_slots" boolean) - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_agora timestamptz; - v_data date; - v_data_inicio date; - v_data_fim date; - v_db_dow int; - v_tem_slot boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - AND (v_data::text || ' ' || s.time::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo' - >= v_agora + (v_antecedencia || ' hours')::interval - ) INTO v_tem_slot; - - IF v_tem_slot THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - - -ALTER FUNCTION "public"."agendador_dias_disponiveis"("p_slug" "text", "p_ano" integer, "p_mes" integer) OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."agendador_gerar_slug"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -DECLARE - v_slug text; - v_exists boolean; -BEGIN - -- só gera se ativou e não tem slug ainda - IF NEW.ativo = true AND (NEW.link_slug IS NULL OR NEW.link_slug = '') THEN - LOOP - v_slug := lower(substring(replace(gen_random_uuid()::text, '-', ''), 1, 8)); - SELECT EXISTS ( - SELECT 1 FROM public.agendador_configuracoes - WHERE link_slug = v_slug AND owner_id <> NEW.owner_id - ) INTO v_exists; - EXIT WHEN NOT v_exists; - END LOOP; - NEW.link_slug := v_slug; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."agendador_gerar_slug"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."agendador_slots_disponiveis"("p_slug" "text", "p_data" "date") RETURNS TABLE("hora" time without time zone, "disponivel" boolean) - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_antecedencia int; - v_agora timestamptz; - v_db_dow int; - v_slot time; - v_slot_fim time; - v_slot_ts timestamptz; - v_ocupado boolean; - -- loop de recorrências - v_rule RECORD; - v_rule_start_dow int; - v_first_occ date; - v_day_diff int; - v_ex_type text; -BEGIN - SELECT c.owner_id, c.duracao_sessao_min, c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; - - FOR v_slot IN - SELECT s.time - FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - ORDER BY s.time - LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - v_ocupado := false; - - -- ── Antecedência mínima ────────────────────────────────────────────────── - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo'; - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- ── Eventos avulsos internos (agenda_eventos) ──────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos e - WHERE e.owner_id = v_owner_id - AND e.status::text NOT IN ('cancelado', 'faltou') - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::date = p_data - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (e.fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Recorrências ativas (recurrence_rules) ─────────────────────────────── - -- Loop explícito para evitar erros de tipo no cálculo do ciclo semanal - IF NOT v_ocupado THEN - FOR v_rule IN - SELECT - r.id, - r.start_date::date AS start_date, - r.end_date::date AS end_date, - r.start_time::time AS start_time, - r.end_time::time AS end_time, - COALESCE(r.interval, 1)::int AS interval - FROM public.recurrence_rules r - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND p_data >= r.start_date::date - AND (r.end_date IS NULL OR p_data <= r.end_date::date) - AND v_db_dow = ANY(r.weekdays) - AND r.start_time::time < v_slot_fim - AND r.end_time::time > v_slot - LOOP - -- Calcula a primeira ocorrência do dia-da-semana a partir do start_date - v_rule_start_dow := extract(dow from v_rule.start_date)::int; - v_first_occ := v_rule.start_date - + (((v_db_dow - v_rule_start_dow + 7) % 7))::int; - v_day_diff := (p_data - v_first_occ)::int; - - -- Ocorrência válida: diff >= 0 e divisível pelo ciclo semanal - IF v_day_diff >= 0 AND v_day_diff % (7 * v_rule.interval) = 0 THEN - - -- Verifica se há exceção para esta data - v_ex_type := NULL; - SELECT ex.type INTO v_ex_type - FROM public.recurrence_exceptions ex - WHERE ex.recurrence_id = v_rule.id - AND ex.original_date = p_data - LIMIT 1; - - -- Sem exceção, ou exceção que não cancela → bloqueia o slot - IF v_ex_type IS NULL OR v_ex_type NOT IN ( - 'cancel_session', 'patient_missed', - 'therapist_canceled', 'holiday_block', - 'reschedule_session' - ) THEN - v_ocupado := true; - EXIT; -- já basta uma regra que conflite - END IF; - - END IF; - END LOOP; - END IF; - - -- ── Recorrências remarcadas para este dia (reschedule → new_date = p_data) ─ - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 - FROM public.recurrence_exceptions ex - JOIN public.recurrence_rules r ON r.id = ex.recurrence_id - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND ex.type = 'reschedule_session' - AND ex.new_date = p_data - AND COALESCE(ex.new_start_time, r.start_time)::time < v_slot_fim - AND COALESCE(ex.new_end_time, r.end_time)::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Solicitações públicas pendentes ────────────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes sol - WHERE sol.owner_id = v_owner_id - AND sol.status = 'pendente' - AND sol.data_solicitada = p_data - AND sol.hora_solicitada = v_slot - AND (sol.reservado_ate IS NULL OR sol.reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END LOOP; -END; -$$; - - -ALTER FUNCTION "public"."agendador_slots_disponiveis"("p_slug" "text", "p_data" "date") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."cancel_recurrence_from"("p_recurrence_id" "uuid", "p_from_date" "date") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -BEGIN - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - status = CASE - WHEN p_from_date <= start_date THEN 'cancelado' - ELSE status - END, - updated_at = now() - WHERE id = p_recurrence_id; -END; -$$; - - -ALTER FUNCTION "public"."cancel_recurrence_from"("p_recurrence_id" "uuid", "p_from_date" "date") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."cancel_subscription"("p_subscription_id" "uuid") RETURNS "public"."subscriptions" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'canceled' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'canceled', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'canceled', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Cancelamento manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'active') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION "public"."cancel_subscription"("p_subscription_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone DEFAULT "now"()) RETURNS integer - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -DECLARE - v_count integer; -BEGIN - UPDATE public.agenda_eventos - SET status = 'cancelado', - updated_at = now() - WHERE serie_id = p_serie_id - AND inicio_em >= p_a_partir_de - AND status NOT IN ('realizado', 'cancelado'); - - GET DIAGNOSTICS v_count = ROW_COUNT; - RETURN v_count; -END; -$$; - - -ALTER FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone) OWNER TO "supabase_admin"; - - -COMMENT ON FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone) IS 'Cancela todos os eventos futuros de uma série a partir de p_a_partir_de (inclusive). - Não cancela eventos já realizados.'; - - - -CREATE OR REPLACE FUNCTION "public"."change_subscription_plan"("p_subscription_id" "uuid", "p_new_plan_id" "uuid") RETURNS "public"."subscriptions" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_old_plan uuid; - v_new_key text; - - v_owner_type text; - v_owner_ref uuid; - - v_new_target text; - v_sub_target text; -begin - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - v_old_plan := v_sub.plan_id; - - if v_old_plan = p_new_plan_id then - return v_sub; - end if; - - select key, target - into v_new_key, v_new_target - from public.plans - where id = p_new_plan_id; - - if v_new_key is null then - raise exception 'Plano não encontrado'; - end if; - - v_new_target := lower(coalesce(v_new_target, '')); - - v_sub_target := case - when v_sub.tenant_id is not null then 'clinic' - else 'therapist' - end; - - if v_new_target <> v_sub_target then - raise exception 'Plano inválido para este tipo de assinatura. Assinatura é % e o plano é %.', - v_sub_target, v_new_target - using errcode = 'P0001'; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set plan_id = p_new_plan_id, - plan_key = v_new_key, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'plan_changed', - v_old_plan, - p_new_plan_id, - auth.uid(), - 'Plan change via DEV menu', - 'dev_menu', - jsonb_build_object( - 'previous_plan', v_old_plan, - 'new_plan', p_new_plan_id, - 'new_plan_key', v_new_key, - 'new_plan_target', v_new_target - ) - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation (owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION "public"."change_subscription_plan"("p_subscription_id" "uuid", "p_new_plan_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."create_clinic_tenant"("p_name" "text") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_tenant uuid; - v_name text; -begin - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Not authenticated'; - end if; - - v_name := nullif(trim(coalesce(p_name, '')), ''); - if v_name is null then - v_name := 'Clínica'; - end if; - - insert into public.tenants (name, kind, created_at) - values (v_name, 'clinic', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION "public"."create_clinic_tenant"("p_name" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."create_patient_intake_request"("p_token" "text", "p_name" "text", "p_email" "text" DEFAULT NULL::"text", "p_phone" "text" DEFAULT NULL::"text", "p_notes" "text" DEFAULT NULL::"text", "p_consent" boolean DEFAULT false) RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -declare - v_owner uuid; - v_active boolean; - v_expires timestamptz; - v_max_uses int; - v_uses int; - v_id uuid; -begin - select owner_id, active, expires_at, max_uses, uses - into v_owner, v_active, v_expires, v_max_uses, v_uses - from public.patient_invites - where token = p_token - limit 1; - - if v_owner is null then - raise exception 'Token inválido'; - end if; - - if v_active is not true then - raise exception 'Link desativado'; - end if; - - if v_expires is not null and now() > v_expires then - raise exception 'Link expirado'; - end if; - - if v_max_uses is not null and v_uses >= v_max_uses then - raise exception 'Limite de uso atingido'; - end if; - - if p_name is null or length(trim(p_name)) = 0 then - raise exception 'Nome é obrigatório'; - end if; - - insert into public.patient_intake_requests - (owner_id, token, name, email, phone, notes, consent, status) - values - (v_owner, p_token, trim(p_name), - nullif(lower(trim(p_email)), ''), - nullif(trim(p_phone), ''), - nullif(trim(p_notes), ''), - coalesce(p_consent, false), - 'new') - returning id into v_id; - - update public.patient_invites - set uses = uses + 1 - where token = p_token; - - return v_id; -end; -$$; - - -ALTER FUNCTION "public"."create_patient_intake_request"("p_token" "text", "p_name" "text", "p_email" "text", "p_phone" "text", "p_notes" "text", "p_consent" boolean) OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $_$ -declare - v_owner_id uuid; - v_intake_id uuid; - v_birth_raw text; - v_birth date; -begin - select owner_id - into v_owner_id - from public.patient_invites - where token = p_token; - - if v_owner_id is null then - raise exception 'Token inválido ou expirado'; - end if; - - v_birth_raw := nullif(trim(coalesce( - p_payload->>'data_nascimento', - '' - )), ''); - - v_birth := case - when v_birth_raw is null then null - when v_birth_raw ~ '^\d{4}-\d{2}-\d{2}$' then v_birth_raw::date - when v_birth_raw ~ '^\d{2}-\d{2}-\d{4}$' then to_date(v_birth_raw, 'DD-MM-YYYY') - else null - end; - - insert into public.patient_intake_requests ( - owner_id, - token, - status, - consent, - - nome_completo, - email_principal, - telefone, - - avatar_url, -- 🔥 AQUI - - data_nascimento, - cpf, - rg, - genero, - estado_civil, - profissao, - escolaridade, - nacionalidade, - naturalidade, - - cep, - pais, - cidade, - estado, - endereco, - numero, - complemento, - bairro, - - observacoes, - notas_internas, - - encaminhado_por, - onde_nos_conheceu - ) - values ( - v_owner_id, - p_token, - 'new', - coalesce((p_payload->>'consent')::boolean, false), - - nullif(trim(p_payload->>'nome_completo'), ''), - nullif(trim(p_payload->>'email_principal'), ''), - nullif(regexp_replace(coalesce(p_payload->>'telefone',''), '\D', '', 'g'), ''), - - nullif(trim(p_payload->>'avatar_url'), ''), -- 🔥 AQUI - - v_birth, - nullif(regexp_replace(coalesce(p_payload->>'cpf',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'rg'), ''), - nullif(trim(p_payload->>'genero'), ''), - nullif(trim(p_payload->>'estado_civil'), ''), - nullif(trim(p_payload->>'profissao'), ''), - nullif(trim(p_payload->>'escolaridade'), ''), - nullif(trim(p_payload->>'nacionalidade'), ''), - nullif(trim(p_payload->>'naturalidade'), ''), - - nullif(regexp_replace(coalesce(p_payload->>'cep',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'pais'), ''), - nullif(trim(p_payload->>'cidade'), ''), - nullif(trim(p_payload->>'estado'), ''), - nullif(trim(p_payload->>'endereco'), ''), - nullif(trim(p_payload->>'numero'), ''), - nullif(trim(p_payload->>'complemento'), ''), - nullif(trim(p_payload->>'bairro'), ''), - - nullif(trim(p_payload->>'observacoes'), ''), - nullif(trim(p_payload->>'notas_internas'), ''), - - nullif(trim(p_payload->>'encaminhado_por'), ''), - nullif(trim(p_payload->>'onde_nos_conheceu'), '') - ) - returning id into v_intake_id; - - return v_intake_id; -end; -$_$; - - -ALTER FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."current_member_id"("p_tenant_id" "uuid") RETURNS "uuid" - LANGUAGE "sql" STABLE - AS $$ - select tm.id - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION "public"."current_member_id"("p_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."current_member_role"("p_tenant_id" "uuid") RETURNS "text" - LANGUAGE "sql" STABLE - AS $$ - select tm.role - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION "public"."current_member_role"("p_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."delete_commitment_full"("p_tenant_id" "uuid", "p_commitment_id" "uuid") RETURNS "jsonb" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields int := 0; - v_logs int := 0; - v_parent int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_fields = row_count; - - delete from public.commitment_time_logs - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_logs = row_count; - - delete from public.determined_commitments - where tenant_id = p_tenant_id - and id = p_commitment_id; - get diagnostics v_parent = row_count; - - if v_parent <> 1 then - raise exception 'Parent not deleted (RLS/owner issue).'; - end if; - - return jsonb_build_object( - 'ok', true, - 'deleted', jsonb_build_object( - 'fields', v_fields, - 'logs', v_logs, - 'commitment', v_parent - ) - ); -end; -$$; - - -ALTER FUNCTION "public"."delete_commitment_full"("p_tenant_id" "uuid", "p_commitment_id" "uuid") OWNER TO "postgres"; - - -CREATE OR REPLACE FUNCTION "public"."delete_determined_commitment"("p_tenant_id" "uuid", "p_commitment_id" "uuid") RETURNS "jsonb" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields_deleted int := 0; - v_logs_deleted int := 0; - v_commitment_deleted int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found for tenant'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields f - where f.tenant_id = p_tenant_id - and f.commitment_id = p_commitment_id; - get diagnostics v_fields_deleted = row_count; - - delete from public.commitment_time_logs l - where l.tenant_id = p_tenant_id - and l.commitment_id = p_commitment_id; - get diagnostics v_logs_deleted = row_count; - - delete from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - get diagnostics v_commitment_deleted = row_count; - - if v_commitment_deleted <> 1 then - raise exception 'Delete did not remove the commitment (tenant mismatch?)'; - end if; - - return jsonb_build_object( - 'ok', true, - 'tenant_id', p_tenant_id, - 'commitment_id', p_commitment_id, - 'deleted', jsonb_build_object( - 'fields', v_fields_deleted, - 'logs', v_logs_deleted, - 'commitment', v_commitment_deleted - ) - ); -end; -$$; - - -ALTER FUNCTION "public"."delete_determined_commitment"("p_tenant_id" "uuid", "p_commitment_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."dev_list_auth_users"("p_limit" integer DEFAULT 50) RETURNS TABLE("id" "uuid", "email" "text", "created_at" timestamp with time zone) - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public', 'auth' - AS $$ -begin - -- só saas_admin pode ver - if not exists ( - select 1 - from public.profiles p - where p.id = auth.uid() - and p.role = 'saas_admin' - ) then - return; - end if; - - return query - select - u.id, - u.email, - u.created_at - from auth.users u - order by u.created_at desc - limit greatest(1, least(coalesce(p_limit, 50), 500)); -end; -$$; - - -ALTER FUNCTION "public"."dev_list_auth_users"("p_limit" integer) OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."dev_list_custom_users"() RETURNS TABLE("user_id" "uuid", "email" "text", "created_at" timestamp with time zone, "global_role" "text", "tenant_role" "text", "tenant_id" "uuid", "password_dev" "text", "kind" "text") - LANGUAGE "sql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ - with base as ( - select - u.id as user_id, - lower(u.email) as email, - u.created_at - from auth.users u - where lower(u.email) not in ( - 'clinic@agenciapsi.com.br', - 'therapist@agenciapsi.com.br', - 'patient@agenciapsi.com.br', - 'saas@agenciapsi.com.br' - ) - ), - prof as ( - select p.id, p.role as global_role - from public.profiles p - ), - last_membership as ( - select distinct on (tm.user_id) - tm.user_id, - tm.tenant_id, - tm.role as tenant_role, - tm.created_at - from public.tenant_members tm - where tm.status = 'active' - order by tm.user_id, tm.created_at desc - ) - select - b.user_id, - b.email, - b.created_at, - pr.global_role, - lm.tenant_role, - lm.tenant_id, - dc.password_dev, - dc.kind - from base b - left join prof pr on pr.id = b.user_id - left join last_membership lm on lm.user_id = b.user_id - left join public.dev_user_credentials dc on lower(dc.email) = b.email - order by b.created_at desc; -$$; - - -ALTER FUNCTION "public"."dev_list_custom_users"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."dev_list_intent_leads"() RETURNS TABLE("email" "text", "last_intent_at" timestamp with time zone, "plan_key" "text", "billing_interval" "text", "status" "text", "tenant_id" "uuid") - LANGUAGE "sql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ - select - lower(si.email) as email, - max(si.created_at) as last_intent_at, - (array_agg(si.plan_key order by si.created_at desc))[1] as plan_key, - (array_agg(si.interval order by si.created_at desc))[1] as billing_interval, - (array_agg(si.status order by si.created_at desc))[1] as status, - (array_agg(si.tenant_id order by si.created_at desc))[1] as tenant_id - from public.subscription_intents si - where si.email is not null - and not exists ( - select 1 - from auth.users au - where lower(au.email) = lower(si.email) - ) - group by lower(si.email) - order by max(si.created_at) desc; -$$; - - -ALTER FUNCTION "public"."dev_list_intent_leads"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."dev_public_debug_snapshot"() RETURNS TABLE("users_total" integer, "tenants_total" integer, "intents_new_total" integer, "latest_intents" "jsonb") - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $_$ -declare - v_latest jsonb; -begin - select jsonb_agg( - jsonb_build_object( - 'created_at', si.created_at, - 'email_masked', - regexp_replace(lower(si.email), '(^.).*(@.*$)', '\1***\2'), - 'plan_key', si.plan_key, - 'status', si.status - ) - order by si.created_at desc - ) - into v_latest - from ( - select si.* - from public.subscription_intents si - where si.email is not null - order by si.created_at desc - limit 5 - ) si; - - return query - select - (select count(*)::int from auth.users) as users_total, - (select count(*)::int from public.tenants) as tenants_total, - (select count(*)::int from public.subscription_intents where status = 'new') as intents_new_total, - coalesce(v_latest, '[]'::jsonb) as latest_intents; -end; -$_$; - - -ALTER FUNCTION "public"."dev_public_debug_snapshot"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."ensure_personal_tenant"() RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -DECLARE - v_uid uuid; - v_existing uuid; -BEGIN - v_uid := auth.uid(); - IF v_uid IS NULL THEN - RAISE EXCEPTION 'Not authenticated'; - END IF; - - SELECT tm.tenant_id INTO v_existing - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = v_uid - AND tm.status = 'active' - AND t.kind IN ('therapist', 'saas') - ORDER BY tm.created_at DESC - LIMIT 1; - - IF v_existing IS NOT NULL THEN - RETURN v_existing; - END IF; - - RETURN public.provision_account_tenant(v_uid, 'therapist'); -END; -$$; - - -ALTER FUNCTION "public"."ensure_personal_tenant"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."ensure_personal_tenant_for_user"("p_user_id" "uuid") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_existing uuid; - v_tenant uuid; - v_email text; - v_name text; -begin - v_uid := p_user_id; - if v_uid is null then - raise exception 'Missing user id'; - end if; - - -- só considera tenant pessoal (kind='saas') - select tm.tenant_id - into v_existing - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = v_uid - and tm.status = 'active' - and t.kind = 'saas' - order by tm.created_at desc - limit 1; - - if v_existing is not null then - return v_existing; - end if; - - select email into v_email - from auth.users - where id = v_uid; - - v_name := coalesce(split_part(v_email, '@', 1), 'Conta'); - - insert into public.tenants (name, kind, created_at) - values (v_name || ' (Pessoal)', 'saas', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION "public"."ensure_personal_tenant_for_user"("p_user_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."faq_votar"("faq_id" "uuid") RETURNS "void" - LANGUAGE "sql" SECURITY DEFINER - AS $$ - update public.saas_faq - set votos = votos + 1, - updated_at = now() - where id = faq_id - and ativo = true; -$$; - - -ALTER FUNCTION "public"."faq_votar"("faq_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."fix_all_subscription_mismatches"() RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - r record; -begin - for r in - select distinct s.user_id as owner_id - from public.subscriptions s - where s.status = 'active' - and s.user_id is not null - loop - perform public.rebuild_owner_entitlements(r.owner_id); - end loop; -end; -$$; - - -ALTER FUNCTION "public"."fix_all_subscription_mismatches"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -declare - v_count int; -begin - if new.ativo is false then - return new; - end if; - - select count(*) into v_count - from public.agenda_regras_semanais r - where r.owner_id = new.owner_id - and r.dia_semana = new.dia_semana - and r.ativo is true - and (tg_op = 'INSERT' or r.id <> new.id) - and (new.hora_inicio < r.hora_fim and new.hora_fim > r.hora_inicio); - - if v_count > 0 then - raise exception 'Janela sobreposta: já existe uma regra ativa nesse intervalo.'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."get_my_email"() RETURNS "text" - LANGUAGE "sql" SECURITY DEFINER - SET "search_path" TO 'public', 'auth' - AS $$ - select lower(email) - from auth.users - where id = auth.uid(); -$$; - - -ALTER FUNCTION "public"."get_my_email"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_account_type_immutable"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -BEGIN - IF OLD.account_type <> 'free' AND NEW.account_type IS DISTINCT FROM OLD.account_type THEN - RAISE EXCEPTION 'account_type é imutável após escolha (atual: "%" para tentativa: "%"). Para mudar de perfil, crie uma nova conta.', OLD.account_type, NEW.account_type - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."guard_account_type_immutable"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_locked_commitment"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - if (old.is_locked = true) then - if (tg_op = 'DELETE') then - raise exception 'Compromisso bloqueado não pode ser excluído.'; - end if; - - if (tg_op = 'UPDATE') then - if (new.active = false) then - raise exception 'Compromisso bloqueado não pode ser desativado.'; - end if; - - -- trava renomear (mantém o "Sessão" sempre igual) - if (new.name is distinct from old.name) then - raise exception 'Compromisso bloqueado não pode ser renomeado.'; - end if; - - -- se quiser travar descrição também, descomente: - -- if (new.description is distinct from old.description) then - -- raise exception 'Compromisso bloqueado não pode alterar descrição.'; - -- end if; - end if; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION "public"."guard_locked_commitment"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_no_change_core_plan_key"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') - and new.key is distinct from old.key then - raise exception 'Não é permitido alterar a key do plano padrão (%).', old.key - using errcode = 'P0001'; - end if; - - return new; -end $$; - - -ALTER FUNCTION "public"."guard_no_change_core_plan_key"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_no_change_plan_target"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -declare - v_bypass text; -begin - -- bypass controlado por sessão/transação: - -- só passa se app.plan_migration_bypass = '1' - v_bypass := current_setting('app.plan_migration_bypass', true); - - if v_bypass = '1' then - return new; - end if; - - -- comportamento original (bloqueia qualquer mudança) - if new.target is distinct from old.target then - raise exception 'Não é permitido alterar target do plano (%) de % para %.', - old.key, old.target, new.target - using errcode = 'P0001'; - end if; - - return new; -end -$$; - - -ALTER FUNCTION "public"."guard_no_change_plan_target"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_no_delete_core_plans"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') then - raise exception 'Plano padrão (%) não pode ser removido.', old.key - using errcode = 'P0001'; - end if; - - return old; -end $$; - - -ALTER FUNCTION "public"."guard_no_delete_core_plans"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_patient_cannot_own_tenant"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -DECLARE - v_account_type text; -BEGIN - SELECT account_type INTO v_account_type - FROM public.profiles - WHERE id = NEW.user_id; - - IF v_account_type = 'patient' AND NEW.role IN ('tenant_admin', 'therapist') THEN - RAISE EXCEPTION 'Usuário com perfil "patient" não pode ser proprietário ou terapeuta de um tenant. Se tornou profissional? Crie uma nova conta.' - USING ERRCODE = 'P0001'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."guard_patient_cannot_own_tenant"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."guard_tenant_kind_immutable"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -BEGIN - IF NEW.kind IS DISTINCT FROM OLD.kind THEN - RAISE EXCEPTION 'tenants.kind é imutável após criação. Tentativa de alterar "%" para "%".', OLD.kind, NEW.kind - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."guard_tenant_kind_immutable"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."handle_new_user"() RETURNS "trigger" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -BEGIN - INSERT INTO public.profiles (id, role, account_type) - VALUES (NEW.id, 'portal_user', 'free') - ON CONFLICT (id) DO NOTHING; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."handle_new_user"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."handle_new_user_create_personal_tenant"() RETURNS "trigger" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -BEGIN - -- Desabilitado. Tenant criado no onboarding via provision_account_tenant(). - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."handle_new_user_create_personal_tenant"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."has_feature"("p_owner_id" "uuid", "p_feature_key" "text") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select exists ( - select 1 - from public.owner_feature_entitlements e - where e.owner_id = p_owner_id - and e.feature_key = p_feature_key - ); -$$; - - -ALTER FUNCTION "public"."has_feature"("p_owner_id" "uuid", "p_feature_key" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."is_clinic_tenant"("_tenant_id" "uuid") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id - AND t.kind IN ('clinic', 'clinic_coworking', 'clinic_reception', 'clinic_full') - ); -$$; - - -ALTER FUNCTION "public"."is_clinic_tenant"("_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."is_saas_admin"() RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select exists ( - select 1 from public.saas_admins sa - where sa.user_id = auth.uid() - ); -$$; - - -ALTER FUNCTION "public"."is_saas_admin"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."is_tenant_admin"("p_tenant_id" "uuid") RETURNS boolean - LANGUAGE "sql" STABLE SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and tm.status = 'active' - ); -$$; - - -ALTER FUNCTION "public"."is_tenant_admin"("p_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."is_tenant_member"("_tenant_id" "uuid") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select exists ( - select 1 - from public.tenant_members m - where m.tenant_id = _tenant_id - and m.user_id = auth.uid() - and m.status = 'active' - ); -$$; - - -ALTER FUNCTION "public"."is_tenant_member"("_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."is_therapist_tenant"("_tenant_id" "uuid") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id AND t.kind = 'therapist' - ); -$$; - - -ALTER FUNCTION "public"."is_therapist_tenant"("_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."jwt_email"() RETURNS "text" - LANGUAGE "sql" STABLE - AS $$ - select nullif(lower(current_setting('request.jwt.claim.email', true)), ''); -$$; - - -ALTER FUNCTION "public"."jwt_email"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."my_tenants"() RETURNS TABLE("tenant_id" "uuid", "role" "text", "status" "text", "kind" "text") - LANGUAGE "sql" STABLE - AS $$ - select - tm.tenant_id, - tm.role, - tm.status, - t.kind - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = auth.uid(); -$$; - - -ALTER FUNCTION "public"."my_tenants"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."on_new_user_seed_patient_groups"() RETURNS "trigger" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ - BEGIN - PERFORM public.seed_default_patient_groups(NEW.id); - RETURN NEW; - END; - $$; - - -ALTER FUNCTION "public"."on_new_user_seed_patient_groups"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."patients_validate_member_consistency"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -DECLARE - v_tenant_responsible uuid; - v_tenant_therapist uuid; -BEGIN - -- responsible_member sempre deve existir e ser do tenant - SELECT tenant_id INTO v_tenant_responsible - FROM public.tenant_members - WHERE id = NEW.responsible_member_id; - - IF v_tenant_responsible IS NULL THEN - RAISE EXCEPTION 'Responsible member not found'; - END IF; - - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'tenant_id is required'; - END IF; - - IF v_tenant_responsible <> NEW.tenant_id THEN - RAISE EXCEPTION 'Responsible member must belong to the same tenant'; - END IF; - - -- therapist scope: therapist_member_id deve existir e ser do mesmo tenant - IF NEW.patient_scope = 'therapist' THEN - IF NEW.therapist_member_id IS NULL THEN - RAISE EXCEPTION 'therapist_member_id is required when patient_scope=therapist'; - END IF; - - SELECT tenant_id INTO v_tenant_therapist - FROM public.tenant_members - WHERE id = NEW.therapist_member_id; - - IF v_tenant_therapist IS NULL THEN - RAISE EXCEPTION 'Therapist member not found'; - END IF; - - IF v_tenant_therapist <> NEW.tenant_id THEN - RAISE EXCEPTION 'Therapist member must belong to the same tenant'; - END IF; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."patients_validate_member_consistency"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."patients_validate_responsible_member_tenant"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -declare - m_tenant uuid; -begin - select tenant_id into m_tenant - from public.tenant_members - where id = new.responsible_member_id; - - if m_tenant is null then - raise exception 'Responsible member not found'; - end if; - - if new.tenant_id is null then - raise exception 'tenant_id is required'; - end if; - - if m_tenant <> new.tenant_id then - raise exception 'Responsible member must belong to the same tenant'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION "public"."patients_validate_responsible_member_tenant"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."prevent_promoting_to_system"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - if new.is_system = true and old.is_system is distinct from true then - raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.'; - end if; - return new; -end; -$$; - - -ALTER FUNCTION "public"."prevent_promoting_to_system"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."prevent_saas_membership"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM public.profiles - WHERE id = NEW.user_id - AND role = 'saas_admin' - ) THEN - RAISE EXCEPTION 'SaaS admin cannot belong to tenant'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."prevent_saas_membership"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."prevent_system_group_changes"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - -- Se for grupo do sistema, regras rígidas: - if old.is_system = true then - - -- nunca pode deletar - if tg_op = 'DELETE' then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - if tg_op = 'UPDATE' then - -- permite SOMENTE mudar tenant_id e/ou updated_at - -- qualquer mudança de conteúdo permanece proibida - if - new.nome is distinct from old.nome or - new.descricao is distinct from old.descricao or - new.cor is distinct from old.cor or - new.is_active is distinct from old.is_active or - new.is_system is distinct from old.is_system or - new.owner_id is distinct from old.owner_id or - new.therapist_id is distinct from old.therapist_id or - new.created_at is distinct from old.created_at - then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - -- chegou aqui: só tenant_id/updated_at mudaram -> ok - return new; - end if; - - end if; - - -- não-system: deixa passar - if tg_op = 'DELETE' then - return old; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION "public"."prevent_system_group_changes"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text" DEFAULT NULL::"text") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -DECLARE - v_tenant_id uuid; - v_account_type text; - v_name text; -BEGIN - IF p_kind NOT IN ('therapist', 'clinic_coworking', 'clinic_reception', 'clinic_full') THEN - RAISE EXCEPTION 'kind inválido: "%". Use: therapist, clinic_coworking, clinic_reception, clinic_full.', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_account_type := CASE WHEN p_kind = 'therapist' THEN 'therapist' ELSE 'clinic' END; - - IF EXISTS ( - SELECT 1 - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = p_user_id - AND tm.role = 'tenant_admin' - AND tm.status = 'active' - AND t.kind = p_kind - ) THEN - RAISE EXCEPTION 'Usuário já possui um tenant do tipo "%".', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_name := COALESCE( - NULLIF(TRIM(p_name), ''), - ( - SELECT COALESCE(NULLIF(TRIM(pr.full_name), ''), SPLIT_PART(au.email, '@', 1)) - FROM public.profiles pr - JOIN auth.users au ON au.id = pr.id - WHERE pr.id = p_user_id - ), - 'Conta' - ); - - INSERT INTO public.tenants (name, kind, created_at) - VALUES (v_name, p_kind, now()) - RETURNING id INTO v_tenant_id; - - INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) - VALUES (v_tenant_id, p_user_id, 'tenant_admin', 'active', now()); - - UPDATE public.profiles - SET account_type = v_account_type - WHERE id = p_user_id; - - PERFORM public.seed_determined_commitments(v_tenant_id); - - RETURN v_tenant_id; -END; -$$; - - -ALTER FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text") OWNER TO "supabase_admin"; - - -COMMENT ON FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text") IS 'Cria o tenant do tipo correto e atualiza account_type no profile. Chamar no onboarding após escolha/pagamento de plano therapist ou clinic. p_kind: therapist | clinic_coworking | clinic_reception | clinic_full'; - - - -CREATE OR REPLACE FUNCTION "public"."reactivate_subscription"("p_subscription_id" "uuid") RETURNS "public"."subscriptions" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'active' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'active', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'reactivated', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Reativação manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'canceled') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION "public"."reactivate_subscription"("p_subscription_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."rebuild_owner_entitlements"("p_owner_id" "uuid") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- Plano ativo do owner (owner = subscriptions.user_id) - select s.plan_id - into v_plan_id - from public.subscriptions s - where s.user_id = p_owner_id - and s.status = 'active' - order by s.created_at desc - limit 1; - - -- Sempre zera entitlements do owner (rebuild) - delete from public.owner_feature_entitlements e - where e.owner_id = p_owner_id; - - -- Se não tem assinatura ativa, acabou - if v_plan_id is null then - return; - end if; - - -- Recria entitlements esperados pelo plano - insert into public.owner_feature_entitlements (owner_id, feature_key, sources, limits_list) - select - p_owner_id as owner_id, - f.key as feature_key, - array['plan'::text] as sources, - '{}'::jsonb as limits_list - from public.plan_features pf - join public.features f on f.id = pf.feature_id - where pf.plan_id = v_plan_id; - -end; -$$; - - -ALTER FUNCTION "public"."rebuild_owner_entitlements"("p_owner_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."rotate_patient_invite_token"("p_new_token" "text") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -declare - v_uid uuid; - v_id uuid; -begin - -- pega o usuário logado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Usuário não autenticado'; - end if; - - -- desativa tokens antigos ativos do usuário - update public.patient_invites - set active = false - where owner_id = v_uid - and active = true; - - -- cria novo token - insert into public.patient_invites (owner_id, token, active) - values (v_uid, p_new_token, true) - returning id into v_id; - - return v_id; -end; -$$; - - -ALTER FUNCTION "public"."rotate_patient_invite_token"("p_new_token" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."saas_votar_doc"("p_doc_id" "uuid", "p_util" boolean) RETURNS "jsonb" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_uid uuid := auth.uid(); - v_voto_antigo boolean; -begin - if v_uid is null then - raise exception 'Não autenticado'; - end if; - - -- Verifica se já votou - select util into v_voto_antigo - from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - if found then - -- Já votou igual → cancela o voto (toggle) - if v_voto_antigo = p_util then - delete from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util - (case when p_util then 1 else 0 end)), - votos_nao_util = greatest(0, votos_nao_util - (case when not p_util then 1 else 0 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'removido', 'util', null); - else - -- Mudou de voto - update public.saas_doc_votos set util = p_util, updated_at = now() - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util + (case when p_util then 1 else -1 end)), - votos_nao_util = greatest(0, votos_nao_util + (case when not p_util then 1 else -1 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'atualizado', 'util', p_util); - end if; - else - -- Primeiro voto - insert into public.saas_doc_votos (doc_id, user_id, util) - values (p_doc_id, v_uid, p_util); - - update public.saas_docs set - votos_util = votos_util + (case when p_util then 1 else 0 end), - votos_nao_util = votos_nao_util + (case when not p_util then 1 else 0 end), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'registrado', 'util', p_util); - end if; -end; -$$; - - -ALTER FUNCTION "public"."saas_votar_doc"("p_doc_id" "uuid", "p_util" boolean) OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."seed_determined_commitments"("p_tenant_id" "uuid") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_id uuid; -begin - -- Sessão (locked + sempre ativa) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'session' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'session', true, true, 'Sessão', 'Sessão com paciente'); - end if; - - -- Leitura - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'reading', false, true, 'Leitura', 'Praticar leitura'); - end if; - - -- Supervisão - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'supervision', false, true, 'Supervisão', 'Supervisão'); - end if; - - -- Aula ✅ (corrigido) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'class', false, false, 'Aula', 'Dar aula'); - end if; - - -- Análise pessoal - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal'); - end if; - - -- ------------------------------------------------------- - -- Campos padrão (idempotentes por (commitment_id, key)) - -- ------------------------------------------------------- - - -- Leitura - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'book') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'book', 'Livro', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'author') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'author', 'Autor', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Supervisão - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'supervisor') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'supervisor', 'Supervisor', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'topic') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'topic', 'Assunto', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Aula - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'theme') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'theme', 'Tema', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'group') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'group', 'Turma', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Análise - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'analyst') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'analyst', 'Analista', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'focus') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'focus', 'Foco', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; -end; -$$; - - -ALTER FUNCTION "public"."seed_determined_commitments"("p_tenant_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."set_owner_id"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - if new.owner_id is null then - new.owner_id := auth.uid(); - end if; - return new; -end; -$$; - - -ALTER FUNCTION "public"."set_owner_id"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."set_tenant_feature_exception"("p_tenant_id" "uuid", "p_feature_key" "text", "p_enabled" boolean, "p_reason" "text" DEFAULT NULL::"text") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -begin - -- ✅ Só owner ou admin do tenant podem alterar features - if not exists ( - select 1 from public.tenant_members - where tenant_id = p_tenant_id - and user_id = auth.uid() - and role in ('owner', 'admin') - and status = 'active' - ) then - raise exception 'Acesso negado: apenas owner/admin pode alterar features do tenant.'; - end if; - - insert into public.tenant_features (tenant_id, feature_key, enabled) - values (p_tenant_id, p_feature_key, p_enabled) - on conflict (tenant_id, feature_key) - do update set enabled = excluded.enabled; - - insert into public.tenant_feature_exceptions_log ( - tenant_id, feature_key, enabled, reason, created_by - ) values ( - p_tenant_id, p_feature_key, p_enabled, p_reason, auth.uid() - ); -end; -$$; - - -ALTER FUNCTION "public"."set_tenant_feature_exception"("p_tenant_id" "uuid", "p_feature_key" "text", "p_enabled" boolean, "p_reason" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."set_updated_at"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -begin - new.updated_at = now(); - return new; -end; -$$; - - -ALTER FUNCTION "public"."set_updated_at"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."set_updated_at_recurrence"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -BEGIN NEW.updated_at = now(); RETURN NEW; END; -$$; - - -ALTER FUNCTION "public"."set_updated_at_recurrence"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."split_recurrence_at"("p_recurrence_id" "uuid", "p_from_date" "date") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -DECLARE - v_old public.recurrence_rules; - v_new_id uuid; -BEGIN - -- busca a regra original - SELECT * INTO v_old - FROM public.recurrence_rules - WHERE id = p_recurrence_id; - - IF NOT FOUND THEN - RAISE EXCEPTION 'recurrence_rule % não encontrada', p_recurrence_id; - END IF; - - -- encerra a regra antiga na data anterior - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - updated_at = now() - WHERE id = p_recurrence_id; - - -- cria nova regra a partir de p_from_date - INSERT INTO public.recurrence_rules ( - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - start_date, end_date, max_occurrences, open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - ) - SELECT - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - p_from_date, v_old.end_date, v_old.max_occurrences, v_old.open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - FROM public.recurrence_rules - WHERE id = p_recurrence_id - RETURNING id INTO v_new_id; - - RETURN v_new_id; -END; -$$; - - -ALTER FUNCTION "public"."split_recurrence_at"("p_recurrence_id" "uuid", "p_from_date" "date") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."subscription_intents_view_insert"() RETURNS "trigger" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_target text; - v_plan_id uuid; -begin - select p.id, p.target into v_plan_id, v_target - from public.plans p - where p.key = new.plan_key; - - if v_plan_id is null then - raise exception 'Plano inválido: plan_key=%', new.plan_key; - end if; - - if lower(v_target) = 'clinic' then - if new.tenant_id is null then - raise exception 'Intenção clinic exige tenant_id.'; - end if; - - insert into public.subscription_intents_tenant ( - id, tenant_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.tenant_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := 'clinic'; - return new; - end if; - - -- therapist ou supervisor → tabela personal - if lower(v_target) in ('therapist', 'supervisor') then - insert into public.subscription_intents_personal ( - id, user_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.user_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := lower(v_target); -- 'therapist' ou 'supervisor' - return new; - end if; - - raise exception 'Target de plano não suportado: %', v_target; -end; -$$; - - -ALTER FUNCTION "public"."subscription_intents_view_insert"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."subscriptions_validate_scope"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target IN ('therapist', 'supervisor') THEN - -- supervisor é pessoal como therapist - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura % não deve ter tenant_id.', v_target; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura % exige user_id.', v_target; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION "public"."subscriptions_validate_scope"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."sync_busy_mirror_agenda_eventos"() RETURNS "trigger" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - AS $$ -declare - clinic_tenant uuid; - is_personal boolean; - should_mirror boolean; -begin - -- Anti-recursão: espelho não espelha - if (tg_op <> 'DELETE') then - if new.mirror_of_event_id is not null then - return new; - end if; - else - if old.mirror_of_event_id is not null then - return old; - end if; - end if; - - -- Define se é pessoal e se deve espelhar - if (tg_op = 'DELETE') then - is_personal := (old.tenant_id = old.owner_id); - should_mirror := (old.visibility_scope in ('busy_only','private')); - else - is_personal := (new.tenant_id = new.owner_id); - should_mirror := (new.visibility_scope in ('busy_only','private')); - end if; - - -- Se não é pessoal, não faz nada - if not is_personal then - if (tg_op = 'DELETE') then - return old; - end if; - return new; - end if; - - -- DELETE: remove espelhos existentes - if (tg_op = 'DELETE') then - delete from public.agenda_eventos e - where e.mirror_of_event_id = old.id - and e.mirror_source = 'personal_busy_mirror'; - - return old; - end if; - - -- INSERT/UPDATE: - -- Se não deve espelhar, remove espelhos e sai - if not should_mirror then - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror'; - - return new; - end if; - - -- Para cada clínica onde o usuário é therapist active, cria/atualiza o "Ocupado" - for clinic_tenant in - select tm.tenant_id - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id <> new.owner_id - loop - insert into public.agenda_eventos ( - tenant_id, - owner_id, - terapeuta_id, - paciente_id, - tipo, - status, - titulo, - observacoes, - inicio_em, - fim_em, - mirror_of_event_id, - mirror_source, - visibility_scope, - created_at, - updated_at - ) values ( - clinic_tenant, - new.owner_id, - new.owner_id, - null, - 'bloqueio'::public.tipo_evento_agenda, - 'agendado'::public.status_evento_agenda, - 'Ocupado', - null, - new.inicio_em, - new.fim_em, - new.id, - 'personal_busy_mirror', - 'public', - now(), - now() - ) - on conflict (tenant_id, mirror_of_event_id) where mirror_of_event_id is not null - do update set - owner_id = excluded.owner_id, - terapeuta_id = excluded.terapeuta_id, - tipo = excluded.tipo, - status = excluded.status, - titulo = excluded.titulo, - observacoes = excluded.observacoes, - inicio_em = excluded.inicio_em, - fim_em = excluded.fim_em, - updated_at = now(); - end loop; - - -- Limpa espelhos de clínicas onde o vínculo therapist active não existe mais - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror' - and not exists ( - select 1 - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id = e.tenant_id - ); - - return new; -end; -$$; - - -ALTER FUNCTION "public"."sync_busy_mirror_agenda_eventos"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_accept_invite"("p_token" "uuid") RETURNS "jsonb" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public', 'auth' - AS $$ -declare - v_uid uuid; - v_email text; - v_invite public.tenant_invites%rowtype; -begin - -- 1) precisa estar autenticado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'not_authenticated' using errcode = 'P0001'; - end if; - - -- 2) pega email real do usuário logado sem depender do JWT claim - select u.email - into v_email - from auth.users u - where u.id = v_uid; - - if v_email is null or length(trim(v_email)) = 0 then - raise exception 'missing_user_email' using errcode = 'P0001'; - end if; - - -- 3) carrega o invite e trava linha (evita 2 aceites concorrentes) - select * - into v_invite - from public.tenant_invites i - where i.token = p_token - for update; - - if not found then - raise exception 'invite_not_found' using errcode = 'P0001'; - end if; - - -- 4) validações de estado - if v_invite.revoked_at is not null then - raise exception 'invite_revoked' using errcode = 'P0001'; - end if; - - if v_invite.accepted_at is not null then - raise exception 'invite_already_accepted' using errcode = 'P0001'; - end if; - - if v_invite.expires_at is not null and v_invite.expires_at <= now() then - raise exception 'invite_expired' using errcode = 'P0001'; - end if; - - -- 5) valida email (case-insensitive) - if lower(trim(v_invite.email)) <> lower(trim(v_email)) then - raise exception 'email_mismatch' using errcode = 'P0001'; - end if; - - -- 6) consome o invite - update public.tenant_invites - set accepted_at = now(), - accepted_by = v_uid - where id = v_invite.id; - - -- 7) cria ou reativa o membership - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_invite.tenant_id, v_uid, v_invite.role, 'active', now()) - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active'; - - -- 8) retorno útil pro front (você já tenta ler tenant_id no AcceptInvitePage) - return jsonb_build_object( - 'ok', true, - 'tenant_id', v_invite.tenant_id, - 'role', v_invite.role - ); -end; -$$; - - -ALTER FUNCTION "public"."tenant_accept_invite"("p_token" "uuid") OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."tenant_members" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "user_id" "uuid" NOT NULL, - "role" "text" NOT NULL, - "status" "text" DEFAULT 'active'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."tenant_members" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_add_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text" DEFAULT 'therapist'::"text") RETURNS "public"."tenant_members" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public', 'auth' - AS $$ -declare - v_target_uid uuid; - v_member public.tenant_members%rowtype; - v_is_admin boolean; - v_email text; -begin - if p_tenant_id is null then - raise exception 'tenant_id é obrigatório'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'email é obrigatório'; - end if; - - -- valida role permitida - if p_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'role inválida: %', p_role; - end if; - - -- apenas admin do tenant (role real no banco) - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and coalesce(tm.status,'active') = 'active' - ) into v_is_admin; - - if not v_is_admin then - raise exception 'sem permissão: apenas admin da clínica pode adicionar membros'; - end if; - - -- acha usuário pelo e-mail no Supabase Auth - select u.id - into v_target_uid - from auth.users u - where lower(u.email) = v_email - limit 1; - - if v_target_uid is null then - raise exception 'nenhum usuário encontrado com este e-mail'; - end if; - - -- cria ou reativa membro - insert into public.tenant_members (tenant_id, user_id, role, status) - values (p_tenant_id, v_target_uid, p_role, 'active') - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active' - returning * into v_member; - - return v_member; -end; -$$; - - -ALTER FUNCTION "public"."tenant_add_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_feature_allowed"("p_tenant_id" "uuid", "p_feature_key" "text") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select exists ( - select 1 - from public.v_tenant_entitlements v - where v.tenant_id = p_tenant_id - and v.feature_key = p_feature_key - and coalesce(v.allowed, false) = true - ); -$$; - - -ALTER FUNCTION "public"."tenant_feature_allowed"("p_tenant_id" "uuid", "p_feature_key" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_feature_enabled"("p_tenant_id" "uuid", "p_feature_key" "text") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select coalesce( - (select tf.enabled - from public.tenant_features tf - where tf.tenant_id = p_tenant_id and tf.feature_key = p_feature_key), - false - ); -$$; - - -ALTER FUNCTION "public"."tenant_feature_enabled"("p_tenant_id" "uuid", "p_feature_key" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_features_guard_with_plan"() RETURNS "trigger" - LANGUAGE "plpgsql" - AS $$ -declare - v_allowed boolean; -begin - -- só valida quando está habilitando - if new.enabled is distinct from true then - return new; - end if; - - -- permitido pelo plano do tenant? - select exists ( - select 1 - from public.v_tenant_entitlements_full v - where v.tenant_id = new.tenant_id - and v.feature_key = new.feature_key - and v.allowed = true - ) - into v_allowed; - - if not v_allowed then - raise exception 'Feature % não permitida pelo plano atual do tenant %.', - new.feature_key, new.tenant_id - using errcode = 'P0001'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION "public"."tenant_features_guard_with_plan"() OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_has_feature"("_tenant_id" "uuid", "_feature" "text") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select - exists ( - select 1 - from public.v_tenant_entitlements e - where e.tenant_id = _tenant_id - and e.feature_key = _feature - and e.allowed = true - ) - or exists ( - select 1 - from public.tenant_features tf - where tf.tenant_id = _tenant_id - and tf.feature_key = _feature - and tf.enabled = true - ); -$$; - - -ALTER FUNCTION "public"."tenant_has_feature"("_tenant_id" "uuid", "_feature" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") RETURNS "uuid" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public', 'auth' - AS $$ -declare - v_email text; - v_my_email text; - v_token uuid; - v_updated int; -begin - -- validações básicas - if p_tenant_id is null then - raise exception 'tenant_id inválido' using errcode = 'P0001'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'Informe um email' using errcode = 'P0001'; - end if; - - -- role permitido (ajuste se quiser) - if p_role is null or p_role not in ('therapist', 'secretary') then - raise exception 'Role inválido (use therapist/secretary)' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: auto-convite - v_my_email := public.get_my_email(); - if v_my_email is not null and v_email = v_my_email then - raise exception 'Você não pode convidar o seu próprio email.' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: já é membro ativo do tenant - if exists ( - select 1 - from tenant_members tm - join auth.users au on au.id = tm.user_id - where tm.tenant_id = p_tenant_id - and tm.status = 'active' - and lower(au.email) = v_email - ) then - raise exception 'Este email já está vinculado a esta clínica.' using errcode = 'P0001'; - end if; - - -- ✅ permissão: só admin do tenant pode convidar - if not exists ( - select 1 - from tenant_members me - where me.tenant_id = p_tenant_id - and me.user_id = auth.uid() - and me.status = 'active' - and me.role in ('tenant_admin','clinic_admin') - ) then - raise exception 'Sem permissão para convidar membros.' using errcode = 'P0001'; - end if; - - -- Gera token (reenvio simples / regeneração) - v_token := gen_random_uuid(); - - -- 1) tenta "regerar" um convite pendente existente (mesmo email) - update tenant_invites - set token = v_token, - role = p_role, - created_at = now(), - expires_at = now() + interval '7 days', - accepted_at = null, - revoked_at = null - where tenant_id = p_tenant_id - and lower(email) = v_email - and accepted_at is null - and revoked_at is null; - - get diagnostics v_updated = row_count; - - -- 2) se não atualizou nada, cria convite novo - if v_updated = 0 then - insert into tenant_invites (tenant_id, email, role, token, created_at, expires_at) - values (p_tenant_id, v_email, p_role, v_token, now(), now() + interval '7 days'); - end if; - - return v_token; -end; -$$; - - -ALTER FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_reactivate_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - update public.tenant_members - set status = 'active' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION "public"."tenant_reactivate_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_remove_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ -declare - v_role text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - -- pega role atual do membro (se não existir, erro) - select role into v_role - from public.tenant_members - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if v_role is null then - raise exception 'membership_not_found'; - end if; - - -- trava: se for therapist, não pode remover com eventos futuros - if v_role = 'therapist' then - if exists ( - select 1 - from public.agenda_eventos e - where e.owner_id = p_tenant_id - and e.terapeuta_id = p_member_user_id - and e.inicio_em >= now() - and e.status::text not in ('cancelado','cancelled','canceled') - limit 1 - ) then - raise exception 'cannot_remove_therapist_with_future_events'; - end if; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION "public"."tenant_remove_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_remove_member_soft"("p_tenant_id" "uuid", "p_member_user_id" "uuid") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION "public"."tenant_remove_member_soft"("p_tenant_id" "uuid", "p_member_user_id" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_revoke_invite"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ -declare - v_email text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - v_email := lower(trim(p_email)); - - update public.tenant_invites - set revoked_at = now(), - revoked_by = auth.uid() - where tenant_id = p_tenant_id - and lower(email) = v_email - and role = p_role - and accepted_at is null - and revoked_at is null; - - if not found then - raise exception 'invite_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION "public"."tenant_revoke_invite"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_set_member_status"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_status" "text") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida status (adapte aos seus valores reais) - if p_new_status not in ('active','inactive','suspended','invited') then - raise exception 'invalid_status: %', p_new_status; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita desativar a si mesmo (opcional) - if p_member_user_id = auth.uid() and p_new_status <> 'active' then - raise exception 'cannot_disable_self'; - end if; - - update public.tenant_members - set status = p_new_status - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION "public"."tenant_set_member_status"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_status" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."tenant_update_member_role"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_role" "text") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - SET "search_path" TO 'public' - SET "row_security" TO 'off' - AS $$ -begin - -- exige auth - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida role - if p_new_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'invalid_role: %', p_new_role; - end if; - - -- somente tenant_admin ativo pode alterar role - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita o admin remover o próprio admin sem querer (opcional mas recomendado) - if p_member_user_id = auth.uid() and p_new_role <> 'tenant_admin' then - raise exception 'cannot_demote_self'; - end if; - - update public.tenant_members - set role = p_new_role - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION "public"."tenant_update_member_role"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_role" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."toggle_plan"("owner" "uuid") RETURNS "void" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - current_key text; - new_key text; -begin - select p.key into current_key - from subscriptions s - join plans p on p.id = s.plan_id - where s.owner_id = owner - and s.status = 'active'; - - new_key := case - when current_key = 'pro' then 'free' - else 'pro' - end; - - update subscriptions s - set plan_id = p.id - from plans p - where p.key = new_key - and s.owner_id = owner - and s.status = 'active'; -end; -$$; - - -ALTER FUNCTION "public"."toggle_plan"("owner" "uuid") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."transition_subscription"("p_subscription_id" "uuid", "p_to_status" "text", "p_reason" "text" DEFAULT NULL::"text", "p_metadata" "jsonb" DEFAULT NULL::"jsonb") RETURNS "public"."subscriptions" - LANGUAGE "plpgsql" SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_uid uuid; - v_is_allowed boolean := false; -begin - v_uid := auth.uid(); - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id; - - if not found then - raise exception 'Assinatura não encontrada'; - end if; - - -- ===================================================== - -- 🔐 BLOCO DE AUTORIZAÇÃO - -- ===================================================== - - -- 1) SaaS admin pode tudo - if is_saas_admin() then - v_is_allowed := true; - end if; - - -- 2) Assinatura pessoal (therapist) - if not v_is_allowed - and v_sub.tenant_id is null - and v_sub.user_id = v_uid then - v_is_allowed := true; - end if; - - -- 3) Assinatura de clinic (tenant) - if not v_is_allowed - and v_sub.tenant_id is not null then - - if exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = v_sub.tenant_id - and tm.user_id = v_uid - and tm.status = 'active' - and tm.role = 'tenant_admin' - ) then - v_is_allowed := true; - end if; - - end if; - - if not v_is_allowed then - raise exception 'Sem permissão para transicionar esta assinatura'; - end if; - - -- ===================================================== - -- 🧠 TRANSIÇÃO - -- ===================================================== - - update public.subscriptions - set status = p_to_status, - updated_at = now(), - cancelled_at = case when p_to_status = 'cancelled' then now() else cancelled_at end, - suspended_at = case when p_to_status = 'suspended' then now() else suspended_at end, - past_due_since = case when p_to_status = 'past_due' then now() else past_due_since end, - expired_at = case when p_to_status = 'expired' then now() else expired_at end, - activated_at = case when p_to_status = 'active' then now() else activated_at end - where id = p_subscription_id - returning * into v_sub; - - -- ===================================================== - -- 🧾 EVENT LOG - -- ===================================================== - - insert into public.subscription_events ( - subscription_id, - owner_id, - event_type, - created_at, - created_by, - source, - reason, - metadata, - owner_type, - owner_ref - ) - values ( - v_sub.id, - coalesce(v_sub.tenant_id, v_sub.user_id), - 'status_changed', - now(), - v_uid, - 'manual_transition', - p_reason, - p_metadata, - case when v_sub.tenant_id is not null then 'tenant' else 'personal' end, - coalesce(v_sub.tenant_id, v_sub.user_id) - ); - - return v_sub; -end; -$$; - - -ALTER FUNCTION "public"."transition_subscription"("p_subscription_id" "uuid", "p_to_status" "text", "p_reason" "text", "p_metadata" "jsonb") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."user_has_feature"("_user_id" "uuid", "_feature" "text") RETURNS boolean - LANGUAGE "sql" STABLE - AS $$ - select exists ( - select 1 - from public.v_user_entitlements e - where e.user_id = _user_id - and e.feature_key = _feature - and e.allowed = true - ); -$$; - - -ALTER FUNCTION "public"."user_has_feature"("_user_id" "uuid", "_feature" "text") OWNER TO "supabase_admin"; - - -CREATE OR REPLACE FUNCTION "public"."whoami"() RETURNS TABLE("uid" "uuid", "role" "text") - LANGUAGE "sql" STABLE - AS $$ - select auth.uid() as uid, auth.role() as role; -$$; - - -ALTER FUNCTION "public"."whoami"() OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_bloqueios" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - "tipo" "text" NOT NULL, - "titulo" "text" NOT NULL, - "data_inicio" "date" NOT NULL, - "data_fim" "date", - "hora_inicio" time without time zone, - "hora_fim" time without time zone, - "recorrente" boolean DEFAULT false NOT NULL, - "dia_semana" smallint, - "observacao" "text", - "origem" "text" DEFAULT 'manual'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - CONSTRAINT "agenda_bloqueios_tipo_check" CHECK (("tipo" = ANY (ARRAY['feriado_nacional'::"text", 'feriado_municipal'::"text", 'bloqueio'::"text"]))) -); - - -ALTER TABLE "public"."agenda_bloqueios" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_configuracoes" ( - "owner_id" "uuid" NOT NULL, - "duracao_padrao_minutos" integer DEFAULT 50 NOT NULL, - "intervalo_padrao_minutos" integer DEFAULT 0 NOT NULL, - "timezone" "text" DEFAULT 'America/Sao_Paulo'::"text" NOT NULL, - "usar_horario_admin_custom" boolean DEFAULT false NOT NULL, - "admin_inicio_visualizacao" time without time zone, - "admin_fim_visualizacao" time without time zone, - "admin_slot_visual_minutos" integer DEFAULT 30 NOT NULL, - "online_ativo" boolean DEFAULT false NOT NULL, - "online_min_antecedencia_horas" integer DEFAULT 24 NOT NULL, - "online_max_dias_futuro" integer DEFAULT 60 NOT NULL, - "online_cancelar_ate_horas" integer DEFAULT 12 NOT NULL, - "online_reagendar_ate_horas" integer DEFAULT 12 NOT NULL, - "online_limite_agendamentos_futuros" integer DEFAULT 1 NOT NULL, - "online_modo" "text" DEFAULT 'automatico'::"text" NOT NULL, - "online_buffer_antes_min" integer DEFAULT 0 NOT NULL, - "online_buffer_depois_min" integer DEFAULT 0 NOT NULL, - "online_modalidade" "text" DEFAULT 'ambos'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "usar_granularidade_custom" boolean DEFAULT false NOT NULL, - "granularidade_min" integer, - "setup_concluido" boolean DEFAULT false NOT NULL, - "setup_concluido_em" timestamp with time zone, - "agenda_view_mode" "text" DEFAULT 'full_24h'::"text" NOT NULL, - "agenda_custom_start" time without time zone, - "agenda_custom_end" time without time zone, - "session_duration_min" integer DEFAULT 50 NOT NULL, - "session_break_min" integer DEFAULT 10 NOT NULL, - "pausas_semanais" "jsonb" DEFAULT '[]'::"jsonb" NOT NULL, - "setup_clinica_concluido" boolean DEFAULT false NOT NULL, - "setup_clinica_concluido_em" timestamp with time zone, - "tenant_id" "uuid", - "jornada_igual_todos" boolean DEFAULT true, - CONSTRAINT "agenda_configuracoes_admin_slot_visual_minutos_check" CHECK (("admin_slot_visual_minutos" = ANY (ARRAY[5, 10, 15, 20, 30, 60]))), - CONSTRAINT "agenda_configuracoes_check" CHECK ((("usar_horario_admin_custom" = false) OR (("admin_inicio_visualizacao" IS NOT NULL) AND ("admin_fim_visualizacao" IS NOT NULL) AND ("admin_fim_visualizacao" > "admin_inicio_visualizacao")))), - CONSTRAINT "agenda_configuracoes_duracao_padrao_minutos_check" CHECK ((("duracao_padrao_minutos" >= 10) AND ("duracao_padrao_minutos" <= 240))), - CONSTRAINT "agenda_configuracoes_granularidade_min_check" CHECK ((("granularidade_min" IS NULL) OR ("granularidade_min" = ANY (ARRAY[5, 10, 15, 20, 30, 45, 50, 60])))), - CONSTRAINT "agenda_configuracoes_intervalo_padrao_minutos_check" CHECK ((("intervalo_padrao_minutos" >= 0) AND ("intervalo_padrao_minutos" <= 120))), - CONSTRAINT "agenda_configuracoes_online_buffer_antes_min_check" CHECK ((("online_buffer_antes_min" >= 0) AND ("online_buffer_antes_min" <= 120))), - CONSTRAINT "agenda_configuracoes_online_buffer_depois_min_check" CHECK ((("online_buffer_depois_min" >= 0) AND ("online_buffer_depois_min" <= 120))), - CONSTRAINT "agenda_configuracoes_online_cancelar_ate_horas_check" CHECK ((("online_cancelar_ate_horas" >= 0) AND ("online_cancelar_ate_horas" <= 720))), - CONSTRAINT "agenda_configuracoes_online_limite_agendamentos_futuros_check" CHECK ((("online_limite_agendamentos_futuros" >= 1) AND ("online_limite_agendamentos_futuros" <= 10))), - CONSTRAINT "agenda_configuracoes_online_max_dias_futuro_check" CHECK ((("online_max_dias_futuro" >= 1) AND ("online_max_dias_futuro" <= 365))), - CONSTRAINT "agenda_configuracoes_online_min_antecedencia_horas_check" CHECK ((("online_min_antecedencia_horas" >= 0) AND ("online_min_antecedencia_horas" <= 720))), - CONSTRAINT "agenda_configuracoes_online_modalidade_check" CHECK (("online_modalidade" = ANY (ARRAY['online'::"text", 'presencial'::"text", 'ambos'::"text"]))), - CONSTRAINT "agenda_configuracoes_online_modo_check" CHECK (("online_modo" = ANY (ARRAY['automatico'::"text", 'aprovacao'::"text"]))), - CONSTRAINT "agenda_configuracoes_online_reagendar_ate_horas_check" CHECK ((("online_reagendar_ate_horas" >= 0) AND ("online_reagendar_ate_horas" <= 720))), - CONSTRAINT "session_break_min_chk" CHECK ((("session_break_min" >= 0) AND ("session_break_min" <= 60))), - CONSTRAINT "session_duration_min_chk" CHECK ((("session_duration_min" >= 10) AND ("session_duration_min" <= 240))) -); - - -ALTER TABLE "public"."agenda_configuracoes" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_eventos" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "paciente_id" "uuid", - "tipo" "public"."tipo_evento_agenda" DEFAULT 'sessao'::"public"."tipo_evento_agenda" NOT NULL, - "status" "public"."status_evento_agenda" DEFAULT 'agendado'::"public"."status_evento_agenda" NOT NULL, - "titulo" "text", - "observacoes" "text", - "inicio_em" timestamp with time zone NOT NULL, - "fim_em" timestamp with time zone NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "terapeuta_id" "uuid", - "tenant_id" "uuid" NOT NULL, - "visibility_scope" "text" DEFAULT 'public'::"text" NOT NULL, - "mirror_of_event_id" "uuid", - "mirror_source" "text", - "patient_id" "uuid", - "determined_commitment_id" "uuid", - "link_online" "text", - "titulo_custom" "text", - "extra_fields" "jsonb", - "recurrence_id" "uuid", - "recurrence_date" "date", - "modalidade" "text" DEFAULT 'presencial'::"text", - CONSTRAINT "agenda_eventos_check" CHECK (("fim_em" > "inicio_em")) -); - - -ALTER TABLE "public"."agenda_eventos" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_excecoes" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "data" "date" NOT NULL, - "hora_inicio" time without time zone, - "hora_fim" time without time zone, - "tipo" "public"."tipo_excecao_agenda" NOT NULL, - "motivo" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "status" "public"."status_excecao_agenda" DEFAULT 'ativo'::"public"."status_excecao_agenda" NOT NULL, - "fonte" "text" DEFAULT 'manual'::"text" NOT NULL, - "aplicavel_online" boolean DEFAULT true NOT NULL, - "tenant_id" "uuid" NOT NULL, - CONSTRAINT "agenda_excecoes_check" CHECK (((("hora_inicio" IS NULL) AND ("hora_fim" IS NULL)) OR (("hora_inicio" IS NOT NULL) AND ("hora_fim" IS NOT NULL) AND ("hora_fim" > "hora_inicio")))), - CONSTRAINT "agenda_excecoes_fonte_check" CHECK (("fonte" = ANY (ARRAY['manual'::"text", 'feriado_google'::"text", 'sistema'::"text"]))) -); - - -ALTER TABLE "public"."agenda_excecoes" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_online_slots" ( - "id" bigint NOT NULL, - "owner_id" "uuid" NOT NULL, - "weekday" integer NOT NULL, - "time" time without time zone NOT NULL, - "enabled" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - CONSTRAINT "agenda_online_slots_weekday_check" CHECK (("weekday" = ANY (ARRAY[0, 1, 2, 3, 4, 5, 6]))) -); - - -ALTER TABLE "public"."agenda_online_slots" OWNER TO "supabase_admin"; - - -CREATE SEQUENCE IF NOT EXISTS "public"."agenda_online_slots_id_seq" - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE "public"."agenda_online_slots_id_seq" OWNER TO "supabase_admin"; - - -ALTER SEQUENCE "public"."agenda_online_slots_id_seq" OWNED BY "public"."agenda_online_slots"."id"; - - - -CREATE TABLE IF NOT EXISTS "public"."agenda_regras_semanais" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "dia_semana" smallint NOT NULL, - "hora_inicio" time without time zone NOT NULL, - "hora_fim" time without time zone NOT NULL, - "modalidade" "text" DEFAULT 'ambos'::"text" NOT NULL, - "ativo" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - CONSTRAINT "agenda_regras_semanais_check" CHECK (("hora_fim" > "hora_inicio")), - CONSTRAINT "agenda_regras_semanais_dia_semana_check" CHECK ((("dia_semana" >= 0) AND ("dia_semana" <= 6))), - CONSTRAINT "agenda_regras_semanais_modalidade_check" CHECK ((("modalidade" = ANY (ARRAY['online'::"text", 'presencial'::"text", 'ambos'::"text"])) OR ("modalidade" IS NULL))) -); - - -ALTER TABLE "public"."agenda_regras_semanais" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_slots_bloqueados_semanais" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "dia_semana" smallint NOT NULL, - "hora_inicio" time without time zone NOT NULL, - "motivo" "text", - "ativo" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - CONSTRAINT "agenda_slots_bloqueados_semanais_dia_semana_check" CHECK ((("dia_semana" >= 0) AND ("dia_semana" <= 6))) -); - - -ALTER TABLE "public"."agenda_slots_bloqueados_semanais" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agenda_slots_regras" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "dia_semana" smallint NOT NULL, - "passo_minutos" integer NOT NULL, - "offset_minutos" integer DEFAULT 0 NOT NULL, - "buffer_antes_min" integer DEFAULT 0 NOT NULL, - "buffer_depois_min" integer DEFAULT 0 NOT NULL, - "min_antecedencia_horas" integer DEFAULT 0 NOT NULL, - "ativo" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - CONSTRAINT "agenda_slots_regras_buffer_antes_min_check" CHECK ((("buffer_antes_min" >= 0) AND ("buffer_antes_min" <= 240))), - CONSTRAINT "agenda_slots_regras_buffer_depois_min_check" CHECK ((("buffer_depois_min" >= 0) AND ("buffer_depois_min" <= 240))), - CONSTRAINT "agenda_slots_regras_dia_semana_check" CHECK ((("dia_semana" >= 0) AND ("dia_semana" <= 6))), - CONSTRAINT "agenda_slots_regras_min_antecedencia_horas_check" CHECK ((("min_antecedencia_horas" >= 0) AND ("min_antecedencia_horas" <= 720))), - CONSTRAINT "agenda_slots_regras_offset_minutos_check" CHECK ((("offset_minutos" >= 0) AND ("offset_minutos" <= 55))), - CONSTRAINT "agenda_slots_regras_passo_minutos_check" CHECK ((("passo_minutos" >= 5) AND ("passo_minutos" <= 240))) -); - - -ALTER TABLE "public"."agenda_slots_regras" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agendador_configuracoes" ( - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - "ativo" boolean DEFAULT false NOT NULL, - "link_slug" "text", - "imagem_fundo_url" "text", - "imagem_header_url" "text", - "logomarca_url" "text", - "cor_primaria" "text" DEFAULT '#4b6bff'::"text", - "nome_exibicao" "text", - "endereco" "text", - "botao_como_chegar_ativo" boolean DEFAULT true NOT NULL, - "maps_url" "text", - "modo_aprovacao" "text" DEFAULT 'aprovacao'::"text" NOT NULL, - "modalidade" "text" DEFAULT 'presencial'::"text" NOT NULL, - "tipos_habilitados" "jsonb" DEFAULT '["primeira", "retorno"]'::"jsonb" NOT NULL, - "duracao_sessao_min" integer DEFAULT 50 NOT NULL, - "antecedencia_minima_horas" integer DEFAULT 24 NOT NULL, - "prazo_resposta_horas" integer DEFAULT 2 NOT NULL, - "reserva_horas" integer DEFAULT 2 NOT NULL, - "pagamento_obrigatorio" boolean DEFAULT false NOT NULL, - "pix_chave" "text", - "pix_countdown_minutos" integer DEFAULT 20 NOT NULL, - "triagem_motivo" boolean DEFAULT true NOT NULL, - "triagem_como_conheceu" boolean DEFAULT false NOT NULL, - "verificacao_email" boolean DEFAULT false NOT NULL, - "exigir_aceite_lgpd" boolean DEFAULT true NOT NULL, - "mensagem_boas_vindas" "text", - "texto_como_se_preparar" "text", - "texto_termos_lgpd" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - CONSTRAINT "agendador_configuracoes_antecedencia_check" CHECK ((("antecedencia_minima_horas" >= 0) AND ("antecedencia_minima_horas" <= 720))), - CONSTRAINT "agendador_configuracoes_duracao_check" CHECK ((("duracao_sessao_min" >= 10) AND ("duracao_sessao_min" <= 240))), - CONSTRAINT "agendador_configuracoes_modalidade_check" CHECK (("modalidade" = ANY (ARRAY['presencial'::"text", 'online'::"text", 'ambos'::"text"]))), - CONSTRAINT "agendador_configuracoes_modo_check" CHECK (("modo_aprovacao" = ANY (ARRAY['automatico'::"text", 'aprovacao'::"text"]))), - CONSTRAINT "agendador_configuracoes_pix_countdown_check" CHECK ((("pix_countdown_minutos" >= 5) AND ("pix_countdown_minutos" <= 120))), - CONSTRAINT "agendador_configuracoes_prazo_check" CHECK ((("prazo_resposta_horas" >= 1) AND ("prazo_resposta_horas" <= 72))), - CONSTRAINT "agendador_configuracoes_reserva_check" CHECK ((("reserva_horas" >= 1) AND ("reserva_horas" <= 48))) -); - - -ALTER TABLE "public"."agendador_configuracoes" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."agendador_solicitacoes" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - "paciente_nome" "text" NOT NULL, - "paciente_sobrenome" "text", - "paciente_email" "text" NOT NULL, - "paciente_celular" "text", - "paciente_cpf" "text", - "tipo" "text" NOT NULL, - "modalidade" "text" NOT NULL, - "data_solicitada" "date" NOT NULL, - "hora_solicitada" time without time zone NOT NULL, - "reservado_ate" timestamp with time zone, - "motivo" "text", - "como_conheceu" "text", - "pix_status" "text" DEFAULT 'pendente'::"text", - "pix_pago_em" timestamp with time zone, - "status" "text" DEFAULT 'pendente'::"text" NOT NULL, - "recusado_motivo" "text", - "autorizado_em" timestamp with time zone, - "autorizado_por" "uuid", - "user_id" "uuid", - "patient_id" "uuid", - "evento_id" "uuid", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - CONSTRAINT "agendador_sol_modalidade_check" CHECK (("modalidade" = ANY (ARRAY['presencial'::"text", 'online'::"text"]))), - CONSTRAINT "agendador_sol_pix_check" CHECK ((("pix_status" IS NULL) OR ("pix_status" = ANY (ARRAY['pendente'::"text", 'pago'::"text", 'expirado'::"text"])))), - CONSTRAINT "agendador_sol_status_check" CHECK (("status" = ANY (ARRAY['pendente'::"text", 'autorizado'::"text", 'recusado'::"text", 'expirado'::"text", 'convertido'::"text"]))), - CONSTRAINT "agendador_sol_tipo_check" CHECK (("tipo" = ANY (ARRAY['primeira'::"text", 'retorno'::"text", 'reagendar'::"text"]))) -); - - -ALTER TABLE "public"."agendador_solicitacoes" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."commitment_time_logs" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "commitment_id" "uuid" NOT NULL, - "calendar_event_id" "uuid", - "source" "public"."commitment_log_source" DEFAULT 'manual'::"public"."commitment_log_source" NOT NULL, - "started_at" timestamp with time zone NOT NULL, - "ended_at" timestamp with time zone NOT NULL, - "minutes" integer NOT NULL, - "created_by" "uuid", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."commitment_time_logs" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."current_tenant_id" AS - SELECT "current_setting"('request.jwt.claim.tenant_id'::"text", true) AS "current_setting"; - - -ALTER VIEW "public"."current_tenant_id" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."determined_commitment_fields" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "commitment_id" "uuid" NOT NULL, - "key" "text" NOT NULL, - "label" "text" NOT NULL, - "field_type" "public"."determined_field_type" DEFAULT 'text'::"public"."determined_field_type" NOT NULL, - "required" boolean DEFAULT false NOT NULL, - "sort_order" integer DEFAULT 0 NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."determined_commitment_fields" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."determined_commitments" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "created_by" "uuid", - "is_native" boolean DEFAULT false NOT NULL, - "native_key" "text", - "is_locked" boolean DEFAULT false NOT NULL, - "active" boolean DEFAULT true NOT NULL, - "name" "text" NOT NULL, - "description" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "bg_color" "text", - "text_color" "text" -); - - -ALTER TABLE "public"."determined_commitments" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."dev_user_credentials" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "user_id" "uuid", - "email" "text" NOT NULL, - "password_dev" "text" NOT NULL, - "kind" "text" DEFAULT 'custom'::"text" NOT NULL, - "note" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."dev_user_credentials" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."entitlements_invalidation" ( - "owner_id" "uuid" NOT NULL, - "changed_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."entitlements_invalidation" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."features" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "key" "text" NOT NULL, - "description" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "descricao" "text" DEFAULT ''::"text" NOT NULL, - "name" "text" DEFAULT ''::"text" NOT NULL -); - - -ALTER TABLE "public"."features" OWNER TO "supabase_admin"; - - -COMMENT ON COLUMN "public"."features"."descricao" IS 'Descrição humana da feature (exibição no admin e documentação).'; - - - -CREATE TABLE IF NOT EXISTS "public"."feriados" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid", - "owner_id" "uuid", - "tipo" "text" DEFAULT 'municipal'::"text" NOT NULL, - "nome" "text" NOT NULL, - "data" "date" NOT NULL, - "cidade" "text", - "estado" "text", - "observacao" "text", - "bloqueia_sessoes" boolean DEFAULT false NOT NULL, - "criado_em" timestamp with time zone DEFAULT "now"() NOT NULL, - CONSTRAINT "feriados_tipo_check" CHECK (("tipo" = ANY (ARRAY['municipal'::"text", 'personalizado'::"text"]))) -); - - -ALTER TABLE "public"."feriados" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."module_features" ( - "module_id" "uuid" NOT NULL, - "feature_id" "uuid" NOT NULL, - "enabled" boolean DEFAULT true NOT NULL, - "limits" "jsonb", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."module_features" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."modules" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "key" "text" NOT NULL, - "name" "text" NOT NULL, - "description" "text", - "is_active" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."modules" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."plan_features" ( - "plan_id" "uuid" NOT NULL, - "feature_id" "uuid" NOT NULL, - "enabled" boolean DEFAULT true NOT NULL, - "limits" "jsonb", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."plan_features" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."tenant_modules" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "module_id" "uuid" NOT NULL, - "status" "text" DEFAULT 'active'::"text" NOT NULL, - "settings" "jsonb", - "provider" "text" DEFAULT 'manual'::"text" NOT NULL, - "provider_item_id" "text", - "installed_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."tenant_modules" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."owner_feature_entitlements" AS - WITH "base" AS ( - SELECT "s"."user_id" AS "owner_id", - "f"."key" AS "feature_key", - "pf"."limits", - 'plan'::"text" AS "source" - FROM (("public"."subscriptions" "s" - JOIN "public"."plan_features" "pf" ON ((("pf"."plan_id" = "s"."plan_id") AND ("pf"."enabled" = true)))) - JOIN "public"."features" "f" ON (("f"."id" = "pf"."feature_id"))) - WHERE (("s"."status" = 'active'::"text") AND ("s"."user_id" IS NOT NULL)) - UNION ALL - SELECT "tm"."owner_id", - "f"."key" AS "feature_key", - "mf"."limits", - 'module'::"text" AS "source" - FROM ((("public"."tenant_modules" "tm" - JOIN "public"."modules" "m" ON ((("m"."id" = "tm"."module_id") AND ("m"."is_active" = true)))) - JOIN "public"."module_features" "mf" ON ((("mf"."module_id" = "m"."id") AND ("mf"."enabled" = true)))) - JOIN "public"."features" "f" ON (("f"."id" = "mf"."feature_id"))) - WHERE (("tm"."status" = 'active'::"text") AND ("tm"."owner_id" IS NOT NULL)) - ) - SELECT "owner_id", - "feature_key", - "array_agg"(DISTINCT "source") AS "sources", - "jsonb_agg"("limits") FILTER (WHERE ("limits" IS NOT NULL)) AS "limits_list" - FROM "base" - GROUP BY "owner_id", "feature_key"; - - -ALTER VIEW "public"."owner_feature_entitlements" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."owner_users" ( - "owner_id" "uuid" NOT NULL, - "user_id" "uuid" NOT NULL, - "role" "text" DEFAULT 'admin'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."owner_users" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patient_group_patient" ( - "patient_group_id" "uuid" NOT NULL, - "patient_id" "uuid" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"(), - "tenant_id" "uuid" NOT NULL -); - - -ALTER TABLE "public"."patient_group_patient" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patient_groups" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "nome" "text" NOT NULL, - "descricao" "text", - "cor" "text", - "is_active" boolean DEFAULT true NOT NULL, - "is_system" boolean DEFAULT false NOT NULL, - "owner_id" "uuid" DEFAULT "auth"."uid"() NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "therapist_id" "uuid", - "tenant_id" "uuid" NOT NULL -); - - -ALTER TABLE "public"."patient_groups" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patient_intake_requests" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "token" "text" NOT NULL, - "consent" boolean DEFAULT false NOT NULL, - "status" "text" DEFAULT 'new'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "converted_patient_id" "uuid", - "rejected_reason" "text", - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "cpf" "text", - "rg" "text", - "cep" "text", - "nome_completo" "text", - "email_principal" "text", - "telefone" "text", - "pais" "text", - "cidade" "text", - "estado" "text", - "endereco" "text", - "numero" "text", - "bairro" "text", - "complemento" "text", - "data_nascimento" "date", - "naturalidade" "text", - "genero" "text", - "estado_civil" "text", - "onde_nos_conheceu" "text", - "encaminhado_por" "text", - "observacoes" "text", - "notas_internas" "text", - "email_alternativo" "text", - "telefone_alternativo" "text", - "profissao" "text", - "escolaridade" "text", - "nacionalidade" "text", - "avatar_url" "text", - "tenant_id" "uuid", - CONSTRAINT "chk_intakes_status" CHECK (("status" = ANY (ARRAY['new'::"text", 'converted'::"text", 'rejected'::"text"]))) -); - - -ALTER TABLE "public"."patient_intake_requests" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patient_invites" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "token" "text" NOT NULL, - "active" boolean DEFAULT true NOT NULL, - "expires_at" timestamp with time zone, - "max_uses" integer, - "uses" integer DEFAULT 0 NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid" -); - - -ALTER TABLE "public"."patient_invites" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patient_patient_tag" ( - "owner_id" "uuid" NOT NULL, - "patient_id" "uuid" NOT NULL, - "tag_id" "uuid" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "tenant_id" "uuid" NOT NULL -); - - -ALTER TABLE "public"."patient_patient_tag" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patient_tags" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "owner_id" "uuid" NOT NULL, - "nome" "text" NOT NULL, - "cor" "text", - "is_padrao" boolean DEFAULT false NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone, - "tenant_id" "uuid" NOT NULL -); - - -ALTER TABLE "public"."patient_tags" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."patients" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "nome_completo" "text" NOT NULL, - "email_principal" "text", - "telefone" "text", - "created_at" timestamp with time zone DEFAULT "now"(), - "owner_id" "uuid", - "avatar_url" "text", - "status" "text" DEFAULT 'Ativo'::"text", - "last_attended_at" timestamp with time zone, - "is_native" boolean DEFAULT false, - "naturalidade" "text", - "data_nascimento" "date", - "rg" "text", - "cpf" "text", - "identification_color" "text", - "genero" "text", - "estado_civil" "text", - "email_alternativo" "text", - "pais" "text" DEFAULT 'Brasil'::"text", - "cep" "text", - "cidade" "text", - "estado" "text", - "endereco" "text", - "numero" "text", - "bairro" "text", - "complemento" "text", - "escolaridade" "text", - "profissao" "text", - "nome_parente" "text", - "grau_parentesco" "text", - "telefone_alternativo" "text", - "onde_nos_conheceu" "text", - "encaminhado_por" "text", - "nome_responsavel" "text", - "telefone_responsavel" "text", - "cpf_responsavel" "text", - "observacao_responsavel" "text", - "cobranca_no_responsavel" boolean DEFAULT false, - "observacoes" "text", - "notas_internas" "text", - "updated_at" timestamp with time zone DEFAULT "now"(), - "telefone_parente" "text", - "tenant_id" "uuid" NOT NULL, - "responsible_member_id" "uuid" NOT NULL, - "user_id" "uuid", - "patient_scope" "text" DEFAULT 'clinic'::"text" NOT NULL, - "therapist_member_id" "uuid", - CONSTRAINT "cpf_responsavel_format_check" CHECK ((("cpf_responsavel" IS NULL) OR ("cpf_responsavel" ~ '^\d{11}$'::"text"))), - CONSTRAINT "patients_cpf_format_check" CHECK ((("cpf" IS NULL) OR ("cpf" ~ '^\d{11}$'::"text"))), - CONSTRAINT "patients_patient_scope_check" CHECK (("patient_scope" = ANY (ARRAY['clinic'::"text", 'therapist'::"text"]))), - CONSTRAINT "patients_status_check" CHECK (("status" = ANY (ARRAY['Ativo'::"text", 'Inativo'::"text", 'Alta'::"text", 'Encaminhado'::"text"]))), - CONSTRAINT "patients_therapist_scope_consistency" CHECK (((("patient_scope" = 'clinic'::"text") AND ("therapist_member_id" IS NULL)) OR (("patient_scope" = 'therapist'::"text") AND ("therapist_member_id" IS NOT NULL)))) -); - - -ALTER TABLE "public"."patients" OWNER TO "supabase_admin"; - - -COMMENT ON COLUMN "public"."patients"."avatar_url" IS 'URL pública da imagem de avatar armazenada no Supabase Storage'; - - - -CREATE TABLE IF NOT EXISTS "public"."plan_prices" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "plan_id" "uuid" NOT NULL, - "currency" "text" DEFAULT 'BRL'::"text" NOT NULL, - "interval" "text" NOT NULL, - "amount_cents" integer NOT NULL, - "is_active" boolean DEFAULT true NOT NULL, - "active_from" timestamp with time zone DEFAULT "now"() NOT NULL, - "active_to" timestamp with time zone, - "source" "text" DEFAULT 'manual'::"text" NOT NULL, - "provider" "text", - "provider_price_id" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - CONSTRAINT "plan_prices_amount_cents_check" CHECK (("amount_cents" >= 0)), - CONSTRAINT "plan_prices_interval_check" CHECK (("interval" = ANY (ARRAY['month'::"text", 'year'::"text"]))) -); - - -ALTER TABLE "public"."plan_prices" OWNER TO "supabase_admin"; - - -COMMENT ON TABLE "public"."plan_prices" IS 'Histórico de preços por plano (fonte: manual/gateway).'; - - - -CREATE TABLE IF NOT EXISTS "public"."plan_public" ( - "plan_id" "uuid" NOT NULL, - "public_name" "text" DEFAULT ''::"text" NOT NULL, - "public_description" "text" DEFAULT ''::"text" NOT NULL, - "badge" "text", - "is_featured" boolean DEFAULT false NOT NULL, - "is_visible" boolean DEFAULT true NOT NULL, - "sort_order" integer DEFAULT 0 NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."plan_public" OWNER TO "supabase_admin"; - - -COMMENT ON TABLE "public"."plan_public" IS 'Configuração de vitrine (página pública) dos planos.'; - - - -CREATE TABLE IF NOT EXISTS "public"."plan_public_bullets" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "plan_id" "uuid" NOT NULL, - "text" "text" NOT NULL, - "sort_order" integer DEFAULT 0 NOT NULL, - "highlight" boolean DEFAULT false NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."plan_public_bullets" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."plans" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "key" "text" NOT NULL, - "name" "text" NOT NULL, - "description" "text", - "is_active" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "price_cents" integer DEFAULT 0 NOT NULL, - "currency" "text" DEFAULT 'BRL'::"text" NOT NULL, - "billing_interval" "text" DEFAULT 'month'::"text" NOT NULL, - "target" "text", - "max_supervisees" integer, - CONSTRAINT "plans_target_check" CHECK (("target" = ANY (ARRAY['patient'::"text", 'therapist'::"text", 'clinic'::"text", 'supervisor'::"text"]))) -); - - -ALTER TABLE "public"."plans" OWNER TO "supabase_admin"; - - -COMMENT ON COLUMN "public"."plans"."name" IS 'Nome interno do plano (admin). A key é técnica/imutável.'; - - - -COMMENT ON COLUMN "public"."plans"."target" IS 'Público-alvo do plano: patient, therapist ou clinic.'; - - - -COMMENT ON COLUMN "public"."plans"."max_supervisees" IS 'Limite de terapeutas que podem ser supervisionados. Apenas para planos target=supervisor. NULL = sem limite.'; - - - -CREATE TABLE IF NOT EXISTS "public"."profiles" ( - "id" "uuid" NOT NULL, - "role" "text" DEFAULT 'tenant_member'::"text" NOT NULL, - "full_name" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "avatar_url" "text", - "phone" "text", - "bio" "text", - "language" "text" DEFAULT 'pt-BR'::"text" NOT NULL, - "timezone" "text" DEFAULT 'America/Sao_Paulo'::"text" NOT NULL, - "notify_system_email" boolean DEFAULT true NOT NULL, - "notify_reminders" boolean DEFAULT true NOT NULL, - "notify_news" boolean DEFAULT false NOT NULL, - "account_type" "text" DEFAULT 'free'::"text" NOT NULL, - "platform_roles" "text"[] DEFAULT '{}'::"text"[] NOT NULL, - CONSTRAINT "profiles_account_type_check" CHECK (("account_type" = ANY (ARRAY['free'::"text", 'patient'::"text", 'therapist'::"text", 'clinic'::"text"]))), - CONSTRAINT "profiles_role_check" CHECK (("role" = ANY (ARRAY['saas_admin'::"text", 'tenant_member'::"text", 'portal_user'::"text", 'patient'::"text"]))) -); - - -ALTER TABLE "public"."profiles" OWNER TO "supabase_admin"; - - -COMMENT ON COLUMN "public"."profiles"."account_type" IS 'Tipo de conta: free=sem perfil ainda, patient=paciente (imutável), therapist=terapeuta (imutável), clinic=clínica (imutável).'; - - - -COMMENT ON COLUMN "public"."profiles"."platform_roles" IS 'Papéis globais de plataforma, independentes de tenant. Ex: editor de microlearning. Atribuído pelo saas_admin.'; - - - -CREATE TABLE IF NOT EXISTS "public"."recurrence_exceptions" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "recurrence_id" "uuid" NOT NULL, - "tenant_id" "uuid" NOT NULL, - "original_date" "date" NOT NULL, - "type" "public"."recurrence_exception_type" NOT NULL, - "new_date" "date", - "new_start_time" time without time zone, - "new_end_time" time without time zone, - "modalidade" "text", - "observacoes" "text", - "titulo_custom" "text", - "extra_fields" "jsonb", - "reason" "text", - "agenda_evento_id" "uuid", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."recurrence_exceptions" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."recurrence_rules" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "owner_id" "uuid" NOT NULL, - "therapist_id" "uuid", - "patient_id" "uuid", - "determined_commitment_id" "uuid", - "type" "public"."recurrence_type" DEFAULT 'weekly'::"public"."recurrence_type" NOT NULL, - "interval" smallint DEFAULT 1 NOT NULL, - "weekdays" smallint[] DEFAULT '{}'::smallint[] NOT NULL, - "start_time" time without time zone NOT NULL, - "end_time" time without time zone NOT NULL, - "timezone" "text" DEFAULT 'America/Sao_Paulo'::"text" NOT NULL, - "duration_min" smallint DEFAULT 50 NOT NULL, - "start_date" "date" NOT NULL, - "end_date" "date", - "max_occurrences" integer, - "open_ended" boolean DEFAULT true NOT NULL, - "modalidade" "text" DEFAULT 'presencial'::"text", - "titulo_custom" "text", - "observacoes" "text", - "extra_fields" "jsonb", - "status" "text" DEFAULT 'ativo'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - CONSTRAINT "recurrence_rules_dates_chk" CHECK ((("end_date" IS NULL) OR ("end_date" >= "start_date"))), - CONSTRAINT "recurrence_rules_interval_chk" CHECK (("interval" >= 1)), - CONSTRAINT "recurrence_rules_status_check" CHECK (("status" = ANY (ARRAY['ativo'::"text", 'pausado'::"text", 'cancelado'::"text"]))), - CONSTRAINT "recurrence_rules_times_chk" CHECK (("end_time" > "start_time")) -); - - -ALTER TABLE "public"."recurrence_rules" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."saas_admins" ( - "user_id" "uuid" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."saas_admins" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."saas_doc_votos" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "doc_id" "uuid" NOT NULL, - "user_id" "uuid" NOT NULL, - "util" boolean NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."saas_doc_votos" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."saas_docs" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "titulo" "text" NOT NULL, - "conteudo" "text" DEFAULT ''::"text" NOT NULL, - "medias" "jsonb" DEFAULT '[]'::"jsonb" NOT NULL, - "tipo_acesso" "text" DEFAULT 'usuario'::"text" NOT NULL, - "pagina_path" "text" NOT NULL, - "docs_relacionados" "uuid"[] DEFAULT '{}'::"uuid"[] NOT NULL, - "ativo" boolean DEFAULT true NOT NULL, - "ordem" integer DEFAULT 0 NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "categoria" "text", - "exibir_no_faq" boolean DEFAULT false NOT NULL, - "votos_util" integer DEFAULT 0 NOT NULL, - "votos_nao_util" integer DEFAULT 0 NOT NULL, - CONSTRAINT "saas_docs_tipo_acesso_check" CHECK (("tipo_acesso" = ANY (ARRAY['admin'::"text", 'usuario'::"text"]))) -); - - -ALTER TABLE "public"."saas_docs" OWNER TO "supabase_admin"; - - -COMMENT ON COLUMN "public"."saas_docs"."categoria" IS 'Agrupa docs no portal FAQ (ex: Conta, Agenda, Pagamentos)'; - - - -COMMENT ON COLUMN "public"."saas_docs"."exibir_no_faq" IS 'Se true, a doc e seus itens FAQ aparecem no portal de FAQ'; - - - -CREATE TABLE IF NOT EXISTS "public"."saas_faq" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "pergunta" "text" NOT NULL, - "categoria" "text", - "publico" boolean DEFAULT false NOT NULL, - "votos" integer DEFAULT 0 NOT NULL, - "titulo" "text", - "conteudo" "text", - "tipo_acesso" "text" DEFAULT 'usuario'::"text" NOT NULL, - "pagina_path" "text" NOT NULL, - "pagina_label" "text", - "medias" "jsonb" DEFAULT '[]'::"jsonb" NOT NULL, - "faqs_relacionados" "uuid"[] DEFAULT '{}'::"uuid"[] NOT NULL, - "ativo" boolean DEFAULT true NOT NULL, - "ordem" integer DEFAULT 0 NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."saas_faq" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."saas_faq_itens" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "doc_id" "uuid" NOT NULL, - "pergunta" "text" NOT NULL, - "resposta" "text", - "ordem" integer DEFAULT 0 NOT NULL, - "ativo" boolean DEFAULT true NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."saas_faq_itens" OWNER TO "supabase_admin"; - - -COMMENT ON TABLE "public"."saas_faq_itens" IS 'Pares pergunta/resposta vinculados a um documento de ajuda'; - - - -CREATE TABLE IF NOT EXISTS "public"."subscription_events" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "subscription_id" "uuid" NOT NULL, - "owner_id" "uuid" NOT NULL, - "event_type" "text" NOT NULL, - "old_plan_id" "uuid", - "new_plan_id" "uuid", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "created_by" "uuid", - "source" "text" DEFAULT 'admin_ui'::"text", - "reason" "text", - "metadata" "jsonb", - "owner_type" "text" NOT NULL, - "owner_ref" "uuid" NOT NULL, - CONSTRAINT "subscription_events_owner_ref_consistency_chk" CHECK (("owner_id" = "owner_ref")), - CONSTRAINT "subscription_events_owner_type_chk" CHECK ((("owner_type" IS NULL) OR ("owner_type" = ANY (ARRAY['clinic'::"text", 'therapist'::"text"])))) -); - - -ALTER TABLE "public"."subscription_events" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."subscription_intents_personal" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "user_id" "uuid" NOT NULL, - "created_by_user_id" "uuid", - "email" "text" NOT NULL, - "plan_id" "uuid" NOT NULL, - "plan_key" "text", - "interval" "text", - "amount_cents" integer, - "currency" "text", - "status" "text" DEFAULT 'new'::"text" NOT NULL, - "source" "text" DEFAULT 'manual'::"text" NOT NULL, - "notes" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "paid_at" timestamp with time zone, - "subscription_id" "uuid", - CONSTRAINT "sint_personal_interval_check" CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::"text", 'year'::"text"])))), - CONSTRAINT "sint_personal_status_check" CHECK (("status" = ANY (ARRAY['new'::"text", 'waiting_payment'::"text", 'paid'::"text", 'canceled'::"text"]))) -); - - -ALTER TABLE "public"."subscription_intents_personal" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."subscription_intents_tenant" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "user_id" "uuid" NOT NULL, - "created_by_user_id" "uuid", - "email" "text" NOT NULL, - "plan_id" "uuid" NOT NULL, - "plan_key" "text", - "interval" "text", - "amount_cents" integer, - "currency" "text", - "status" "text" DEFAULT 'new'::"text" NOT NULL, - "source" "text" DEFAULT 'manual'::"text" NOT NULL, - "notes" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "paid_at" timestamp with time zone, - "tenant_id" "uuid" NOT NULL, - "subscription_id" "uuid", - CONSTRAINT "sint_tenant_interval_check" CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::"text", 'year'::"text"])))), - CONSTRAINT "sint_tenant_status_check" CHECK (("status" = ANY (ARRAY['new'::"text", 'waiting_payment'::"text", 'paid'::"text", 'canceled'::"text"]))) -); - - -ALTER TABLE "public"."subscription_intents_tenant" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."subscription_intents" AS - SELECT "t"."id", - "t"."user_id", - "t"."created_by_user_id", - "t"."email", - "t"."plan_id", - "t"."plan_key", - "t"."interval", - "t"."amount_cents", - "t"."currency", - "t"."status", - "t"."source", - "t"."notes", - "t"."created_at", - "t"."paid_at", - "t"."tenant_id", - "t"."subscription_id", - 'clinic'::"text" AS "plan_target" - FROM "public"."subscription_intents_tenant" "t" -UNION ALL - SELECT "p"."id", - "p"."user_id", - "p"."created_by_user_id", - "p"."email", - "p"."plan_id", - "p"."plan_key", - "p"."interval", - "p"."amount_cents", - "p"."currency", - "p"."status", - "p"."source", - "p"."notes", - "p"."created_at", - "p"."paid_at", - NULL::"uuid" AS "tenant_id", - "p"."subscription_id", - 'therapist'::"text" AS "plan_target" - FROM "public"."subscription_intents_personal" "p"; - - -ALTER VIEW "public"."subscription_intents" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."subscription_intents_legacy" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "user_id" "uuid", - "email" "text", - "plan_key" "text" NOT NULL, - "interval" "text" NOT NULL, - "amount_cents" integer NOT NULL, - "currency" "text" DEFAULT 'BRL'::"text" NOT NULL, - "status" "text" DEFAULT 'new'::"text" NOT NULL, - "source" "text" DEFAULT 'landing'::"text" NOT NULL, - "notes" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "paid_at" timestamp with time zone, - "tenant_id" "uuid" NOT NULL, - "created_by_user_id" "uuid", - CONSTRAINT "subscription_intents_interval_check" CHECK (("interval" = ANY (ARRAY['month'::"text", 'year'::"text"]))), - CONSTRAINT "subscription_intents_status_check" CHECK (("status" = ANY (ARRAY['new'::"text", 'waiting_payment'::"text", 'paid'::"text", 'canceled'::"text"]))) -); - - -ALTER TABLE "public"."subscription_intents_legacy" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."tenant_feature_exceptions_log" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "feature_key" "text" NOT NULL, - "enabled" boolean NOT NULL, - "reason" "text", - "created_by" "uuid", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."tenant_feature_exceptions_log" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."tenant_features" ( - "tenant_id" "uuid" NOT NULL, - "feature_key" "text" NOT NULL, - "enabled" boolean DEFAULT false NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."tenant_features" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."tenant_invites" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "tenant_id" "uuid" NOT NULL, - "email" "text" NOT NULL, - "role" "text" NOT NULL, - "token" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "invited_by" "uuid", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "expires_at" timestamp with time zone DEFAULT ("now"() + '7 days'::interval) NOT NULL, - "accepted_at" timestamp with time zone, - "accepted_by" "uuid", - "revoked_at" timestamp with time zone, - "revoked_by" "uuid", - CONSTRAINT "tenant_invites_role_check" CHECK (("role" = ANY (ARRAY['therapist'::"text", 'secretary'::"text"]))) -); - - -ALTER TABLE "public"."tenant_invites" OWNER TO "supabase_admin"; - - -CREATE TABLE IF NOT EXISTS "public"."tenants" ( - "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, - "name" "text", - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "kind" "text" DEFAULT 'saas'::"text" NOT NULL, - CONSTRAINT "tenants_kind_check" CHECK (("kind" = ANY (ARRAY['therapist'::"text", 'clinic_coworking'::"text", 'clinic_reception'::"text", 'clinic_full'::"text", 'clinic'::"text", 'saas'::"text", 'supervisor'::"text"]))) -); - - -ALTER TABLE "public"."tenants" OWNER TO "supabase_admin"; - - -COMMENT ON COLUMN "public"."tenants"."kind" IS 'Tipo do tenant. Imutável após criação. therapist=terapeuta solo. clinic_coworking/clinic_reception/clinic_full=clínicas. clinic e saas são legados.'; - - - -CREATE TABLE IF NOT EXISTS "public"."user_settings" ( - "user_id" "uuid" NOT NULL, - "theme_mode" "text" DEFAULT 'dark'::"text" NOT NULL, - "preset" "text" DEFAULT 'Aura'::"text" NOT NULL, - "primary_color" "text" DEFAULT 'noir'::"text" NOT NULL, - "surface_color" "text" DEFAULT 'slate'::"text" NOT NULL, - "menu_mode" "text" DEFAULT 'static'::"text" NOT NULL, - "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, - "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL -); - - -ALTER TABLE "public"."user_settings" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_auth_users_public" AS - SELECT "id" AS "user_id", - "email", - "created_at", - "last_sign_in_at" - FROM "auth"."users" "u"; - - -ALTER VIEW "public"."v_auth_users_public" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_commitment_totals" AS - SELECT "c"."tenant_id", - "c"."id" AS "commitment_id", - (COALESCE("sum"("l"."minutes"), (0)::bigint))::integer AS "total_minutes" - FROM ("public"."determined_commitments" "c" - LEFT JOIN "public"."commitment_time_logs" "l" ON (("l"."commitment_id" = "c"."id"))) - GROUP BY "c"."tenant_id", "c"."id"; - - -ALTER VIEW "public"."v_commitment_totals" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_patient_groups_with_counts" AS - SELECT "pg"."id", - "pg"."nome", - "pg"."cor", - "pg"."owner_id", - "pg"."is_system", - "pg"."is_active", - "pg"."created_at", - "pg"."updated_at", - (COALESCE("count"("pgp"."patient_id"), (0)::bigint))::integer AS "patients_count" - FROM ("public"."patient_groups" "pg" - LEFT JOIN "public"."patient_group_patient" "pgp" ON (("pgp"."patient_group_id" = "pg"."id"))) - GROUP BY "pg"."id", "pg"."nome", "pg"."cor", "pg"."owner_id", "pg"."is_system", "pg"."is_active", "pg"."created_at", "pg"."updated_at"; - - -ALTER VIEW "public"."v_patient_groups_with_counts" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_plan_active_prices" AS - SELECT "plan_id", - "max"( - CASE - WHEN (("interval" = 'month'::"text") AND "is_active") THEN "amount_cents" - ELSE NULL::integer - END) AS "monthly_cents", - "max"( - CASE - WHEN (("interval" = 'year'::"text") AND "is_active") THEN "amount_cents" - ELSE NULL::integer - END) AS "yearly_cents", - "max"( - CASE - WHEN (("interval" = 'month'::"text") AND "is_active") THEN "currency" - ELSE NULL::"text" - END) AS "monthly_currency", - "max"( - CASE - WHEN (("interval" = 'year'::"text") AND "is_active") THEN "currency" - ELSE NULL::"text" - END) AS "yearly_currency" - FROM "public"."plan_prices" - GROUP BY "plan_id"; - - -ALTER VIEW "public"."v_plan_active_prices" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_public_pricing" AS - SELECT "p"."id" AS "plan_id", - "p"."key" AS "plan_key", - "p"."name" AS "plan_name", - COALESCE("pp"."public_name", ''::"text") AS "public_name", - COALESCE("pp"."public_description", ''::"text") AS "public_description", - "pp"."badge", - COALESCE("pp"."is_featured", false) AS "is_featured", - COALESCE("pp"."is_visible", true) AS "is_visible", - COALESCE("pp"."sort_order", 0) AS "sort_order", - "ap"."monthly_cents", - "ap"."yearly_cents", - "ap"."monthly_currency", - "ap"."yearly_currency", - COALESCE(( SELECT "jsonb_agg"("jsonb_build_object"('id', "b"."id", 'text', "b"."text", 'highlight', "b"."highlight", 'sort_order', "b"."sort_order") ORDER BY "b"."sort_order", "b"."created_at") AS "jsonb_agg" - FROM "public"."plan_public_bullets" "b" - WHERE ("b"."plan_id" = "p"."id")), '[]'::"jsonb") AS "bullets", - "p"."target" AS "plan_target" - FROM (("public"."plans" "p" - LEFT JOIN "public"."plan_public" "pp" ON (("pp"."plan_id" = "p"."id"))) - LEFT JOIN "public"."v_plan_active_prices" "ap" ON (("ap"."plan_id" = "p"."id"))) - ORDER BY COALESCE("pp"."sort_order", 0), "p"."key"; - - -ALTER VIEW "public"."v_public_pricing" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_subscription_feature_mismatch" AS - WITH "expected" AS ( - SELECT "s"."user_id" AS "owner_id", - "f"."key" AS "feature_key" - FROM (("public"."subscriptions" "s" - JOIN "public"."plan_features" "pf" ON ((("pf"."plan_id" = "s"."plan_id") AND ("pf"."enabled" = true)))) - JOIN "public"."features" "f" ON (("f"."id" = "pf"."feature_id"))) - WHERE (("s"."status" = 'active'::"text") AND ("s"."tenant_id" IS NULL) AND ("s"."user_id" IS NOT NULL)) - ), "actual" AS ( - SELECT "e"."owner_id", - "e"."feature_key" - FROM "public"."owner_feature_entitlements" "e" - ) - SELECT COALESCE("expected"."owner_id", "actual"."owner_id") AS "owner_id", - COALESCE("expected"."feature_key", "actual"."feature_key") AS "feature_key", - CASE - WHEN (("expected"."feature_key" IS NOT NULL) AND ("actual"."feature_key" IS NULL)) THEN 'missing_entitlement'::"text" - WHEN (("expected"."feature_key" IS NULL) AND ("actual"."feature_key" IS NOT NULL)) THEN 'unexpected_entitlement'::"text" - ELSE NULL::"text" - END AS "mismatch_type" - FROM ("expected" - FULL JOIN "actual" ON ((("expected"."owner_id" = "actual"."owner_id") AND ("expected"."feature_key" = "actual"."feature_key")))) - WHERE (("expected"."feature_key" IS NULL) OR ("actual"."feature_key" IS NULL)); - - -ALTER VIEW "public"."v_subscription_feature_mismatch" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_subscription_health" AS - SELECT "s"."id" AS "subscription_id", - "s"."user_id" AS "owner_id", - "s"."status", - "s"."plan_id", - "p"."key" AS "plan_key", - "s"."current_period_start", - "s"."current_period_end", - "s"."updated_at", - CASE - WHEN ("s"."plan_id" IS NULL) THEN 'missing_plan'::"text" - WHEN ("p"."id" IS NULL) THEN 'invalid_plan'::"text" - WHEN (("s"."status" = 'active'::"text") AND ("s"."current_period_end" IS NOT NULL) AND ("s"."current_period_end" < "now"())) THEN 'expired_but_active'::"text" - WHEN (("s"."status" = 'canceled'::"text") AND ("s"."current_period_end" > "now"())) THEN 'canceled_but_still_in_period'::"text" - ELSE 'ok'::"text" - END AS "health_status", - CASE - WHEN ("s"."tenant_id" IS NOT NULL) THEN 'clinic'::"text" - ELSE 'therapist'::"text" - END AS "owner_type", - COALESCE("s"."tenant_id", "s"."user_id") AS "owner_ref" - FROM ("public"."subscriptions" "s" - LEFT JOIN "public"."plans" "p" ON (("p"."id" = "s"."plan_id"))); - - -ALTER VIEW "public"."v_subscription_health" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_subscription_health_v2" AS - SELECT "s"."id" AS "subscription_id", - "s"."user_id" AS "owner_id", - CASE - WHEN ("s"."tenant_id" IS NOT NULL) THEN 'clinic'::"text" - ELSE 'therapist'::"text" - END AS "owner_type", - COALESCE("s"."tenant_id", "s"."user_id") AS "owner_ref", - "s"."status", - "s"."plan_id", - "p"."key" AS "plan_key", - "s"."current_period_start", - "s"."current_period_end", - "s"."updated_at", - CASE - WHEN ("s"."plan_id" IS NULL) THEN 'missing_plan'::"text" - WHEN ("p"."id" IS NULL) THEN 'invalid_plan'::"text" - WHEN (("s"."status" = 'active'::"text") AND ("s"."current_period_end" IS NOT NULL) AND ("s"."current_period_end" < "now"())) THEN 'expired_but_active'::"text" - WHEN (("s"."status" = 'canceled'::"text") AND ("s"."current_period_end" > "now"())) THEN 'canceled_but_still_in_period'::"text" - ELSE 'ok'::"text" - END AS "health_status" - FROM ("public"."subscriptions" "s" - LEFT JOIN "public"."plans" "p" ON (("p"."id" = "s"."plan_id"))); - - -ALTER VIEW "public"."v_subscription_health_v2" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tag_patient_counts" AS - SELECT "t"."id", - "t"."owner_id", - "t"."nome", - "t"."cor", - "t"."is_padrao", - "t"."created_at", - "t"."updated_at", - (COALESCE("count"("ppt"."patient_id"), (0)::bigint))::integer AS "pacientes_count", - (COALESCE("count"("ppt"."patient_id"), (0)::bigint))::integer AS "patient_count" - FROM ("public"."patient_tags" "t" - LEFT JOIN "public"."patient_patient_tag" "ppt" ON ((("ppt"."tag_id" = "t"."id") AND ("ppt"."owner_id" = "t"."owner_id")))) - GROUP BY "t"."id", "t"."owner_id", "t"."nome", "t"."cor", "t"."is_padrao", "t"."created_at", "t"."updated_at"; - - -ALTER VIEW "public"."v_tag_patient_counts" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_active_subscription" AS - SELECT DISTINCT ON ("tenant_id") "tenant_id", - "plan_id", - "plan_key", - "interval", - "status", - "current_period_start", - "current_period_end", - "created_at" - FROM "public"."subscriptions" "s" - WHERE (("tenant_id" IS NOT NULL) AND ("status" = 'active'::"text") AND (("current_period_end" IS NULL) OR ("current_period_end" > "now"()))) - ORDER BY "tenant_id", "created_at" DESC; - - -ALTER VIEW "public"."v_tenant_active_subscription" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_entitlements" AS - SELECT "a"."tenant_id", - "f"."key" AS "feature_key", - true AS "allowed" - FROM (("public"."v_tenant_active_subscription" "a" - JOIN "public"."plan_features" "pf" ON ((("pf"."plan_id" = "a"."plan_id") AND ("pf"."enabled" = true)))) - JOIN "public"."features" "f" ON (("f"."id" = "pf"."feature_id"))); - - -ALTER VIEW "public"."v_tenant_entitlements" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_entitlements_full" AS - SELECT "a"."tenant_id", - "f"."key" AS "feature_key", - ("pf"."enabled" = true) AS "allowed", - "pf"."limits", - "a"."plan_id", - "p"."key" AS "plan_key" - FROM ((("public"."v_tenant_active_subscription" "a" - JOIN "public"."plan_features" "pf" ON (("pf"."plan_id" = "a"."plan_id"))) - JOIN "public"."features" "f" ON (("f"."id" = "pf"."feature_id"))) - JOIN "public"."plans" "p" ON (("p"."id" = "a"."plan_id"))); - - -ALTER VIEW "public"."v_tenant_entitlements_full" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_entitlements_json" AS - SELECT "tenant_id", - "max"("plan_key") AS "plan_key", - "jsonb_object_agg"("feature_key", "jsonb_build_object"('allowed', "allowed", 'limits', COALESCE("limits", '{}'::"jsonb")) ORDER BY "feature_key") AS "entitlements" - FROM "public"."v_tenant_entitlements_full" - GROUP BY "tenant_id"; - - -ALTER VIEW "public"."v_tenant_entitlements_json" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_feature_exceptions" AS - SELECT "tf"."tenant_id", - "a"."plan_key", - "tf"."feature_key", - 'commercial_exception'::"text" AS "exception_type" - FROM (("public"."tenant_features" "tf" - JOIN "public"."v_tenant_active_subscription" "a" ON (("a"."tenant_id" = "tf"."tenant_id"))) - LEFT JOIN "public"."v_tenant_entitlements_full" "v" ON ((("v"."tenant_id" = "tf"."tenant_id") AND ("v"."feature_key" = "tf"."feature_key")))) - WHERE (("tf"."enabled" = true) AND (COALESCE("v"."allowed", false) = false)); - - -ALTER VIEW "public"."v_tenant_feature_exceptions" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_feature_mismatch" AS - WITH "plan_allowed" AS ( - SELECT "v"."tenant_id", - "v"."feature_key", - "v"."allowed" - FROM "public"."v_tenant_entitlements_full" "v" - ), "overrides" AS ( - SELECT "tf"."tenant_id", - "tf"."feature_key", - "tf"."enabled" - FROM "public"."tenant_features" "tf" - ) - SELECT "o"."tenant_id", - "o"."feature_key", - CASE - WHEN (("o"."enabled" = true) AND (COALESCE("p"."allowed", false) = false)) THEN 'unexpected_override'::"text" - ELSE NULL::"text" - END AS "mismatch_type" - FROM ("overrides" "o" - LEFT JOIN "plan_allowed" "p" ON ((("p"."tenant_id" = "o"."tenant_id") AND ("p"."feature_key" = "o"."feature_key")))) - WHERE (("o"."enabled" = true) AND (COALESCE("p"."allowed", false) = false)); - - -ALTER VIEW "public"."v_tenant_feature_mismatch" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_members_with_profiles" AS - SELECT "tm"."id" AS "tenant_member_id", - "tm"."tenant_id", - "tm"."user_id", - "tm"."role", - "tm"."status", - "tm"."created_at", - "p"."full_name", - "au"."email" - FROM (("public"."tenant_members" "tm" - LEFT JOIN "public"."profiles" "p" ON (("p"."id" = "tm"."user_id"))) - LEFT JOIN "auth"."users" "au" ON (("au"."id" = "tm"."user_id"))); - - -ALTER VIEW "public"."v_tenant_members_with_profiles" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_people" AS - SELECT 'member'::"text" AS "type", - "m"."tenant_id", - "m"."user_id", - "u"."email", - "m"."role", - "m"."status", - NULL::"uuid" AS "invite_token", - NULL::timestamp with time zone AS "expires_at" - FROM ("public"."tenant_members" "m" - JOIN "auth"."users" "u" ON (("u"."id" = "m"."user_id"))) -UNION ALL - SELECT 'invite'::"text" AS "type", - "i"."tenant_id", - NULL::"uuid" AS "user_id", - "i"."email", - "i"."role", - 'invited'::"text" AS "status", - "i"."token" AS "invite_token", - "i"."expires_at" - FROM "public"."tenant_invites" "i" - WHERE (("i"."accepted_at" IS NULL) AND ("i"."revoked_at" IS NULL)); - - -ALTER VIEW "public"."v_tenant_people" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_tenant_staff" AS - SELECT ('m_'::"text" || ("tm"."id")::"text") AS "row_id", - "tm"."tenant_id", - "tm"."user_id", - "tm"."role", - "tm"."status", - "tm"."created_at", - "p"."full_name", - "au"."email", - NULL::"uuid" AS "invite_token" - FROM (("public"."tenant_members" "tm" - LEFT JOIN "public"."profiles" "p" ON (("p"."id" = "tm"."user_id"))) - LEFT JOIN "auth"."users" "au" ON (("au"."id" = "tm"."user_id"))) -UNION ALL - SELECT ('i_'::"text" || ("ti"."id")::"text") AS "row_id", - "ti"."tenant_id", - NULL::"uuid" AS "user_id", - "ti"."role", - 'invited'::"text" AS "status", - "ti"."created_at", - NULL::"text" AS "full_name", - "ti"."email", - "ti"."token" AS "invite_token" - FROM "public"."tenant_invites" "ti" - WHERE (("ti"."accepted_at" IS NULL) AND ("ti"."revoked_at" IS NULL) AND ("ti"."expires_at" > "now"())); - - -ALTER VIEW "public"."v_tenant_staff" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_user_active_subscription" AS - SELECT DISTINCT ON ("user_id") "user_id", - "plan_id", - "plan_key", - "interval", - "status", - "current_period_start", - "current_period_end", - "created_at" - FROM "public"."subscriptions" "s" - WHERE (("tenant_id" IS NULL) AND ("user_id" IS NOT NULL) AND ("status" = 'active'::"text") AND (("current_period_end" IS NULL) OR ("current_period_end" > "now"()))) - ORDER BY "user_id", "created_at" DESC; - - -ALTER VIEW "public"."v_user_active_subscription" OWNER TO "supabase_admin"; - - -CREATE OR REPLACE VIEW "public"."v_user_entitlements" AS - SELECT "a"."user_id", - "f"."key" AS "feature_key", - true AS "allowed" - FROM (("public"."v_user_active_subscription" "a" - JOIN "public"."plan_features" "pf" ON ((("pf"."plan_id" = "a"."plan_id") AND ("pf"."enabled" = true)))) - JOIN "public"."features" "f" ON (("f"."id" = "pf"."feature_id"))); - - -ALTER VIEW "public"."v_user_entitlements" OWNER TO "supabase_admin"; - - -ALTER TABLE ONLY "public"."agenda_online_slots" ALTER COLUMN "id" SET DEFAULT "nextval"('"public"."agenda_online_slots_id_seq"'::"regclass"); - - - -ALTER TABLE ONLY "public"."agenda_bloqueios" - ADD CONSTRAINT "agenda_bloqueios_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agenda_configuracoes" - ADD CONSTRAINT "agenda_configuracoes_pkey" PRIMARY KEY ("owner_id"); - - - -ALTER TABLE ONLY "public"."agenda_eventos" - ADD CONSTRAINT "agenda_eventos_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agenda_eventos" - ADD CONSTRAINT "agenda_eventos_sem_sobreposicao" EXCLUDE USING "gist" ("owner_id" WITH =, "tstzrange"("inicio_em", "fim_em", '[)'::"text") WITH &&); - - - -ALTER TABLE ONLY "public"."agenda_excecoes" - ADD CONSTRAINT "agenda_excecoes_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agenda_online_slots" - ADD CONSTRAINT "agenda_online_slots_owner_id_weekday_time_key" UNIQUE ("owner_id", "weekday", "time"); - - - -ALTER TABLE ONLY "public"."agenda_online_slots" - ADD CONSTRAINT "agenda_online_slots_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agenda_regras_semanais" - ADD CONSTRAINT "agenda_regras_semanais_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agenda_regras_semanais" - ADD CONSTRAINT "agenda_regras_semanais_unique" UNIQUE ("owner_id", "dia_semana", "hora_inicio", "hora_fim", "modalidade"); - - - -ALTER TABLE ONLY "public"."agenda_slots_bloqueados_semanais" - ADD CONSTRAINT "agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key" UNIQUE ("owner_id", "dia_semana", "hora_inicio"); - - - -ALTER TABLE ONLY "public"."agenda_slots_bloqueados_semanais" - ADD CONSTRAINT "agenda_slots_bloqueados_semanais_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agenda_slots_regras" - ADD CONSTRAINT "agenda_slots_regras_owner_id_dia_semana_key" UNIQUE ("owner_id", "dia_semana"); - - - -ALTER TABLE ONLY "public"."agenda_slots_regras" - ADD CONSTRAINT "agenda_slots_regras_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."agendador_configuracoes" - ADD CONSTRAINT "agendador_configuracoes_pkey" PRIMARY KEY ("owner_id"); - - - -ALTER TABLE ONLY "public"."agendador_solicitacoes" - ADD CONSTRAINT "agendador_solicitacoes_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."commitment_time_logs" - ADD CONSTRAINT "commitment_time_logs_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."determined_commitment_fields" - ADD CONSTRAINT "determined_commitment_fields_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."determined_commitments" - ADD CONSTRAINT "determined_commitments_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."determined_commitments" - ADD CONSTRAINT "determined_commitments_tenant_native_key_uq" UNIQUE ("tenant_id", "native_key"); - - - -ALTER TABLE ONLY "public"."dev_user_credentials" - ADD CONSTRAINT "dev_user_credentials_email_key" UNIQUE ("email"); - - - -ALTER TABLE ONLY "public"."dev_user_credentials" - ADD CONSTRAINT "dev_user_credentials_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."entitlements_invalidation" - ADD CONSTRAINT "entitlements_invalidation_pkey" PRIMARY KEY ("owner_id"); - - - -ALTER TABLE ONLY "public"."features" - ADD CONSTRAINT "features_key_key" UNIQUE ("key"); - - - -ALTER TABLE ONLY "public"."features" - ADD CONSTRAINT "features_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."feriados" - ADD CONSTRAINT "feriados_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."feriados" - ADD CONSTRAINT "feriados_tenant_id_data_nome_key" UNIQUE ("tenant_id", "data", "nome"); - - - -ALTER TABLE ONLY "public"."module_features" - ADD CONSTRAINT "module_features_pkey" PRIMARY KEY ("module_id", "feature_id"); - - - -ALTER TABLE ONLY "public"."modules" - ADD CONSTRAINT "modules_key_key" UNIQUE ("key"); - - - -ALTER TABLE ONLY "public"."modules" - ADD CONSTRAINT "modules_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."owner_users" - ADD CONSTRAINT "owner_users_pkey" PRIMARY KEY ("owner_id", "user_id"); - - - -ALTER TABLE ONLY "public"."patient_group_patient" - ADD CONSTRAINT "patient_group_patient_pkey" PRIMARY KEY ("patient_group_id", "patient_id"); - - - -ALTER TABLE ONLY "public"."patient_groups" - ADD CONSTRAINT "patient_groups_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."patient_intake_requests" - ADD CONSTRAINT "patient_intake_requests_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."patient_invites" - ADD CONSTRAINT "patient_invites_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."patient_invites" - ADD CONSTRAINT "patient_invites_token_key" UNIQUE ("token"); - - - -ALTER TABLE ONLY "public"."patient_patient_tag" - ADD CONSTRAINT "patient_patient_tag_pkey" PRIMARY KEY ("patient_id", "tag_id"); - - - -ALTER TABLE ONLY "public"."patient_tags" - ADD CONSTRAINT "patient_tags_owner_name_uniq" UNIQUE ("owner_id", "nome"); - - - -ALTER TABLE ONLY "public"."patient_tags" - ADD CONSTRAINT "patient_tags_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."patients" - ADD CONSTRAINT "patients_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."plan_features" - ADD CONSTRAINT "plan_features_pkey" PRIMARY KEY ("plan_id", "feature_id"); - - - -ALTER TABLE ONLY "public"."plan_prices" - ADD CONSTRAINT "plan_prices_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."plan_public_bullets" - ADD CONSTRAINT "plan_public_bullets_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."plan_public" - ADD CONSTRAINT "plan_public_pkey" PRIMARY KEY ("plan_id"); - - - -ALTER TABLE ONLY "public"."plans" - ADD CONSTRAINT "plans_key_key" UNIQUE ("key"); - - - -ALTER TABLE ONLY "public"."plans" - ADD CONSTRAINT "plans_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."profiles" - ADD CONSTRAINT "profiles_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."recurrence_exceptions" - ADD CONSTRAINT "recurrence_exceptions_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."recurrence_exceptions" - ADD CONSTRAINT "recurrence_exceptions_unique" UNIQUE ("recurrence_id", "original_date"); - - - -ALTER TABLE ONLY "public"."recurrence_rules" - ADD CONSTRAINT "recurrence_rules_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."saas_admins" - ADD CONSTRAINT "saas_admins_pkey" PRIMARY KEY ("user_id"); - - - -ALTER TABLE ONLY "public"."saas_doc_votos" - ADD CONSTRAINT "saas_doc_votos_doc_id_user_id_key" UNIQUE ("doc_id", "user_id"); - - - -ALTER TABLE ONLY "public"."saas_doc_votos" - ADD CONSTRAINT "saas_doc_votos_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."saas_docs" - ADD CONSTRAINT "saas_docs_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."saas_faq_itens" - ADD CONSTRAINT "saas_faq_itens_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."saas_faq" - ADD CONSTRAINT "saas_faq_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."subscription_events" - ADD CONSTRAINT "subscription_events_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."subscription_intents_personal" - ADD CONSTRAINT "subscription_intents_personal_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."subscription_intents_legacy" - ADD CONSTRAINT "subscription_intents_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."subscription_intents_tenant" - ADD CONSTRAINT "subscription_intents_tenant_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."subscriptions" - ADD CONSTRAINT "subscriptions_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."tenant_feature_exceptions_log" - ADD CONSTRAINT "tenant_feature_exceptions_log_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."tenant_features" - ADD CONSTRAINT "tenant_features_pkey" PRIMARY KEY ("tenant_id", "feature_key"); - - - -ALTER TABLE ONLY "public"."tenant_invites" - ADD CONSTRAINT "tenant_invites_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."tenant_members" - ADD CONSTRAINT "tenant_members_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."tenant_members" - ADD CONSTRAINT "tenant_members_tenant_id_user_id_key" UNIQUE ("tenant_id", "user_id"); - - - -ALTER TABLE ONLY "public"."tenant_modules" - ADD CONSTRAINT "tenant_modules_owner_id_module_id_key" UNIQUE ("owner_id", "module_id"); - - - -ALTER TABLE ONLY "public"."tenant_modules" - ADD CONSTRAINT "tenant_modules_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."tenants" - ADD CONSTRAINT "tenants_pkey" PRIMARY KEY ("id"); - - - -ALTER TABLE ONLY "public"."user_settings" - ADD CONSTRAINT "user_settings_pkey" PRIMARY KEY ("user_id"); - - - -CREATE INDEX "agenda_bloqueios_owner_data_idx" ON "public"."agenda_bloqueios" USING "btree" ("owner_id", "data_inicio", "data_fim"); - - - -CREATE INDEX "agenda_bloqueios_owner_id_idx" ON "public"."agenda_bloqueios" USING "btree" ("owner_id"); - - - -CREATE INDEX "agenda_bloqueios_recorrente_idx" ON "public"."agenda_bloqueios" USING "btree" ("owner_id", "dia_semana") WHERE ("recorrente" = true); - - - -CREATE INDEX "agenda_bloqueios_tenant_id_idx" ON "public"."agenda_bloqueios" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_configuracoes_tenant_idx" ON "public"."agenda_configuracoes" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_configuracoes_tenant_owner_idx" ON "public"."agenda_configuracoes" USING "btree" ("tenant_id", "owner_id"); - - - -CREATE INDEX "agenda_eventos_owner_inicio_idx" ON "public"."agenda_eventos" USING "btree" ("owner_id", "inicio_em"); - - - -CREATE INDEX "agenda_eventos_owner_paciente_idx" ON "public"."agenda_eventos" USING "btree" ("owner_id", "paciente_id"); - - - -CREATE INDEX "agenda_eventos_owner_terapeuta_inicio_idx" ON "public"."agenda_eventos" USING "btree" ("owner_id", "terapeuta_id", "inicio_em"); - - - -CREATE INDEX "agenda_eventos_recurrence_idx" ON "public"."agenda_eventos" USING "btree" ("recurrence_id") WHERE ("recurrence_id" IS NOT NULL); - - - -CREATE INDEX "agenda_eventos_tenant_inicio_idx" ON "public"."agenda_eventos" USING "btree" ("tenant_id", "inicio_em"); - - - -CREATE INDEX "agenda_eventos_tenant_owner_inicio_idx" ON "public"."agenda_eventos" USING "btree" ("tenant_id", "owner_id", "inicio_em"); - - - -CREATE INDEX "agenda_excecoes_owner_data_idx" ON "public"."agenda_excecoes" USING "btree" ("owner_id", "data"); - - - -CREATE INDEX "agenda_excecoes_tenant_idx" ON "public"."agenda_excecoes" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_excecoes_tenant_owner_idx" ON "public"."agenda_excecoes" USING "btree" ("tenant_id", "owner_id"); - - - -CREATE INDEX "agenda_online_slots_owner_weekday_idx" ON "public"."agenda_online_slots" USING "btree" ("owner_id", "weekday"); - - - -CREATE INDEX "agenda_online_slots_tenant_idx" ON "public"."agenda_online_slots" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_online_slots_tenant_owner_idx" ON "public"."agenda_online_slots" USING "btree" ("tenant_id", "owner_id"); - - - -CREATE INDEX "agenda_regras_semanais_owner_dia_idx" ON "public"."agenda_regras_semanais" USING "btree" ("owner_id", "dia_semana"); - - - -CREATE INDEX "agenda_regras_semanais_tenant_idx" ON "public"."agenda_regras_semanais" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_regras_semanais_tenant_owner_idx" ON "public"."agenda_regras_semanais" USING "btree" ("tenant_id", "owner_id"); - - - -CREATE INDEX "agenda_slots_bloqueados_semanais_tenant_idx" ON "public"."agenda_slots_bloqueados_semanais" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_slots_bloqueados_semanais_tenant_owner_idx" ON "public"."agenda_slots_bloqueados_semanais" USING "btree" ("tenant_id", "owner_id"); - - - -CREATE INDEX "agenda_slots_regras_tenant_idx" ON "public"."agenda_slots_regras" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agenda_slots_regras_tenant_owner_idx" ON "public"."agenda_slots_regras" USING "btree" ("tenant_id", "owner_id"); - - - -CREATE INDEX "agendador_cfg_tenant_idx" ON "public"."agendador_configuracoes" USING "btree" ("tenant_id"); - - - -CREATE INDEX "agendador_sol_data_idx" ON "public"."agendador_solicitacoes" USING "btree" ("data_solicitada", "hora_solicitada"); - - - -CREATE INDEX "agendador_sol_owner_idx" ON "public"."agendador_solicitacoes" USING "btree" ("owner_id", "status"); - - - -CREATE INDEX "agendador_sol_tenant_idx" ON "public"."agendador_solicitacoes" USING "btree" ("tenant_id"); - - - -CREATE INDEX "commitment_time_logs_calendar_event_idx" ON "public"."commitment_time_logs" USING "btree" ("calendar_event_id"); - - - -CREATE INDEX "commitment_time_logs_commitment_idx" ON "public"."commitment_time_logs" USING "btree" ("commitment_id", "created_at" DESC); - - - -CREATE INDEX "commitment_time_logs_tenant_idx" ON "public"."commitment_time_logs" USING "btree" ("tenant_id", "created_at" DESC); - - - -CREATE INDEX "determined_commitment_fields_commitment_idx" ON "public"."determined_commitment_fields" USING "btree" ("commitment_id", "sort_order"); - - - -CREATE UNIQUE INDEX "determined_commitment_fields_key_uniq" ON "public"."determined_commitment_fields" USING "btree" ("commitment_id", "key"); - - - -CREATE INDEX "determined_commitment_fields_tenant_idx" ON "public"."determined_commitment_fields" USING "btree" ("tenant_id"); - - - -CREATE INDEX "determined_commitments_active_idx" ON "public"."determined_commitments" USING "btree" ("tenant_id", "active"); - - - -CREATE INDEX "determined_commitments_tenant_idx" ON "public"."determined_commitments" USING "btree" ("tenant_id"); - - - -CREATE UNIQUE INDEX "determined_commitments_tenant_name_uniq" ON "public"."determined_commitments" USING "btree" ("tenant_id", "lower"("name")); - - - -CREATE UNIQUE INDEX "feriados_global_unique" ON "public"."feriados" USING "btree" ("data", "nome") WHERE ("tenant_id" IS NULL); - - - -CREATE INDEX "idx_agenda_eventos_determined_commitment_id" ON "public"."agenda_eventos" USING "btree" ("determined_commitment_id"); - - - -CREATE INDEX "idx_agenda_excecoes_owner_data" ON "public"."agenda_excecoes" USING "btree" ("owner_id", "data"); - - - -CREATE INDEX "idx_agenda_slots_regras_owner_dia" ON "public"."agenda_slots_regras" USING "btree" ("owner_id", "dia_semana"); - - - -CREATE INDEX "idx_intakes_converted_patient_id" ON "public"."patient_intake_requests" USING "btree" ("converted_patient_id"); - - - -CREATE INDEX "idx_intakes_owner_cpf" ON "public"."patient_intake_requests" USING "btree" ("owner_id", "cpf"); - - - -CREATE INDEX "idx_intakes_owner_created" ON "public"."patient_intake_requests" USING "btree" ("owner_id", "created_at" DESC); - - - -CREATE INDEX "idx_intakes_owner_status_created" ON "public"."patient_intake_requests" USING "btree" ("owner_id", "status", "created_at" DESC); - - - -CREATE INDEX "idx_intakes_status_created" ON "public"."patient_intake_requests" USING "btree" ("status", "created_at" DESC); - - - -CREATE INDEX "idx_patient_group_patient_group_id" ON "public"."patient_group_patient" USING "btree" ("patient_group_id"); - - - -CREATE INDEX "idx_patient_groups_owner" ON "public"."patient_groups" USING "btree" ("owner_id"); - - - -CREATE INDEX "idx_patient_groups_owner_system_nome" ON "public"."patient_groups" USING "btree" ("owner_id", "is_system", "nome"); - - - -CREATE INDEX "idx_patient_tags_owner" ON "public"."patient_tags" USING "btree" ("owner_id"); - - - -CREATE INDEX "idx_patients_created_at" ON "public"."patients" USING "btree" ("created_at" DESC); - - - -CREATE INDEX "idx_patients_last_attended" ON "public"."patients" USING "btree" ("last_attended_at" DESC); - - - -CREATE INDEX "idx_patients_owner_email_principal" ON "public"."patients" USING "btree" ("owner_id", "email_principal"); - - - -CREATE INDEX "idx_patients_owner_id" ON "public"."patients" USING "btree" ("owner_id"); - - - -CREATE INDEX "idx_patients_owner_nome" ON "public"."patients" USING "btree" ("owner_id", "nome_completo"); - - - -CREATE INDEX "idx_patients_responsible_member" ON "public"."patients" USING "btree" ("responsible_member_id"); - - - -CREATE INDEX "idx_patients_status" ON "public"."patients" USING "btree" ("status"); - - - -CREATE INDEX "idx_patients_tenant" ON "public"."patients" USING "btree" ("tenant_id"); - - - -CREATE INDEX "idx_patients_tenant_email_norm" ON "public"."patients" USING "btree" ("tenant_id", "lower"(TRIM(BOTH FROM "email_principal"))); - - - -CREATE INDEX "idx_pgp_group" ON "public"."patient_group_patient" USING "btree" ("patient_group_id"); - - - -CREATE INDEX "idx_pgp_patient" ON "public"."patient_group_patient" USING "btree" ("patient_id"); - - - -CREATE INDEX "idx_ppt_patient" ON "public"."patient_patient_tag" USING "btree" ("patient_id"); - - - -CREATE INDEX "idx_ppt_tag" ON "public"."patient_patient_tag" USING "btree" ("tag_id"); - - - -CREATE INDEX "idx_slots_bloq_owner_dia" ON "public"."agenda_slots_bloqueados_semanais" USING "btree" ("owner_id", "dia_semana"); - - - -CREATE INDEX "idx_subscription_intents_plan_interval" ON "public"."subscription_intents_legacy" USING "btree" ("plan_key", "interval"); - - - -CREATE INDEX "idx_subscription_intents_status" ON "public"."subscription_intents_legacy" USING "btree" ("status"); - - - -CREATE INDEX "idx_subscription_intents_user_id" ON "public"."subscription_intents_legacy" USING "btree" ("user_id"); - - - -CREATE INDEX "idx_tenant_features_tenant" ON "public"."tenant_features" USING "btree" ("tenant_id"); - - - -CREATE INDEX "idx_tenant_invites_tenant" ON "public"."tenant_invites" USING "btree" ("tenant_id"); - - - -CREATE INDEX "idx_tenant_invites_token" ON "public"."tenant_invites" USING "btree" ("token"); - - - -CREATE INDEX "ix_plan_prices_plan" ON "public"."plan_prices" USING "btree" ("plan_id"); - - - -CREATE INDEX "ix_plan_public_bullets_plan" ON "public"."plan_public_bullets" USING "btree" ("plan_id"); - - - -CREATE INDEX "ix_plan_public_sort" ON "public"."plan_public" USING "btree" ("sort_order"); - - - -CREATE INDEX "patient_group_patient_tenant_idx" ON "public"."patient_group_patient" USING "btree" ("tenant_id"); - - - -CREATE UNIQUE INDEX "patient_groups_owner_nome_uniq" ON "public"."patient_groups" USING "btree" ("owner_id", "nome"); - - - -CREATE INDEX "patient_groups_tenant_idx" ON "public"."patient_groups" USING "btree" ("tenant_id"); - - - -CREATE INDEX "patient_intake_owner_id_idx" ON "public"."patient_intake_requests" USING "btree" ("owner_id"); - - - -CREATE INDEX "patient_intake_requests_tenant_idx" ON "public"."patient_intake_requests" USING "btree" ("tenant_id"); - - - -CREATE INDEX "patient_intake_status_idx" ON "public"."patient_intake_requests" USING "btree" ("status"); - - - -CREATE INDEX "patient_intake_token_idx" ON "public"."patient_intake_requests" USING "btree" ("token"); - - - -CREATE UNIQUE INDEX "patient_invites_one_active_per_owner" ON "public"."patient_invites" USING "btree" ("owner_id") WHERE ("active" = true); - - - -CREATE INDEX "patient_invites_owner_id_idx" ON "public"."patient_invites" USING "btree" ("owner_id"); - - - -CREATE INDEX "patient_invites_tenant_idx" ON "public"."patient_invites" USING "btree" ("tenant_id"); - - - -CREATE INDEX "patient_invites_token_idx" ON "public"."patient_invites" USING "btree" ("token"); - - - -CREATE INDEX "patient_patient_tag_tenant_idx" ON "public"."patient_patient_tag" USING "btree" ("tenant_id"); - - - -CREATE UNIQUE INDEX "patient_tags_owner_name_uq" ON "public"."patient_tags" USING "btree" ("owner_id", "lower"("nome")); - - - -CREATE INDEX "patient_tags_tenant_idx" ON "public"."patient_tags" USING "btree" ("tenant_id"); - - - -CREATE INDEX "ppt_owner_idx" ON "public"."patient_patient_tag" USING "btree" ("owner_id"); - - - -CREATE INDEX "ppt_patient_idx" ON "public"."patient_patient_tag" USING "btree" ("patient_id"); - - - -CREATE INDEX "ppt_tag_idx" ON "public"."patient_patient_tag" USING "btree" ("tag_id"); - - - -CREATE INDEX "recurrence_exceptions_rule_idx" ON "public"."recurrence_exceptions" USING "btree" ("recurrence_id"); - - - -CREATE INDEX "recurrence_exceptions_tenant_idx" ON "public"."recurrence_exceptions" USING "btree" ("tenant_id"); - - - -CREATE INDEX "recurrence_rules_active_idx" ON "public"."recurrence_rules" USING "btree" ("owner_id", "status") WHERE ("status" = 'ativo'::"text"); - - - -CREATE INDEX "recurrence_rules_owner_idx" ON "public"."recurrence_rules" USING "btree" ("owner_id"); - - - -CREATE INDEX "recurrence_rules_patient_idx" ON "public"."recurrence_rules" USING "btree" ("patient_id"); - - - -CREATE INDEX "recurrence_rules_tenant_idx" ON "public"."recurrence_rules" USING "btree" ("tenant_id"); - - - -CREATE INDEX "saas_doc_votos_doc_id_idx" ON "public"."saas_doc_votos" USING "btree" ("doc_id"); - - - -CREATE INDEX "saas_doc_votos_user_id_idx" ON "public"."saas_doc_votos" USING "btree" ("user_id"); - - - -CREATE INDEX "saas_docs_categoria_idx" ON "public"."saas_docs" USING "btree" ("categoria"); - - - -CREATE INDEX "saas_docs_exibir_no_faq_idx" ON "public"."saas_docs" USING "btree" ("exibir_no_faq") WHERE ("exibir_no_faq" = true); - - - -CREATE INDEX "saas_docs_path_ativo_idx" ON "public"."saas_docs" USING "btree" ("pagina_path", "ativo"); - - - -CREATE INDEX "saas_faq_ativo_idx" ON "public"."saas_faq" USING "btree" ("ativo"); - - - -CREATE INDEX "saas_faq_categoria_idx" ON "public"."saas_faq" USING "btree" ("categoria"); - - - -CREATE INDEX "saas_faq_fts_idx" ON "public"."saas_faq" USING "gin" ("to_tsvector"('"portuguese"'::"regconfig", ((COALESCE("pergunta", ''::"text") || ' '::"text") || COALESCE("conteudo", ''::"text")))); - - - -CREATE INDEX "saas_faq_itens_ativo_idx" ON "public"."saas_faq_itens" USING "btree" ("ativo"); - - - -CREATE INDEX "saas_faq_itens_doc_id_idx" ON "public"."saas_faq_itens" USING "btree" ("doc_id"); - - - -CREATE INDEX "saas_faq_pagina_path_idx" ON "public"."saas_faq" USING "btree" ("pagina_path"); - - - -CREATE INDEX "saas_faq_publico_idx" ON "public"."saas_faq" USING "btree" ("publico"); - - - -CREATE INDEX "saas_faq_votos_idx" ON "public"."saas_faq" USING "btree" ("votos" DESC); - - - -CREATE INDEX "sint_personal_created_idx" ON "public"."subscription_intents_personal" USING "btree" ("created_at" DESC); - - - -CREATE INDEX "sint_personal_status_idx" ON "public"."subscription_intents_personal" USING "btree" ("status"); - - - -CREATE INDEX "sint_tenant_created_idx" ON "public"."subscription_intents_tenant" USING "btree" ("created_at" DESC); - - - -CREATE INDEX "sint_tenant_status_idx" ON "public"."subscription_intents_tenant" USING "btree" ("status"); - - - -CREATE INDEX "sint_tenant_tenant_idx" ON "public"."subscription_intents_tenant" USING "btree" ("tenant_id"); - - - -CREATE INDEX "subscription_events_created_at_idx" ON "public"."subscription_events" USING "btree" ("created_at" DESC); - - - -CREATE INDEX "subscription_events_owner_ref_idx" ON "public"."subscription_events" USING "btree" ("owner_type", "owner_ref"); - - - -CREATE INDEX "subscription_events_sub_created_idx" ON "public"."subscription_events" USING "btree" ("subscription_id", "created_at" DESC); - - - -CREATE INDEX "subscription_events_subscription_id_idx" ON "public"."subscription_events" USING "btree" ("subscription_id"); - - - -CREATE UNIQUE INDEX "subscriptions_one_active_per_tenant" ON "public"."subscriptions" USING "btree" ("tenant_id") WHERE ("status" = 'active'::"text"); - - - -CREATE UNIQUE INDEX "subscriptions_one_active_per_user" ON "public"."subscriptions" USING "btree" ("user_id") WHERE ("status" = 'active'::"text"); - - - -CREATE UNIQUE INDEX "subscriptions_one_active_per_user_personal" ON "public"."subscriptions" USING "btree" ("user_id") WHERE (("tenant_id" IS NULL) AND ("status" = 'active'::"text")); - - - -CREATE INDEX "subscriptions_owner_idx" ON "public"."subscriptions" USING "btree" ("user_id"); - - - -CREATE INDEX "subscriptions_plan_key_idx" ON "public"."subscriptions" USING "btree" ("plan_key"); - - - -CREATE INDEX "subscriptions_status_idx" ON "public"."subscriptions" USING "btree" ("status"); - - - -CREATE INDEX "subscriptions_tenant_id_idx" ON "public"."subscriptions" USING "btree" ("tenant_id"); - - - -CREATE INDEX "subscriptions_tenant_period_end_idx" ON "public"."subscriptions" USING "btree" ("tenant_id", "current_period_end"); - - - -CREATE INDEX "subscriptions_tenant_status_idx" ON "public"."subscriptions" USING "btree" ("tenant_id", "status"); - - - -CREATE INDEX "subscriptions_user_status_idx" ON "public"."subscriptions" USING "btree" ("user_id", "status", "created_at" DESC); - - - -CREATE INDEX "tenant_members_tenant_idx" ON "public"."tenant_members" USING "btree" ("tenant_id"); - - - -CREATE INDEX "tenant_members_user_idx" ON "public"."tenant_members" USING "btree" ("user_id"); - - - -CREATE INDEX "tenant_modules_owner_idx" ON "public"."tenant_modules" USING "btree" ("owner_id"); - - - -CREATE UNIQUE INDEX "unique_member_per_tenant" ON "public"."tenant_members" USING "btree" ("tenant_id", "user_id"); - - - -CREATE UNIQUE INDEX "uq_patients_tenant_user" ON "public"."patients" USING "btree" ("tenant_id", "user_id") WHERE ("user_id" IS NOT NULL); - - - -CREATE UNIQUE INDEX "uq_plan_price_active" ON "public"."plan_prices" USING "btree" ("plan_id", "interval", "currency") WHERE (("is_active" = true) AND ("active_to" IS NULL)); - - - -CREATE UNIQUE INDEX "uq_plan_prices_active" ON "public"."plan_prices" USING "btree" ("plan_id", "interval") WHERE ("is_active" = true); - - - -CREATE UNIQUE INDEX "uq_subscriptions_active_by_tenant" ON "public"."subscriptions" USING "btree" ("tenant_id") WHERE (("tenant_id" IS NOT NULL) AND ("status" = 'active'::"text")); - - - -CREATE UNIQUE INDEX "uq_subscriptions_active_personal_by_user" ON "public"."subscriptions" USING "btree" ("user_id") WHERE (("tenant_id" IS NULL) AND ("status" = 'active'::"text")); - - - -CREATE UNIQUE INDEX "uq_tenant_invites_pending" ON "public"."tenant_invites" USING "btree" ("tenant_id", "lower"("email"), "role") WHERE (("accepted_at" IS NULL) AND ("revoked_at" IS NULL)); - - - -CREATE UNIQUE INDEX "uq_tenant_members_tenant_user" ON "public"."tenant_members" USING "btree" ("tenant_id", "user_id"); - - - -CREATE UNIQUE INDEX "ux_subscriptions_active_per_personal_user" ON "public"."subscriptions" USING "btree" ("user_id") WHERE (("status" = 'active'::"text") AND ("tenant_id" IS NULL)); - - - -CREATE UNIQUE INDEX "ux_subscriptions_active_per_tenant" ON "public"."subscriptions" USING "btree" ("tenant_id") WHERE (("status" = 'active'::"text") AND ("tenant_id" IS NOT NULL)); - - - -CREATE OR REPLACE TRIGGER "agenda_bloqueios_updated_at" BEFORE UPDATE ON "public"."agenda_bloqueios" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "agendador_slug_trigger" BEFORE INSERT OR UPDATE ON "public"."agendador_configuracoes" FOR EACH ROW EXECUTE FUNCTION "public"."agendador_gerar_slug"(); - - - -CREATE OR REPLACE TRIGGER "prevent_saas_membership_trigger" BEFORE INSERT ON "public"."tenant_members" FOR EACH ROW EXECUTE FUNCTION "public"."prevent_saas_membership"(); - - - -CREATE OR REPLACE TRIGGER "tg_agenda_configuracoes_updated_at" BEFORE UPDATE ON "public"."agenda_configuracoes" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "tg_agenda_eventos_updated_at" BEFORE UPDATE ON "public"."agenda_eventos" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "tg_agenda_excecoes_updated_at" BEFORE UPDATE ON "public"."agenda_excecoes" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "tg_agenda_regras_semanais_updated_at" BEFORE UPDATE ON "public"."agenda_regras_semanais" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "tg_recurrence_rules_updated_at" BEFORE UPDATE ON "public"."recurrence_rules" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at_recurrence"(); - - - -CREATE OR REPLACE TRIGGER "tr_plan_public_updated_at" BEFORE UPDATE ON "public"."plan_public" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_account_type_immutable" BEFORE UPDATE OF "account_type" ON "public"."profiles" FOR EACH ROW EXECUTE FUNCTION "public"."guard_account_type_immutable"(); - - - -CREATE OR REPLACE TRIGGER "trg_agenda_cfg_sync" BEFORE INSERT OR UPDATE ON "public"."agenda_configuracoes" FOR EACH ROW EXECUTE FUNCTION "public"."agenda_cfg_sync"(); - - - -CREATE OR REPLACE TRIGGER "trg_agenda_eventos_busy_mirror_del" AFTER DELETE ON "public"."agenda_eventos" FOR EACH ROW WHEN ((("old"."mirror_of_event_id" IS NULL) AND ("old"."tenant_id" = "old"."owner_id"))) EXECUTE FUNCTION "public"."sync_busy_mirror_agenda_eventos"(); - - - -CREATE OR REPLACE TRIGGER "trg_agenda_eventos_busy_mirror_ins" AFTER INSERT ON "public"."agenda_eventos" FOR EACH ROW WHEN ((("new"."mirror_of_event_id" IS NULL) AND ("new"."tenant_id" = "new"."owner_id") AND ("new"."visibility_scope" = ANY (ARRAY['busy_only'::"text", 'private'::"text"])))) EXECUTE FUNCTION "public"."sync_busy_mirror_agenda_eventos"(); - - - -CREATE OR REPLACE TRIGGER "trg_agenda_eventos_busy_mirror_upd" AFTER UPDATE ON "public"."agenda_eventos" FOR EACH ROW WHEN ((("new"."mirror_of_event_id" IS NULL) AND ("new"."tenant_id" = "new"."owner_id") AND (("new"."visibility_scope" IS DISTINCT FROM "old"."visibility_scope") OR ("new"."inicio_em" IS DISTINCT FROM "old"."inicio_em") OR ("new"."fim_em" IS DISTINCT FROM "old"."fim_em") OR ("new"."owner_id" IS DISTINCT FROM "old"."owner_id") OR ("new"."tenant_id" IS DISTINCT FROM "old"."tenant_id")))) EXECUTE FUNCTION "public"."sync_busy_mirror_agenda_eventos"(); - - - -CREATE OR REPLACE TRIGGER "trg_agenda_regras_semanais_no_overlap" BEFORE INSERT OR UPDATE ON "public"."agenda_regras_semanais" FOR EACH ROW EXECUTE FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"(); - - - -CREATE OR REPLACE TRIGGER "trg_determined_commitment_fields_updated_at" BEFORE UPDATE ON "public"."determined_commitment_fields" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_determined_commitments_updated_at" BEFORE UPDATE ON "public"."determined_commitments" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_no_change_core_plan_key" BEFORE UPDATE ON "public"."plans" FOR EACH ROW EXECUTE FUNCTION "public"."guard_no_change_core_plan_key"(); - - - -CREATE OR REPLACE TRIGGER "trg_no_change_plan_target" BEFORE UPDATE ON "public"."plans" FOR EACH ROW EXECUTE FUNCTION "public"."guard_no_change_plan_target"(); - - - -CREATE OR REPLACE TRIGGER "trg_no_delete_core_plans" BEFORE DELETE ON "public"."plans" FOR EACH ROW EXECUTE FUNCTION "public"."guard_no_delete_core_plans"(); - - - -CREATE OR REPLACE TRIGGER "trg_patient_cannot_own_tenant" BEFORE INSERT OR UPDATE ON "public"."tenant_members" FOR EACH ROW EXECUTE FUNCTION "public"."guard_patient_cannot_own_tenant"(); - - - -CREATE OR REPLACE TRIGGER "trg_patient_groups_set_updated_at" BEFORE UPDATE ON "public"."patient_groups" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_patient_intake_requests_updated_at" BEFORE UPDATE ON "public"."patient_intake_requests" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_patient_tags_set_updated_at" BEFORE UPDATE ON "public"."patient_tags" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_patients_updated_at" BEFORE UPDATE ON "public"."patients" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_patients_validate_members" BEFORE INSERT OR UPDATE OF "tenant_id", "responsible_member_id", "patient_scope", "therapist_member_id" ON "public"."patients" FOR EACH ROW EXECUTE FUNCTION "public"."patients_validate_member_consistency"(); - - - -CREATE OR REPLACE TRIGGER "trg_prevent_promoting_to_system" BEFORE UPDATE ON "public"."patient_groups" FOR EACH ROW EXECUTE FUNCTION "public"."prevent_promoting_to_system"(); - - - -CREATE OR REPLACE TRIGGER "trg_prevent_system_group_changes" BEFORE DELETE OR UPDATE ON "public"."patient_groups" FOR EACH ROW EXECUTE FUNCTION "public"."prevent_system_group_changes"(); - - - -CREATE OR REPLACE TRIGGER "trg_profiles_updated_at" BEFORE UPDATE ON "public"."profiles" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_subscription_intents_view_insert" INSTEAD OF INSERT ON "public"."subscription_intents" FOR EACH ROW EXECUTE FUNCTION "public"."subscription_intents_view_insert"(); - - - -CREATE OR REPLACE TRIGGER "trg_subscriptions_validate_scope" BEFORE INSERT OR UPDATE ON "public"."subscriptions" FOR EACH ROW EXECUTE FUNCTION "public"."subscriptions_validate_scope"(); - - - -CREATE OR REPLACE TRIGGER "trg_tenant_features_guard_with_plan" BEFORE INSERT OR UPDATE ON "public"."tenant_features" FOR EACH ROW EXECUTE FUNCTION "public"."tenant_features_guard_with_plan"(); - - - -CREATE OR REPLACE TRIGGER "trg_tenant_features_updated_at" BEFORE UPDATE ON "public"."tenant_features" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -CREATE OR REPLACE TRIGGER "trg_tenant_kind_immutable" BEFORE UPDATE OF "kind" ON "public"."tenants" FOR EACH ROW EXECUTE FUNCTION "public"."guard_tenant_kind_immutable"(); - - - -CREATE OR REPLACE TRIGGER "trg_user_settings_updated_at" BEFORE UPDATE ON "public"."user_settings" FOR EACH ROW EXECUTE FUNCTION "public"."set_updated_at"(); - - - -ALTER TABLE ONLY "public"."agenda_bloqueios" - ADD CONSTRAINT "agenda_bloqueios_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_bloqueios" - ADD CONSTRAINT "agenda_bloqueios_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."agenda_configuracoes" - ADD CONSTRAINT "agenda_configuracoes_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_eventos" - ADD CONSTRAINT "agenda_eventos_determined_commitment_fk" FOREIGN KEY ("determined_commitment_id") REFERENCES "public"."determined_commitments"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."agenda_eventos" - ADD CONSTRAINT "agenda_eventos_patient_id_fkey" FOREIGN KEY ("patient_id") REFERENCES "public"."patients"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."agenda_eventos" - ADD CONSTRAINT "agenda_eventos_recurrence_id_fkey" FOREIGN KEY ("recurrence_id") REFERENCES "public"."recurrence_rules"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."agenda_eventos" - ADD CONSTRAINT "agenda_eventos_terapeuta_fk" FOREIGN KEY ("terapeuta_id") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."agenda_excecoes" - ADD CONSTRAINT "agenda_excecoes_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_online_slots" - ADD CONSTRAINT "agenda_online_slots_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_online_slots" - ADD CONSTRAINT "agenda_online_slots_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_regras_semanais" - ADD CONSTRAINT "agenda_regras_semanais_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_slots_bloqueados_semanais" - ADD CONSTRAINT "agenda_slots_bloqueados_semanais_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agenda_slots_regras" - ADD CONSTRAINT "agenda_slots_regras_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agendador_configuracoes" - ADD CONSTRAINT "agendador_configuracoes_owner_fk" FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agendador_configuracoes" - ADD CONSTRAINT "agendador_configuracoes_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agendador_solicitacoes" - ADD CONSTRAINT "agendador_sol_owner_fk" FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."agendador_solicitacoes" - ADD CONSTRAINT "agendador_sol_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."commitment_time_logs" - ADD CONSTRAINT "commitment_time_logs_calendar_event_id_fkey" FOREIGN KEY ("calendar_event_id") REFERENCES "public"."agenda_eventos"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."commitment_time_logs" - ADD CONSTRAINT "commitment_time_logs_commitment_id_fkey" FOREIGN KEY ("commitment_id") REFERENCES "public"."determined_commitments"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."commitment_time_logs" - ADD CONSTRAINT "commitment_time_logs_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."determined_commitment_fields" - ADD CONSTRAINT "determined_commitment_fields_commitment_id_fkey" FOREIGN KEY ("commitment_id") REFERENCES "public"."determined_commitments"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."determined_commitment_fields" - ADD CONSTRAINT "determined_commitment_fields_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."determined_commitments" - ADD CONSTRAINT "determined_commitments_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."feriados" - ADD CONSTRAINT "feriados_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."feriados" - ADD CONSTRAINT "feriados_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."module_features" - ADD CONSTRAINT "module_features_feature_id_fkey" FOREIGN KEY ("feature_id") REFERENCES "public"."features"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."module_features" - ADD CONSTRAINT "module_features_module_id_fkey" FOREIGN KEY ("module_id") REFERENCES "public"."modules"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_group_patient" - ADD CONSTRAINT "patient_group_patient_patient_id_fkey" FOREIGN KEY ("patient_id") REFERENCES "public"."patients"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_group_patient" - ADD CONSTRAINT "patient_group_patient_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_groups" - ADD CONSTRAINT "patient_groups_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_intake_requests" - ADD CONSTRAINT "patient_intake_requests_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_invites" - ADD CONSTRAINT "patient_invites_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_patient_tag" - ADD CONSTRAINT "patient_patient_tag_tag_id_fkey" FOREIGN KEY ("tag_id") REFERENCES "public"."patient_tags"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_patient_tag" - ADD CONSTRAINT "patient_patient_tag_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_tags" - ADD CONSTRAINT "patient_tags_tenant_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patients" - ADD CONSTRAINT "patients_responsible_member_id_fkey" FOREIGN KEY ("responsible_member_id") REFERENCES "public"."tenant_members"("id") ON DELETE RESTRICT; - - - -ALTER TABLE ONLY "public"."patients" - ADD CONSTRAINT "patients_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patients" - ADD CONSTRAINT "patients_therapist_member_id_fkey" FOREIGN KEY ("therapist_member_id") REFERENCES "public"."tenant_members"("id"); - - - -ALTER TABLE ONLY "public"."patients" - ADD CONSTRAINT "patients_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."plan_features" - ADD CONSTRAINT "plan_features_feature_id_fkey" FOREIGN KEY ("feature_id") REFERENCES "public"."features"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."plan_features" - ADD CONSTRAINT "plan_features_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."plan_prices" - ADD CONSTRAINT "plan_prices_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."plan_public_bullets" - ADD CONSTRAINT "plan_public_bullets_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."plan_public" - ADD CONSTRAINT "plan_public_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_patient_tag" - ADD CONSTRAINT "ppt_patient_fk" FOREIGN KEY ("patient_id") REFERENCES "public"."patients"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."patient_patient_tag" - ADD CONSTRAINT "ppt_tag_fk" FOREIGN KEY ("tag_id") REFERENCES "public"."patient_tags"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."profiles" - ADD CONSTRAINT "profiles_id_fkey" FOREIGN KEY ("id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."recurrence_exceptions" - ADD CONSTRAINT "recurrence_exceptions_agenda_evento_id_fkey" FOREIGN KEY ("agenda_evento_id") REFERENCES "public"."agenda_eventos"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."recurrence_exceptions" - ADD CONSTRAINT "recurrence_exceptions_recurrence_id_fkey" FOREIGN KEY ("recurrence_id") REFERENCES "public"."recurrence_rules"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."saas_admins" - ADD CONSTRAINT "saas_admins_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."saas_doc_votos" - ADD CONSTRAINT "saas_doc_votos_doc_id_fkey" FOREIGN KEY ("doc_id") REFERENCES "public"."saas_docs"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."saas_doc_votos" - ADD CONSTRAINT "saas_doc_votos_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."saas_faq_itens" - ADD CONSTRAINT "saas_faq_itens_doc_id_fkey" FOREIGN KEY ("doc_id") REFERENCES "public"."saas_docs"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."subscription_intents_personal" - ADD CONSTRAINT "sint_personal_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "public"."subscriptions"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."subscription_intents_tenant" - ADD CONSTRAINT "sint_tenant_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "public"."subscriptions"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."subscription_events" - ADD CONSTRAINT "subscription_events_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "public"."subscriptions"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."subscription_intents_personal" - ADD CONSTRAINT "subscription_intents_personal_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE RESTRICT; - - - -ALTER TABLE ONLY "public"."subscription_intents_tenant" - ADD CONSTRAINT "subscription_intents_tenant_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE RESTRICT; - - - -ALTER TABLE ONLY "public"."subscription_intents_legacy" - ADD CONSTRAINT "subscription_intents_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."subscriptions" - ADD CONSTRAINT "subscriptions_owner_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."subscriptions" - ADD CONSTRAINT "subscriptions_plan_id_fkey" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE RESTRICT; - - - -ALTER TABLE ONLY "public"."tenant_features" - ADD CONSTRAINT "tenant_features_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."tenant_invites" - ADD CONSTRAINT "tenant_invites_accepted_by_fkey" FOREIGN KEY ("accepted_by") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."tenant_invites" - ADD CONSTRAINT "tenant_invites_invited_by_fkey" FOREIGN KEY ("invited_by") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."tenant_invites" - ADD CONSTRAINT "tenant_invites_revoked_by_fkey" FOREIGN KEY ("revoked_by") REFERENCES "auth"."users"("id") ON DELETE SET NULL; - - - -ALTER TABLE ONLY "public"."tenant_invites" - ADD CONSTRAINT "tenant_invites_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."tenant_members" - ADD CONSTRAINT "tenant_members_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."tenant_members" - ADD CONSTRAINT "tenant_members_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."tenant_modules" - ADD CONSTRAINT "tenant_modules_module_id_fkey" FOREIGN KEY ("module_id") REFERENCES "public"."modules"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."tenant_modules" - ADD CONSTRAINT "tenant_modules_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE ONLY "public"."user_settings" - ADD CONSTRAINT "user_settings_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE; - - - -ALTER TABLE "public"."agenda_bloqueios" ENABLE ROW LEVEL SECURITY; - - -ALTER TABLE "public"."agenda_configuracoes" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_configuracoes_clinic_read" ON "public"."agenda_configuracoes" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_configuracoes_clinic_write" ON "public"."agenda_configuracoes" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -CREATE POLICY "agenda_configuracoes_owner" ON "public"."agenda_configuracoes" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."agenda_eventos" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_eventos_delete" ON "public"."agenda_eventos" FOR DELETE USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.delete'::"text"))); - - - -CREATE POLICY "agenda_eventos_insert" ON "public"."agenda_eventos" FOR INSERT WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.create'::"text"))); - - - -CREATE POLICY "agenda_eventos_owner_all" ON "public"."agenda_eventos" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "agenda_eventos_select" ON "public"."agenda_eventos" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_eventos_update" ON "public"."agenda_eventos" FOR UPDATE USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -ALTER TABLE "public"."agenda_excecoes" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_excecoes_owner" ON "public"."agenda_excecoes" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "agenda_excecoes_select" ON "public"."agenda_excecoes" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_excecoes_write" ON "public"."agenda_excecoes" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -ALTER TABLE "public"."agenda_online_slots" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_online_slots_owner" ON "public"."agenda_online_slots" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "agenda_online_slots_select" ON "public"."agenda_online_slots" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_online_slots_write" ON "public"."agenda_online_slots" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -ALTER TABLE "public"."agenda_regras_semanais" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_regras_semanais_owner" ON "public"."agenda_regras_semanais" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "agenda_regras_semanais_select" ON "public"."agenda_regras_semanais" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_regras_semanais_write" ON "public"."agenda_regras_semanais" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -ALTER TABLE "public"."agenda_slots_bloqueados_semanais" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_slots_bloqueados_semanais_select" ON "public"."agenda_slots_bloqueados_semanais" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_slots_bloqueados_semanais_write" ON "public"."agenda_slots_bloqueados_semanais" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -ALTER TABLE "public"."agenda_slots_regras" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agenda_slots_regras_select" ON "public"."agenda_slots_regras" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "agenda_slots_regras_write" ON "public"."agenda_slots_regras" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -CREATE POLICY "agendador_cfg_public_read" ON "public"."agendador_configuracoes" FOR SELECT TO "anon" USING ((("ativo" = true) AND ("link_slug" IS NOT NULL))); - - - -CREATE POLICY "agendador_cfg_select" ON "public"."agendador_configuracoes" FOR SELECT USING (("auth"."uid"() = "owner_id")); - - - -CREATE POLICY "agendador_cfg_write" ON "public"."agendador_configuracoes" USING (("auth"."uid"() = "owner_id")) WITH CHECK (("auth"."uid"() = "owner_id")); - - - -ALTER TABLE "public"."agendador_configuracoes" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "agendador_sol_owner_select" ON "public"."agendador_solicitacoes" FOR SELECT USING (("auth"."uid"() = "owner_id")); - - - -CREATE POLICY "agendador_sol_owner_write" ON "public"."agendador_solicitacoes" USING (("auth"."uid"() = "owner_id")) WITH CHECK (("auth"."uid"() = "owner_id")); - - - -CREATE POLICY "agendador_sol_patient_read" ON "public"."agendador_solicitacoes" FOR SELECT TO "authenticated" USING ((("auth"."uid"() = "user_id") OR ("auth"."uid"() = "owner_id"))); - - - -CREATE POLICY "agendador_sol_public_insert" ON "public"."agendador_solicitacoes" FOR INSERT TO "anon" WITH CHECK (true); - - - -ALTER TABLE "public"."agendador_solicitacoes" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "bloqueios_delete" ON "public"."agenda_bloqueios" FOR DELETE TO "authenticated" USING (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "bloqueios_insert" ON "public"."agenda_bloqueios" FOR INSERT TO "authenticated" WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "bloqueios_select_clinic" ON "public"."agenda_bloqueios" FOR SELECT TO "authenticated" USING (("tenant_id" IN ( SELECT "tenant_members"."tenant_id" - FROM "public"."tenant_members" - WHERE (("tenant_members"."user_id" = "auth"."uid"()) AND ("tenant_members"."role" = ANY (ARRAY['admin'::"text", 'clinic_admin'::"text", 'tenant_admin'::"text", 'secretary'::"text"])))))); - - - -CREATE POLICY "bloqueios_select_own" ON "public"."agenda_bloqueios" FOR SELECT TO "authenticated" USING (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "bloqueios_update" ON "public"."agenda_bloqueios" FOR UPDATE TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "clinic_admin_read_all_docs" ON "public"."saas_docs" FOR SELECT TO "authenticated" USING ((("ativo" = true) AND (EXISTS ( SELECT 1 - FROM "public"."profiles" - WHERE (("profiles"."id" = "auth"."uid"()) AND ("profiles"."role" = ANY (ARRAY['clinic_admin'::"text", 'tenant_admin'::"text"]))))))); - - - -ALTER TABLE "public"."commitment_time_logs" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "ctl_delete_for_active_member" ON "public"."commitment_time_logs" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "commitment_time_logs"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "ctl_insert_for_active_member" ON "public"."commitment_time_logs" FOR INSERT TO "authenticated" WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "commitment_time_logs"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "ctl_select_for_active_member" ON "public"."commitment_time_logs" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "commitment_time_logs"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "ctl_update_for_active_member" ON "public"."commitment_time_logs" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "commitment_time_logs"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "commitment_time_logs"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dc_delete_custom_for_active_member" ON "public"."determined_commitments" FOR DELETE TO "authenticated" USING ((("is_native" = false) AND (EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitments"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text")))))); - - - -CREATE POLICY "dc_insert_for_active_member" ON "public"."determined_commitments" FOR INSERT TO "authenticated" WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitments"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dc_select_for_active_member" ON "public"."determined_commitments" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitments"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dc_update_for_active_member" ON "public"."determined_commitments" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitments"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitments"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dcf_delete_for_active_member" ON "public"."determined_commitment_fields" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitment_fields"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dcf_insert_for_active_member" ON "public"."determined_commitment_fields" FOR INSERT TO "authenticated" WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitment_fields"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dcf_select_for_active_member" ON "public"."determined_commitment_fields" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitment_fields"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "dcf_update_for_active_member" ON "public"."determined_commitment_fields" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitment_fields"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "determined_commitment_fields"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text"))))); - - - -CREATE POLICY "delete own" ON "public"."agenda_bloqueios" FOR DELETE USING (("owner_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."determined_commitment_fields" ENABLE ROW LEVEL SECURITY; - - -ALTER TABLE "public"."determined_commitments" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "dev_creds_select_saas_admin" ON "public"."dev_user_credentials" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."profiles" "p" - WHERE (("p"."id" = "auth"."uid"()) AND ("p"."role" = 'saas_admin'::"text"))))); - - - -CREATE POLICY "dev_creds_write_saas_admin" ON "public"."dev_user_credentials" TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."profiles" "p" - WHERE (("p"."id" = "auth"."uid"()) AND ("p"."role" = 'saas_admin'::"text"))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."profiles" "p" - WHERE (("p"."id" = "auth"."uid"()) AND ("p"."role" = 'saas_admin'::"text"))))); - - - -ALTER TABLE "public"."dev_user_credentials" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "ent_inv_select_own" ON "public"."entitlements_invalidation" FOR SELECT USING ((("owner_id" = "auth"."uid"()) OR "public"."is_saas_admin"())); - - - -CREATE POLICY "ent_inv_update_saas" ON "public"."entitlements_invalidation" FOR UPDATE USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -CREATE POLICY "ent_inv_write_saas" ON "public"."entitlements_invalidation" FOR INSERT WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."entitlements_invalidation" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "faq_admin_write" ON "public"."saas_faq" TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."profiles" - WHERE (("profiles"."id" = "auth"."uid"()) AND ("profiles"."role" = ANY (ARRAY['saas_admin'::"text", 'tenant_admin'::"text", 'clinic_admin'::"text"])))))); - - - -CREATE POLICY "faq_auth_read" ON "public"."saas_faq" FOR SELECT TO "authenticated" USING (("ativo" = true)); - - - -CREATE POLICY "faq_itens_admin_write" ON "public"."saas_faq_itens" TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."profiles" - WHERE (("profiles"."id" = "auth"."uid"()) AND ("profiles"."role" = ANY (ARRAY['saas_admin'::"text", 'tenant_admin'::"text", 'clinic_admin'::"text"])))))); - - - -CREATE POLICY "faq_itens_auth_read" ON "public"."saas_faq_itens" FOR SELECT TO "authenticated" USING ((("ativo" = true) AND (EXISTS ( SELECT 1 - FROM "public"."saas_docs" "d" - WHERE (("d"."id" = "saas_faq_itens"."doc_id") AND ("d"."ativo" = true)))))); - - - -CREATE POLICY "faq_public_read" ON "public"."saas_faq" FOR SELECT USING ((("publico" = true) AND ("ativo" = true))); - - - -ALTER TABLE "public"."features" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "features_read_authenticated" ON "public"."features" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "features_write_saas_admin" ON "public"."features" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."feriados" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "feriados_delete" ON "public"."feriados" FOR DELETE USING (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "feriados_global_select" ON "public"."feriados" FOR SELECT USING (("tenant_id" IS NULL)); - - - -CREATE POLICY "feriados_insert" ON "public"."feriados" FOR INSERT WITH CHECK (("tenant_id" IN ( SELECT "tenant_members"."tenant_id" - FROM "public"."tenant_members" - WHERE ("tenant_members"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "feriados_saas_delete" ON "public"."feriados" FOR DELETE USING ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" - WHERE ("saas_admins"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "feriados_saas_insert" ON "public"."feriados" FOR INSERT WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" - WHERE ("saas_admins"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "feriados_saas_select" ON "public"."feriados" FOR SELECT USING ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" - WHERE ("saas_admins"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "feriados_select" ON "public"."feriados" FOR SELECT USING (("tenant_id" IN ( SELECT "tenant_members"."tenant_id" - FROM "public"."tenant_members" - WHERE ("tenant_members"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "insert own" ON "public"."agenda_bloqueios" FOR INSERT WITH CHECK (("owner_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."module_features" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "module_features_read_authenticated" ON "public"."module_features" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "module_features_write_saas_admin" ON "public"."module_features" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."modules" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "modules_read_authenticated" ON "public"."modules" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "modules_write_saas_admin" ON "public"."modules" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."owner_users" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "owner_users: user can read own links" ON "public"."owner_users" FOR SELECT TO "authenticated" USING (("user_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."patient_group_patient" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patient_group_patient_owner_all" ON "public"."patient_group_patient" TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."patients" "p" - WHERE (("p"."id" = "patient_group_patient"."patient_id") AND ("p"."owner_id" = "auth"."uid"()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."patients" "p" - WHERE (("p"."id" = "patient_group_patient"."patient_id") AND ("p"."owner_id" = "auth"."uid"()))))); - - - -CREATE POLICY "patient_group_patient_select" ON "public"."patient_group_patient" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patient_group_patient_write" ON "public"."patient_group_patient" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."patient_groups" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patient_groups_owner_all" ON "public"."patient_groups" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "patient_groups_select" ON "public"."patient_groups" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patient_groups_write" ON "public"."patient_groups" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."patient_intake_requests" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patient_intake_requests_owner_all" ON "public"."patient_intake_requests" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "patient_intake_requests_select" ON "public"."patient_intake_requests" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patient_intake_requests_write" ON "public"."patient_intake_requests" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."patient_invites" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patient_invites_owner_all" ON "public"."patient_invites" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "patient_invites_select" ON "public"."patient_invites" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patient_invites_write" ON "public"."patient_invites" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."patient_patient_tag" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patient_patient_tag_owner_all" ON "public"."patient_patient_tag" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "patient_patient_tag_select" ON "public"."patient_patient_tag" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patient_patient_tag_write" ON "public"."patient_patient_tag" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."patient_tags" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patient_tags_owner_all" ON "public"."patient_tags" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "patient_tags_select" ON "public"."patient_tags" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patient_tags_write" ON "public"."patient_tags" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."patients" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "patients_delete" ON "public"."patients" FOR DELETE USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.delete'::"text"))); - - - -CREATE POLICY "patients_insert" ON "public"."patients" FOR INSERT WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.create'::"text"))); - - - -CREATE POLICY "patients_owner_all" ON "public"."patients" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "patients_select" ON "public"."patients" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.view'::"text"))); - - - -CREATE POLICY "patients_update" ON "public"."patients" FOR UPDATE USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'patients.edit'::"text"))); - - - -ALTER TABLE "public"."plan_features" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "plan_features_read_authenticated" ON "public"."plan_features" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "plan_features_write_saas_admin" ON "public"."plan_features" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."plans" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "plans_read_authenticated" ON "public"."plans" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "plans_write_saas_admin" ON "public"."plans" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."profiles" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "profiles_insert_own" ON "public"."profiles" FOR INSERT WITH CHECK (("id" = "auth"."uid"())); - - - -CREATE POLICY "profiles_read_saas_admin" ON "public"."profiles" FOR SELECT USING ("public"."is_saas_admin"()); - - - -CREATE POLICY "profiles_select_own" ON "public"."profiles" FOR SELECT USING (("id" = "auth"."uid"())); - - - -CREATE POLICY "profiles_update_own" ON "public"."profiles" FOR UPDATE USING (("id" = "auth"."uid"())) WITH CHECK (("id" = "auth"."uid"())); - - - -CREATE POLICY "read features (auth)" ON "public"."features" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "read plan_features (auth)" ON "public"."plan_features" FOR SELECT TO "authenticated" USING (true); - - - -CREATE POLICY "read plans (auth)" ON "public"."plans" FOR SELECT TO "authenticated" USING (true); - - - -ALTER TABLE "public"."recurrence_exceptions" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "recurrence_exceptions_tenant" ON "public"."recurrence_exceptions" TO "authenticated" USING (("tenant_id" IN ( SELECT "tenant_members"."tenant_id" - FROM "public"."tenant_members" - WHERE ("tenant_members"."user_id" = "auth"."uid"())))) WITH CHECK (("tenant_id" IN ( SELECT "tenant_members"."tenant_id" - FROM "public"."tenant_members" - WHERE ("tenant_members"."user_id" = "auth"."uid"())))); - - - -ALTER TABLE "public"."recurrence_rules" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "recurrence_rules_clinic_read" ON "public"."recurrence_rules" FOR SELECT USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.view'::"text"))); - - - -CREATE POLICY "recurrence_rules_clinic_write" ON "public"."recurrence_rules" USING (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))) WITH CHECK (("public"."is_clinic_tenant"("tenant_id") AND "public"."is_tenant_member"("tenant_id") AND "public"."tenant_has_feature"("tenant_id", 'agenda.edit'::"text"))); - - - -CREATE POLICY "recurrence_rules_owner" ON "public"."recurrence_rules" TO "authenticated" USING (("owner_id" = "auth"."uid"())) WITH CHECK (("owner_id" = "auth"."uid"())); - - - -CREATE POLICY "saas_admin can read subscription_intents" ON "public"."subscription_intents_legacy" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" "a" - WHERE ("a"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "saas_admin can update subscription_intents" ON "public"."subscription_intents_legacy" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" "a" - WHERE ("a"."user_id" = "auth"."uid"())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" "a" - WHERE ("a"."user_id" = "auth"."uid"())))); - - - -CREATE POLICY "saas_admin_full_access" ON "public"."saas_docs" TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" - WHERE ("saas_admins"."user_id" = "auth"."uid"())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM "public"."saas_admins" - WHERE ("saas_admins"."user_id" = "auth"."uid"())))); - - - -ALTER TABLE "public"."saas_admins" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "saas_admins_select_self" ON "public"."saas_admins" FOR SELECT TO "authenticated" USING (("user_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."saas_doc_votos" ENABLE ROW LEVEL SECURITY; - - -ALTER TABLE "public"."saas_docs" ENABLE ROW LEVEL SECURITY; - - -ALTER TABLE "public"."saas_faq" ENABLE ROW LEVEL SECURITY; - - -ALTER TABLE "public"."saas_faq_itens" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "select own" ON "public"."agenda_bloqueios" FOR SELECT USING (("owner_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."subscription_events" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "subscription_events_read_saas" ON "public"."subscription_events" FOR SELECT USING ("public"."is_saas_admin"()); - - - -CREATE POLICY "subscription_events_write_saas" ON "public"."subscription_events" FOR INSERT WITH CHECK ("public"."is_saas_admin"()); - - - -CREATE POLICY "subscription_intents_insert_own" ON "public"."subscription_intents_legacy" FOR INSERT TO "authenticated" WITH CHECK (("user_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."subscription_intents_legacy" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "subscription_intents_select_own" ON "public"."subscription_intents_legacy" FOR SELECT TO "authenticated" USING (("user_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."subscriptions" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "subscriptions read own" ON "public"."subscriptions" FOR SELECT TO "authenticated" USING (("user_id" = "auth"."uid"())); - - - -CREATE POLICY "subscriptions: read if linked owner_users" ON "public"."subscriptions" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1 - FROM "public"."owner_users" "ou" - WHERE (("ou"."owner_id" = "subscriptions"."user_id") AND ("ou"."user_id" = "auth"."uid"()))))); - - - -CREATE POLICY "subscriptions_insert_own_personal" ON "public"."subscriptions" FOR INSERT TO "authenticated" WITH CHECK ((("user_id" = "auth"."uid"()) AND ("tenant_id" IS NULL))); - - - -CREATE POLICY "subscriptions_no_direct_update" ON "public"."subscriptions" FOR UPDATE TO "authenticated" USING (false) WITH CHECK (false); - - - -CREATE POLICY "subscriptions_read_own" ON "public"."subscriptions" FOR SELECT TO "authenticated" USING ((("user_id" = "auth"."uid"()) OR "public"."is_saas_admin"())); - - - -CREATE POLICY "subscriptions_select_for_tenant_members" ON "public"."subscriptions" FOR SELECT TO "authenticated" USING ((("tenant_id" IS NOT NULL) AND (EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "subscriptions"."tenant_id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text")))))); - - - -CREATE POLICY "subscriptions_select_own_personal" ON "public"."subscriptions" FOR SELECT TO "authenticated" USING ((("user_id" = "auth"."uid"()) AND ("tenant_id" IS NULL))); - - - -CREATE POLICY "subscriptions_update_only_saas_admin" ON "public"."subscriptions" FOR UPDATE TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."tenant_members" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "tenant_members_write_saas" ON "public"."tenant_members" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."tenant_modules" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "tenant_modules_read_own" ON "public"."tenant_modules" FOR SELECT TO "authenticated" USING ((("owner_id" = "auth"."uid"()) OR "public"."is_saas_admin"())); - - - -CREATE POLICY "tenant_modules_write_saas" ON "public"."tenant_modules" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -ALTER TABLE "public"."tenants" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "tenants_read_members" ON "public"."tenants" FOR SELECT TO "authenticated" USING (("public"."is_saas_admin"() OR (EXISTS ( SELECT 1 - FROM "public"."tenant_members" "tm" - WHERE (("tm"."tenant_id" = "tenants"."id") AND ("tm"."user_id" = "auth"."uid"()) AND ("tm"."status" = 'active'::"text")))))); - - - -CREATE POLICY "tenants_write_saas" ON "public"."tenants" TO "authenticated" USING ("public"."is_saas_admin"()) WITH CHECK ("public"."is_saas_admin"()); - - - -CREATE POLICY "tm_select_admin_all_members" ON "public"."tenant_members" FOR SELECT TO "authenticated" USING ("public"."is_tenant_admin"("tenant_id")); - - - -CREATE POLICY "tm_select_own_membership" ON "public"."tenant_members" FOR SELECT TO "authenticated" USING (("user_id" = "auth"."uid"())); - - - -CREATE POLICY "update own" ON "public"."agenda_bloqueios" FOR UPDATE USING (("owner_id" = "auth"."uid"())); - - - -ALTER TABLE "public"."user_settings" ENABLE ROW LEVEL SECURITY; - - -CREATE POLICY "user_settings_insert_own" ON "public"."user_settings" FOR INSERT WITH CHECK (("user_id" = "auth"."uid"())); - - - -CREATE POLICY "user_settings_select_own" ON "public"."user_settings" FOR SELECT USING (("user_id" = "auth"."uid"())); - - - -CREATE POLICY "user_settings_update_own" ON "public"."user_settings" FOR UPDATE USING (("user_id" = "auth"."uid"())) WITH CHECK (("user_id" = "auth"."uid"())); - - - -CREATE POLICY "users_read_usuario_docs" ON "public"."saas_docs" FOR SELECT TO "authenticated" USING ((("ativo" = true) AND ("tipo_acesso" = 'usuario'::"text"))); - - - -CREATE POLICY "votos_select_own" ON "public"."saas_doc_votos" FOR SELECT TO "authenticated" USING (("user_id" = "auth"."uid"())); - - - -CREATE POLICY "votos_upsert_own" ON "public"."saas_doc_votos" TO "authenticated" USING (("user_id" = "auth"."uid"())) WITH CHECK (("user_id" = "auth"."uid"())); - - - - - -ALTER PUBLICATION "supabase_realtime" OWNER TO "postgres"; - - - - - -GRANT USAGE ON SCHEMA "public" TO "postgres"; -GRANT USAGE ON SCHEMA "public" TO "anon"; -GRANT USAGE ON SCHEMA "public" TO "authenticated"; -GRANT USAGE ON SCHEMA "public" TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citextin"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citextin"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."citextin"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citextin"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citextout"("public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citextout"("public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citextout"("public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citextout"("public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citextrecv"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citextrecv"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."citextrecv"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citextrecv"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citextsend"("public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citextsend"("public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citextsend"("public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citextsend"("public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey16_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey16_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey16_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey16_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey16_out"("public"."gbtreekey16") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey16_out"("public"."gbtreekey16") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey16_out"("public"."gbtreekey16") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey16_out"("public"."gbtreekey16") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey2_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey2_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey2_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey2_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey2_out"("public"."gbtreekey2") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey2_out"("public"."gbtreekey2") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey2_out"("public"."gbtreekey2") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey2_out"("public"."gbtreekey2") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey32_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey32_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey32_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey32_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey32_out"("public"."gbtreekey32") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey32_out"("public"."gbtreekey32") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey32_out"("public"."gbtreekey32") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey32_out"("public"."gbtreekey32") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey4_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey4_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey4_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey4_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey4_out"("public"."gbtreekey4") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey4_out"("public"."gbtreekey4") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey4_out"("public"."gbtreekey4") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey4_out"("public"."gbtreekey4") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey8_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey8_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey8_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey8_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey8_out"("public"."gbtreekey8") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey8_out"("public"."gbtreekey8") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey8_out"("public"."gbtreekey8") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey8_out"("public"."gbtreekey8") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey_var_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey_var_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey_var_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey_var_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbtreekey_var_out"("public"."gbtreekey_var") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbtreekey_var_out"("public"."gbtreekey_var") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbtreekey_var_out"("public"."gbtreekey_var") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbtreekey_var_out"("public"."gbtreekey_var") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_in"("cstring") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_in"("cstring") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_in"("cstring") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_in"("cstring") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_out"("public"."gtrgm") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_out"("public"."gtrgm") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_out"("public"."gtrgm") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_out"("public"."gtrgm") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext"(boolean) TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext"(boolean) TO "anon"; -GRANT ALL ON FUNCTION "public"."citext"(boolean) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext"(boolean) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext"(character) TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext"(character) TO "anon"; -GRANT ALL ON FUNCTION "public"."citext"(character) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext"(character) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext"("inet") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext"("inet") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext"("inet") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext"("inet") TO "service_role"; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GRANT ALL ON FUNCTION "public"."__rls_ping"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."__rls_ping"() TO "anon"; -GRANT ALL ON FUNCTION "public"."__rls_ping"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."__rls_ping"() TO "service_role"; - - - -GRANT ALL ON TABLE "public"."subscriptions" TO "postgres"; -GRANT ALL ON TABLE "public"."subscriptions" TO "anon"; -GRANT ALL ON TABLE "public"."subscriptions" TO "authenticated"; -GRANT ALL ON TABLE "public"."subscriptions" TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."activate_subscription_from_intent"("p_intent_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."activate_subscription_from_intent"("p_intent_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."activate_subscription_from_intent"("p_intent_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."activate_subscription_from_intent"("p_intent_id" "uuid") TO "service_role"; - - - -REVOKE ALL ON FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") FROM PUBLIC; -GRANT ALL ON FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."admin_fix_plan_target"("p_plan_key" "text", "p_new_target" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."agenda_cfg_sync"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."agenda_cfg_sync"() TO "anon"; -GRANT ALL ON FUNCTION "public"."agenda_cfg_sync"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."agenda_cfg_sync"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."agendador_dias_disponiveis"("p_slug" "text", "p_ano" integer, "p_mes" integer) TO "postgres"; -GRANT ALL ON FUNCTION "public"."agendador_dias_disponiveis"("p_slug" "text", "p_ano" integer, "p_mes" integer) TO "anon"; -GRANT ALL ON FUNCTION "public"."agendador_dias_disponiveis"("p_slug" "text", "p_ano" integer, "p_mes" integer) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."agendador_dias_disponiveis"("p_slug" "text", "p_ano" integer, "p_mes" integer) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."agendador_gerar_slug"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."agendador_gerar_slug"() TO "anon"; -GRANT ALL ON FUNCTION "public"."agendador_gerar_slug"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."agendador_gerar_slug"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."agendador_slots_disponiveis"("p_slug" "text", "p_data" "date") TO "postgres"; -GRANT ALL ON FUNCTION "public"."agendador_slots_disponiveis"("p_slug" "text", "p_data" "date") TO "anon"; -GRANT ALL ON FUNCTION "public"."agendador_slots_disponiveis"("p_slug" "text", "p_data" "date") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."agendador_slots_disponiveis"("p_slug" "text", "p_data" "date") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."cancel_recurrence_from"("p_recurrence_id" "uuid", "p_from_date" "date") TO "postgres"; -GRANT ALL ON FUNCTION "public"."cancel_recurrence_from"("p_recurrence_id" "uuid", "p_from_date" "date") TO "anon"; -GRANT ALL ON FUNCTION "public"."cancel_recurrence_from"("p_recurrence_id" "uuid", "p_from_date" "date") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."cancel_recurrence_from"("p_recurrence_id" "uuid", "p_from_date" "date") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."cancel_subscription"("p_subscription_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."cancel_subscription"("p_subscription_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."cancel_subscription"("p_subscription_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."cancel_subscription"("p_subscription_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone) TO "postgres"; -GRANT ALL ON FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone) TO "anon"; -GRANT ALL ON FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."cancelar_eventos_serie"("p_serie_id" "uuid", "p_a_partir_de" timestamp with time zone) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."cash_dist"("money", "money") TO "postgres"; -GRANT ALL ON FUNCTION "public"."cash_dist"("money", "money") TO "anon"; -GRANT ALL ON FUNCTION "public"."cash_dist"("money", "money") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."cash_dist"("money", "money") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."change_subscription_plan"("p_subscription_id" "uuid", "p_new_plan_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."change_subscription_plan"("p_subscription_id" "uuid", "p_new_plan_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."change_subscription_plan"("p_subscription_id" "uuid", "p_new_plan_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."change_subscription_plan"("p_subscription_id" "uuid", "p_new_plan_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_cmp"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_cmp"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_cmp"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_cmp"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_eq"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_eq"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_eq"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_eq"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_ge"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_ge"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_ge"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_ge"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_gt"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_gt"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_gt"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_gt"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_hash"("public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_hash"("public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_hash"("public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_hash"("public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_hash_extended"("public"."citext", bigint) TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_hash_extended"("public"."citext", bigint) TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_hash_extended"("public"."citext", bigint) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_hash_extended"("public"."citext", bigint) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_larger"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_larger"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_larger"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_larger"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_le"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_le"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_le"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_le"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_lt"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_lt"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_lt"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_lt"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_ne"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_ne"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_ne"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_ne"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_pattern_cmp"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_pattern_cmp"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_pattern_cmp"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_pattern_cmp"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_pattern_ge"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_pattern_ge"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_pattern_ge"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_pattern_ge"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_pattern_gt"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_pattern_gt"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_pattern_gt"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_pattern_gt"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_pattern_le"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_pattern_le"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_pattern_le"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_pattern_le"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_pattern_lt"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_pattern_lt"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_pattern_lt"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_pattern_lt"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."citext_smaller"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."citext_smaller"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."citext_smaller"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."citext_smaller"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."create_clinic_tenant"("p_name" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."create_clinic_tenant"("p_name" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."create_clinic_tenant"("p_name" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."create_clinic_tenant"("p_name" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."create_patient_intake_request"("p_token" "text", "p_name" "text", "p_email" "text", "p_phone" "text", "p_notes" "text", "p_consent" boolean) TO "postgres"; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request"("p_token" "text", "p_name" "text", "p_email" "text", "p_phone" "text", "p_notes" "text", "p_consent" boolean) TO "anon"; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request"("p_token" "text", "p_name" "text", "p_email" "text", "p_phone" "text", "p_notes" "text", "p_consent" boolean) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request"("p_token" "text", "p_name" "text", "p_email" "text", "p_phone" "text", "p_notes" "text", "p_consent" boolean) TO "service_role"; - - - -REVOKE ALL ON FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") FROM PUBLIC; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") TO "postgres"; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") TO "anon"; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."create_patient_intake_request_v2"("p_token" "text", "p_payload" "jsonb") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."current_member_id"("p_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."current_member_id"("p_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."current_member_id"("p_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."current_member_id"("p_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."current_member_role"("p_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."current_member_role"("p_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."current_member_role"("p_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."current_member_role"("p_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."date_dist"("date", "date") TO "postgres"; -GRANT ALL ON FUNCTION "public"."date_dist"("date", "date") TO "anon"; -GRANT ALL ON FUNCTION "public"."date_dist"("date", "date") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."date_dist"("date", "date") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."delete_commitment_full"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."delete_commitment_full"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."delete_commitment_full"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."delete_determined_commitment"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."delete_determined_commitment"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."delete_determined_commitment"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."delete_determined_commitment"("p_tenant_id" "uuid", "p_commitment_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."dev_list_auth_users"("p_limit" integer) TO "postgres"; -GRANT ALL ON FUNCTION "public"."dev_list_auth_users"("p_limit" integer) TO "anon"; -GRANT ALL ON FUNCTION "public"."dev_list_auth_users"("p_limit" integer) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."dev_list_auth_users"("p_limit" integer) TO "service_role"; - - - -REVOKE ALL ON FUNCTION "public"."dev_list_custom_users"() FROM PUBLIC; -GRANT ALL ON FUNCTION "public"."dev_list_custom_users"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."dev_list_custom_users"() TO "anon"; -GRANT ALL ON FUNCTION "public"."dev_list_custom_users"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."dev_list_custom_users"() TO "service_role"; - - - -REVOKE ALL ON FUNCTION "public"."dev_list_intent_leads"() FROM PUBLIC; -GRANT ALL ON FUNCTION "public"."dev_list_intent_leads"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."dev_list_intent_leads"() TO "anon"; -GRANT ALL ON FUNCTION "public"."dev_list_intent_leads"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."dev_list_intent_leads"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."dev_public_debug_snapshot"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."dev_public_debug_snapshot"() TO "anon"; -GRANT ALL ON FUNCTION "public"."dev_public_debug_snapshot"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."dev_public_debug_snapshot"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant"() TO "anon"; -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant_for_user"("p_user_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant_for_user"("p_user_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant_for_user"("p_user_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."ensure_personal_tenant_for_user"("p_user_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."faq_votar"("faq_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."faq_votar"("faq_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."faq_votar"("faq_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."faq_votar"("faq_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."fix_all_subscription_mismatches"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."fix_all_subscription_mismatches"() TO "anon"; -GRANT ALL ON FUNCTION "public"."fix_all_subscription_mismatches"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."fix_all_subscription_mismatches"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."float4_dist"(real, real) TO "postgres"; -GRANT ALL ON FUNCTION "public"."float4_dist"(real, real) TO "anon"; -GRANT ALL ON FUNCTION "public"."float4_dist"(real, real) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."float4_dist"(real, real) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."float8_dist"(double precision, double precision) TO "postgres"; -GRANT ALL ON FUNCTION "public"."float8_dist"(double precision, double precision) TO "anon"; -GRANT ALL ON FUNCTION "public"."float8_dist"(double precision, double precision) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."float8_dist"(double precision, double precision) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"() TO "anon"; -GRANT ALL ON FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."fn_agenda_regras_semanais_no_overlap"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bit_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bit_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bit_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bit_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bit_consistent"("internal", bit, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bit_consistent"("internal", bit, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bit_consistent"("internal", bit, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bit_consistent"("internal", bit, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bit_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bit_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bit_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bit_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bit_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bit_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bit_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bit_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bit_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bit_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bit_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bit_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bit_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bit_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bit_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bit_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_consistent"("internal", boolean, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_consistent"("internal", boolean, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_consistent"("internal", boolean, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_consistent"("internal", boolean, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_same"("public"."gbtreekey2", "public"."gbtreekey2", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_same"("public"."gbtreekey2", "public"."gbtreekey2", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_same"("public"."gbtreekey2", "public"."gbtreekey2", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_same"("public"."gbtreekey2", "public"."gbtreekey2", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bool_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bool_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bool_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bool_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bpchar_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bpchar_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bpchar_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bpchar_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bpchar_consistent"("internal", character, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bpchar_consistent"("internal", character, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bpchar_consistent"("internal", character, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bpchar_consistent"("internal", character, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bytea_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bytea_consistent"("internal", "bytea", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_consistent"("internal", "bytea", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_consistent"("internal", "bytea", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_consistent"("internal", "bytea", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bytea_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bytea_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bytea_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_bytea_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_bytea_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_consistent"("internal", "money", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_consistent"("internal", "money", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_consistent"("internal", "money", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_consistent"("internal", "money", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_distance"("internal", "money", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_distance"("internal", "money", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_distance"("internal", "money", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_distance"("internal", "money", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_cash_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_cash_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_cash_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_cash_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_consistent"("internal", "date", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_consistent"("internal", "date", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_consistent"("internal", "date", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_consistent"("internal", "date", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_distance"("internal", "date", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_distance"("internal", "date", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_distance"("internal", "date", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_distance"("internal", "date", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_date_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_date_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_date_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_date_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_decompress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_decompress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_decompress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_decompress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_consistent"("internal", "anyenum", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_consistent"("internal", "anyenum", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_consistent"("internal", "anyenum", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_consistent"("internal", "anyenum", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_enum_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_enum_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_enum_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_enum_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_consistent"("internal", real, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_consistent"("internal", real, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_consistent"("internal", real, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_consistent"("internal", real, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_distance"("internal", real, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_distance"("internal", real, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_distance"("internal", real, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_distance"("internal", real, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float4_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float4_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float4_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float4_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_consistent"("internal", double precision, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_consistent"("internal", double precision, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_consistent"("internal", double precision, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_consistent"("internal", double precision, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_distance"("internal", double precision, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_distance"("internal", double precision, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_distance"("internal", double precision, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_distance"("internal", double precision, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_float8_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_float8_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_float8_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_float8_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_inet_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_inet_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_inet_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_inet_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_inet_consistent"("internal", "inet", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_inet_consistent"("internal", "inet", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_inet_consistent"("internal", "inet", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_inet_consistent"("internal", "inet", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_inet_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_inet_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_inet_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_inet_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_inet_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_inet_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_inet_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_inet_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_inet_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_inet_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_inet_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_inet_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_inet_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_inet_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_inet_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_inet_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_consistent"("internal", smallint, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_consistent"("internal", smallint, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_consistent"("internal", smallint, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_consistent"("internal", smallint, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_distance"("internal", smallint, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_distance"("internal", smallint, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_distance"("internal", smallint, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_distance"("internal", smallint, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_same"("public"."gbtreekey4", "public"."gbtreekey4", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_same"("public"."gbtreekey4", "public"."gbtreekey4", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_same"("public"."gbtreekey4", "public"."gbtreekey4", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_same"("public"."gbtreekey4", "public"."gbtreekey4", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int2_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int2_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int2_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int2_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_consistent"("internal", integer, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_consistent"("internal", integer, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_consistent"("internal", integer, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_consistent"("internal", integer, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_distance"("internal", integer, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_distance"("internal", integer, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_distance"("internal", integer, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_distance"("internal", integer, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int4_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int4_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int4_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int4_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_consistent"("internal", bigint, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_consistent"("internal", bigint, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_consistent"("internal", bigint, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_consistent"("internal", bigint, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_distance"("internal", bigint, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_distance"("internal", bigint, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_distance"("internal", bigint, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_distance"("internal", bigint, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_int8_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_int8_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_int8_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_int8_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_consistent"("internal", interval, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_consistent"("internal", interval, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_consistent"("internal", interval, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_consistent"("internal", interval, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_decompress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_decompress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_decompress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_decompress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_distance"("internal", interval, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_distance"("internal", interval, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_distance"("internal", interval, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_distance"("internal", interval, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_intv_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_intv_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_intv_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_intv_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_consistent"("internal", "macaddr8", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_consistent"("internal", "macaddr8", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_consistent"("internal", "macaddr8", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_consistent"("internal", "macaddr8", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad8_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad8_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_consistent"("internal", "macaddr", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_consistent"("internal", "macaddr", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_consistent"("internal", "macaddr", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_consistent"("internal", "macaddr", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_macad_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_macad_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_macad_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_macad_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_numeric_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_numeric_consistent"("internal", numeric, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_consistent"("internal", numeric, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_consistent"("internal", numeric, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_consistent"("internal", numeric, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_numeric_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_numeric_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_numeric_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_numeric_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_numeric_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_consistent"("internal", "oid", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_consistent"("internal", "oid", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_consistent"("internal", "oid", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_consistent"("internal", "oid", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_distance"("internal", "oid", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_distance"("internal", "oid", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_distance"("internal", "oid", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_distance"("internal", "oid", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_same"("public"."gbtreekey8", "public"."gbtreekey8", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_oid_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_oid_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_oid_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_oid_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_text_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_text_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_text_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_text_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_text_consistent"("internal", "text", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_text_consistent"("internal", "text", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_text_consistent"("internal", "text", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_text_consistent"("internal", "text", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_text_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_text_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_text_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_text_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_text_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_text_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_text_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_text_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_text_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_text_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_text_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_text_same"("public"."gbtreekey_var", "public"."gbtreekey_var", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_text_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_text_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_text_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_text_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_consistent"("internal", time without time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_consistent"("internal", time without time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_consistent"("internal", time without time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_consistent"("internal", time without time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_distance"("internal", time without time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_distance"("internal", time without time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_distance"("internal", time without time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_distance"("internal", time without time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_time_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_time_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_time_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_time_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_timetz_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_timetz_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_timetz_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_timetz_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_timetz_consistent"("internal", time with time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_timetz_consistent"("internal", time with time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_timetz_consistent"("internal", time with time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_timetz_consistent"("internal", time with time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_consistent"("internal", timestamp without time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_consistent"("internal", timestamp without time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_consistent"("internal", timestamp without time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_consistent"("internal", timestamp without time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_distance"("internal", timestamp without time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_distance"("internal", timestamp without time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_distance"("internal", timestamp without time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_distance"("internal", timestamp without time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_same"("public"."gbtreekey16", "public"."gbtreekey16", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_ts_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_ts_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_ts_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_ts_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_tstz_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_tstz_consistent"("internal", timestamp with time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_consistent"("internal", timestamp with time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_consistent"("internal", timestamp with time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_consistent"("internal", timestamp with time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_tstz_distance"("internal", timestamp with time zone, smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_distance"("internal", timestamp with time zone, smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_distance"("internal", timestamp with time zone, smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_tstz_distance"("internal", timestamp with time zone, smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_consistent"("internal", "uuid", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_consistent"("internal", "uuid", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_consistent"("internal", "uuid", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_consistent"("internal", "uuid", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_fetch"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_same"("public"."gbtreekey32", "public"."gbtreekey32", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_uuid_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_uuid_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_var_decompress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_var_decompress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_var_decompress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_var_decompress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gbt_var_fetch"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gbt_var_fetch"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gbt_var_fetch"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gbt_var_fetch"("internal") TO "service_role"; - - - -REVOKE ALL ON FUNCTION "public"."get_my_email"() FROM PUBLIC; -GRANT ALL ON FUNCTION "public"."get_my_email"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."get_my_email"() TO "anon"; -GRANT ALL ON FUNCTION "public"."get_my_email"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."get_my_email"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gin_extract_query_trgm"("text", "internal", smallint, "internal", "internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gin_extract_query_trgm"("text", "internal", smallint, "internal", "internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gin_extract_query_trgm"("text", "internal", smallint, "internal", "internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gin_extract_query_trgm"("text", "internal", smallint, "internal", "internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gin_extract_value_trgm"("text", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gin_extract_value_trgm"("text", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gin_extract_value_trgm"("text", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gin_extract_value_trgm"("text", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gin_trgm_consistent"("internal", smallint, "text", integer, "internal", "internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gin_trgm_consistent"("internal", smallint, "text", integer, "internal", "internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gin_trgm_consistent"("internal", smallint, "text", integer, "internal", "internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gin_trgm_consistent"("internal", smallint, "text", integer, "internal", "internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gin_trgm_triconsistent"("internal", smallint, "text", integer, "internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gin_trgm_triconsistent"("internal", smallint, "text", integer, "internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gin_trgm_triconsistent"("internal", smallint, "text", integer, "internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gin_trgm_triconsistent"("internal", smallint, "text", integer, "internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_compress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_compress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_compress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_compress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_consistent"("internal", "text", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_consistent"("internal", "text", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_consistent"("internal", "text", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_consistent"("internal", "text", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_decompress"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_decompress"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_decompress"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_decompress"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_distance"("internal", "text", smallint, "oid", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_distance"("internal", "text", smallint, "oid", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_distance"("internal", "text", smallint, "oid", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_distance"("internal", "text", smallint, "oid", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_options"("internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_options"("internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_options"("internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_options"("internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_penalty"("internal", "internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_penalty"("internal", "internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_penalty"("internal", "internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_penalty"("internal", "internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_picksplit"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_picksplit"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_picksplit"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_picksplit"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_same"("public"."gtrgm", "public"."gtrgm", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_same"("public"."gtrgm", "public"."gtrgm", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_same"("public"."gtrgm", "public"."gtrgm", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_same"("public"."gtrgm", "public"."gtrgm", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."gtrgm_union"("internal", "internal") TO "postgres"; -GRANT ALL ON FUNCTION "public"."gtrgm_union"("internal", "internal") TO "anon"; -GRANT ALL ON FUNCTION "public"."gtrgm_union"("internal", "internal") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."gtrgm_union"("internal", "internal") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_account_type_immutable"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_account_type_immutable"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_account_type_immutable"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_account_type_immutable"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_locked_commitment"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_locked_commitment"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_locked_commitment"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_locked_commitment"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_no_change_core_plan_key"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_no_change_core_plan_key"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_no_change_core_plan_key"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_no_change_core_plan_key"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_no_change_plan_target"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_no_change_plan_target"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_no_change_plan_target"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_no_change_plan_target"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_no_delete_core_plans"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_no_delete_core_plans"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_no_delete_core_plans"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_no_delete_core_plans"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_patient_cannot_own_tenant"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_patient_cannot_own_tenant"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_patient_cannot_own_tenant"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_patient_cannot_own_tenant"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."guard_tenant_kind_immutable"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."guard_tenant_kind_immutable"() TO "anon"; -GRANT ALL ON FUNCTION "public"."guard_tenant_kind_immutable"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."guard_tenant_kind_immutable"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "anon"; -GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."handle_new_user_create_personal_tenant"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."handle_new_user_create_personal_tenant"() TO "anon"; -GRANT ALL ON FUNCTION "public"."handle_new_user_create_personal_tenant"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."handle_new_user_create_personal_tenant"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."has_feature"("p_owner_id" "uuid", "p_feature_key" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."has_feature"("p_owner_id" "uuid", "p_feature_key" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."has_feature"("p_owner_id" "uuid", "p_feature_key" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."has_feature"("p_owner_id" "uuid", "p_feature_key" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."int2_dist"(smallint, smallint) TO "postgres"; -GRANT ALL ON FUNCTION "public"."int2_dist"(smallint, smallint) TO "anon"; -GRANT ALL ON FUNCTION "public"."int2_dist"(smallint, smallint) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."int2_dist"(smallint, smallint) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."int4_dist"(integer, integer) TO "postgres"; -GRANT ALL ON FUNCTION "public"."int4_dist"(integer, integer) TO "anon"; -GRANT ALL ON FUNCTION "public"."int4_dist"(integer, integer) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."int4_dist"(integer, integer) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."int8_dist"(bigint, bigint) TO "postgres"; -GRANT ALL ON FUNCTION "public"."int8_dist"(bigint, bigint) TO "anon"; -GRANT ALL ON FUNCTION "public"."int8_dist"(bigint, bigint) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."int8_dist"(bigint, bigint) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."interval_dist"(interval, interval) TO "postgres"; -GRANT ALL ON FUNCTION "public"."interval_dist"(interval, interval) TO "anon"; -GRANT ALL ON FUNCTION "public"."interval_dist"(interval, interval) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."interval_dist"(interval, interval) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."is_clinic_tenant"("_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."is_clinic_tenant"("_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."is_clinic_tenant"("_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."is_clinic_tenant"("_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."is_saas_admin"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."is_saas_admin"() TO "anon"; -GRANT ALL ON FUNCTION "public"."is_saas_admin"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."is_saas_admin"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."is_tenant_admin"("p_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."is_tenant_admin"("p_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."is_tenant_admin"("p_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."is_tenant_admin"("p_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."is_tenant_member"("_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."is_tenant_member"("_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."is_tenant_member"("_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."is_tenant_member"("_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."is_therapist_tenant"("_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."is_therapist_tenant"("_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."is_therapist_tenant"("_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."is_therapist_tenant"("_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."jwt_email"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."jwt_email"() TO "anon"; -GRANT ALL ON FUNCTION "public"."jwt_email"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."jwt_email"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."my_tenants"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."my_tenants"() TO "anon"; -GRANT ALL ON FUNCTION "public"."my_tenants"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."my_tenants"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."oid_dist"("oid", "oid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."oid_dist"("oid", "oid") TO "anon"; -GRANT ALL ON FUNCTION "public"."oid_dist"("oid", "oid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."oid_dist"("oid", "oid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."on_new_user_seed_patient_groups"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."on_new_user_seed_patient_groups"() TO "anon"; -GRANT ALL ON FUNCTION "public"."on_new_user_seed_patient_groups"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."on_new_user_seed_patient_groups"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."patients_validate_member_consistency"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."patients_validate_member_consistency"() TO "anon"; -GRANT ALL ON FUNCTION "public"."patients_validate_member_consistency"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."patients_validate_member_consistency"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."patients_validate_responsible_member_tenant"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."patients_validate_responsible_member_tenant"() TO "anon"; -GRANT ALL ON FUNCTION "public"."patients_validate_responsible_member_tenant"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."patients_validate_responsible_member_tenant"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."prevent_promoting_to_system"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."prevent_promoting_to_system"() TO "anon"; -GRANT ALL ON FUNCTION "public"."prevent_promoting_to_system"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."prevent_promoting_to_system"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."prevent_saas_membership"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."prevent_saas_membership"() TO "anon"; -GRANT ALL ON FUNCTION "public"."prevent_saas_membership"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."prevent_saas_membership"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."prevent_system_group_changes"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."prevent_system_group_changes"() TO "anon"; -GRANT ALL ON FUNCTION "public"."prevent_system_group_changes"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."prevent_system_group_changes"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."provision_account_tenant"("p_user_id" "uuid", "p_kind" "text", "p_name" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."reactivate_subscription"("p_subscription_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."reactivate_subscription"("p_subscription_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."reactivate_subscription"("p_subscription_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."reactivate_subscription"("p_subscription_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."rebuild_owner_entitlements"("p_owner_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."rebuild_owner_entitlements"("p_owner_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."rebuild_owner_entitlements"("p_owner_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."rebuild_owner_entitlements"("p_owner_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_match"("public"."citext", "public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_matches"("public"."citext", "public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_replace"("public"."citext", "public"."citext", "text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_array"("public"."citext", "public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."regexp_split_to_table"("public"."citext", "public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."replace"("public"."citext", "public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."replace"("public"."citext", "public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."replace"("public"."citext", "public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."replace"("public"."citext", "public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."rotate_patient_invite_token"("p_new_token" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."rotate_patient_invite_token"("p_new_token" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."rotate_patient_invite_token"("p_new_token" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."rotate_patient_invite_token"("p_new_token" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."saas_votar_doc"("p_doc_id" "uuid", "p_util" boolean) TO "postgres"; -GRANT ALL ON FUNCTION "public"."saas_votar_doc"("p_doc_id" "uuid", "p_util" boolean) TO "anon"; -GRANT ALL ON FUNCTION "public"."saas_votar_doc"("p_doc_id" "uuid", "p_util" boolean) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."saas_votar_doc"("p_doc_id" "uuid", "p_util" boolean) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."seed_determined_commitments"("p_tenant_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."seed_determined_commitments"("p_tenant_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."seed_determined_commitments"("p_tenant_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."seed_determined_commitments"("p_tenant_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."set_limit"(real) TO "postgres"; -GRANT ALL ON FUNCTION "public"."set_limit"(real) TO "anon"; -GRANT ALL ON FUNCTION "public"."set_limit"(real) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."set_limit"(real) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."set_owner_id"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."set_owner_id"() TO "anon"; -GRANT ALL ON FUNCTION "public"."set_owner_id"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."set_owner_id"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."set_tenant_feature_exception"("p_tenant_id" "uuid", "p_feature_key" "text", "p_enabled" boolean, "p_reason" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."set_tenant_feature_exception"("p_tenant_id" "uuid", "p_feature_key" "text", "p_enabled" boolean, "p_reason" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."set_tenant_feature_exception"("p_tenant_id" "uuid", "p_feature_key" "text", "p_enabled" boolean, "p_reason" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."set_tenant_feature_exception"("p_tenant_id" "uuid", "p_feature_key" "text", "p_enabled" boolean, "p_reason" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."set_updated_at"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."set_updated_at"() TO "anon"; -GRANT ALL ON FUNCTION "public"."set_updated_at"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."set_updated_at"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."set_updated_at_recurrence"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."set_updated_at_recurrence"() TO "anon"; -GRANT ALL ON FUNCTION "public"."set_updated_at_recurrence"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."set_updated_at_recurrence"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."show_limit"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."show_limit"() TO "anon"; -GRANT ALL ON FUNCTION "public"."show_limit"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."show_limit"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."show_trgm"("text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."show_trgm"("text") TO "anon"; -GRANT ALL ON FUNCTION "public"."show_trgm"("text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."show_trgm"("text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."similarity"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."similarity"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."similarity"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."similarity"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."similarity_dist"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."similarity_dist"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."similarity_dist"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."similarity_dist"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."similarity_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."similarity_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."similarity_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."similarity_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."split_part"("public"."citext", "public"."citext", integer) TO "postgres"; -GRANT ALL ON FUNCTION "public"."split_part"("public"."citext", "public"."citext", integer) TO "anon"; -GRANT ALL ON FUNCTION "public"."split_part"("public"."citext", "public"."citext", integer) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."split_part"("public"."citext", "public"."citext", integer) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."split_recurrence_at"("p_recurrence_id" "uuid", "p_from_date" "date") TO "postgres"; -GRANT ALL ON FUNCTION "public"."split_recurrence_at"("p_recurrence_id" "uuid", "p_from_date" "date") TO "anon"; -GRANT ALL ON FUNCTION "public"."split_recurrence_at"("p_recurrence_id" "uuid", "p_from_date" "date") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."split_recurrence_at"("p_recurrence_id" "uuid", "p_from_date" "date") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."strict_word_similarity"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."strict_word_similarity_commutator_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_commutator_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_commutator_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_commutator_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_commutator_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_commutator_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_commutator_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_commutator_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_dist_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."strict_word_similarity_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."strict_word_similarity_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."strpos"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."strpos"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."strpos"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."strpos"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."subscription_intents_view_insert"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."subscription_intents_view_insert"() TO "anon"; -GRANT ALL ON FUNCTION "public"."subscription_intents_view_insert"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."subscription_intents_view_insert"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."subscriptions_validate_scope"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."subscriptions_validate_scope"() TO "anon"; -GRANT ALL ON FUNCTION "public"."subscriptions_validate_scope"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."subscriptions_validate_scope"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."sync_busy_mirror_agenda_eventos"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."sync_busy_mirror_agenda_eventos"() TO "anon"; -GRANT ALL ON FUNCTION "public"."sync_busy_mirror_agenda_eventos"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."sync_busy_mirror_agenda_eventos"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_accept_invite"("p_token" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_accept_invite"("p_token" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_accept_invite"("p_token" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_accept_invite"("p_token" "uuid") TO "service_role"; - - - -GRANT ALL ON TABLE "public"."tenant_members" TO "postgres"; -GRANT SELECT,REFERENCES,TRIGGER,TRUNCATE,MAINTAIN ON TABLE "public"."tenant_members" TO "authenticated"; -GRANT ALL ON TABLE "public"."tenant_members" TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_add_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_add_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_add_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_add_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_feature_allowed"("p_tenant_id" "uuid", "p_feature_key" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_feature_allowed"("p_tenant_id" "uuid", "p_feature_key" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_feature_allowed"("p_tenant_id" "uuid", "p_feature_key" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_feature_allowed"("p_tenant_id" "uuid", "p_feature_key" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_feature_enabled"("p_tenant_id" "uuid", "p_feature_key" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_feature_enabled"("p_tenant_id" "uuid", "p_feature_key" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_feature_enabled"("p_tenant_id" "uuid", "p_feature_key" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_feature_enabled"("p_tenant_id" "uuid", "p_feature_key" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_features_guard_with_plan"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_features_guard_with_plan"() TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_features_guard_with_plan"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_features_guard_with_plan"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_has_feature"("_tenant_id" "uuid", "_feature" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_has_feature"("_tenant_id" "uuid", "_feature" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_has_feature"("_tenant_id" "uuid", "_feature" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_has_feature"("_tenant_id" "uuid", "_feature" "text") TO "service_role"; - - - -REVOKE ALL ON FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") FROM PUBLIC; -GRANT ALL ON FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_invite_member_by_email"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_reactivate_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_reactivate_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_reactivate_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_reactivate_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_remove_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_remove_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_remove_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_remove_member"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_remove_member_soft"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_remove_member_soft"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_remove_member_soft"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_remove_member_soft"("p_tenant_id" "uuid", "p_member_user_id" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_revoke_invite"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_revoke_invite"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_revoke_invite"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_revoke_invite"("p_tenant_id" "uuid", "p_email" "text", "p_role" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_set_member_status"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_status" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_set_member_status"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_status" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_set_member_status"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_status" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_set_member_status"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_status" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tenant_update_member_role"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_role" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."tenant_update_member_role"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_role" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."tenant_update_member_role"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_role" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tenant_update_member_role"("p_tenant_id" "uuid", "p_member_user_id" "uuid", "p_new_role" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticlike"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticnlike"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticregexeq"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."texticregexne"("public"."citext", "public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."time_dist"(time without time zone, time without time zone) TO "postgres"; -GRANT ALL ON FUNCTION "public"."time_dist"(time without time zone, time without time zone) TO "anon"; -GRANT ALL ON FUNCTION "public"."time_dist"(time without time zone, time without time zone) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."time_dist"(time without time zone, time without time zone) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."toggle_plan"("owner" "uuid") TO "postgres"; -GRANT ALL ON FUNCTION "public"."toggle_plan"("owner" "uuid") TO "anon"; -GRANT ALL ON FUNCTION "public"."toggle_plan"("owner" "uuid") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."toggle_plan"("owner" "uuid") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."transition_subscription"("p_subscription_id" "uuid", "p_to_status" "text", "p_reason" "text", "p_metadata" "jsonb") TO "postgres"; -GRANT ALL ON FUNCTION "public"."transition_subscription"("p_subscription_id" "uuid", "p_to_status" "text", "p_reason" "text", "p_metadata" "jsonb") TO "anon"; -GRANT ALL ON FUNCTION "public"."transition_subscription"("p_subscription_id" "uuid", "p_to_status" "text", "p_reason" "text", "p_metadata" "jsonb") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."transition_subscription"("p_subscription_id" "uuid", "p_to_status" "text", "p_reason" "text", "p_metadata" "jsonb") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."translate"("public"."citext", "public"."citext", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."translate"("public"."citext", "public"."citext", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."translate"("public"."citext", "public"."citext", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."translate"("public"."citext", "public"."citext", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."ts_dist"(timestamp without time zone, timestamp without time zone) TO "postgres"; -GRANT ALL ON FUNCTION "public"."ts_dist"(timestamp without time zone, timestamp without time zone) TO "anon"; -GRANT ALL ON FUNCTION "public"."ts_dist"(timestamp without time zone, timestamp without time zone) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."ts_dist"(timestamp without time zone, timestamp without time zone) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."tstz_dist"(timestamp with time zone, timestamp with time zone) TO "postgres"; -GRANT ALL ON FUNCTION "public"."tstz_dist"(timestamp with time zone, timestamp with time zone) TO "anon"; -GRANT ALL ON FUNCTION "public"."tstz_dist"(timestamp with time zone, timestamp with time zone) TO "authenticated"; -GRANT ALL ON FUNCTION "public"."tstz_dist"(timestamp with time zone, timestamp with time zone) TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."user_has_feature"("_user_id" "uuid", "_feature" "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."user_has_feature"("_user_id" "uuid", "_feature" "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."user_has_feature"("_user_id" "uuid", "_feature" "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."user_has_feature"("_user_id" "uuid", "_feature" "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."whoami"() TO "postgres"; -GRANT ALL ON FUNCTION "public"."whoami"() TO "anon"; -GRANT ALL ON FUNCTION "public"."whoami"() TO "authenticated"; -GRANT ALL ON FUNCTION "public"."whoami"() TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."word_similarity"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."word_similarity"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."word_similarity"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."word_similarity"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."word_similarity_commutator_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."word_similarity_commutator_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."word_similarity_commutator_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."word_similarity_commutator_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."word_similarity_dist_commutator_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."word_similarity_dist_commutator_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."word_similarity_dist_commutator_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."word_similarity_dist_commutator_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."word_similarity_dist_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."word_similarity_dist_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."word_similarity_dist_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."word_similarity_dist_op"("text", "text") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."word_similarity_op"("text", "text") TO "postgres"; -GRANT ALL ON FUNCTION "public"."word_similarity_op"("text", "text") TO "anon"; -GRANT ALL ON FUNCTION "public"."word_similarity_op"("text", "text") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."word_similarity_op"("text", "text") TO "service_role"; - - - - - - - - - - - - -GRANT ALL ON FUNCTION "public"."max"("public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."max"("public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."max"("public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."max"("public"."citext") TO "service_role"; - - - -GRANT ALL ON FUNCTION "public"."min"("public"."citext") TO "postgres"; -GRANT ALL ON FUNCTION "public"."min"("public"."citext") TO "anon"; -GRANT ALL ON FUNCTION "public"."min"("public"."citext") TO "authenticated"; -GRANT ALL ON FUNCTION "public"."min"("public"."citext") TO "service_role"; - - - - - - - - - -GRANT ALL ON TABLE "public"."agenda_bloqueios" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_bloqueios" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_bloqueios" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_bloqueios" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_configuracoes" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_configuracoes" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_configuracoes" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_configuracoes" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_eventos" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_eventos" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_eventos" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_eventos" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_excecoes" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_excecoes" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_excecoes" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_excecoes" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_online_slots" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_online_slots" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_online_slots" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_online_slots" TO "service_role"; - - - -GRANT ALL ON SEQUENCE "public"."agenda_online_slots_id_seq" TO "postgres"; -GRANT ALL ON SEQUENCE "public"."agenda_online_slots_id_seq" TO "anon"; -GRANT ALL ON SEQUENCE "public"."agenda_online_slots_id_seq" TO "authenticated"; -GRANT ALL ON SEQUENCE "public"."agenda_online_slots_id_seq" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_regras_semanais" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_regras_semanais" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_regras_semanais" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_regras_semanais" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_slots_bloqueados_semanais" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_slots_bloqueados_semanais" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_slots_bloqueados_semanais" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_slots_bloqueados_semanais" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agenda_slots_regras" TO "postgres"; -GRANT ALL ON TABLE "public"."agenda_slots_regras" TO "anon"; -GRANT ALL ON TABLE "public"."agenda_slots_regras" TO "authenticated"; -GRANT ALL ON TABLE "public"."agenda_slots_regras" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agendador_configuracoes" TO "postgres"; -GRANT ALL ON TABLE "public"."agendador_configuracoes" TO "anon"; -GRANT ALL ON TABLE "public"."agendador_configuracoes" TO "authenticated"; -GRANT ALL ON TABLE "public"."agendador_configuracoes" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."agendador_solicitacoes" TO "postgres"; -GRANT ALL ON TABLE "public"."agendador_solicitacoes" TO "anon"; -GRANT ALL ON TABLE "public"."agendador_solicitacoes" TO "authenticated"; -GRANT ALL ON TABLE "public"."agendador_solicitacoes" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."commitment_time_logs" TO "postgres"; -GRANT ALL ON TABLE "public"."commitment_time_logs" TO "anon"; -GRANT ALL ON TABLE "public"."commitment_time_logs" TO "authenticated"; -GRANT ALL ON TABLE "public"."commitment_time_logs" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."current_tenant_id" TO "postgres"; -GRANT ALL ON TABLE "public"."current_tenant_id" TO "anon"; -GRANT ALL ON TABLE "public"."current_tenant_id" TO "authenticated"; -GRANT ALL ON TABLE "public"."current_tenant_id" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."determined_commitment_fields" TO "postgres"; -GRANT ALL ON TABLE "public"."determined_commitment_fields" TO "anon"; -GRANT ALL ON TABLE "public"."determined_commitment_fields" TO "authenticated"; -GRANT ALL ON TABLE "public"."determined_commitment_fields" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."determined_commitments" TO "postgres"; -GRANT ALL ON TABLE "public"."determined_commitments" TO "anon"; -GRANT ALL ON TABLE "public"."determined_commitments" TO "authenticated"; -GRANT ALL ON TABLE "public"."determined_commitments" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."dev_user_credentials" TO "postgres"; -GRANT ALL ON TABLE "public"."dev_user_credentials" TO "anon"; -GRANT ALL ON TABLE "public"."dev_user_credentials" TO "authenticated"; -GRANT ALL ON TABLE "public"."dev_user_credentials" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."entitlements_invalidation" TO "postgres"; -GRANT ALL ON TABLE "public"."entitlements_invalidation" TO "anon"; -GRANT ALL ON TABLE "public"."entitlements_invalidation" TO "authenticated"; -GRANT ALL ON TABLE "public"."entitlements_invalidation" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."features" TO "postgres"; -GRANT ALL ON TABLE "public"."features" TO "anon"; -GRANT ALL ON TABLE "public"."features" TO "authenticated"; -GRANT ALL ON TABLE "public"."features" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."feriados" TO "postgres"; -GRANT ALL ON TABLE "public"."feriados" TO "anon"; -GRANT ALL ON TABLE "public"."feriados" TO "authenticated"; -GRANT ALL ON TABLE "public"."feriados" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."module_features" TO "postgres"; -GRANT ALL ON TABLE "public"."module_features" TO "anon"; -GRANT ALL ON TABLE "public"."module_features" TO "authenticated"; -GRANT ALL ON TABLE "public"."module_features" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."modules" TO "postgres"; -GRANT ALL ON TABLE "public"."modules" TO "anon"; -GRANT ALL ON TABLE "public"."modules" TO "authenticated"; -GRANT ALL ON TABLE "public"."modules" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."plan_features" TO "postgres"; -GRANT ALL ON TABLE "public"."plan_features" TO "anon"; -GRANT ALL ON TABLE "public"."plan_features" TO "authenticated"; -GRANT ALL ON TABLE "public"."plan_features" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."tenant_modules" TO "postgres"; -GRANT ALL ON TABLE "public"."tenant_modules" TO "anon"; -GRANT ALL ON TABLE "public"."tenant_modules" TO "authenticated"; -GRANT ALL ON TABLE "public"."tenant_modules" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."owner_feature_entitlements" TO "postgres"; -GRANT ALL ON TABLE "public"."owner_feature_entitlements" TO "anon"; -GRANT ALL ON TABLE "public"."owner_feature_entitlements" TO "authenticated"; -GRANT ALL ON TABLE "public"."owner_feature_entitlements" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."owner_users" TO "postgres"; -GRANT ALL ON TABLE "public"."owner_users" TO "anon"; -GRANT ALL ON TABLE "public"."owner_users" TO "authenticated"; -GRANT ALL ON TABLE "public"."owner_users" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patient_group_patient" TO "postgres"; -GRANT ALL ON TABLE "public"."patient_group_patient" TO "anon"; -GRANT ALL ON TABLE "public"."patient_group_patient" TO "authenticated"; -GRANT ALL ON TABLE "public"."patient_group_patient" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patient_groups" TO "postgres"; -GRANT ALL ON TABLE "public"."patient_groups" TO "anon"; -GRANT ALL ON TABLE "public"."patient_groups" TO "authenticated"; -GRANT ALL ON TABLE "public"."patient_groups" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patient_intake_requests" TO "postgres"; -GRANT ALL ON TABLE "public"."patient_intake_requests" TO "authenticated"; -GRANT ALL ON TABLE "public"."patient_intake_requests" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patient_invites" TO "postgres"; -GRANT ALL ON TABLE "public"."patient_invites" TO "authenticated"; -GRANT ALL ON TABLE "public"."patient_invites" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patient_patient_tag" TO "postgres"; -GRANT ALL ON TABLE "public"."patient_patient_tag" TO "anon"; -GRANT ALL ON TABLE "public"."patient_patient_tag" TO "authenticated"; -GRANT ALL ON TABLE "public"."patient_patient_tag" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patient_tags" TO "postgres"; -GRANT ALL ON TABLE "public"."patient_tags" TO "anon"; -GRANT ALL ON TABLE "public"."patient_tags" TO "authenticated"; -GRANT ALL ON TABLE "public"."patient_tags" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."patients" TO "postgres"; -GRANT ALL ON TABLE "public"."patients" TO "anon"; -GRANT ALL ON TABLE "public"."patients" TO "authenticated"; -GRANT ALL ON TABLE "public"."patients" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."plan_prices" TO "postgres"; -GRANT ALL ON TABLE "public"."plan_prices" TO "anon"; -GRANT ALL ON TABLE "public"."plan_prices" TO "authenticated"; -GRANT ALL ON TABLE "public"."plan_prices" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."plan_public" TO "postgres"; -GRANT ALL ON TABLE "public"."plan_public" TO "anon"; -GRANT ALL ON TABLE "public"."plan_public" TO "authenticated"; -GRANT ALL ON TABLE "public"."plan_public" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."plan_public_bullets" TO "postgres"; -GRANT ALL ON TABLE "public"."plan_public_bullets" TO "anon"; -GRANT ALL ON TABLE "public"."plan_public_bullets" TO "authenticated"; -GRANT ALL ON TABLE "public"."plan_public_bullets" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."plans" TO "postgres"; -GRANT ALL ON TABLE "public"."plans" TO "anon"; -GRANT ALL ON TABLE "public"."plans" TO "authenticated"; -GRANT ALL ON TABLE "public"."plans" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."profiles" TO "postgres"; -GRANT ALL ON TABLE "public"."profiles" TO "anon"; -GRANT ALL ON TABLE "public"."profiles" TO "authenticated"; -GRANT ALL ON TABLE "public"."profiles" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."recurrence_exceptions" TO "postgres"; -GRANT ALL ON TABLE "public"."recurrence_exceptions" TO "anon"; -GRANT ALL ON TABLE "public"."recurrence_exceptions" TO "authenticated"; -GRANT ALL ON TABLE "public"."recurrence_exceptions" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."recurrence_rules" TO "postgres"; -GRANT ALL ON TABLE "public"."recurrence_rules" TO "anon"; -GRANT ALL ON TABLE "public"."recurrence_rules" TO "authenticated"; -GRANT ALL ON TABLE "public"."recurrence_rules" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."saas_admins" TO "postgres"; -GRANT ALL ON TABLE "public"."saas_admins" TO "anon"; -GRANT ALL ON TABLE "public"."saas_admins" TO "authenticated"; -GRANT ALL ON TABLE "public"."saas_admins" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."saas_doc_votos" TO "postgres"; -GRANT ALL ON TABLE "public"."saas_doc_votos" TO "anon"; -GRANT ALL ON TABLE "public"."saas_doc_votos" TO "authenticated"; -GRANT ALL ON TABLE "public"."saas_doc_votos" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."saas_docs" TO "postgres"; -GRANT ALL ON TABLE "public"."saas_docs" TO "anon"; -GRANT ALL ON TABLE "public"."saas_docs" TO "authenticated"; -GRANT ALL ON TABLE "public"."saas_docs" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."saas_faq" TO "postgres"; -GRANT ALL ON TABLE "public"."saas_faq" TO "anon"; -GRANT ALL ON TABLE "public"."saas_faq" TO "authenticated"; -GRANT ALL ON TABLE "public"."saas_faq" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."saas_faq_itens" TO "postgres"; -GRANT ALL ON TABLE "public"."saas_faq_itens" TO "anon"; -GRANT ALL ON TABLE "public"."saas_faq_itens" TO "authenticated"; -GRANT ALL ON TABLE "public"."saas_faq_itens" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."subscription_events" TO "postgres"; -GRANT ALL ON TABLE "public"."subscription_events" TO "anon"; -GRANT ALL ON TABLE "public"."subscription_events" TO "authenticated"; -GRANT ALL ON TABLE "public"."subscription_events" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."subscription_intents_personal" TO "postgres"; -GRANT ALL ON TABLE "public"."subscription_intents_personal" TO "anon"; -GRANT ALL ON TABLE "public"."subscription_intents_personal" TO "authenticated"; -GRANT ALL ON TABLE "public"."subscription_intents_personal" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."subscription_intents_tenant" TO "postgres"; -GRANT ALL ON TABLE "public"."subscription_intents_tenant" TO "anon"; -GRANT ALL ON TABLE "public"."subscription_intents_tenant" TO "authenticated"; -GRANT ALL ON TABLE "public"."subscription_intents_tenant" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."subscription_intents" TO "postgres"; -GRANT ALL ON TABLE "public"."subscription_intents" TO "anon"; -GRANT ALL ON TABLE "public"."subscription_intents" TO "authenticated"; -GRANT ALL ON TABLE "public"."subscription_intents" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."subscription_intents_legacy" TO "postgres"; -GRANT ALL ON TABLE "public"."subscription_intents_legacy" TO "anon"; -GRANT ALL ON TABLE "public"."subscription_intents_legacy" TO "authenticated"; -GRANT ALL ON TABLE "public"."subscription_intents_legacy" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."tenant_feature_exceptions_log" TO "postgres"; -GRANT ALL ON TABLE "public"."tenant_feature_exceptions_log" TO "anon"; -GRANT ALL ON TABLE "public"."tenant_feature_exceptions_log" TO "authenticated"; -GRANT ALL ON TABLE "public"."tenant_feature_exceptions_log" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."tenant_features" TO "postgres"; -GRANT ALL ON TABLE "public"."tenant_features" TO "anon"; -GRANT ALL ON TABLE "public"."tenant_features" TO "authenticated"; -GRANT ALL ON TABLE "public"."tenant_features" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."tenant_invites" TO "postgres"; -GRANT ALL ON TABLE "public"."tenant_invites" TO "authenticated"; -GRANT ALL ON TABLE "public"."tenant_invites" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."tenants" TO "postgres"; -GRANT ALL ON TABLE "public"."tenants" TO "anon"; -GRANT ALL ON TABLE "public"."tenants" TO "authenticated"; -GRANT ALL ON TABLE "public"."tenants" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."user_settings" TO "postgres"; -GRANT ALL ON TABLE "public"."user_settings" TO "anon"; -GRANT ALL ON TABLE "public"."user_settings" TO "authenticated"; -GRANT ALL ON TABLE "public"."user_settings" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_auth_users_public" TO "postgres"; -GRANT ALL ON TABLE "public"."v_auth_users_public" TO "anon"; -GRANT ALL ON TABLE "public"."v_auth_users_public" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_auth_users_public" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_commitment_totals" TO "postgres"; -GRANT ALL ON TABLE "public"."v_commitment_totals" TO "anon"; -GRANT ALL ON TABLE "public"."v_commitment_totals" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_commitment_totals" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_patient_groups_with_counts" TO "postgres"; -GRANT ALL ON TABLE "public"."v_patient_groups_with_counts" TO "anon"; -GRANT ALL ON TABLE "public"."v_patient_groups_with_counts" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_patient_groups_with_counts" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_plan_active_prices" TO "postgres"; -GRANT ALL ON TABLE "public"."v_plan_active_prices" TO "anon"; -GRANT ALL ON TABLE "public"."v_plan_active_prices" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_plan_active_prices" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_public_pricing" TO "postgres"; -GRANT ALL ON TABLE "public"."v_public_pricing" TO "anon"; -GRANT ALL ON TABLE "public"."v_public_pricing" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_public_pricing" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_subscription_feature_mismatch" TO "postgres"; -GRANT ALL ON TABLE "public"."v_subscription_feature_mismatch" TO "anon"; -GRANT ALL ON TABLE "public"."v_subscription_feature_mismatch" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_subscription_feature_mismatch" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_subscription_health" TO "postgres"; -GRANT ALL ON TABLE "public"."v_subscription_health" TO "anon"; -GRANT ALL ON TABLE "public"."v_subscription_health" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_subscription_health" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_subscription_health_v2" TO "postgres"; -GRANT ALL ON TABLE "public"."v_subscription_health_v2" TO "anon"; -GRANT ALL ON TABLE "public"."v_subscription_health_v2" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_subscription_health_v2" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tag_patient_counts" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tag_patient_counts" TO "anon"; -GRANT ALL ON TABLE "public"."v_tag_patient_counts" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tag_patient_counts" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_active_subscription" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_active_subscription" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_active_subscription" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_active_subscription" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_entitlements" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_entitlements_full" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements_full" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements_full" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements_full" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_entitlements_json" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements_json" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements_json" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_entitlements_json" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_feature_exceptions" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_feature_exceptions" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_feature_exceptions" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_feature_exceptions" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_feature_mismatch" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_feature_mismatch" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_feature_mismatch" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_feature_mismatch" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_members_with_profiles" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_members_with_profiles" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_members_with_profiles" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_members_with_profiles" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_people" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_people" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_people" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_people" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_tenant_staff" TO "postgres"; -GRANT ALL ON TABLE "public"."v_tenant_staff" TO "anon"; -GRANT ALL ON TABLE "public"."v_tenant_staff" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_tenant_staff" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_user_active_subscription" TO "postgres"; -GRANT ALL ON TABLE "public"."v_user_active_subscription" TO "anon"; -GRANT ALL ON TABLE "public"."v_user_active_subscription" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_user_active_subscription" TO "service_role"; - - - -GRANT ALL ON TABLE "public"."v_user_entitlements" TO "postgres"; -GRANT ALL ON TABLE "public"."v_user_entitlements" TO "anon"; -GRANT ALL ON TABLE "public"."v_user_entitlements" TO "authenticated"; -GRANT ALL ON TABLE "public"."v_user_entitlements" TO "service_role"; - - - - - - - - - -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role"; - - - - - - -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role"; - - - - - - -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated"; -ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role"; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DBS/2026-03-11/root/schema.sql b/DBS/2026-03-11/root/schema.sql deleted file mode 100644 index 06441f8..0000000 Binary files a/DBS/2026-03-11/root/schema.sql and /dev/null differ diff --git a/DBS/2026-03-11/src-sql-arquivos/01_profiles.sql b/DBS/2026-03-11/src-sql-arquivos/01_profiles.sql deleted file mode 100644 index ff1694d..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/01_profiles.sql +++ /dev/null @@ -1,110 +0,0 @@ --- ========================================================= --- Agência PSI — Profiles (v2) + Trigger + RLS --- - 1 profile por auth.users.id --- - role base (admin|therapist|patient) --- - pronto para evoluir p/ multi-tenant depois --- ========================================================= - --- 0) Função padrão updated_at (se já existir, mantém) -create or replace function public.set_updated_at() -returns trigger -language plpgsql -as $$ -begin - new.updated_at = now(); - return new; -end; -$$; - --- 1) Tabela profiles -create table if not exists public.profiles ( - id uuid primary key, -- = auth.users.id - email text, - full_name text, - avatar_url text, - - role text not null default 'patient', - status text not null default 'active', - - created_at timestamptz not null default now(), - updated_at timestamptz not null default now(), - - constraint profiles_role_check check (role in ('admin','therapist','patient')), - constraint profiles_status_check check (status in ('active','inactive','invited')) -); - --- FK opcional (em Supabase costuma ser ok) -do $$ -begin - if not exists ( - select 1 - from pg_constraint - where conname = 'profiles_id_fkey' - ) then - alter table public.profiles - add constraint profiles_id_fkey - foreign key (id) references auth.users(id) - on delete cascade; - end if; -end $$; - --- Índices úteis -create index if not exists profiles_role_idx on public.profiles(role); -create index if not exists profiles_status_idx on public.profiles(status); - --- 2) Trigger updated_at -drop trigger if exists t_profiles_set_updated_at on public.profiles; -create trigger t_profiles_set_updated_at -before update on public.profiles -for each row execute function public.set_updated_at(); - --- 3) Trigger pós-signup: cria profile automático --- Observação: roda como SECURITY DEFINER -create or replace function public.handle_new_user() -returns trigger -language plpgsql -security definer -set search_path = public -as $$ -begin - insert into public.profiles (id, email, role, status) - values (new.id, new.email, 'patient', 'active') - on conflict (id) do update - set email = excluded.email; - - return new; -end; -$$; - -drop trigger if exists on_auth_user_created on auth.users; -create trigger on_auth_user_created -after insert on auth.users -for each row execute function public.handle_new_user(); - --- 4) RLS -alter table public.profiles enable row level security; - --- Leitura do próprio profile -drop policy if exists "profiles_select_own" on public.profiles; -create policy "profiles_select_own" -on public.profiles -for select -to authenticated -using (id = auth.uid()); - --- Update do próprio profile (campos não-sensíveis) -drop policy if exists "profiles_update_own" on public.profiles; -create policy "profiles_update_own" -on public.profiles -for update -to authenticated -using (id = auth.uid()) -with check (id = auth.uid()); - --- Insert só do próprio (na prática quem insere é trigger, mas deixa coerente) -drop policy if exists "profiles_insert_own" on public.profiles; -create policy "profiles_insert_own" -on public.profiles -for insert -to authenticated -with check (id = auth.uid()); diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_cadastro_externo.sql b/DBS/2026-03-11/src-sql-arquivos/supabase_cadastro_externo.sql deleted file mode 100644 index e9b170f..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/supabase_cadastro_externo.sql +++ /dev/null @@ -1,212 +0,0 @@ --- ========================================================= --- Agência PSI Quasar — Cadastro Externo de Paciente (Supabase/Postgres) --- Objetivo: --- - Ter um link público com TOKEN que o terapeuta envia ao paciente --- - Paciente preenche um formulário público --- - Salva em "intake requests" (pré-cadastro) --- - Terapeuta revisa e converte em paciente dentro do sistema --- --- Tabelas: --- - patient_invites --- - patient_intake_requests --- --- Funções: --- - create_patient_intake_request (RPC pública - anon) --- --- Segurança: --- - RLS habilitada --- - Público (anon) não lê nada, só executa RPC --- - Terapeuta (authenticated) lê/atualiza somente seus registros --- ========================================================= - --- 0) Tabelas -create table if not exists public.patient_invites ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null, - token text not null unique, - active boolean not null default true, - expires_at timestamptz null, - max_uses int null, - uses int not null default 0, - created_at timestamptz not null default now() -); - -create index if not exists patient_invites_owner_id_idx on public.patient_invites(owner_id); -create index if not exists patient_invites_token_idx on public.patient_invites(token); - -create table if not exists public.patient_intake_requests ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null, - token text not null, - name text not null, - email text null, - phone text null, - notes text null, - consent boolean not null default false, - status text not null default 'new', -- new | converted | rejected - created_at timestamptz not null default now() -); - -create index if not exists patient_intake_owner_id_idx on public.patient_intake_requests(owner_id); -create index if not exists patient_intake_token_idx on public.patient_intake_requests(token); -create index if not exists patient_intake_status_idx on public.patient_intake_requests(status); - --- 1) RLS -alter table public.patient_invites enable row level security; -alter table public.patient_intake_requests enable row level security; - --- 2) Fechar acesso direto para anon (público) -revoke all on table public.patient_invites from anon; -revoke all on table public.patient_intake_requests from anon; - --- 3) Policies: terapeuta (authenticated) - somente próprios registros - --- patient_invites -drop policy if exists invites_select_own on public.patient_invites; -create policy invites_select_own -on public.patient_invites for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists invites_insert_own on public.patient_invites; -create policy invites_insert_own -on public.patient_invites for insert -to authenticated -with check (owner_id = auth.uid()); - -drop policy if exists invites_update_own on public.patient_invites; -create policy invites_update_own -on public.patient_invites for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - --- patient_intake_requests -drop policy if exists intake_select_own on public.patient_intake_requests; -create policy intake_select_own -on public.patient_intake_requests for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists intake_update_own on public.patient_intake_requests; -create policy intake_update_own -on public.patient_intake_requests for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - --- 4) RPC pública para criar intake (página pública) --- Importantíssimo: security definer + search_path fixo -create or replace function public.create_patient_intake_request( - p_token text, - p_name text, - p_email text default null, - p_phone text default null, - p_notes text default null, - p_consent boolean default false -) -returns uuid -language plpgsql -security definer -set search_path = public -as $$ -declare - v_owner uuid; - v_active boolean; - v_expires timestamptz; - v_max_uses int; - v_uses int; - v_id uuid; -begin - select owner_id, active, expires_at, max_uses, uses - into v_owner, v_active, v_expires, v_max_uses, v_uses - from public.patient_invites - where token = p_token - limit 1; - - if v_owner is null then - raise exception 'Token inválido'; - end if; - - if v_active is not true then - raise exception 'Link desativado'; - end if; - - if v_expires is not null and now() > v_expires then - raise exception 'Link expirado'; - end if; - - if v_max_uses is not null and v_uses >= v_max_uses then - raise exception 'Limite de uso atingido'; - end if; - - if p_name is null or length(trim(p_name)) = 0 then - raise exception 'Nome é obrigatório'; - end if; - - insert into public.patient_intake_requests - (owner_id, token, name, email, phone, notes, consent, status) - values - (v_owner, p_token, trim(p_name), - nullif(lower(trim(p_email)), ''), - nullif(trim(p_phone), ''), - nullif(trim(p_notes), ''), - coalesce(p_consent, false), - 'new') - returning id into v_id; - - update public.patient_invites - set uses = uses + 1 - where token = p_token; - - return v_id; -end; -$$; - -grant execute on function public.create_patient_intake_request(text, text, text, text, text, boolean) to anon; -grant execute on function public.create_patient_intake_request(text, text, text, text, text, boolean) to authenticated; - --- 5) (Opcional) helper para rotacionar token no painel (somente authenticated) --- Você pode usar no front via supabase.rpc('rotate_patient_invite_token') -create or replace function public.rotate_patient_invite_token( - p_new_token text -) -returns uuid -language plpgsql -security definer -set search_path = public -as $$ -declare - v_uid uuid; - v_id uuid; -begin - -- pega o usuário logado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Usuário não autenticado'; - end if; - - -- desativa tokens antigos ativos do usuário - update public.patient_invites - set active = false - where owner_id = v_uid - and active = true; - - -- cria novo token - insert into public.patient_invites (owner_id, token, active) - values (v_uid, p_new_token, true) - returning id into v_id; - - return v_id; -end; -$$; - -grant execute on function public.rotate_patient_invite_token(text) to authenticated; - -grant select, insert, update, delete on table public.patient_invites to authenticated; -grant select, insert, update, delete on table public.patient_intake_requests to authenticated; - --- anon não precisa acessar tabelas diretamente -revoke all on table public.patient_invites from anon; -revoke all on table public.patient_intake_requests from anon; - diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_cadastro_pacientes.sql b/DBS/2026-03-11/src-sql-arquivos/supabase_cadastro_pacientes.sql deleted file mode 100644 index 4eb0d54..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/supabase_cadastro_pacientes.sql +++ /dev/null @@ -1,266 +0,0 @@ --- ========================================================= --- PATCH — Completar cadastro para bater com PatientsCadastroPage.vue --- (rode DEPOIS do seu supabase_cadastro_pacientes.sql) --- ========================================================= - -create extension if not exists pgcrypto; - --- --------------------------------------------------------- --- 1) Completar colunas que o front usa e hoje faltam em patients --- --------------------------------------------------------- -do $$ -begin - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='email_alt' - ) then - alter table public.patients add column email_alt text; - end if; - - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='phones' - ) then - -- array de textos (Postgres). No JS você manda ["...","..."] normalmente. - alter table public.patients add column phones text[]; - end if; - - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='gender' - ) then - alter table public.patients add column gender text; - end if; - - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='marital_status' - ) then - alter table public.patients add column marital_status text; - end if; -end $$; - --- (opcional) índices úteis pra busca/filtro por nome/email -create index if not exists idx_patients_owner_name on public.patients(owner_id, name); -create index if not exists idx_patients_owner_email on public.patients(owner_id, email); - --- --------------------------------------------------------- --- 2) patient_groups --- --------------------------------------------------------- -create table if not exists public.patient_groups ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null references auth.users(id) on delete cascade, - name text not null, - color text, - is_system boolean not null default false, - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - --- nome único por owner -do $$ -begin - if not exists ( - select 1 from pg_constraint - where conname = 'patient_groups_owner_name_uniq' - and conrelid = 'public.patient_groups'::regclass - ) then - alter table public.patient_groups - add constraint patient_groups_owner_name_uniq unique(owner_id, name); - end if; -end $$; - -drop trigger if exists trg_patient_groups_set_updated_at on public.patient_groups; -create trigger trg_patient_groups_set_updated_at -before update on public.patient_groups -for each row execute function public.set_updated_at(); - -create index if not exists idx_patient_groups_owner on public.patient_groups(owner_id); - -alter table public.patient_groups enable row level security; - -drop policy if exists "patient_groups_select_own" on public.patient_groups; -create policy "patient_groups_select_own" -on public.patient_groups for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists "patient_groups_insert_own" on public.patient_groups; -create policy "patient_groups_insert_own" -on public.patient_groups for insert -to authenticated -with check (owner_id = auth.uid()); - -drop policy if exists "patient_groups_update_own" on public.patient_groups; -create policy "patient_groups_update_own" -on public.patient_groups for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - -drop policy if exists "patient_groups_delete_own" on public.patient_groups; -create policy "patient_groups_delete_own" -on public.patient_groups for delete -to authenticated -using (owner_id = auth.uid()); - -grant select, insert, update, delete on public.patient_groups to authenticated; - --- --------------------------------------------------------- --- 3) patient_tags --- --------------------------------------------------------- -create table if not exists public.patient_tags ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null references auth.users(id) on delete cascade, - name text not null, - color text, - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - -do $$ -begin - if not exists ( - select 1 from pg_constraint - where conname = 'patient_tags_owner_name_uniq' - and conrelid = 'public.patient_tags'::regclass - ) then - alter table public.patient_tags - add constraint patient_tags_owner_name_uniq unique(owner_id, name); - end if; -end $$; - -drop trigger if exists trg_patient_tags_set_updated_at on public.patient_tags; -create trigger trg_patient_tags_set_updated_at -before update on public.patient_tags -for each row execute function public.set_updated_at(); - -create index if not exists idx_patient_tags_owner on public.patient_tags(owner_id); - -alter table public.patient_tags enable row level security; - -drop policy if exists "patient_tags_select_own" on public.patient_tags; -create policy "patient_tags_select_own" -on public.patient_tags for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists "patient_tags_insert_own" on public.patient_tags; -create policy "patient_tags_insert_own" -on public.patient_tags for insert -to authenticated -with check (owner_id = auth.uid()); - -drop policy if exists "patient_tags_update_own" on public.patient_tags; -create policy "patient_tags_update_own" -on public.patient_tags for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - -drop policy if exists "patient_tags_delete_own" on public.patient_tags; -create policy "patient_tags_delete_own" -on public.patient_tags for delete -to authenticated -using (owner_id = auth.uid()); - -grant select, insert, update, delete on public.patient_tags to authenticated; - --- --------------------------------------------------------- --- 4) pivôs (patient_group_patient / patient_patient_tag) --- --------------------------------------------------------- -create table if not exists public.patient_group_patient ( - patient_id uuid not null references public.patients(id) on delete cascade, - patient_group_id uuid not null references public.patient_groups(id) on delete cascade, - created_at timestamptz not null default now(), - primary key (patient_id, patient_group_id) -); - -create index if not exists idx_pgp_patient on public.patient_group_patient(patient_id); -create index if not exists idx_pgp_group on public.patient_group_patient(patient_group_id); - -alter table public.patient_group_patient enable row level security; - --- a pivot “herda” tenant via join; policy usando exists pra validar owner do patient -drop policy if exists "pgp_select_own" on public.patient_group_patient; -create policy "pgp_select_own" -on public.patient_group_patient for select -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_group_patient.patient_id - and p.owner_id = auth.uid() - ) -); - -drop policy if exists "pgp_write_own" on public.patient_group_patient; -create policy "pgp_write_own" -on public.patient_group_patient for all -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_group_patient.patient_id - and p.owner_id = auth.uid() - ) -) -with check ( - exists ( - select 1 from public.patients p - where p.id = patient_group_patient.patient_id - and p.owner_id = auth.uid() - ) -); - -grant select, insert, update, delete on public.patient_group_patient to authenticated; - --- tags pivot (ATENÇÃO: coluna é tag_id, como teu Vue usa!) -create table if not exists public.patient_patient_tag ( - patient_id uuid not null references public.patients(id) on delete cascade, - tag_id uuid not null references public.patient_tags(id) on delete cascade, - created_at timestamptz not null default now(), - primary key (patient_id, tag_id) -); - -create index if not exists idx_ppt_patient on public.patient_patient_tag(patient_id); -create index if not exists idx_ppt_tag on public.patient_patient_tag(tag_id); - -alter table public.patient_patient_tag enable row level security; - -drop policy if exists "ppt_select_own" on public.patient_patient_tag; -create policy "ppt_select_own" -on public.patient_patient_tag for select -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_patient_tag.patient_id - and p.owner_id = auth.uid() - ) -); - -drop policy if exists "ppt_write_own" on public.patient_patient_tag; -create policy "ppt_write_own" -on public.patient_patient_tag for all -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_patient_tag.patient_id - and p.owner_id = auth.uid() - ) -) -with check ( - exists ( - select 1 from public.patients p - where p.id = patient_patient_tag.patient_id - and p.owner_id = auth.uid() - ) -); - -grant select, insert, update, delete on public.patient_patient_tag to authenticated; - --- ========================================================= --- FIM PATCH --- ========================================================= diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_cadastros_recebidos(intakes).sql b/DBS/2026-03-11/src-sql-arquivos/supabase_cadastros_recebidos(intakes).sql deleted file mode 100644 index 3e43d42..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/supabase_cadastros_recebidos(intakes).sql +++ /dev/null @@ -1,105 +0,0 @@ --- ========================================================= --- INTakes / Cadastros Recebidos - Supabase Local --- ========================================================= - --- 0) Extensões úteis (geralmente já existem no Supabase, mas é seguro) -create extension if not exists pgcrypto; - --- 1) Função padrão para updated_at -create or replace function public.set_updated_at() -returns trigger -language plpgsql -as $$ -begin - new.updated_at = now(); - return new; -end; -$$; - --- 2) Tabela patient_intake_requests (espelhando nuvem) -create table if not exists public.patient_intake_requests ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null, - token text, - name text, - email text, - phone text, - notes text, - consent boolean not null default false, - status text not null default 'new', - created_at timestamptz not null default now(), - updated_at timestamptz not null default now(), - payload jsonb -); - --- 3) Índices (performance em listagem e filtros) -create index if not exists idx_intakes_owner_created - on public.patient_intake_requests (owner_id, created_at desc); - -create index if not exists idx_intakes_owner_status_created - on public.patient_intake_requests (owner_id, status, created_at desc); - -create index if not exists idx_intakes_status_created - on public.patient_intake_requests (status, created_at desc); - --- 4) Trigger updated_at -drop trigger if exists trg_patient_intake_requests_updated_at on public.patient_intake_requests; - -create trigger trg_patient_intake_requests_updated_at -before update on public.patient_intake_requests -for each row execute function public.set_updated_at(); - --- 5) RLS -alter table public.patient_intake_requests enable row level security; - --- 6) Policies (iguais às que você mostrou na nuvem) -drop policy if exists intake_select_own on public.patient_intake_requests; -create policy intake_select_own -on public.patient_intake_requests -for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists intake_update_own on public.patient_intake_requests; -create policy intake_update_own -on public.patient_intake_requests -for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - -drop policy if exists "delete own intake requests" on public.patient_intake_requests; -create policy "delete own intake requests" -on public.patient_intake_requests -for delete -to authenticated -using (owner_id = auth.uid()); - --- ========================================================= --- OPCIONAL (RECOMENDADO): registrar conversão --- ========================================================= --- Se você pretende marcar intake como convertido e guardar o patient_id: -alter table public.patient_intake_requests - add column if not exists converted_patient_id uuid; - -create index if not exists idx_intakes_converted_patient_id - on public.patient_intake_requests (converted_patient_id); - --- Opcional: impedir delete de intakes convertidos (melhor para auditoria) --- (Se quiser manter delete liberado como na nuvem, comente este bloco.) -drop policy if exists "delete own intake requests" on public.patient_intake_requests; -create policy "delete_own_intakes_not_converted" -on public.patient_intake_requests -for delete -to authenticated -using (owner_id = auth.uid() and status <> 'converted'); - --- ========================================================= --- OPCIONAL: check de status (evita status inválido) --- ========================================================= -alter table public.patient_intake_requests - drop constraint if exists chk_intakes_status; - -alter table public.patient_intake_requests - add constraint chk_intakes_status - check (status in ('new', 'converted', 'rejected')); diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_patient_groups.sql b/DBS/2026-03-11/src-sql-arquivos/supabase_patient_groups.sql deleted file mode 100644 index 08070b4..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/supabase_patient_groups.sql +++ /dev/null @@ -1,174 +0,0 @@ -/* - patient_groups_setup.sql - Setup completo para: - - public.patient_groups - - public.patient_group_patient (tabela ponte) - - view public.v_patient_groups_with_counts - - índice único por owner + nome (case-insensitive) - - 3 grupos padrão do sistema (Crianças, Adolescentes, Idosos) NÃO editáveis / NÃO removíveis - - triggers de proteção - - Observação (importante): - - Os grupos padrão são criados com owner_id = '00000000-0000-0000-0000-000000000000' (SYSTEM_OWNER), - para ficarem "globais" e não dependerem de auth.uid() em migrations. - - Se você quiser que os grupos padrão pertençam a um owner específico (tenant), - basta trocar o SYSTEM_OWNER abaixo por esse UUID. -*/ - -begin; - --- =========================== --- 0) Constante de "dono do sistema" --- =========================== --- Troque aqui se você quiser que os grupos padrão pertençam a um owner específico. --- Ex.: '816b24fe-a0c3-4409-b79b-c6c0a6935d03' -do $$ -begin - -- só para documentar; não cria nada -end $$; - --- =========================== --- 1) Tabela principal: patient_groups --- =========================== -create table if not exists public.patient_groups ( - id uuid primary key default gen_random_uuid(), - name text not null, - description text, - color text, - is_active boolean not null default true, - is_system boolean not null default false, - owner_id uuid not null, - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - --- (Opcional, mas recomendado) Garante que name não seja só espaços --- e evita nomes vazios. -alter table public.patient_groups - drop constraint if exists patient_groups_name_not_blank_check; - -alter table public.patient_groups - add constraint patient_groups_name_not_blank_check - check (length(btrim(name)) > 0); - --- =========================== --- 2) Tabela ponte: patient_group_patient --- =========================== --- Se você já tiver essa tabela com FKs, ajuste aqui conforme seu schema. -create table if not exists public.patient_group_patient ( - patient_group_id uuid not null references public.patient_groups(id) on delete cascade, - patient_id uuid not null references public.patients(id) on delete cascade, - created_at timestamptz not null default now() -); - --- Evita duplicar vínculo paciente<->grupo -create unique index if not exists patient_group_patient_unique -on public.patient_group_patient (patient_group_id, patient_id); - --- =========================== --- 3) View com contagem --- =========================== -create or replace view public.v_patient_groups_with_counts as -select - g.*, - coalesce(count(distinct pgp.patient_id), 0)::int as patients_count -from public.patient_groups g -left join public.patient_group_patient pgp - on pgp.patient_group_id = g.id -group by g.id; - --- =========================== --- 4) Índice único: não permitir mesmo nome por owner (case-insensitive) --- =========================== --- Atenção: se já existirem duplicados, este índice pode falhar ao criar. -create unique index if not exists patient_groups_owner_name_unique -on public.patient_groups (owner_id, (lower(name))); - --- =========================== --- 5) Triggers de proteção: system não edita / não remove --- =========================== -create or replace function public.prevent_system_group_changes() -returns trigger -language plpgsql -as $$ -begin - if old.is_system = true then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - if tg_op = 'DELETE' then - return old; - end if; - - return new; -end; -$$; - -drop trigger if exists trg_prevent_system_group_changes on public.patient_groups; - -create trigger trg_prevent_system_group_changes -before update or delete on public.patient_groups -for each row -execute function public.prevent_system_group_changes(); - --- Impede "promover" um grupo comum para system -create or replace function public.prevent_promoting_to_system() -returns trigger -language plpgsql -as $$ -begin - if new.is_system = true and old.is_system is distinct from true then - raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.'; - end if; - return new; -end; -$$; - -drop trigger if exists trg_prevent_promoting_to_system on public.patient_groups; - -create trigger trg_prevent_promoting_to_system -before update on public.patient_groups -for each row -execute function public.prevent_promoting_to_system(); - --- =========================== --- 6) Inserir 3 grupos padrão (imutáveis) --- =========================== --- Dono "global" do sistema (mude se quiser): --- 00000000-0000-0000-0000-000000000000 -with sys_owner as ( - select '00000000-0000-0000-0000-000000000000'::uuid as owner_id -) -insert into public.patient_groups (name, description, color, is_active, is_system, owner_id) -select v.name, v.description, v.color, v.is_active, v.is_system, s.owner_id -from sys_owner s -join (values - ('Crianças', 'Grupo padrão do sistema', null, true, true), - ('Adolescentes', 'Grupo padrão do sistema', null, true, true), - ('Idosos', 'Grupo padrão do sistema', null, true, true) -) as v(name, description, color, is_active, is_system) -on true -where not exists ( - select 1 - from public.patient_groups g - where g.owner_id = s.owner_id - and lower(g.name) = lower(v.name) -); - -commit; - -/* - Testes rápidos: - 1) Ver tudo: - select * from public.v_patient_groups_with_counts order by is_system desc, name; - - 2) Tentar editar um system (deve falhar): - update public.patient_groups set name='X' where name='Crianças'; - - 3) Tentar deletar um system (deve falhar): - delete from public.patient_groups where name='Crianças'; - - 4) Tentar duplicar nome no mesmo owner (deve falhar por índice único): - insert into public.patient_groups (name, is_active, is_system, owner_id) - values ('teste22', true, false, '816b24fe-a0c3-4409-b79b-c6c0a6935d03'); -*/ diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_patient_index_page.sql b/DBS/2026-03-11/src-sql-arquivos/supabase_patient_index_page.sql deleted file mode 100644 index 6a6dbd5..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/supabase_patient_index_page.sql +++ /dev/null @@ -1,147 +0,0 @@ --- ========================================================= --- pacientesIndexPage.sql --- Views + índices para a tela PatientsListPage --- ========================================================= - --- 0) Extensões úteis -create extension if not exists pg_trgm; - --- 1) updated_at automático (se você quiser manter updated_at sempre correto) -create or replace function public.set_updated_at() -returns trigger -language plpgsql -as $$ -begin - new.updated_at = now(); - return new; -end; -$$; - -drop trigger if exists trg_patients_set_updated_at on public.patients; -create trigger trg_patients_set_updated_at -before update on public.patients -for each row execute function public.set_updated_at(); - - --- ========================================================= --- 2) Views de contagem (usadas em KPIs e telas auxiliares) --- ========================================================= - --- 2.1) Grupos com contagem de pacientes -create or replace view public.v_patient_groups_with_counts as -select - g.id, - g.name, - g.color, - coalesce(count(pgp.patient_id), 0)::int as patients_count -from public.patient_groups g -left join public.patient_group_patient pgp - on pgp.patient_group_id = g.id -group by g.id, g.name, g.color; - --- 2.2) Tags com contagem de pacientes -create or replace view public.v_tag_patient_counts as -select - t.id, - t.name, - t.color, - coalesce(count(ppt.patient_id), 0)::int as patients_count -from public.patient_tags t -left join public.patient_patient_tag ppt - on ppt.tag_id = t.id -group by t.id, t.name, t.color; - - --- ========================================================= --- 3) View principal da Index (pacientes + grupos/tags agregados) --- ========================================================= - -create or replace view public.v_patients_index as -select - p.*, - - -- array JSON com os grupos do paciente - coalesce(gx.groups, '[]'::jsonb) as groups, - - -- array JSON com as tags do paciente - coalesce(tx.tags, '[]'::jsonb) as tags, - - -- contagens para UI/KPIs - coalesce(gx.groups_count, 0)::int as groups_count, - coalesce(tx.tags_count, 0)::int as tags_count - -from public.patients p - -left join lateral ( - select - jsonb_agg( - distinct jsonb_build_object( - 'id', g.id, - 'name', g.name, - 'color', g.color - ) - ) filter (where g.id is not null) as groups, - count(distinct g.id) as groups_count - from public.patient_group_patient pgp - join public.patient_groups g - on g.id = pgp.patient_group_id - where pgp.patient_id = p.id -) gx on true - -left join lateral ( - select - jsonb_agg( - distinct jsonb_build_object( - 'id', t.id, - 'name', t.name, - 'color', t.color - ) - ) filter (where t.id is not null) as tags, - count(distinct t.id) as tags_count - from public.patient_patient_tag ppt - join public.patient_tags t - on t.id = ppt.tag_id - where ppt.patient_id = p.id -) tx on true; - - --- ========================================================= --- 4) Índices recomendados (performance real na listagem/filtros) --- ========================================================= - --- Patients -create index if not exists idx_patients_owner_id - on public.patients (owner_id); - -create index if not exists idx_patients_created_at - on public.patients (created_at desc); - -create index if not exists idx_patients_status - on public.patients (status); - -create index if not exists idx_patients_last_attended_at - on public.patients (last_attended_at desc); - --- Busca rápida (name/email/phone) -create index if not exists idx_patients_name_trgm - on public.patients using gin (name gin_trgm_ops); - -create index if not exists idx_patients_email_trgm - on public.patients using gin (email gin_trgm_ops); - -create index if not exists idx_patients_phone_trgm - on public.patients using gin (phone gin_trgm_ops); - --- Pivot: grupos -create index if not exists idx_pgp_patient_id - on public.patient_group_patient (patient_id); - -create index if not exists idx_pgp_group_id - on public.patient_group_patient (patient_group_id); - --- Pivot: tags -create index if not exists idx_ppt_patient_id - on public.patient_patient_tag (patient_id); - -create index if not exists idx_ppt_tag_id - on public.patient_patient_tag (tag_id); diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_patients_populate.sql b/DBS/2026-03-11/src-sql-arquivos/supabase_patients_populate.sql deleted file mode 100644 index e69de29..0000000 diff --git a/DBS/2026-03-11/src-sql-arquivos/supabase_tags.sql b/DBS/2026-03-11/src-sql-arquivos/supabase_tags.sql deleted file mode 100644 index 42668af..0000000 --- a/DBS/2026-03-11/src-sql-arquivos/supabase_tags.sql +++ /dev/null @@ -1,134 +0,0 @@ -create extension if not exists pgcrypto; - --- =============================== --- TABELA: patient_tags --- =============================== -create table if not exists public.patient_tags ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null, - name text not null, - color text, - is_native boolean not null default false, - created_at timestamptz not null default now(), - updated_at timestamptz -); - -create unique index if not exists patient_tags_owner_name_uq - on public.patient_tags (owner_id, lower(name)); - --- =============================== --- TABELA: patient_patient_tag (pivot) --- =============================== -create table if not exists public.patient_patient_tag ( - owner_id uuid not null, - patient_id uuid not null, - tag_id uuid not null, - created_at timestamptz not null default now(), - primary key (patient_id, tag_id) -); - -create index if not exists ppt_owner_idx on public.patient_patient_tag(owner_id); -create index if not exists ppt_tag_idx on public.patient_patient_tag(tag_id); -create index if not exists ppt_patient_idx on public.patient_patient_tag(patient_id); - --- =============================== --- FOREIGN KEYS (com checagem) --- =============================== -do $$ -begin - if not exists ( - select 1 from pg_constraint - where conname = 'ppt_tag_fk' - and conrelid = 'public.patient_patient_tag'::regclass - ) then - alter table public.patient_patient_tag - add constraint ppt_tag_fk - foreign key (tag_id) - references public.patient_tags(id) - on delete cascade; - end if; -end $$; - -do $$ -begin - if not exists ( - select 1 from pg_constraint - where conname = 'ppt_patient_fk' - and conrelid = 'public.patient_patient_tag'::regclass - ) then - alter table public.patient_patient_tag - add constraint ppt_patient_fk - foreign key (patient_id) - references public.patients(id) - on delete cascade; - end if; -end $$; - --- =============================== --- VIEW: contagem por tag --- =============================== -create or replace view public.v_tag_patient_counts as -select - t.id, - t.owner_id, - t.name, - t.color, - t.is_native, - t.created_at, - t.updated_at, - coalesce(count(ppt.patient_id), 0)::int as patient_count -from public.patient_tags t -left join public.patient_patient_tag ppt - on ppt.tag_id = t.id - and ppt.owner_id = t.owner_id -group by - t.id, t.owner_id, t.name, t.color, t.is_native, t.created_at, t.updated_at; - --- =============================== --- RLS --- =============================== -alter table public.patient_tags enable row level security; -alter table public.patient_patient_tag enable row level security; - -drop policy if exists tags_select_own on public.patient_tags; -create policy tags_select_own -on public.patient_tags -for select -using (owner_id = auth.uid()); - -drop policy if exists tags_insert_own on public.patient_tags; -create policy tags_insert_own -on public.patient_tags -for insert -with check (owner_id = auth.uid()); - -drop policy if exists tags_update_own on public.patient_tags; -create policy tags_update_own -on public.patient_tags -for update -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - -drop policy if exists tags_delete_own on public.patient_tags; -create policy tags_delete_own -on public.patient_tags -for delete -using (owner_id = auth.uid()); - -drop policy if exists ppt_select_own on public.patient_patient_tag; -create policy ppt_select_own -on public.patient_patient_tag -for select -using (owner_id = auth.uid()); - -drop policy if exists ppt_insert_own on public.patient_patient_tag; -create policy ppt_insert_own -on public.patient_patient_tag -for insert -with check (owner_id = auth.uid()); - -drop policy if exists ppt_delete_own on public.patient_patient_tag; -create policy ppt_delete_own -on public.patient_patient_tag -for delete -using (owner_id = auth.uid()); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 116.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 116.sql deleted file mode 100644 index a623ce1..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 116.sql +++ /dev/null @@ -1,2 +0,0 @@ - ALTER TABLE public.agenda_configuracoes DROP COLUMN IF EXISTS - session_start_offset_min; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 130.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 130.sql deleted file mode 100644 index 9262341..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 130.sql +++ /dev/null @@ -1 +0,0 @@ -select pg_get_functiondef('public.NOME_DA_FUNCAO(args_aqui)'::regprocedure); \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 132.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 132.sql deleted file mode 100644 index 4e31c77..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 132.sql +++ /dev/null @@ -1,45 +0,0 @@ --- 1) Tabela profiles -create table if not exists public.profiles ( - id uuid primary key references auth.users(id) on delete cascade, - role text not null default 'patient' check (role in ('admin','therapist','patient')), - full_name text, - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - --- 2) updated_at automático -create or replace function public.set_updated_at() -returns trigger -language plpgsql -as $$ -begin - new.updated_at = now(); - return new; -end; -$$; - -drop trigger if exists trg_profiles_updated_at on public.profiles; -create trigger trg_profiles_updated_at -before update on public.profiles -for each row execute function public.set_updated_at(); - --- 3) Trigger: cria profile automaticamente quando usuário nasce no auth -create or replace function public.handle_new_user() -returns trigger -language plpgsql -security definer -set search_path = public -as $$ -begin - insert into public.profiles (id, role) - values (new.id, 'patient') - on conflict (id) do nothing; - - return new; -end; -$$; - -drop trigger if exists on_auth_user_created on auth.users; -create trigger on_auth_user_created -after insert on auth.users -for each row execute function public.handle_new_user(); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 157.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 157.sql deleted file mode 100644 index e6e3802..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 157.sql +++ /dev/null @@ -1,20 +0,0 @@ -do $$ -begin - if exists ( - select 1 - from information_schema.columns - where table_schema = 'public' - and table_name = 'patient_patient_tag' - and column_name = 'patient_tag_id' - ) - and not exists ( - select 1 - from information_schema.columns - where table_schema = 'public' - and table_name = 'patient_patient_tag' - and column_name = 'tag_id' - ) then - alter table public.patient_patient_tag - rename column patient_tag_id to tag_id; - end if; -end $$; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 159.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 159.sql deleted file mode 100644 index 6ca2eb5..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 159.sql +++ /dev/null @@ -1,5 +0,0 @@ -insert into public.profiles (id, role) -select u.id, 'patient' -from auth.users u -left join public.profiles p on p.id = u.id -where p.id is null; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 174.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 174.sql deleted file mode 100644 index d6098a6..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 174.sql +++ /dev/null @@ -1,12 +0,0 @@ -select - id, name, email, phone, - birth_date, cpf, rg, gender, - marital_status, profession, - place_of_birth, education_level, - cep, address_street, address_number, - address_neighborhood, address_city, address_state, - phone_alt, - notes, consent, created_at -from public.patient_intake_requests -order by created_at desc -limit 1; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 209.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 209.sql deleted file mode 100644 index 24e9855..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 209.sql +++ /dev/null @@ -1,23 +0,0 @@ -create or replace function public.agenda_cfg_sync() -returns trigger -language plpgsql -as $$ -begin - if new.agenda_view_mode = 'custom' then - new.usar_horario_admin_custom := true; - new.admin_inicio_visualizacao := new.agenda_custom_start; - new.admin_fim_visualizacao := new.agenda_custom_end; - else - new.usar_horario_admin_custom := false; - end if; - - return new; -end; -$$; - -drop trigger if exists trg_agenda_cfg_sync on public.agenda_configuracoes; - -create trigger trg_agenda_cfg_sync -before insert or update on public.agenda_configuracoes -for each row -execute function public.agenda_cfg_sync(); \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 216.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 216.sql deleted file mode 100644 index 090476f..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 216.sql +++ /dev/null @@ -1,2 +0,0 @@ -drop index if exists public.uq_subscriptions_tenant; -drop index if exists public.uq_subscriptions_personal_user; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 219.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 219.sql deleted file mode 100644 index 610a5b1..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 219.sql +++ /dev/null @@ -1,6 +0,0 @@ --- Limpa TUDO da agenda (eventos, regras, exceções) --- Execute no Supabase Studio — não tem volta! - -DELETE FROM recurrence_exceptions; -DELETE FROM recurrence_rules; -DELETE FROM agenda_eventos; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 221.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 221.sql deleted file mode 100644 index f80fe77..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 221.sql +++ /dev/null @@ -1,12 +0,0 @@ -select - t.tgname as trigger_name, - pg_get_triggerdef(t.oid) as trigger_def, - p.proname as function_name, - n.nspname as function_schema -from pg_trigger t -join pg_proc p on p.oid = t.tgfoid -join pg_namespace n on n.oid = p.pronamespace -join pg_class c on c.oid = t.tgrelid -where not t.tgisinternal - and c.relname = 'patient_intake_requests' -order by t.tgname; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 235.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 235.sql deleted file mode 100644 index d99d5cf..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 235.sql +++ /dev/null @@ -1,46 +0,0 @@ --- ============================================================ - -- LIMPEZA DE DADOS DE TESTE — filtra por tenant/owner - -- Execute no Supabase Studio com cuidado -- ============================================================ - DO $$ DECLARE - v_tenant_id uuid := 'bbbbbbbb-0002-0002-0002-000000000002'; - v_owner_id uuid := 'aaaaaaaa-0002-0002-0002-000000000002'; - n_exc int; - n_ev int; - n_rule int; - n_sol int; - BEGIN - - -- 1. Exceções (filha de recurrence_rules — apagar primeiro) - DELETE FROM public.recurrence_exceptions - WHERE recurrence_id IN ( - SELECT id FROM public.recurrence_rules - WHERE (v_tenant_id IS NULL OR tenant_id = v_tenant_id) - AND (v_owner_id IS NULL OR owner_id = v_owner_id) - ); - GET DIAGNOSTICS n_exc = ROW_COUNT; - - -- 2. Regras de recorrência - DELETE FROM public.recurrence_rules - WHERE (v_tenant_id IS NULL OR tenant_id = v_tenant_id) - AND (v_owner_id IS NULL OR owner_id = v_owner_id); - GET DIAGNOSTICS n_rule = ROW_COUNT; - - -- 3. Eventos da agenda - DELETE FROM public.agenda_eventos - WHERE (v_tenant_id IS NULL OR tenant_id = v_tenant_id) - AND (v_owner_id IS NULL OR owner_id = v_owner_id); - GET DIAGNOSTICS n_ev = ROW_COUNT; - - -- 4. Solicitações públicas (agendador online) - DELETE FROM public.agendador_solicitacoes - WHERE (v_tenant_id IS NULL OR tenant_id = v_tenant_id) - AND (v_owner_id IS NULL OR owner_id = v_owner_id); - GET DIAGNOSTICS n_sol = ROW_COUNT; - - RAISE NOTICE '✅ Limpeza concluída:'; - RAISE NOTICE ' recurrence_exceptions : %', n_exc; - RAISE NOTICE ' recurrence_rules : %', n_rule; - RAISE NOTICE ' agenda_eventos : %', n_ev; - RAISE NOTICE ' agendador_solicitacoes : %', n_sol; - END; - $$; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 271.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 271.sql deleted file mode 100644 index a658306..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 271.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - id as tenant_member_id, - tenant_id, - user_id, - role, - status, - created_at -from public.tenant_members -where user_id = '824f125c-55bb-40f5-a8c4-7a33618b91c7' -order by created_at desc; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 277.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 277.sql deleted file mode 100644 index 24ec0cb..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 277.sql +++ /dev/null @@ -1,4 +0,0 @@ -select * -from agenda_eventos -order by created_at desc nulls last -limit 10; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 319.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 319.sql deleted file mode 100644 index 6ee16fd..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 319.sql +++ /dev/null @@ -1,6 +0,0 @@ -select - routine_name, - routine_type -from information_schema.routines -where routine_schema = 'public' - and routine_name ilike '%intake%'; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 323.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 323.sql deleted file mode 100644 index 24bb689..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 323.sql +++ /dev/null @@ -1,4 +0,0 @@ -select id as owner_id, email, created_at -from auth.users -where email = 'admin@agendapsi.com.br' -limit 1; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 324.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 324.sql deleted file mode 100644 index 178f63a..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 324.sql +++ /dev/null @@ -1,8 +0,0 @@ -select - id, - owner_id, - status, - created_at, - converted_patient_id -from public.patient_intake_requests -where id = '54daa09a-b2cb-4a0b-91aa-e4cea1915efe'; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 330.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 330.sql deleted file mode 100644 index 28ae3d2..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 330.sql +++ /dev/null @@ -1,6 +0,0 @@ -select f.key as feature_key -from public.plan_features pf -join public.features f on f.id = pf.feature_id -where pf.plan_id = 'fdc2813d-dfaa-4e2c-b71d-ef7b84dfd9e9' - and pf.enabled = true -order by f.key; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 361.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 361.sql deleted file mode 100644 index a339a14..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 361.sql +++ /dev/null @@ -1,3 +0,0 @@ -select id, key, name -from public.plans -order by key; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 376.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 376.sql deleted file mode 100644 index cbfe1ee..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 376.sql +++ /dev/null @@ -1 +0,0 @@ - SELECT * FROM public.agendador_solicitacoes LIMIT 5; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 431.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 431.sql deleted file mode 100644 index 8acc511..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 431.sql +++ /dev/null @@ -1,5 +0,0 @@ -select table_schema, table_name, column_name -from information_schema.columns -where column_name in ('owner_id', 'tenant_id') - and table_schema = 'public' -order by table_name; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 437.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 437.sql deleted file mode 100644 index 5418bb1..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 437.sql +++ /dev/null @@ -1,12 +0,0 @@ -alter table public.patient_groups enable row level security; - -drop policy if exists patient_groups_select on public.patient_groups; - -create policy patient_groups_select -on public.patient_groups -for select -to authenticated -using ( - owner_id = auth.uid() - or owner_id is null -); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 439.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 439.sql deleted file mode 100644 index cfb5556..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 439.sql +++ /dev/null @@ -1,9 +0,0 @@ - - - select * -from public.owner_feature_entitlements -where owner_id = '816b24fe-a0c3-4409-b79b-c6c0a6935d03'::uuid -order by feature_key; - -select public.has_feature('816b24fe-a0c3-4409-b79b-c6c0a6935d03'::uuid, 'online_scheduling.manage') as can_manage; - diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 449.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 449.sql deleted file mode 100644 index 1fad21f..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 449.sql +++ /dev/null @@ -1,5 +0,0 @@ -create index if not exists idx_patient_group_patient_group_id - on public.patient_group_patient (patient_group_id); - -create index if not exists idx_patient_groups_owner_system_nome - on public.patient_groups (owner_id, is_system, nome); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 457.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 457.sql deleted file mode 100644 index 721fd3c..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 457.sql +++ /dev/null @@ -1,9 +0,0 @@ --- 1) Marcar como SaaS master -insert into public.saas_admins (user_id) -values ('40a4b683-a0c9-4890-a201-20faf41fca06') -on conflict (user_id) do nothing; - --- 2) Garantir profile (seu session.js busca role em profiles) -insert into public.profiles (id, role) -values ('40a4b683-a0c9-4890-a201-20faf41fca06', 'saas_admin') -on conflict (id) do update set role = excluded.role; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 468.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 468.sql deleted file mode 100644 index 5bbc486..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 468.sql +++ /dev/null @@ -1,5 +0,0 @@ -select * -from public.owner_feature_entitlements -where owner_id = '816b24fe-a0c3-4409-b79b-c6c0a6935d03'::uuid -order by feature_key; - diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 476.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 476.sql deleted file mode 100644 index 6fca30d..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 476.sql +++ /dev/null @@ -1,5 +0,0 @@ -select column_name, data_type -from information_schema.columns -where table_schema = 'public' - and table_name = 'patient_patient_tag' -order by ordinal_position; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 508.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 508.sql deleted file mode 100644 index 5aedcee..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 508.sql +++ /dev/null @@ -1,18 +0,0 @@ -create or replace function public.prevent_promoting_to_system() -returns trigger -language plpgsql -as $$ -begin - if new.is_system = true and old.is_system is distinct from true then - raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.'; - end if; - return new; -end; -$$; - -drop trigger if exists trg_prevent_promoting_to_system on public.patient_groups; - -create trigger trg_prevent_promoting_to_system -before update on public.patient_groups -for each row -execute function public.prevent_promoting_to_system(); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 521.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 521.sql deleted file mode 100644 index a104170..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 521.sql +++ /dev/null @@ -1,4 +0,0 @@ -select id, tenant_id, user_id, role, status, created_at -from tenant_members -where user_id = '1715ec83-9a30-4dce-b73a-2deb66dcfb13' -order by created_at desc; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 566.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 566.sql deleted file mode 100644 index 22e0403..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 566.sql +++ /dev/null @@ -1,2 +0,0 @@ -const { data, error } = await supabase.rpc('my_tenants') -console.log({ data, error }) diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 633.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 633.sql deleted file mode 100644 index 7cccd7a..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 633.sql +++ /dev/null @@ -1,6 +0,0 @@ -select id, tenant_id, user_id, role, status, created_at -from tenant_members -where tenant_id = '816b24fe-a0c3-4409-b79b-c6c0a6935d03'::uuid -order by - (case when role = 'clinic_admin' then 0 else 1 end), - created_at; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 641.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 641.sql deleted file mode 100644 index a8677bd..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 641.sql +++ /dev/null @@ -1,15 +0,0 @@ --- Para o tenant A: -select id as responsible_member_id -from public.tenant_members -where tenant_id = '816b24fe-a0c3-4409-b79b-c6c0a6935d03' - and user_id = '824f125c-55bb-40f5-a8c4-7a33618b91c7' - and status = 'active' -limit 1; - --- Para o tenant B: -select id as responsible_member_id -from public.tenant_members -where tenant_id = 'e8b10543-fb36-4e75-9d37-6fece9745637' - and user_id = '824f125c-55bb-40f5-a8c4-7a33618b91c7' - and status = 'active' -limit 1; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 649.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 649.sql deleted file mode 100644 index b4fa608..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 649.sql +++ /dev/null @@ -1,4 +0,0 @@ -select id, name, kind, created_at -from public.tenants -order by created_at desc -limit 10; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 677.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 677.sql deleted file mode 100644 index a4d6756..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 677.sql +++ /dev/null @@ -1,5 +0,0 @@ -select id as member_id -from tenant_members -where tenant_id = '816b24fe-a0c3-4409-b79b-c6c0a6935d03' - and user_id = '824f125c-55bb-40f5-a8c4-7a33618b91c7' -limit 1; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 744.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 744.sql deleted file mode 100644 index 096d873..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 744.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into public.users (id, created_at) -values ('e8b10543-fb36-4e75-9d37-6fece9745637', now()); \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 781.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 781.sql deleted file mode 100644 index e455447..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 781.sql +++ /dev/null @@ -1,4 +0,0 @@ -select * -from public.tenant_members -where tenant_id = 'UUID_AQUI' -order by created_at desc; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 790.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 790.sql deleted file mode 100644 index a7c1bba..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 790.sql +++ /dev/null @@ -1,17 +0,0 @@ -create table if not exists public.subscriptions ( - id uuid primary key default gen_random_uuid(), - user_id uuid not null references auth.users(id) on delete cascade, - plan_key text not null, - interval text not null check (interval in ('month','year')), - status text not null check (status in ('active','canceled','past_due','trial')) default 'active', - started_at timestamptz not null default now(), - current_period_start timestamptz not null default now(), - current_period_end timestamptz null, - canceled_at timestamptz null, - source text not null default 'manual', - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - -create index if not exists subscriptions_user_id_idx on public.subscriptions(user_id); -create index if not exists subscriptions_status_idx on public.subscriptions(status); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 830.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 830.sql deleted file mode 100644 index 16f2509..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 830.sql +++ /dev/null @@ -1,13 +0,0 @@ --- Ver todas as regras no banco -SELECT - id, - owner_id, - status, - type, - weekdays, - start_date, - end_date, - start_time, - created_at -FROM recurrence_rules -ORDER BY created_at DESC; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 843.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 843.sql deleted file mode 100644 index 1f210fe..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 843.sql +++ /dev/null @@ -1,3 +0,0 @@ -select id, name, created_at -from public.tenants -order by created_at desc; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 856.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 856.sql deleted file mode 100644 index 2984797..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 856.sql +++ /dev/null @@ -1,8 +0,0 @@ -alter table public.profiles enable row level security; - -drop policy if exists "profiles_select_own" on public.profiles; -create policy "profiles_select_own" -on public.profiles -for select -to authenticated -using (id = auth.uid()); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 869.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 869.sql deleted file mode 100644 index ebd1632..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 869.sql +++ /dev/null @@ -1,7 +0,0 @@ --- 2) Tenho membership ativa no tenant atual? -select * -from tenant_members -where tenant_id = 'e8b10543-fb36-4e75-9d37-6fece9745637' - and user_id = auth.uid() -order by created_at desc; - diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 880.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 880.sql deleted file mode 100644 index 9fe1f32..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 880.sql +++ /dev/null @@ -1,8 +0,0 @@ -select - n.nspname as schema, - p.proname as function_name, - pg_get_functiondef(p.oid) as definition -from pg_proc p -join pg_namespace n on n.oid = p.pronamespace -where n.nspname = 'public' - and pg_get_functiondef(p.oid) ilike '%entitlements_invalidation%'; diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 886.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 886.sql deleted file mode 100644 index 4eb0d54..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 886.sql +++ /dev/null @@ -1,266 +0,0 @@ --- ========================================================= --- PATCH — Completar cadastro para bater com PatientsCadastroPage.vue --- (rode DEPOIS do seu supabase_cadastro_pacientes.sql) --- ========================================================= - -create extension if not exists pgcrypto; - --- --------------------------------------------------------- --- 1) Completar colunas que o front usa e hoje faltam em patients --- --------------------------------------------------------- -do $$ -begin - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='email_alt' - ) then - alter table public.patients add column email_alt text; - end if; - - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='phones' - ) then - -- array de textos (Postgres). No JS você manda ["...","..."] normalmente. - alter table public.patients add column phones text[]; - end if; - - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='gender' - ) then - alter table public.patients add column gender text; - end if; - - if not exists ( - select 1 from information_schema.columns - where table_schema='public' and table_name='patients' and column_name='marital_status' - ) then - alter table public.patients add column marital_status text; - end if; -end $$; - --- (opcional) índices úteis pra busca/filtro por nome/email -create index if not exists idx_patients_owner_name on public.patients(owner_id, name); -create index if not exists idx_patients_owner_email on public.patients(owner_id, email); - --- --------------------------------------------------------- --- 2) patient_groups --- --------------------------------------------------------- -create table if not exists public.patient_groups ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null references auth.users(id) on delete cascade, - name text not null, - color text, - is_system boolean not null default false, - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - --- nome único por owner -do $$ -begin - if not exists ( - select 1 from pg_constraint - where conname = 'patient_groups_owner_name_uniq' - and conrelid = 'public.patient_groups'::regclass - ) then - alter table public.patient_groups - add constraint patient_groups_owner_name_uniq unique(owner_id, name); - end if; -end $$; - -drop trigger if exists trg_patient_groups_set_updated_at on public.patient_groups; -create trigger trg_patient_groups_set_updated_at -before update on public.patient_groups -for each row execute function public.set_updated_at(); - -create index if not exists idx_patient_groups_owner on public.patient_groups(owner_id); - -alter table public.patient_groups enable row level security; - -drop policy if exists "patient_groups_select_own" on public.patient_groups; -create policy "patient_groups_select_own" -on public.patient_groups for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists "patient_groups_insert_own" on public.patient_groups; -create policy "patient_groups_insert_own" -on public.patient_groups for insert -to authenticated -with check (owner_id = auth.uid()); - -drop policy if exists "patient_groups_update_own" on public.patient_groups; -create policy "patient_groups_update_own" -on public.patient_groups for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - -drop policy if exists "patient_groups_delete_own" on public.patient_groups; -create policy "patient_groups_delete_own" -on public.patient_groups for delete -to authenticated -using (owner_id = auth.uid()); - -grant select, insert, update, delete on public.patient_groups to authenticated; - --- --------------------------------------------------------- --- 3) patient_tags --- --------------------------------------------------------- -create table if not exists public.patient_tags ( - id uuid primary key default gen_random_uuid(), - owner_id uuid not null references auth.users(id) on delete cascade, - name text not null, - color text, - created_at timestamptz not null default now(), - updated_at timestamptz not null default now() -); - -do $$ -begin - if not exists ( - select 1 from pg_constraint - where conname = 'patient_tags_owner_name_uniq' - and conrelid = 'public.patient_tags'::regclass - ) then - alter table public.patient_tags - add constraint patient_tags_owner_name_uniq unique(owner_id, name); - end if; -end $$; - -drop trigger if exists trg_patient_tags_set_updated_at on public.patient_tags; -create trigger trg_patient_tags_set_updated_at -before update on public.patient_tags -for each row execute function public.set_updated_at(); - -create index if not exists idx_patient_tags_owner on public.patient_tags(owner_id); - -alter table public.patient_tags enable row level security; - -drop policy if exists "patient_tags_select_own" on public.patient_tags; -create policy "patient_tags_select_own" -on public.patient_tags for select -to authenticated -using (owner_id = auth.uid()); - -drop policy if exists "patient_tags_insert_own" on public.patient_tags; -create policy "patient_tags_insert_own" -on public.patient_tags for insert -to authenticated -with check (owner_id = auth.uid()); - -drop policy if exists "patient_tags_update_own" on public.patient_tags; -create policy "patient_tags_update_own" -on public.patient_tags for update -to authenticated -using (owner_id = auth.uid()) -with check (owner_id = auth.uid()); - -drop policy if exists "patient_tags_delete_own" on public.patient_tags; -create policy "patient_tags_delete_own" -on public.patient_tags for delete -to authenticated -using (owner_id = auth.uid()); - -grant select, insert, update, delete on public.patient_tags to authenticated; - --- --------------------------------------------------------- --- 4) pivôs (patient_group_patient / patient_patient_tag) --- --------------------------------------------------------- -create table if not exists public.patient_group_patient ( - patient_id uuid not null references public.patients(id) on delete cascade, - patient_group_id uuid not null references public.patient_groups(id) on delete cascade, - created_at timestamptz not null default now(), - primary key (patient_id, patient_group_id) -); - -create index if not exists idx_pgp_patient on public.patient_group_patient(patient_id); -create index if not exists idx_pgp_group on public.patient_group_patient(patient_group_id); - -alter table public.patient_group_patient enable row level security; - --- a pivot “herda” tenant via join; policy usando exists pra validar owner do patient -drop policy if exists "pgp_select_own" on public.patient_group_patient; -create policy "pgp_select_own" -on public.patient_group_patient for select -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_group_patient.patient_id - and p.owner_id = auth.uid() - ) -); - -drop policy if exists "pgp_write_own" on public.patient_group_patient; -create policy "pgp_write_own" -on public.patient_group_patient for all -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_group_patient.patient_id - and p.owner_id = auth.uid() - ) -) -with check ( - exists ( - select 1 from public.patients p - where p.id = patient_group_patient.patient_id - and p.owner_id = auth.uid() - ) -); - -grant select, insert, update, delete on public.patient_group_patient to authenticated; - --- tags pivot (ATENÇÃO: coluna é tag_id, como teu Vue usa!) -create table if not exists public.patient_patient_tag ( - patient_id uuid not null references public.patients(id) on delete cascade, - tag_id uuid not null references public.patient_tags(id) on delete cascade, - created_at timestamptz not null default now(), - primary key (patient_id, tag_id) -); - -create index if not exists idx_ppt_patient on public.patient_patient_tag(patient_id); -create index if not exists idx_ppt_tag on public.patient_patient_tag(tag_id); - -alter table public.patient_patient_tag enable row level security; - -drop policy if exists "ppt_select_own" on public.patient_patient_tag; -create policy "ppt_select_own" -on public.patient_patient_tag for select -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_patient_tag.patient_id - and p.owner_id = auth.uid() - ) -); - -drop policy if exists "ppt_write_own" on public.patient_patient_tag; -create policy "ppt_write_own" -on public.patient_patient_tag for all -to authenticated -using ( - exists ( - select 1 from public.patients p - where p.id = patient_patient_tag.patient_id - and p.owner_id = auth.uid() - ) -) -with check ( - exists ( - select 1 from public.patients p - where p.id = patient_patient_tag.patient_id - and p.owner_id = auth.uid() - ) -); - -grant select, insert, update, delete on public.patient_patient_tag to authenticated; - --- ========================================================= --- FIM PATCH --- ========================================================= diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 899.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 899.sql deleted file mode 100644 index 6bcb015..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 899.sql +++ /dev/null @@ -1,42 +0,0 @@ --- BUCKET avatars: RLS por pasta do usuário "/..." --- Requer que seu path seja: `${auth.uid()}/...` (no seu código já é) - -drop policy if exists "avatars_select_own" on storage.objects; -create policy "avatars_select_own" -on storage.objects for select -to authenticated -using ( - bucket_id = 'avatars' - and name like auth.uid()::text || '/%' -); - -drop policy if exists "avatars_insert_own" on storage.objects; -create policy "avatars_insert_own" -on storage.objects for insert -to authenticated -with check ( - bucket_id = 'avatars' - and name like auth.uid()::text || '/%' -); - -drop policy if exists "avatars_update_own" on storage.objects; -create policy "avatars_update_own" -on storage.objects for update -to authenticated -using ( - bucket_id = 'avatars' - and name like auth.uid()::text || '/%' -) -with check ( - bucket_id = 'avatars' - and name like auth.uid()::text || '/%' -); - -drop policy if exists "avatars_delete_own" on storage.objects; -create policy "avatars_delete_own" -on storage.objects for delete -to authenticated -using ( - bucket_id = 'avatars' - and name like auth.uid()::text || '/%' -); diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 934.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 934.sql deleted file mode 100644 index 5be15f1..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 934.sql +++ /dev/null @@ -1,3 +0,0 @@ -select * -from tenant_members -where user_id = 'SEU_USER_ID'; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 938.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 938.sql deleted file mode 100644 index a4d2f11..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 938.sql +++ /dev/null @@ -1,14 +0,0 @@ -select - tm.id as responsible_member_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at -from public.tenant_members tm -where tm.tenant_id = ( - select owner_id from public.patient_intake_requests - where id = '54daa09a-b2cb-4a0b-91aa-e4cea1915efe' -) -and tm.user_id = '824f125c-55bb-40f5-a8c4-7a33618b91c7' -limit 10; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/Untitled query 975.sql b/DBS/2026-03-11/supabase-snippets/Untitled query 975.sql deleted file mode 100644 index ce7959e..0000000 --- a/DBS/2026-03-11/supabase-snippets/Untitled query 975.sql +++ /dev/null @@ -1,17 +0,0 @@ --- 1) Qual é meu uid? -select auth.uid() as my_uid; - --- 2) Tenho membership ativa no tenant atual? -select * -from tenant_members -where tenant_id = 'e8b10543-fb36-4e75-9d37-6fece9745637' - and user_id = auth.uid() -order by created_at desc; - --- 3) Se você usa status: -select * -from tenant_members -where tenant_id = 'e8b10543-fb36-4e75-9d37-6fece9745637' - and user_id = auth.uid() - and status = 'active' -order by created_at desc; \ No newline at end of file diff --git a/DBS/2026-03-11/supabase-snippets/saas_docs.sql b/DBS/2026-03-11/supabase-snippets/saas_docs.sql deleted file mode 100644 index d12c728..0000000 --- a/DBS/2026-03-11/supabase-snippets/saas_docs.sql +++ /dev/null @@ -1,123 +0,0 @@ --- ============================================================ --- saas_docs — Documentação dinâmica do sistema --- Exibida nas páginas do frontend via botão "Ajuda" --- ============================================================ - --- ------------------------------------------------------------ --- 1. TABELA --- ------------------------------------------------------------ -CREATE TABLE IF NOT EXISTS public.saas_docs ( - id uuid PRIMARY KEY DEFAULT gen_random_uuid(), - titulo text NOT NULL, - conteudo text NOT NULL DEFAULT '', - medias jsonb NOT NULL DEFAULT '[]'::jsonb, - -- formato: [{ "tipo": "imagem"|"video", "url": "..." }, ...] - - tipo_acesso text NOT NULL DEFAULT 'usuario' - CHECK (tipo_acesso IN ('usuario', 'admin')), - -- 'usuario' → todos os autenticados - -- 'admin' → clinic_admin, tenant_admin, saas_admin - - pagina_path text NOT NULL, - -- path da rota do frontend, ex: '/therapist/agenda' - - pagina_label text, - -- label amigável (informativo, não usado no match) - - docs_relacionados uuid[] NOT NULL DEFAULT '{}', - -- IDs de outros saas_docs exibidos como "Veja também" - - ativo boolean NOT NULL DEFAULT true, - ordem int NOT NULL DEFAULT 0, - created_at timestamptz NOT NULL DEFAULT now(), - updated_at timestamptz NOT NULL DEFAULT now() -); - --- ------------------------------------------------------------ --- 2. ÍNDICE --- ------------------------------------------------------------ --- Query principal do frontend: filtra por path + ativo -CREATE INDEX IF NOT EXISTS saas_docs_path_ativo_idx - ON public.saas_docs (pagina_path, ativo); - --- ------------------------------------------------------------ --- 3. RLS --- ------------------------------------------------------------ -ALTER TABLE public.saas_docs ENABLE ROW LEVEL SECURITY; - --- SaaS admin: acesso total (SELECT, INSERT, UPDATE, DELETE) --- Verificado via tabela saas_admins -CREATE POLICY "saas_admin_full_access" ON public.saas_docs - FOR ALL - TO authenticated - USING ( - EXISTS ( - SELECT 1 FROM public.saas_admins - WHERE saas_admins.user_id = auth.uid() - ) - ) - WITH CHECK ( - EXISTS ( - SELECT 1 FROM public.saas_admins - WHERE saas_admins.user_id = auth.uid() - ) - ); - --- Admins de clínica: leem todos os docs ativos (usuario + admin) -CREATE POLICY "clinic_admin_read_all_docs" ON public.saas_docs - FOR SELECT - TO authenticated - USING ( - ativo = true - AND EXISTS ( - SELECT 1 FROM public.profiles - WHERE profiles.id = auth.uid() - AND profiles.role IN ('clinic_admin', 'tenant_admin') - ) - ); - --- Demais usuários autenticados: leem apenas docs do tipo 'usuario' -CREATE POLICY "users_read_usuario_docs" ON public.saas_docs - FOR SELECT - TO authenticated - USING ( - ativo = true - AND tipo_acesso = 'usuario' - ); - --- ------------------------------------------------------------ --- 4. STORAGE — bucket saas-docs (imagens dos documentos) --- ------------------------------------------------------------ -INSERT INTO storage.buckets (id, name, public) -VALUES ('saas-docs', 'saas-docs', true) -ON CONFLICT (id) DO NOTHING; - --- SaaS admin: pode fazer upload -CREATE POLICY "saas_admin_storage_upload" ON storage.objects - FOR INSERT - TO authenticated - WITH CHECK ( - bucket_id = 'saas-docs' - AND EXISTS ( - SELECT 1 FROM public.saas_admins - WHERE saas_admins.user_id = auth.uid() - ) - ); - --- SaaS admin: pode deletar -CREATE POLICY "saas_admin_storage_delete" ON storage.objects - FOR DELETE - TO authenticated - USING ( - bucket_id = 'saas-docs' - AND EXISTS ( - SELECT 1 FROM public.saas_admins - WHERE saas_admins.user_id = auth.uid() - ) - ); - --- Leitura pública (bucket é público, mas policy explícita para clareza) -CREATE POLICY "saas_docs_public_read" ON storage.objects - FOR SELECT - TO public - USING (bucket_id = 'saas-docs'); diff --git a/DBS/2026-03-12/schema.sql b/DBS/2026-03-12/schema.sql deleted file mode 100644 index 69f5974..0000000 --- a/DBS/2026-03-12/schema.sql +++ /dev/null @@ -1,20960 +0,0 @@ --- --- PostgreSQL database dump --- - -\restrict 9bHVG2mCJlFIsM9VG52U52tbNZAgdYvv06RBgjMuM391ZzgcAGwa0O040leLtAl - --- Dumped from database version 17.6 --- Dumped by pg_dump version 17.6 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET transaction_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- Name: _realtime; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA _realtime; - - -ALTER SCHEMA _realtime OWNER TO postgres; - --- --- Name: auth; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA auth; - - -ALTER SCHEMA auth OWNER TO supabase_admin; - --- --- Name: extensions; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA extensions; - - -ALTER SCHEMA extensions OWNER TO postgres; - --- --- Name: graphql; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA graphql; - - -ALTER SCHEMA graphql OWNER TO supabase_admin; - --- --- Name: graphql_public; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA graphql_public; - - -ALTER SCHEMA graphql_public OWNER TO supabase_admin; - --- --- Name: pg_net; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions; - - --- --- Name: EXTENSION pg_net; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_net IS 'Async HTTP'; - - --- --- Name: pgbouncer; Type: SCHEMA; Schema: -; Owner: pgbouncer --- - -CREATE SCHEMA pgbouncer; - - -ALTER SCHEMA pgbouncer OWNER TO pgbouncer; - --- --- Name: realtime; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA realtime; - - -ALTER SCHEMA realtime OWNER TO supabase_admin; - --- --- Name: storage; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA storage; - - -ALTER SCHEMA storage OWNER TO supabase_admin; - --- --- Name: supabase_functions; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA supabase_functions; - - -ALTER SCHEMA supabase_functions OWNER TO supabase_admin; - --- --- Name: vault; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA vault; - - -ALTER SCHEMA vault OWNER TO supabase_admin; - --- --- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public; - - --- --- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST'; - - --- --- Name: citext; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; - - --- --- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings'; - - --- --- Name: pg_graphql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; - - --- --- Name: EXTENSION pg_graphql; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; - - --- --- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA extensions; - - --- --- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed'; - - --- --- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; - - --- --- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; - - --- --- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions; - - --- --- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; - - --- --- Name: supabase_vault; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS supabase_vault WITH SCHEMA vault; - - --- --- Name: EXTENSION supabase_vault; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION supabase_vault IS 'Supabase Vault Extension'; - - --- --- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions; - - --- --- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; - - --- --- Name: aal_level; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.aal_level AS ENUM ( - 'aal1', - 'aal2', - 'aal3' -); - - -ALTER TYPE auth.aal_level OWNER TO supabase_auth_admin; - --- --- Name: code_challenge_method; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.code_challenge_method AS ENUM ( - 's256', - 'plain' -); - - -ALTER TYPE auth.code_challenge_method OWNER TO supabase_auth_admin; - --- --- Name: factor_status; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.factor_status AS ENUM ( - 'unverified', - 'verified' -); - - -ALTER TYPE auth.factor_status OWNER TO supabase_auth_admin; - --- --- Name: factor_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.factor_type AS ENUM ( - 'totp', - 'webauthn', - 'phone' -); - - -ALTER TYPE auth.factor_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_authorization_status; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_authorization_status AS ENUM ( - 'pending', - 'approved', - 'denied', - 'expired' -); - - -ALTER TYPE auth.oauth_authorization_status OWNER TO supabase_auth_admin; - --- --- Name: oauth_client_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_client_type AS ENUM ( - 'public', - 'confidential' -); - - -ALTER TYPE auth.oauth_client_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_registration_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_registration_type AS ENUM ( - 'dynamic', - 'manual' -); - - -ALTER TYPE auth.oauth_registration_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_response_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_response_type AS ENUM ( - 'code' -); - - -ALTER TYPE auth.oauth_response_type OWNER TO supabase_auth_admin; - --- --- Name: one_time_token_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.one_time_token_type AS ENUM ( - 'confirmation_token', - 'reauthentication_token', - 'recovery_token', - 'email_change_token_new', - 'email_change_token_current', - 'phone_change_token' -); - - -ALTER TYPE auth.one_time_token_type OWNER TO supabase_auth_admin; - --- --- Name: commitment_log_source; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.commitment_log_source AS ENUM ( - 'manual', - 'auto' -); - - -ALTER TYPE public.commitment_log_source OWNER TO supabase_admin; - --- --- Name: determined_field_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.determined_field_type AS ENUM ( - 'text', - 'textarea', - 'number', - 'date', - 'select', - 'boolean' -); - - -ALTER TYPE public.determined_field_type OWNER TO supabase_admin; - --- --- Name: recurrence_exception_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.recurrence_exception_type AS ENUM ( - 'cancel_session', - 'reschedule_session', - 'patient_missed', - 'therapist_canceled', - 'holiday_block' -); - - -ALTER TYPE public.recurrence_exception_type OWNER TO supabase_admin; - --- --- Name: recurrence_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.recurrence_type AS ENUM ( - 'weekly', - 'biweekly', - 'monthly', - 'yearly', - 'custom_weekdays' -); - - -ALTER TYPE public.recurrence_type OWNER TO supabase_admin; - --- --- Name: status_agenda_serie; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_agenda_serie AS ENUM ( - 'ativo', - 'pausado', - 'cancelado' -); - - -ALTER TYPE public.status_agenda_serie OWNER TO supabase_admin; - --- --- Name: status_evento_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_evento_agenda AS ENUM ( - 'agendado', - 'realizado', - 'faltou', - 'cancelado', - 'remarcar' -); - - -ALTER TYPE public.status_evento_agenda OWNER TO supabase_admin; - --- --- Name: status_excecao_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_excecao_agenda AS ENUM ( - 'pendente', - 'ativo', - 'arquivado' -); - - -ALTER TYPE public.status_excecao_agenda OWNER TO supabase_admin; - --- --- Name: tipo_evento_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.tipo_evento_agenda AS ENUM ( - 'sessao', - 'bloqueio' -); - - -ALTER TYPE public.tipo_evento_agenda OWNER TO supabase_admin; - --- --- Name: tipo_excecao_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.tipo_excecao_agenda AS ENUM ( - 'bloqueio', - 'horario_extra' -); - - -ALTER TYPE public.tipo_excecao_agenda OWNER TO supabase_admin; - --- --- Name: action; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.action AS ENUM ( - 'INSERT', - 'UPDATE', - 'DELETE', - 'TRUNCATE', - 'ERROR' -); - - -ALTER TYPE realtime.action OWNER TO supabase_admin; - --- --- Name: equality_op; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.equality_op AS ENUM ( - 'eq', - 'neq', - 'lt', - 'lte', - 'gt', - 'gte', - 'in' -); - - -ALTER TYPE realtime.equality_op OWNER TO supabase_admin; - --- --- Name: user_defined_filter; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.user_defined_filter AS ( - column_name text, - op realtime.equality_op, - value text -); - - -ALTER TYPE realtime.user_defined_filter OWNER TO supabase_admin; - --- --- Name: wal_column; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.wal_column AS ( - name text, - type_name text, - type_oid oid, - value jsonb, - is_pkey boolean, - is_selectable boolean -); - - -ALTER TYPE realtime.wal_column OWNER TO supabase_admin; - --- --- Name: wal_rls; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.wal_rls AS ( - wal jsonb, - is_rls_enabled boolean, - subscription_ids uuid[], - errors text[] -); - - -ALTER TYPE realtime.wal_rls OWNER TO supabase_admin; - --- --- Name: buckettype; Type: TYPE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TYPE storage.buckettype AS ENUM ( - 'STANDARD', - 'ANALYTICS', - 'VECTOR' -); - - -ALTER TYPE storage.buckettype OWNER TO supabase_storage_admin; - --- --- Name: email(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.email() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION email(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.email() IS 'Deprecated. Use auth.jwt() -> ''email'' instead.'; - - --- --- Name: jwt(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.jwt() OWNER TO supabase_auth_admin; - --- --- Name: role(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.role() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION role(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.role() IS 'Deprecated. Use auth.jwt() -> ''role'' instead.'; - - --- --- Name: uid(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.uid() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION uid(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.uid() IS 'Deprecated. Use auth.jwt() -> ''sub'' instead.'; - - --- --- Name: grant_pg_cron_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_cron_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT - FROM pg_event_trigger_ddl_commands() AS ev - JOIN pg_extension AS ext - ON ev.objid = ext.oid - WHERE ext.extname = 'pg_cron' - ) - THEN - grant usage on schema cron to postgres with grant option; - - alter default privileges in schema cron grant all on tables to postgres with grant option; - alter default privileges in schema cron grant all on functions to postgres with grant option; - alter default privileges in schema cron grant all on sequences to postgres with grant option; - - alter default privileges for user supabase_admin in schema cron grant all - on sequences to postgres with grant option; - alter default privileges for user supabase_admin in schema cron grant all - on tables to postgres with grant option; - alter default privileges for user supabase_admin in schema cron grant all - on functions to postgres with grant option; - - grant all privileges on all tables in schema cron to postgres with grant option; - revoke all on table cron.job from postgres; - grant select on table cron.job to postgres with grant option; - END IF; -END; -$$; - - -ALTER FUNCTION extensions.grant_pg_cron_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_cron_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_cron_access() IS 'Grants access to pg_cron'; - - --- --- Name: grant_pg_graphql_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_graphql_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $_$ -DECLARE - func_is_graphql_resolve bool; -BEGIN - func_is_graphql_resolve = ( - SELECT n.proname = 'resolve' - FROM pg_event_trigger_ddl_commands() AS ev - LEFT JOIN pg_catalog.pg_proc AS n - ON ev.objid = n.oid - ); - - IF func_is_graphql_resolve - THEN - -- Update public wrapper to pass all arguments through to the pg_graphql resolve func - DROP FUNCTION IF EXISTS graphql_public.graphql; - create or replace function graphql_public.graphql( - "operationName" text default null, - query text default null, - variables jsonb default null, - extensions jsonb default null - ) - returns jsonb - language sql - as $$ - select graphql.resolve( - query := query, - variables := coalesce(variables, '{}'), - "operationName" := "operationName", - extensions := extensions - ); - $$; - - -- This hook executes when `graphql.resolve` is created. That is not necessarily the last - -- function in the extension so we need to grant permissions on existing entities AND - -- update default permissions to any others that are created after `graphql.resolve` - grant usage on schema graphql to postgres, anon, authenticated, service_role; - grant select on all tables in schema graphql to postgres, anon, authenticated, service_role; - grant execute on all functions in schema graphql to postgres, anon, authenticated, service_role; - grant all on all sequences in schema graphql to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on tables to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on functions to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on sequences to postgres, anon, authenticated, service_role; - - -- Allow postgres role to allow granting usage on graphql and graphql_public schemas to custom roles - grant usage on schema graphql_public to postgres with grant option; - grant usage on schema graphql to postgres with grant option; - END IF; - -END; -$_$; - - -ALTER FUNCTION extensions.grant_pg_graphql_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_graphql_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_graphql_access() IS 'Grants access to pg_graphql'; - - --- --- Name: grant_pg_net_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_net_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM pg_event_trigger_ddl_commands() AS ev - JOIN pg_extension AS ext - ON ev.objid = ext.oid - WHERE ext.extname = 'pg_net' - ) - THEN - GRANT USAGE ON SCHEMA net TO supabase_functions_admin, postgres, anon, authenticated, service_role; - - ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER; - ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER; - - ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; - ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; - - REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; - REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; - - GRANT EXECUTE ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role; - GRANT EXECUTE ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role; - END IF; -END; -$$; - - -ALTER FUNCTION extensions.grant_pg_net_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_net_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_net_access() IS 'Grants access to pg_net'; - - --- --- Name: pgrst_ddl_watch(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.pgrst_ddl_watch() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -DECLARE - cmd record; -BEGIN - FOR cmd IN SELECT * FROM pg_event_trigger_ddl_commands() - LOOP - IF cmd.command_tag IN ( - 'CREATE SCHEMA', 'ALTER SCHEMA' - , 'CREATE TABLE', 'CREATE TABLE AS', 'SELECT INTO', 'ALTER TABLE' - , 'CREATE FOREIGN TABLE', 'ALTER FOREIGN TABLE' - , 'CREATE VIEW', 'ALTER VIEW' - , 'CREATE MATERIALIZED VIEW', 'ALTER MATERIALIZED VIEW' - , 'CREATE FUNCTION', 'ALTER FUNCTION' - , 'CREATE TRIGGER' - , 'CREATE TYPE', 'ALTER TYPE' - , 'CREATE RULE' - , 'COMMENT' - ) - -- don't notify in case of CREATE TEMP table or other objects created on pg_temp - AND cmd.schema_name is distinct from 'pg_temp' - THEN - NOTIFY pgrst, 'reload schema'; - END IF; - END LOOP; -END; $$; - - -ALTER FUNCTION extensions.pgrst_ddl_watch() OWNER TO supabase_admin; - --- --- Name: pgrst_drop_watch(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.pgrst_drop_watch() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -DECLARE - obj record; -BEGIN - FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects() - LOOP - IF obj.object_type IN ( - 'schema' - , 'table' - , 'foreign table' - , 'view' - , 'materialized view' - , 'function' - , 'trigger' - , 'type' - , 'rule' - ) - AND obj.is_temporary IS false -- no pg_temp objects - THEN - NOTIFY pgrst, 'reload schema'; - END IF; - END LOOP; -END; $$; - - -ALTER FUNCTION extensions.pgrst_drop_watch() OWNER TO supabase_admin; - --- --- Name: set_graphql_placeholder(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.set_graphql_placeholder() RETURNS event_trigger - LANGUAGE plpgsql - AS $_$ - DECLARE - graphql_is_dropped bool; - BEGIN - graphql_is_dropped = ( - SELECT ev.schema_name = 'graphql_public' - FROM pg_event_trigger_dropped_objects() AS ev - WHERE ev.schema_name = 'graphql_public' - ); - - IF graphql_is_dropped - THEN - create or replace function graphql_public.graphql( - "operationName" text default null, - query text default null, - variables jsonb default null, - extensions jsonb default null - ) - returns jsonb - language plpgsql - as $$ - DECLARE - server_version float; - BEGIN - server_version = (SELECT (SPLIT_PART((select version()), ' ', 2))::float); - - IF server_version >= 14 THEN - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql extension is not enabled.' - ) - ) - ); - ELSE - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql is only available on projects running Postgres 14 onwards.' - ) - ) - ); - END IF; - END; - $$; - END IF; - - END; -$_$; - - -ALTER FUNCTION extensions.set_graphql_placeholder() OWNER TO supabase_admin; - --- --- Name: FUNCTION set_graphql_placeholder(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.set_graphql_placeholder() IS 'Reintroduces placeholder function for graphql_public.graphql'; - - --- --- Name: get_auth(text); Type: FUNCTION; Schema: pgbouncer; Owner: supabase_admin --- - -CREATE FUNCTION pgbouncer.get_auth(p_usename text) RETURNS TABLE(username text, password text) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO '' - AS $_$ -begin - raise debug 'PgBouncer auth request: %', p_usename; - - return query - select - rolname::text, - case when rolvaliduntil < now() - then null - else rolpassword::text - end - from pg_authid - where rolname=$1 and rolcanlogin; -end; -$_$; - - -ALTER FUNCTION pgbouncer.get_auth(p_usename text) OWNER TO supabase_admin; - --- --- Name: __rls_ping(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.__rls_ping() RETURNS text - LANGUAGE sql STABLE - AS $$ - select 'ok'::text; -$$; - - -ALTER FUNCTION public.__rls_ping() OWNER TO supabase_admin; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- Name: subscriptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscriptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - plan_id uuid NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - current_period_start timestamp with time zone, - current_period_end timestamp with time zone, - cancel_at_period_end boolean DEFAULT false NOT NULL, - provider text DEFAULT 'manual'::text NOT NULL, - provider_customer_id text, - provider_subscription_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid, - plan_key text, - "interval" text, - source text DEFAULT 'manual'::text NOT NULL, - started_at timestamp with time zone DEFAULT now() NOT NULL, - canceled_at timestamp with time zone, - activated_at timestamp with time zone, - past_due_since timestamp with time zone, - suspended_at timestamp with time zone, - suspended_reason text, - cancelled_at timestamp with time zone, - cancel_reason text, - expired_at timestamp with time zone, - CONSTRAINT subscriptions_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))), - CONSTRAINT subscriptions_owner_xor CHECK ((((tenant_id IS NOT NULL) AND (user_id IS NULL)) OR ((tenant_id IS NULL) AND (user_id IS NOT NULL)))), - CONSTRAINT subscriptions_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'active'::text, 'past_due'::text, 'suspended'::text, 'cancelled'::text, 'expired'::text]))) -); - - -ALTER TABLE public.subscriptions OWNER TO supabase_admin; - --- --- Name: activate_subscription_from_intent(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_intent record; - v_sub public.subscriptions; - v_days int; - v_user_id uuid; - v_plan_id uuid; - v_target text; -begin - -- lê pela VIEW unificada - select * into v_intent - from public.subscription_intents - where id = p_intent_id; - - if not found then - raise exception 'Intent não encontrado: %', p_intent_id; - end if; - - if v_intent.status <> 'paid' then - raise exception 'Intent precisa estar paid para ativar assinatura'; - end if; - - -- resolve target e plan_id via plans.key - select p.id, p.target - into v_plan_id, v_target - from public.plans p - where p.key = v_intent.plan_key - limit 1; - - if v_plan_id is null then - raise exception 'Plano não encontrado em plans.key = %', v_intent.plan_key; - end if; - - v_target := lower(coalesce(v_target, '')); - - -- ✅ supervisor adicionado - if v_target not in ('clinic', 'therapist', 'supervisor') then - raise exception 'Target inválido em plans.target: %', v_target; - end if; - - -- regra por target - if v_target = 'clinic' then - if v_intent.tenant_id is null then - raise exception 'Intent sem tenant_id'; - end if; - else - -- therapist ou supervisor: vinculado ao user - v_user_id := v_intent.user_id; - if v_user_id is null then - v_user_id := v_intent.created_by_user_id; - end if; - end if; - - if v_target in ('therapist', 'supervisor') and v_user_id is null then - raise exception 'Não foi possível determinar user_id para assinatura %.', v_target; - end if; - - -- cancela assinatura ativa anterior - if v_target = 'clinic' then - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where tenant_id = v_intent.tenant_id - and plan_id = v_plan_id - and status = 'active'; - else - -- therapist ou supervisor - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where user_id = v_user_id - and plan_id = v_plan_id - and status = 'active' - and tenant_id is null; - end if; - - -- duração do plano (30 dias para mensal) - v_days := case - when lower(coalesce(v_intent.interval, 'month')) = 'year' then 365 - else 30 - end; - - -- cria nova assinatura - insert into public.subscriptions ( - user_id, - plan_id, - status, - started_at, - expires_at, - cancelled_at, - activated_at, - tenant_id, - plan_key, - interval, - source, - created_at, - updated_at - ) - values ( - case when v_target = 'clinic' then null else v_user_id end, - v_plan_id, - 'active', - now(), - now() + make_interval(days => v_days), - null, - now(), - case when v_target = 'clinic' then v_intent.tenant_id else null end, - v_intent.plan_key, - v_intent.interval, - 'manual', - now(), - now() - ) - returning * into v_sub; - - -- grava vínculo intent → subscription - if v_target = 'clinic' then - update public.subscription_intents_tenant - set subscription_id = v_sub.id - where id = p_intent_id; - else - update public.subscription_intents_personal - set subscription_id = v_sub.id - where id = p_intent_id; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) OWNER TO supabase_admin; - --- --- Name: admin_fix_plan_target(text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- (opcional) restringe targets válidos - if p_new_target not in ('clinic','therapist') then - raise exception 'Target inválido: %', p_new_target using errcode='P0001'; - end if; - - -- trava o plano - select id into v_plan_id - from public.plans - where key = p_plan_key - for update; - - if v_plan_id is null then - raise exception 'Plano não encontrado: %', p_plan_key using errcode='P0001'; - end if; - - -- segurança: não mexer se existe subscription - if exists (select 1 from public.subscriptions s where s.plan_id = v_plan_id) then - raise exception 'Plano % possui subscriptions. Migração bloqueada.', p_plan_key using errcode='P0001'; - end if; - - -- liga bypass SOMENTE nesta transação - perform set_config('app.plan_migration_bypass', '1', true); - - update public.plans - set target = p_new_target - where id = v_plan_id; - -end -$$; - - -ALTER FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) OWNER TO supabase_admin; - --- --- Name: agenda_cfg_sync(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agenda_cfg_sync() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.agenda_view_mode = 'custom' then - new.usar_horario_admin_custom := true; - new.admin_inicio_visualizacao := new.agenda_custom_start; - new.admin_fim_visualizacao := new.agenda_custom_end; - else - new.usar_horario_admin_custom := false; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.agenda_cfg_sync() OWNER TO supabase_admin; - --- --- Name: agendador_dias_disponiveis(text, integer, integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) RETURNS TABLE(data date, tem_slots boolean) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_agora timestamptz; - v_data date; - v_data_inicio date; - v_data_fim date; - v_db_dow int; - v_tem_slot boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - AND (v_data::text || ' ' || s.time::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo' - >= v_agora + (v_antecedencia || ' hours')::interval - ) INTO v_tem_slot; - - IF v_tem_slot THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - - -ALTER FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) OWNER TO supabase_admin; - --- --- Name: agendador_gerar_slug(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_gerar_slug() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_slug text; - v_exists boolean; -BEGIN - -- só gera se ativou e não tem slug ainda - IF NEW.ativo = true AND (NEW.link_slug IS NULL OR NEW.link_slug = '') THEN - LOOP - v_slug := lower(substring(replace(gen_random_uuid()::text, '-', ''), 1, 8)); - SELECT EXISTS ( - SELECT 1 FROM public.agendador_configuracoes - WHERE link_slug = v_slug AND owner_id <> NEW.owner_id - ) INTO v_exists; - EXIT WHEN NOT v_exists; - END LOOP; - NEW.link_slug := v_slug; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.agendador_gerar_slug() OWNER TO supabase_admin; - --- --- Name: agendador_slots_disponiveis(text, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) RETURNS TABLE(hora time without time zone, disponivel boolean) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_antecedencia int; - v_agora timestamptz; - v_db_dow int; - v_slot time; - v_slot_fim time; - v_slot_ts timestamptz; - v_ocupado boolean; - -- loop de recorrências - v_rule RECORD; - v_rule_start_dow int; - v_first_occ date; - v_day_diff int; - v_ex_type text; -BEGIN - SELECT c.owner_id, c.duracao_sessao_min, c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; - - FOR v_slot IN - SELECT s.time - FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - ORDER BY s.time - LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - v_ocupado := false; - - -- ── Antecedência mínima ────────────────────────────────────────────────── - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo'; - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- ── Eventos avulsos internos (agenda_eventos) ──────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos e - WHERE e.owner_id = v_owner_id - AND e.status::text NOT IN ('cancelado', 'faltou') - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::date = p_data - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (e.fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Recorrências ativas (recurrence_rules) ─────────────────────────────── - -- Loop explícito para evitar erros de tipo no cálculo do ciclo semanal - IF NOT v_ocupado THEN - FOR v_rule IN - SELECT - r.id, - r.start_date::date AS start_date, - r.end_date::date AS end_date, - r.start_time::time AS start_time, - r.end_time::time AS end_time, - COALESCE(r.interval, 1)::int AS interval - FROM public.recurrence_rules r - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND p_data >= r.start_date::date - AND (r.end_date IS NULL OR p_data <= r.end_date::date) - AND v_db_dow = ANY(r.weekdays) - AND r.start_time::time < v_slot_fim - AND r.end_time::time > v_slot - LOOP - -- Calcula a primeira ocorrência do dia-da-semana a partir do start_date - v_rule_start_dow := extract(dow from v_rule.start_date)::int; - v_first_occ := v_rule.start_date - + (((v_db_dow - v_rule_start_dow + 7) % 7))::int; - v_day_diff := (p_data - v_first_occ)::int; - - -- Ocorrência válida: diff >= 0 e divisível pelo ciclo semanal - IF v_day_diff >= 0 AND v_day_diff % (7 * v_rule.interval) = 0 THEN - - -- Verifica se há exceção para esta data - v_ex_type := NULL; - SELECT ex.type INTO v_ex_type - FROM public.recurrence_exceptions ex - WHERE ex.recurrence_id = v_rule.id - AND ex.original_date = p_data - LIMIT 1; - - -- Sem exceção, ou exceção que não cancela → bloqueia o slot - IF v_ex_type IS NULL OR v_ex_type NOT IN ( - 'cancel_session', 'patient_missed', - 'therapist_canceled', 'holiday_block', - 'reschedule_session' - ) THEN - v_ocupado := true; - EXIT; -- já basta uma regra que conflite - END IF; - - END IF; - END LOOP; - END IF; - - -- ── Recorrências remarcadas para este dia (reschedule → new_date = p_data) ─ - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 - FROM public.recurrence_exceptions ex - JOIN public.recurrence_rules r ON r.id = ex.recurrence_id - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND ex.type = 'reschedule_session' - AND ex.new_date = p_data - AND COALESCE(ex.new_start_time, r.start_time)::time < v_slot_fim - AND COALESCE(ex.new_end_time, r.end_time)::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Solicitações públicas pendentes ────────────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes sol - WHERE sol.owner_id = v_owner_id - AND sol.status = 'pendente' - AND sol.data_solicitada = p_data - AND sol.hora_solicitada = v_slot - AND (sol.reservado_ate IS NULL OR sol.reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END LOOP; -END; -$$; - - -ALTER FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) OWNER TO supabase_admin; - --- --- Name: cancel_recurrence_from(uuid, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -BEGIN - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - status = CASE - WHEN p_from_date <= start_date THEN 'cancelado' - ELSE status - END, - updated_at = now() - WHERE id = p_recurrence_id; -END; -$$; - - -ALTER FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) OWNER TO supabase_admin; - --- --- Name: cancel_subscription(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancel_subscription(p_subscription_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'canceled' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'canceled', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'canceled', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Cancelamento manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'active') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION public.cancel_subscription(p_subscription_id uuid) OWNER TO supabase_admin; - --- --- Name: cancelar_eventos_serie(uuid, timestamp with time zone); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone DEFAULT now()) RETURNS integer - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_count integer; -BEGIN - UPDATE public.agenda_eventos - SET status = 'cancelado', - updated_at = now() - WHERE serie_id = p_serie_id - AND inicio_em >= p_a_partir_de - AND status NOT IN ('realizado', 'cancelado'); - - GET DIAGNOSTICS v_count = ROW_COUNT; - RETURN v_count; -END; -$$; - - -ALTER FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) OWNER TO supabase_admin; - --- --- Name: FUNCTION cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone); Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) IS 'Cancela todos os eventos futuros de uma série a partir de p_a_partir_de (inclusive). - Não cancela eventos já realizados.'; - - --- --- Name: change_subscription_plan(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_old_plan uuid; - v_new_key text; - - v_owner_type text; - v_owner_ref uuid; - - v_new_target text; - v_sub_target text; -begin - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - v_old_plan := v_sub.plan_id; - - if v_old_plan = p_new_plan_id then - return v_sub; - end if; - - select key, target - into v_new_key, v_new_target - from public.plans - where id = p_new_plan_id; - - if v_new_key is null then - raise exception 'Plano não encontrado'; - end if; - - v_new_target := lower(coalesce(v_new_target, '')); - - v_sub_target := case - when v_sub.tenant_id is not null then 'clinic' - else 'therapist' - end; - - if v_new_target <> v_sub_target then - raise exception 'Plano inválido para este tipo de assinatura. Assinatura é % e o plano é %.', - v_sub_target, v_new_target - using errcode = 'P0001'; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set plan_id = p_new_plan_id, - plan_key = v_new_key, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'plan_changed', - v_old_plan, - p_new_plan_id, - auth.uid(), - 'Plan change via DEV menu', - 'dev_menu', - jsonb_build_object( - 'previous_plan', v_old_plan, - 'new_plan', p_new_plan_id, - 'new_plan_key', v_new_key, - 'new_plan_target', v_new_target - ) - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation (owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) OWNER TO supabase_admin; - --- --- Name: create_clinic_tenant(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_clinic_tenant(p_name text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_tenant uuid; - v_name text; -begin - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Not authenticated'; - end if; - - v_name := nullif(trim(coalesce(p_name, '')), ''); - if v_name is null then - v_name := 'Clínica'; - end if; - - insert into public.tenants (name, kind, created_at) - values (v_name, 'clinic', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION public.create_clinic_tenant(p_name text) OWNER TO supabase_admin; - --- --- Name: create_patient_intake_request(text, text, text, text, text, boolean); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text DEFAULT NULL::text, p_phone text DEFAULT NULL::text, p_notes text DEFAULT NULL::text, p_consent boolean DEFAULT false) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_owner uuid; - v_active boolean; - v_expires timestamptz; - v_max_uses int; - v_uses int; - v_id uuid; -begin - select owner_id, active, expires_at, max_uses, uses - into v_owner, v_active, v_expires, v_max_uses, v_uses - from public.patient_invites - where token = p_token - limit 1; - - if v_owner is null then - raise exception 'Token inválido'; - end if; - - if v_active is not true then - raise exception 'Link desativado'; - end if; - - if v_expires is not null and now() > v_expires then - raise exception 'Link expirado'; - end if; - - if v_max_uses is not null and v_uses >= v_max_uses then - raise exception 'Limite de uso atingido'; - end if; - - if p_name is null or length(trim(p_name)) = 0 then - raise exception 'Nome é obrigatório'; - end if; - - insert into public.patient_intake_requests - (owner_id, token, name, email, phone, notes, consent, status) - values - (v_owner, p_token, trim(p_name), - nullif(lower(trim(p_email)), ''), - nullif(trim(p_phone), ''), - nullif(trim(p_notes), ''), - coalesce(p_consent, false), - 'new') - returning id into v_id; - - update public.patient_invites - set uses = uses + 1 - where token = p_token; - - return v_id; -end; -$$; - - -ALTER FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) OWNER TO supabase_admin; - --- --- Name: create_patient_intake_request_v2(text, jsonb); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $_$ -declare - v_owner_id uuid; - v_intake_id uuid; - v_birth_raw text; - v_birth date; -begin - select owner_id - into v_owner_id - from public.patient_invites - where token = p_token; - - if v_owner_id is null then - raise exception 'Token inválido ou expirado'; - end if; - - v_birth_raw := nullif(trim(coalesce( - p_payload->>'data_nascimento', - '' - )), ''); - - v_birth := case - when v_birth_raw is null then null - when v_birth_raw ~ '^\d{4}-\d{2}-\d{2}$' then v_birth_raw::date - when v_birth_raw ~ '^\d{2}-\d{2}-\d{4}$' then to_date(v_birth_raw, 'DD-MM-YYYY') - else null - end; - - insert into public.patient_intake_requests ( - owner_id, - token, - status, - consent, - - nome_completo, - email_principal, - telefone, - - avatar_url, -- 🔥 AQUI - - data_nascimento, - cpf, - rg, - genero, - estado_civil, - profissao, - escolaridade, - nacionalidade, - naturalidade, - - cep, - pais, - cidade, - estado, - endereco, - numero, - complemento, - bairro, - - observacoes, - notas_internas, - - encaminhado_por, - onde_nos_conheceu - ) - values ( - v_owner_id, - p_token, - 'new', - coalesce((p_payload->>'consent')::boolean, false), - - nullif(trim(p_payload->>'nome_completo'), ''), - nullif(trim(p_payload->>'email_principal'), ''), - nullif(regexp_replace(coalesce(p_payload->>'telefone',''), '\D', '', 'g'), ''), - - nullif(trim(p_payload->>'avatar_url'), ''), -- 🔥 AQUI - - v_birth, - nullif(regexp_replace(coalesce(p_payload->>'cpf',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'rg'), ''), - nullif(trim(p_payload->>'genero'), ''), - nullif(trim(p_payload->>'estado_civil'), ''), - nullif(trim(p_payload->>'profissao'), ''), - nullif(trim(p_payload->>'escolaridade'), ''), - nullif(trim(p_payload->>'nacionalidade'), ''), - nullif(trim(p_payload->>'naturalidade'), ''), - - nullif(regexp_replace(coalesce(p_payload->>'cep',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'pais'), ''), - nullif(trim(p_payload->>'cidade'), ''), - nullif(trim(p_payload->>'estado'), ''), - nullif(trim(p_payload->>'endereco'), ''), - nullif(trim(p_payload->>'numero'), ''), - nullif(trim(p_payload->>'complemento'), ''), - nullif(trim(p_payload->>'bairro'), ''), - - nullif(trim(p_payload->>'observacoes'), ''), - nullif(trim(p_payload->>'notas_internas'), ''), - - nullif(trim(p_payload->>'encaminhado_por'), ''), - nullif(trim(p_payload->>'onde_nos_conheceu'), '') - ) - returning id into v_intake_id; - - return v_intake_id; -end; -$_$; - - -ALTER FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) OWNER TO supabase_admin; - --- --- Name: create_support_session(uuid, integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer DEFAULT 60) RETURNS json - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_admin_id uuid; - v_role text; - v_token text; - v_expires timestamp with time zone; - v_session support_sessions; -BEGIN - -- Verifica autenticação - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - -- Verifica role saas_admin - SELECT role INTO v_role - FROM public.profiles - WHERE id = v_admin_id; - - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado. Somente saas_admin pode criar sessões de suporte.' - USING ERRCODE = 'P0002'; - END IF; - - -- Valida TTL (1 a 120 minutos) - IF p_ttl_minutes < 1 OR p_ttl_minutes > 120 THEN - RAISE EXCEPTION 'TTL inválido. Use entre 1 e 120 minutos.' - USING ERRCODE = 'P0003'; - END IF; - - -- Valida tenant - IF NOT EXISTS (SELECT 1 FROM public.tenants WHERE id = p_tenant_id) THEN - RAISE EXCEPTION 'Tenant não encontrado.' - USING ERRCODE = 'P0004'; - END IF; - - -- Gera token único (64 chars hex, sem pgcrypto) - v_token := replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', ''); - v_expires := now() + (p_ttl_minutes || ' minutes')::interval; - - -- Insere sessão - INSERT INTO public.support_sessions (tenant_id, admin_id, token, expires_at) - VALUES (p_tenant_id, v_admin_id, v_token, v_expires) - RETURNING * INTO v_session; - - RETURN json_build_object( - 'token', v_session.token, - 'expires_at', v_session.expires_at, - 'session_id', v_session.id - ); -END; -$$; - - -ALTER FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) OWNER TO supabase_admin; - --- --- Name: current_member_id(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.current_member_id(p_tenant_id uuid) RETURNS uuid - LANGUAGE sql STABLE - AS $$ - select tm.id - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION public.current_member_id(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: current_member_role(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.current_member_role(p_tenant_id uuid) RETURNS text - LANGUAGE sql STABLE - AS $$ - select tm.role - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION public.current_member_role(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: delete_commitment_full(uuid, uuid); Type: FUNCTION; Schema: public; Owner: postgres --- - -CREATE FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields int := 0; - v_logs int := 0; - v_parent int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_fields = row_count; - - delete from public.commitment_time_logs - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_logs = row_count; - - delete from public.determined_commitments - where tenant_id = p_tenant_id - and id = p_commitment_id; - get diagnostics v_parent = row_count; - - if v_parent <> 1 then - raise exception 'Parent not deleted (RLS/owner issue).'; - end if; - - return jsonb_build_object( - 'ok', true, - 'deleted', jsonb_build_object( - 'fields', v_fields, - 'logs', v_logs, - 'commitment', v_parent - ) - ); -end; -$$; - - -ALTER FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) OWNER TO postgres; - --- --- Name: delete_determined_commitment(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields_deleted int := 0; - v_logs_deleted int := 0; - v_commitment_deleted int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found for tenant'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields f - where f.tenant_id = p_tenant_id - and f.commitment_id = p_commitment_id; - get diagnostics v_fields_deleted = row_count; - - delete from public.commitment_time_logs l - where l.tenant_id = p_tenant_id - and l.commitment_id = p_commitment_id; - get diagnostics v_logs_deleted = row_count; - - delete from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - get diagnostics v_commitment_deleted = row_count; - - if v_commitment_deleted <> 1 then - raise exception 'Delete did not remove the commitment (tenant mismatch?)'; - end if; - - return jsonb_build_object( - 'ok', true, - 'tenant_id', p_tenant_id, - 'commitment_id', p_commitment_id, - 'deleted', jsonb_build_object( - 'fields', v_fields_deleted, - 'logs', v_logs_deleted, - 'commitment', v_commitment_deleted - ) - ); -end; -$$; - - -ALTER FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) OWNER TO supabase_admin; - --- --- Name: dev_list_auth_users(integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_auth_users(p_limit integer DEFAULT 50) RETURNS TABLE(id uuid, email text, created_at timestamp with time zone) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -begin - -- só saas_admin pode ver - if not exists ( - select 1 - from public.profiles p - where p.id = auth.uid() - and p.role = 'saas_admin' - ) then - return; - end if; - - return query - select - u.id, - u.email, - u.created_at - from auth.users u - order by u.created_at desc - limit greatest(1, least(coalesce(p_limit, 50), 500)); -end; -$$; - - -ALTER FUNCTION public.dev_list_auth_users(p_limit integer) OWNER TO supabase_admin; - --- --- Name: dev_list_custom_users(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_custom_users() RETURNS TABLE(user_id uuid, email text, created_at timestamp with time zone, global_role text, tenant_role text, tenant_id uuid, password_dev text, kind text) - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - with base as ( - select - u.id as user_id, - lower(u.email) as email, - u.created_at - from auth.users u - where lower(u.email) not in ( - 'clinic@agenciapsi.com.br', - 'therapist@agenciapsi.com.br', - 'patient@agenciapsi.com.br', - 'saas@agenciapsi.com.br' - ) - ), - prof as ( - select p.id, p.role as global_role - from public.profiles p - ), - last_membership as ( - select distinct on (tm.user_id) - tm.user_id, - tm.tenant_id, - tm.role as tenant_role, - tm.created_at - from public.tenant_members tm - where tm.status = 'active' - order by tm.user_id, tm.created_at desc - ) - select - b.user_id, - b.email, - b.created_at, - pr.global_role, - lm.tenant_role, - lm.tenant_id, - dc.password_dev, - dc.kind - from base b - left join prof pr on pr.id = b.user_id - left join last_membership lm on lm.user_id = b.user_id - left join public.dev_user_credentials dc on lower(dc.email) = b.email - order by b.created_at desc; -$$; - - -ALTER FUNCTION public.dev_list_custom_users() OWNER TO supabase_admin; - --- --- Name: dev_list_intent_leads(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_intent_leads() RETURNS TABLE(email text, last_intent_at timestamp with time zone, plan_key text, billing_interval text, status text, tenant_id uuid) - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - select - lower(si.email) as email, - max(si.created_at) as last_intent_at, - (array_agg(si.plan_key order by si.created_at desc))[1] as plan_key, - (array_agg(si.interval order by si.created_at desc))[1] as billing_interval, - (array_agg(si.status order by si.created_at desc))[1] as status, - (array_agg(si.tenant_id order by si.created_at desc))[1] as tenant_id - from public.subscription_intents si - where si.email is not null - and not exists ( - select 1 - from auth.users au - where lower(au.email) = lower(si.email) - ) - group by lower(si.email) - order by max(si.created_at) desc; -$$; - - -ALTER FUNCTION public.dev_list_intent_leads() OWNER TO supabase_admin; - --- --- Name: dev_public_debug_snapshot(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_public_debug_snapshot() RETURNS TABLE(users_total integer, tenants_total integer, intents_new_total integer, latest_intents jsonb) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $_$ -declare - v_latest jsonb; -begin - select jsonb_agg( - jsonb_build_object( - 'created_at', si.created_at, - 'email_masked', - regexp_replace(lower(si.email), '(^.).*(@.*$)', '\1***\2'), - 'plan_key', si.plan_key, - 'status', si.status - ) - order by si.created_at desc - ) - into v_latest - from ( - select si.* - from public.subscription_intents si - where si.email is not null - order by si.created_at desc - limit 5 - ) si; - - return query - select - (select count(*)::int from auth.users) as users_total, - (select count(*)::int from public.tenants) as tenants_total, - (select count(*)::int from public.subscription_intents where status = 'new') as intents_new_total, - coalesce(v_latest, '[]'::jsonb) as latest_intents; -end; -$_$; - - -ALTER FUNCTION public.dev_public_debug_snapshot() OWNER TO supabase_admin; - --- --- Name: ensure_personal_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.ensure_personal_tenant() RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_uid uuid; - v_existing uuid; -BEGIN - v_uid := auth.uid(); - IF v_uid IS NULL THEN - RAISE EXCEPTION 'Not authenticated'; - END IF; - - SELECT tm.tenant_id INTO v_existing - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = v_uid - AND tm.status = 'active' - AND t.kind IN ('therapist', 'saas') - ORDER BY tm.created_at DESC - LIMIT 1; - - IF v_existing IS NOT NULL THEN - RETURN v_existing; - END IF; - - RETURN public.provision_account_tenant(v_uid, 'therapist'); -END; -$$; - - -ALTER FUNCTION public.ensure_personal_tenant() OWNER TO supabase_admin; - --- --- Name: ensure_personal_tenant_for_user(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_existing uuid; - v_tenant uuid; - v_email text; - v_name text; -begin - v_uid := p_user_id; - if v_uid is null then - raise exception 'Missing user id'; - end if; - - -- só considera tenant pessoal (kind='saas') - select tm.tenant_id - into v_existing - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = v_uid - and tm.status = 'active' - and t.kind = 'saas' - order by tm.created_at desc - limit 1; - - if v_existing is not null then - return v_existing; - end if; - - select email into v_email - from auth.users - where id = v_uid; - - v_name := coalesce(split_part(v_email, '@', 1), 'Conta'); - - insert into public.tenants (name, kind, created_at) - values (v_name || ' (Pessoal)', 'saas', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) OWNER TO supabase_admin; - --- --- Name: faq_votar(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.faq_votar(faq_id uuid) RETURNS void - LANGUAGE sql SECURITY DEFINER - AS $$ - update public.saas_faq - set votos = votos + 1, - updated_at = now() - where id = faq_id - and ativo = true; -$$; - - -ALTER FUNCTION public.faq_votar(faq_id uuid) OWNER TO supabase_admin; - --- --- Name: fix_all_subscription_mismatches(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.fix_all_subscription_mismatches() RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - r record; -begin - for r in - select distinct s.user_id as owner_id - from public.subscriptions s - where s.status = 'active' - and s.user_id is not null - loop - perform public.rebuild_owner_entitlements(r.owner_id); - end loop; -end; -$$; - - -ALTER FUNCTION public.fix_all_subscription_mismatches() OWNER TO supabase_admin; - --- --- Name: fn_agenda_regras_semanais_no_overlap(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.fn_agenda_regras_semanais_no_overlap() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_count int; -begin - if new.ativo is false then - return new; - end if; - - select count(*) into v_count - from public.agenda_regras_semanais r - where r.owner_id = new.owner_id - and r.dia_semana = new.dia_semana - and r.ativo is true - and (tg_op = 'INSERT' or r.id <> new.id) - and (new.hora_inicio < r.hora_fim and new.hora_fim > r.hora_inicio); - - if v_count > 0 then - raise exception 'Janela sobreposta: já existe uma regra ativa nesse intervalo.'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.fn_agenda_regras_semanais_no_overlap() OWNER TO supabase_admin; - --- --- Name: get_my_email(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.get_my_email() RETURNS text - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ - select lower(email) - from auth.users - where id = auth.uid(); -$$; - - -ALTER FUNCTION public.get_my_email() OWNER TO supabase_admin; - --- --- Name: guard_account_type_immutable(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_account_type_immutable() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF OLD.account_type <> 'free' AND NEW.account_type IS DISTINCT FROM OLD.account_type THEN - RAISE EXCEPTION 'account_type é imutável após escolha (atual: "%" para tentativa: "%"). Para mudar de perfil, crie uma nova conta.', OLD.account_type, NEW.account_type - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_account_type_immutable() OWNER TO supabase_admin; - --- --- Name: guard_locked_commitment(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_locked_commitment() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if (old.is_locked = true) then - if (tg_op = 'DELETE') then - raise exception 'Compromisso bloqueado não pode ser excluído.'; - end if; - - if (tg_op = 'UPDATE') then - if (new.active = false) then - raise exception 'Compromisso bloqueado não pode ser desativado.'; - end if; - - -- trava renomear (mantém o "Sessão" sempre igual) - if (new.name is distinct from old.name) then - raise exception 'Compromisso bloqueado não pode ser renomeado.'; - end if; - - -- se quiser travar descrição também, descomente: - -- if (new.description is distinct from old.description) then - -- raise exception 'Compromisso bloqueado não pode alterar descrição.'; - -- end if; - end if; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.guard_locked_commitment() OWNER TO supabase_admin; - --- --- Name: guard_no_change_core_plan_key(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_change_core_plan_key() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') - and new.key is distinct from old.key then - raise exception 'Não é permitido alterar a key do plano padrão (%).', old.key - using errcode = 'P0001'; - end if; - - return new; -end $$; - - -ALTER FUNCTION public.guard_no_change_core_plan_key() OWNER TO supabase_admin; - --- --- Name: guard_no_change_plan_target(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_change_plan_target() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_bypass text; -begin - -- bypass controlado por sessão/transação: - -- só passa se app.plan_migration_bypass = '1' - v_bypass := current_setting('app.plan_migration_bypass', true); - - if v_bypass = '1' then - return new; - end if; - - -- comportamento original (bloqueia qualquer mudança) - if new.target is distinct from old.target then - raise exception 'Não é permitido alterar target do plano (%) de % para %.', - old.key, old.target, new.target - using errcode = 'P0001'; - end if; - - return new; -end -$$; - - -ALTER FUNCTION public.guard_no_change_plan_target() OWNER TO supabase_admin; - --- --- Name: guard_no_delete_core_plans(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_delete_core_plans() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') then - raise exception 'Plano padrão (%) não pode ser removido.', old.key - using errcode = 'P0001'; - end if; - - return old; -end $$; - - -ALTER FUNCTION public.guard_no_delete_core_plans() OWNER TO supabase_admin; - --- --- Name: guard_patient_cannot_own_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_patient_cannot_own_tenant() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_account_type text; -BEGIN - SELECT account_type INTO v_account_type - FROM public.profiles - WHERE id = NEW.user_id; - - IF v_account_type = 'patient' AND NEW.role IN ('tenant_admin', 'therapist') THEN - RAISE EXCEPTION 'Usuário com perfil "patient" não pode ser proprietário ou terapeuta de um tenant. Se tornou profissional? Crie uma nova conta.' - USING ERRCODE = 'P0001'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_patient_cannot_own_tenant() OWNER TO supabase_admin; - --- --- Name: guard_tenant_kind_immutable(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_tenant_kind_immutable() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF NEW.kind IS DISTINCT FROM OLD.kind THEN - RAISE EXCEPTION 'tenants.kind é imutável após criação. Tentativa de alterar "%" para "%".', OLD.kind, NEW.kind - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_tenant_kind_immutable() OWNER TO supabase_admin; - --- --- Name: handle_new_user(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.handle_new_user() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -BEGIN - INSERT INTO public.profiles (id, role, account_type) - VALUES (NEW.id, 'portal_user', 'free') - ON CONFLICT (id) DO NOTHING; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.handle_new_user() OWNER TO supabase_admin; - --- --- Name: handle_new_user_create_personal_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.handle_new_user_create_personal_tenant() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -BEGIN - -- Desabilitado. Tenant criado no onboarding via provision_account_tenant(). - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.handle_new_user_create_personal_tenant() OWNER TO supabase_admin; - --- --- Name: has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.owner_feature_entitlements e - where e.owner_id = p_owner_id - and e.feature_key = p_feature_key - ); -$$; - - -ALTER FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: is_clinic_tenant(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_clinic_tenant(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id - AND t.kind IN ('clinic', 'clinic_coworking', 'clinic_reception', 'clinic_full') - ); -$$; - - -ALTER FUNCTION public.is_clinic_tenant(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_saas_admin(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_saas_admin() RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 from public.saas_admins sa - where sa.user_id = auth.uid() - ); -$$; - - -ALTER FUNCTION public.is_saas_admin() OWNER TO supabase_admin; - --- --- Name: is_tenant_admin(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_tenant_admin(p_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and tm.status = 'active' - ); -$$; - - -ALTER FUNCTION public.is_tenant_admin(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_tenant_member(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_tenant_member(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.tenant_members m - where m.tenant_id = _tenant_id - and m.user_id = auth.uid() - and m.status = 'active' - ); -$$; - - -ALTER FUNCTION public.is_tenant_member(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_therapist_tenant(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_therapist_tenant(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id AND t.kind = 'therapist' - ); -$$; - - -ALTER FUNCTION public.is_therapist_tenant(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: jwt_email(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.jwt_email() RETURNS text - LANGUAGE sql STABLE - AS $$ - select nullif(lower(current_setting('request.jwt.claim.email', true)), ''); -$$; - - -ALTER FUNCTION public.jwt_email() OWNER TO supabase_admin; - --- --- Name: my_tenants(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.my_tenants() RETURNS TABLE(tenant_id uuid, role text, status text, kind text) - LANGUAGE sql STABLE - AS $$ - select - tm.tenant_id, - tm.role, - tm.status, - t.kind - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = auth.uid(); -$$; - - -ALTER FUNCTION public.my_tenants() OWNER TO supabase_admin; - --- --- Name: on_new_user_seed_patient_groups(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.on_new_user_seed_patient_groups() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - BEGIN - PERFORM public.seed_default_patient_groups(NEW.id); - RETURN NEW; - END; - $$; - - -ALTER FUNCTION public.on_new_user_seed_patient_groups() OWNER TO supabase_admin; - --- --- Name: patients_validate_member_consistency(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.patients_validate_member_consistency() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_tenant_responsible uuid; - v_tenant_therapist uuid; -BEGIN - -- responsible_member sempre deve existir e ser do tenant - SELECT tenant_id INTO v_tenant_responsible - FROM public.tenant_members - WHERE id = NEW.responsible_member_id; - - IF v_tenant_responsible IS NULL THEN - RAISE EXCEPTION 'Responsible member not found'; - END IF; - - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'tenant_id is required'; - END IF; - - IF v_tenant_responsible <> NEW.tenant_id THEN - RAISE EXCEPTION 'Responsible member must belong to the same tenant'; - END IF; - - -- therapist scope: therapist_member_id deve existir e ser do mesmo tenant - IF NEW.patient_scope = 'therapist' THEN - IF NEW.therapist_member_id IS NULL THEN - RAISE EXCEPTION 'therapist_member_id is required when patient_scope=therapist'; - END IF; - - SELECT tenant_id INTO v_tenant_therapist - FROM public.tenant_members - WHERE id = NEW.therapist_member_id; - - IF v_tenant_therapist IS NULL THEN - RAISE EXCEPTION 'Therapist member not found'; - END IF; - - IF v_tenant_therapist <> NEW.tenant_id THEN - RAISE EXCEPTION 'Therapist member must belong to the same tenant'; - END IF; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.patients_validate_member_consistency() OWNER TO supabase_admin; - --- --- Name: patients_validate_responsible_member_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.patients_validate_responsible_member_tenant() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - m_tenant uuid; -begin - select tenant_id into m_tenant - from public.tenant_members - where id = new.responsible_member_id; - - if m_tenant is null then - raise exception 'Responsible member not found'; - end if; - - if new.tenant_id is null then - raise exception 'tenant_id is required'; - end if; - - if m_tenant <> new.tenant_id then - raise exception 'Responsible member must belong to the same tenant'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.patients_validate_responsible_member_tenant() OWNER TO supabase_admin; - --- --- Name: prevent_promoting_to_system(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_promoting_to_system() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.is_system = true and old.is_system is distinct from true then - raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.'; - end if; - return new; -end; -$$; - - -ALTER FUNCTION public.prevent_promoting_to_system() OWNER TO supabase_admin; - --- --- Name: prevent_saas_membership(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_saas_membership() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM public.profiles - WHERE id = NEW.user_id - AND role = 'saas_admin' - ) THEN - RAISE EXCEPTION 'SaaS admin cannot belong to tenant'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.prevent_saas_membership() OWNER TO supabase_admin; - --- --- Name: prevent_system_group_changes(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_system_group_changes() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - -- Se for grupo do sistema, regras rígidas: - if old.is_system = true then - - -- nunca pode deletar - if tg_op = 'DELETE' then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - if tg_op = 'UPDATE' then - -- permite SOMENTE mudar tenant_id e/ou updated_at - -- qualquer mudança de conteúdo permanece proibida - if - new.nome is distinct from old.nome or - new.descricao is distinct from old.descricao or - new.cor is distinct from old.cor or - new.is_active is distinct from old.is_active or - new.is_system is distinct from old.is_system or - new.owner_id is distinct from old.owner_id or - new.therapist_id is distinct from old.therapist_id or - new.created_at is distinct from old.created_at - then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - -- chegou aqui: só tenant_id/updated_at mudaram -> ok - return new; - end if; - - end if; - - -- não-system: deixa passar - if tg_op = 'DELETE' then - return old; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.prevent_system_group_changes() OWNER TO supabase_admin; - --- --- Name: provision_account_tenant(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text DEFAULT NULL::text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_tenant_id uuid; - v_account_type text; - v_name text; -BEGIN - IF p_kind NOT IN ('therapist', 'clinic_coworking', 'clinic_reception', 'clinic_full') THEN - RAISE EXCEPTION 'kind inválido: "%". Use: therapist, clinic_coworking, clinic_reception, clinic_full.', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_account_type := CASE WHEN p_kind = 'therapist' THEN 'therapist' ELSE 'clinic' END; - - IF EXISTS ( - SELECT 1 - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = p_user_id - AND tm.role = 'tenant_admin' - AND tm.status = 'active' - AND t.kind = p_kind - ) THEN - RAISE EXCEPTION 'Usuário já possui um tenant do tipo "%".', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_name := COALESCE( - NULLIF(TRIM(p_name), ''), - ( - SELECT COALESCE(NULLIF(TRIM(pr.full_name), ''), SPLIT_PART(au.email, '@', 1)) - FROM public.profiles pr - JOIN auth.users au ON au.id = pr.id - WHERE pr.id = p_user_id - ), - 'Conta' - ); - - INSERT INTO public.tenants (name, kind, created_at) - VALUES (v_name, p_kind, now()) - RETURNING id INTO v_tenant_id; - - INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) - VALUES (v_tenant_id, p_user_id, 'tenant_admin', 'active', now()); - - UPDATE public.profiles - SET account_type = v_account_type - WHERE id = p_user_id; - - PERFORM public.seed_determined_commitments(v_tenant_id); - - RETURN v_tenant_id; -END; -$$; - - -ALTER FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) OWNER TO supabase_admin; - --- --- Name: FUNCTION provision_account_tenant(p_user_id uuid, p_kind text, p_name text); Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) IS 'Cria o tenant do tipo correto e atualiza account_type no profile. Chamar no onboarding após escolha/pagamento de plano therapist ou clinic. p_kind: therapist | clinic_coworking | clinic_reception | clinic_full'; - - --- --- Name: reactivate_subscription(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.reactivate_subscription(p_subscription_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'active' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'active', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'reactivated', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Reativação manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'canceled') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION public.reactivate_subscription(p_subscription_id uuid) OWNER TO supabase_admin; - --- --- Name: rebuild_owner_entitlements(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- Plano ativo do owner (owner = subscriptions.user_id) - select s.plan_id - into v_plan_id - from public.subscriptions s - where s.user_id = p_owner_id - and s.status = 'active' - order by s.created_at desc - limit 1; - - -- Sempre zera entitlements do owner (rebuild) - delete from public.owner_feature_entitlements e - where e.owner_id = p_owner_id; - - -- Se não tem assinatura ativa, acabou - if v_plan_id is null then - return; - end if; - - -- Recria entitlements esperados pelo plano - insert into public.owner_feature_entitlements (owner_id, feature_key, sources, limits_list) - select - p_owner_id as owner_id, - f.key as feature_key, - array['plan'::text] as sources, - '{}'::jsonb as limits_list - from public.plan_features pf - join public.features f on f.id = pf.feature_id - where pf.plan_id = v_plan_id; - -end; -$$; - - -ALTER FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) OWNER TO supabase_admin; - --- --- Name: revoke_support_session(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.revoke_support_session(p_token text) RETURNS boolean - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_admin_id uuid; - v_role text; -BEGIN - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - SELECT role INTO v_role FROM public.profiles WHERE id = v_admin_id; - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado.' USING ERRCODE = 'P0002'; - END IF; - - DELETE FROM public.support_sessions - WHERE token = p_token - AND admin_id = v_admin_id; - - RETURN FOUND; -END; -$$; - - -ALTER FUNCTION public.revoke_support_session(p_token text) OWNER TO supabase_admin; - --- --- Name: rotate_patient_invite_token(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.rotate_patient_invite_token(p_new_token text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_uid uuid; - v_id uuid; -begin - -- pega o usuário logado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Usuário não autenticado'; - end if; - - -- desativa tokens antigos ativos do usuário - update public.patient_invites - set active = false - where owner_id = v_uid - and active = true; - - -- cria novo token - insert into public.patient_invites (owner_id, token, active) - values (v_uid, p_new_token, true) - returning id into v_id; - - return v_id; -end; -$$; - - -ALTER FUNCTION public.rotate_patient_invite_token(p_new_token text) OWNER TO supabase_admin; - --- --- Name: saas_votar_doc(uuid, boolean); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid := auth.uid(); - v_voto_antigo boolean; -begin - if v_uid is null then - raise exception 'Não autenticado'; - end if; - - -- Verifica se já votou - select util into v_voto_antigo - from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - if found then - -- Já votou igual → cancela o voto (toggle) - if v_voto_antigo = p_util then - delete from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util - (case when p_util then 1 else 0 end)), - votos_nao_util = greatest(0, votos_nao_util - (case when not p_util then 1 else 0 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'removido', 'util', null); - else - -- Mudou de voto - update public.saas_doc_votos set util = p_util, updated_at = now() - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util + (case when p_util then 1 else -1 end)), - votos_nao_util = greatest(0, votos_nao_util + (case when not p_util then 1 else -1 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'atualizado', 'util', p_util); - end if; - else - -- Primeiro voto - insert into public.saas_doc_votos (doc_id, user_id, util) - values (p_doc_id, v_uid, p_util); - - update public.saas_docs set - votos_util = votos_util + (case when p_util then 1 else 0 end), - votos_nao_util = votos_nao_util + (case when not p_util then 1 else 0 end), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'registrado', 'util', p_util); - end if; -end; -$$; - - -ALTER FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) OWNER TO supabase_admin; - --- --- Name: seed_determined_commitments(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.seed_determined_commitments(p_tenant_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_id uuid; -begin - -- Sessão (locked + sempre ativa) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'session' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'session', true, true, 'Sessão', 'Sessão com paciente'); - end if; - - -- Leitura - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'reading', false, true, 'Leitura', 'Praticar leitura'); - end if; - - -- Supervisão - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'supervision', false, true, 'Supervisão', 'Supervisão'); - end if; - - -- Aula ✅ (corrigido) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'class', false, false, 'Aula', 'Dar aula'); - end if; - - -- Análise pessoal - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal'); - end if; - - -- ------------------------------------------------------- - -- Campos padrão (idempotentes por (commitment_id, key)) - -- ------------------------------------------------------- - - -- Leitura - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'book') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'book', 'Livro', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'author') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'author', 'Autor', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Supervisão - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'supervisor') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'supervisor', 'Supervisor', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'topic') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'topic', 'Assunto', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Aula - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'theme') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'theme', 'Tema', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'group') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'group', 'Turma', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Análise - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'analyst') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'analyst', 'Analista', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'focus') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'focus', 'Foco', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; -end; -$$; - - -ALTER FUNCTION public.seed_determined_commitments(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: set_owner_id(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_owner_id() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.owner_id is null then - new.owner_id := auth.uid(); - end if; - return new; -end; -$$; - - -ALTER FUNCTION public.set_owner_id() OWNER TO supabase_admin; - --- --- Name: set_tenant_feature_exception(uuid, text, boolean, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text DEFAULT NULL::text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -begin - -- ✅ Só owner ou admin do tenant podem alterar features - if not exists ( - select 1 from public.tenant_members - where tenant_id = p_tenant_id - and user_id = auth.uid() - and role in ('owner', 'admin') - and status = 'active' - ) then - raise exception 'Acesso negado: apenas owner/admin pode alterar features do tenant.'; - end if; - - insert into public.tenant_features (tenant_id, feature_key, enabled) - values (p_tenant_id, p_feature_key, p_enabled) - on conflict (tenant_id, feature_key) - do update set enabled = excluded.enabled; - - insert into public.tenant_feature_exceptions_log ( - tenant_id, feature_key, enabled, reason, created_by - ) values ( - p_tenant_id, p_feature_key, p_enabled, p_reason, auth.uid() - ); -end; -$$; - - -ALTER FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) OWNER TO supabase_admin; - --- --- Name: set_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - new.updated_at = now(); - return new; -end; -$$; - - -ALTER FUNCTION public.set_updated_at() OWNER TO supabase_admin; - --- --- Name: set_updated_at_recurrence(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_updated_at_recurrence() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN NEW.updated_at = now(); RETURN NEW; END; -$$; - - -ALTER FUNCTION public.set_updated_at_recurrence() OWNER TO supabase_admin; - --- --- Name: split_recurrence_at(uuid, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_old public.recurrence_rules; - v_new_id uuid; -BEGIN - -- busca a regra original - SELECT * INTO v_old - FROM public.recurrence_rules - WHERE id = p_recurrence_id; - - IF NOT FOUND THEN - RAISE EXCEPTION 'recurrence_rule % não encontrada', p_recurrence_id; - END IF; - - -- encerra a regra antiga na data anterior - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - updated_at = now() - WHERE id = p_recurrence_id; - - -- cria nova regra a partir de p_from_date - INSERT INTO public.recurrence_rules ( - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - start_date, end_date, max_occurrences, open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - ) - SELECT - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - p_from_date, v_old.end_date, v_old.max_occurrences, v_old.open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - FROM public.recurrence_rules - WHERE id = p_recurrence_id - RETURNING id INTO v_new_id; - - RETURN v_new_id; -END; -$$; - - -ALTER FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) OWNER TO supabase_admin; - --- --- Name: subscription_intents_view_insert(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.subscription_intents_view_insert() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_target text; - v_plan_id uuid; -begin - select p.id, p.target into v_plan_id, v_target - from public.plans p - where p.key = new.plan_key; - - if v_plan_id is null then - raise exception 'Plano inválido: plan_key=%', new.plan_key; - end if; - - if lower(v_target) = 'clinic' then - if new.tenant_id is null then - raise exception 'Intenção clinic exige tenant_id.'; - end if; - - insert into public.subscription_intents_tenant ( - id, tenant_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.tenant_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := 'clinic'; - return new; - end if; - - -- therapist ou supervisor → tabela personal - if lower(v_target) in ('therapist', 'supervisor') then - insert into public.subscription_intents_personal ( - id, user_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.user_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := lower(v_target); -- 'therapist' ou 'supervisor' - return new; - end if; - - raise exception 'Target de plano não suportado: %', v_target; -end; -$$; - - -ALTER FUNCTION public.subscription_intents_view_insert() OWNER TO supabase_admin; - --- --- Name: subscriptions_validate_scope(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.subscriptions_validate_scope() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target IN ('therapist', 'supervisor') THEN - -- supervisor é pessoal como therapist - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura % não deve ter tenant_id.', v_target; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura % exige user_id.', v_target; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.subscriptions_validate_scope() OWNER TO supabase_admin; - --- --- Name: sync_busy_mirror_agenda_eventos(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.sync_busy_mirror_agenda_eventos() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - clinic_tenant uuid; - is_personal boolean; - should_mirror boolean; -begin - -- Anti-recursão: espelho não espelha - if (tg_op <> 'DELETE') then - if new.mirror_of_event_id is not null then - return new; - end if; - else - if old.mirror_of_event_id is not null then - return old; - end if; - end if; - - -- Define se é pessoal e se deve espelhar - if (tg_op = 'DELETE') then - is_personal := (old.tenant_id = old.owner_id); - should_mirror := (old.visibility_scope in ('busy_only','private')); - else - is_personal := (new.tenant_id = new.owner_id); - should_mirror := (new.visibility_scope in ('busy_only','private')); - end if; - - -- Se não é pessoal, não faz nada - if not is_personal then - if (tg_op = 'DELETE') then - return old; - end if; - return new; - end if; - - -- DELETE: remove espelhos existentes - if (tg_op = 'DELETE') then - delete from public.agenda_eventos e - where e.mirror_of_event_id = old.id - and e.mirror_source = 'personal_busy_mirror'; - - return old; - end if; - - -- INSERT/UPDATE: - -- Se não deve espelhar, remove espelhos e sai - if not should_mirror then - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror'; - - return new; - end if; - - -- Para cada clínica onde o usuário é therapist active, cria/atualiza o "Ocupado" - for clinic_tenant in - select tm.tenant_id - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id <> new.owner_id - loop - insert into public.agenda_eventos ( - tenant_id, - owner_id, - terapeuta_id, - paciente_id, - tipo, - status, - titulo, - observacoes, - inicio_em, - fim_em, - mirror_of_event_id, - mirror_source, - visibility_scope, - created_at, - updated_at - ) values ( - clinic_tenant, - new.owner_id, - new.owner_id, - null, - 'bloqueio'::public.tipo_evento_agenda, - 'agendado'::public.status_evento_agenda, - 'Ocupado', - null, - new.inicio_em, - new.fim_em, - new.id, - 'personal_busy_mirror', - 'public', - now(), - now() - ) - on conflict (tenant_id, mirror_of_event_id) where mirror_of_event_id is not null - do update set - owner_id = excluded.owner_id, - terapeuta_id = excluded.terapeuta_id, - tipo = excluded.tipo, - status = excluded.status, - titulo = excluded.titulo, - observacoes = excluded.observacoes, - inicio_em = excluded.inicio_em, - fim_em = excluded.fim_em, - updated_at = now(); - end loop; - - -- Limpa espelhos de clínicas onde o vínculo therapist active não existe mais - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror' - and not exists ( - select 1 - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id = e.tenant_id - ); - - return new; -end; -$$; - - -ALTER FUNCTION public.sync_busy_mirror_agenda_eventos() OWNER TO supabase_admin; - --- --- Name: tenant_accept_invite(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_accept_invite(p_token uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_uid uuid; - v_email text; - v_invite public.tenant_invites%rowtype; -begin - -- 1) precisa estar autenticado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'not_authenticated' using errcode = 'P0001'; - end if; - - -- 2) pega email real do usuário logado sem depender do JWT claim - select u.email - into v_email - from auth.users u - where u.id = v_uid; - - if v_email is null or length(trim(v_email)) = 0 then - raise exception 'missing_user_email' using errcode = 'P0001'; - end if; - - -- 3) carrega o invite e trava linha (evita 2 aceites concorrentes) - select * - into v_invite - from public.tenant_invites i - where i.token = p_token - for update; - - if not found then - raise exception 'invite_not_found' using errcode = 'P0001'; - end if; - - -- 4) validações de estado - if v_invite.revoked_at is not null then - raise exception 'invite_revoked' using errcode = 'P0001'; - end if; - - if v_invite.accepted_at is not null then - raise exception 'invite_already_accepted' using errcode = 'P0001'; - end if; - - if v_invite.expires_at is not null and v_invite.expires_at <= now() then - raise exception 'invite_expired' using errcode = 'P0001'; - end if; - - -- 5) valida email (case-insensitive) - if lower(trim(v_invite.email)) <> lower(trim(v_email)) then - raise exception 'email_mismatch' using errcode = 'P0001'; - end if; - - -- 6) consome o invite - update public.tenant_invites - set accepted_at = now(), - accepted_by = v_uid - where id = v_invite.id; - - -- 7) cria ou reativa o membership - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_invite.tenant_id, v_uid, v_invite.role, 'active', now()) - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active'; - - -- 8) retorno útil pro front (você já tenta ler tenant_id no AcceptInvitePage) - return jsonb_build_object( - 'ok', true, - 'tenant_id', v_invite.tenant_id, - 'role', v_invite.role - ); -end; -$$; - - -ALTER FUNCTION public.tenant_accept_invite(p_token uuid) OWNER TO supabase_admin; - --- --- Name: tenant_members; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_members ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - user_id uuid NOT NULL, - role text NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_members OWNER TO supabase_admin; - --- --- Name: tenant_add_member_by_email(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text DEFAULT 'therapist'::text) RETURNS public.tenant_members - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_target_uid uuid; - v_member public.tenant_members%rowtype; - v_is_admin boolean; - v_email text; -begin - if p_tenant_id is null then - raise exception 'tenant_id é obrigatório'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'email é obrigatório'; - end if; - - -- valida role permitida - if p_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'role inválida: %', p_role; - end if; - - -- apenas admin do tenant (role real no banco) - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and coalesce(tm.status,'active') = 'active' - ) into v_is_admin; - - if not v_is_admin then - raise exception 'sem permissão: apenas admin da clínica pode adicionar membros'; - end if; - - -- acha usuário pelo e-mail no Supabase Auth - select u.id - into v_target_uid - from auth.users u - where lower(u.email) = v_email - limit 1; - - if v_target_uid is null then - raise exception 'nenhum usuário encontrado com este e-mail'; - end if; - - -- cria ou reativa membro - insert into public.tenant_members (tenant_id, user_id, role, status) - values (p_tenant_id, v_target_uid, p_role, 'active') - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active' - returning * into v_member; - - return v_member; -end; -$$; - - -ALTER FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_feature_allowed(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.v_tenant_entitlements v - where v.tenant_id = p_tenant_id - and v.feature_key = p_feature_key - and coalesce(v.allowed, false) = true - ); -$$; - - -ALTER FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: tenant_feature_enabled(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select coalesce( - (select tf.enabled - from public.tenant_features tf - where tf.tenant_id = p_tenant_id and tf.feature_key = p_feature_key), - false - ); -$$; - - -ALTER FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: tenant_features_guard_with_plan(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_features_guard_with_plan() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_allowed boolean; -begin - -- só valida quando está habilitando - if new.enabled is distinct from true then - return new; - end if; - - -- permitido pelo plano do tenant? - select exists ( - select 1 - from public.v_tenant_entitlements_full v - where v.tenant_id = new.tenant_id - and v.feature_key = new.feature_key - and v.allowed = true - ) - into v_allowed; - - if not v_allowed then - raise exception 'Feature % não permitida pelo plano atual do tenant %.', - new.feature_key, new.tenant_id - using errcode = 'P0001'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.tenant_features_guard_with_plan() OWNER TO supabase_admin; - --- --- Name: tenant_has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select - exists ( - select 1 - from public.v_tenant_entitlements e - where e.tenant_id = _tenant_id - and e.feature_key = _feature - and e.allowed = true - ) - or exists ( - select 1 - from public.tenant_features tf - where tf.tenant_id = _tenant_id - and tf.feature_key = _feature - and tf.enabled = true - ); -$$; - - -ALTER FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) OWNER TO supabase_admin; - --- --- Name: tenant_invite_member_by_email(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_email text; - v_my_email text; - v_token uuid; - v_updated int; -begin - -- validações básicas - if p_tenant_id is null then - raise exception 'tenant_id inválido' using errcode = 'P0001'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'Informe um email' using errcode = 'P0001'; - end if; - - -- role permitido (ajuste se quiser) - if p_role is null or p_role not in ('therapist', 'secretary') then - raise exception 'Role inválido (use therapist/secretary)' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: auto-convite - v_my_email := public.get_my_email(); - if v_my_email is not null and v_email = v_my_email then - raise exception 'Você não pode convidar o seu próprio email.' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: já é membro ativo do tenant - if exists ( - select 1 - from tenant_members tm - join auth.users au on au.id = tm.user_id - where tm.tenant_id = p_tenant_id - and tm.status = 'active' - and lower(au.email) = v_email - ) then - raise exception 'Este email já está vinculado a esta clínica.' using errcode = 'P0001'; - end if; - - -- ✅ permissão: só admin do tenant pode convidar - if not exists ( - select 1 - from tenant_members me - where me.tenant_id = p_tenant_id - and me.user_id = auth.uid() - and me.status = 'active' - and me.role in ('tenant_admin','clinic_admin') - ) then - raise exception 'Sem permissão para convidar membros.' using errcode = 'P0001'; - end if; - - -- Gera token (reenvio simples / regeneração) - v_token := gen_random_uuid(); - - -- 1) tenta "regerar" um convite pendente existente (mesmo email) - update tenant_invites - set token = v_token, - role = p_role, - created_at = now(), - expires_at = now() + interval '7 days', - accepted_at = null, - revoked_at = null - where tenant_id = p_tenant_id - and lower(email) = v_email - and accepted_at is null - and revoked_at is null; - - get diagnostics v_updated = row_count; - - -- 2) se não atualizou nada, cria convite novo - if v_updated = 0 then - insert into tenant_invites (tenant_id, email, role, token, created_at, expires_at) - values (p_tenant_id, v_email, p_role, v_token, now(), now() + interval '7 days'); - end if; - - return v_token; -end; -$$; - - -ALTER FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_reactivate_member(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - update public.tenant_members - set status = 'active' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_remove_member(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -declare - v_role text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - -- pega role atual do membro (se não existir, erro) - select role into v_role - from public.tenant_members - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if v_role is null then - raise exception 'membership_not_found'; - end if; - - -- trava: se for therapist, não pode remover com eventos futuros - if v_role = 'therapist' then - if exists ( - select 1 - from public.agenda_eventos e - where e.owner_id = p_tenant_id - and e.terapeuta_id = p_member_user_id - and e.inicio_em >= now() - and e.status::text not in ('cancelado','cancelled','canceled') - limit 1 - ) then - raise exception 'cannot_remove_therapist_with_future_events'; - end if; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_remove_member_soft(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_revoke_invite(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -declare - v_email text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - v_email := lower(trim(p_email)); - - update public.tenant_invites - set revoked_at = now(), - revoked_by = auth.uid() - where tenant_id = p_tenant_id - and lower(email) = v_email - and role = p_role - and accepted_at is null - and revoked_at is null; - - if not found then - raise exception 'invite_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_set_member_status(uuid, uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida status (adapte aos seus valores reais) - if p_new_status not in ('active','inactive','suspended','invited') then - raise exception 'invalid_status: %', p_new_status; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita desativar a si mesmo (opcional) - if p_member_user_id = auth.uid() and p_new_status <> 'active' then - raise exception 'cannot_disable_self'; - end if; - - update public.tenant_members - set status = p_new_status - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) OWNER TO supabase_admin; - --- --- Name: tenant_update_member_role(uuid, uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - -- exige auth - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida role - if p_new_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'invalid_role: %', p_new_role; - end if; - - -- somente tenant_admin ativo pode alterar role - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita o admin remover o próprio admin sem querer (opcional mas recomendado) - if p_member_user_id = auth.uid() and p_new_role <> 'tenant_admin' then - raise exception 'cannot_demote_self'; - end if; - - update public.tenant_members - set role = p_new_role - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) OWNER TO supabase_admin; - --- --- Name: toggle_plan(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.toggle_plan(owner uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - current_key text; - new_key text; -begin - select p.key into current_key - from subscriptions s - join plans p on p.id = s.plan_id - where s.owner_id = owner - and s.status = 'active'; - - new_key := case - when current_key = 'pro' then 'free' - else 'pro' - end; - - update subscriptions s - set plan_id = p.id - from plans p - where p.key = new_key - and s.owner_id = owner - and s.status = 'active'; -end; -$$; - - -ALTER FUNCTION public.toggle_plan(owner uuid) OWNER TO supabase_admin; - --- --- Name: transition_subscription(uuid, text, text, jsonb); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text DEFAULT NULL::text, p_metadata jsonb DEFAULT NULL::jsonb) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_uid uuid; - v_is_allowed boolean := false; -begin - v_uid := auth.uid(); - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id; - - if not found then - raise exception 'Assinatura não encontrada'; - end if; - - -- ===================================================== - -- 🔐 BLOCO DE AUTORIZAÇÃO - -- ===================================================== - - -- 1) SaaS admin pode tudo - if is_saas_admin() then - v_is_allowed := true; - end if; - - -- 2) Assinatura pessoal (therapist) - if not v_is_allowed - and v_sub.tenant_id is null - and v_sub.user_id = v_uid then - v_is_allowed := true; - end if; - - -- 3) Assinatura de clinic (tenant) - if not v_is_allowed - and v_sub.tenant_id is not null then - - if exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = v_sub.tenant_id - and tm.user_id = v_uid - and tm.status = 'active' - and tm.role = 'tenant_admin' - ) then - v_is_allowed := true; - end if; - - end if; - - if not v_is_allowed then - raise exception 'Sem permissão para transicionar esta assinatura'; - end if; - - -- ===================================================== - -- 🧠 TRANSIÇÃO - -- ===================================================== - - update public.subscriptions - set status = p_to_status, - updated_at = now(), - cancelled_at = case when p_to_status = 'cancelled' then now() else cancelled_at end, - suspended_at = case when p_to_status = 'suspended' then now() else suspended_at end, - past_due_since = case when p_to_status = 'past_due' then now() else past_due_since end, - expired_at = case when p_to_status = 'expired' then now() else expired_at end, - activated_at = case when p_to_status = 'active' then now() else activated_at end - where id = p_subscription_id - returning * into v_sub; - - -- ===================================================== - -- 🧾 EVENT LOG - -- ===================================================== - - insert into public.subscription_events ( - subscription_id, - owner_id, - event_type, - created_at, - created_by, - source, - reason, - metadata, - owner_type, - owner_ref - ) - values ( - v_sub.id, - coalesce(v_sub.tenant_id, v_sub.user_id), - 'status_changed', - now(), - v_uid, - 'manual_transition', - p_reason, - p_metadata, - case when v_sub.tenant_id is not null then 'tenant' else 'personal' end, - coalesce(v_sub.tenant_id, v_sub.user_id) - ); - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) OWNER TO supabase_admin; - --- --- Name: update_payment_settings_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.update_payment_settings_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.update_payment_settings_updated_at() OWNER TO supabase_admin; - --- --- Name: update_professional_pricing_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.update_professional_pricing_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.update_professional_pricing_updated_at() OWNER TO supabase_admin; - --- --- Name: user_has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.user_has_feature(_user_id uuid, _feature text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.v_user_entitlements e - where e.user_id = _user_id - and e.feature_key = _feature - and e.allowed = true - ); -$$; - - -ALTER FUNCTION public.user_has_feature(_user_id uuid, _feature text) OWNER TO supabase_admin; - --- --- Name: validate_support_session(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.validate_support_session(p_token text) RETURNS json - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_session support_sessions; -BEGIN - IF p_token IS NULL OR length(trim(p_token)) < 32 THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - SELECT * INTO v_session - FROM public.support_sessions - WHERE token = p_token - AND expires_at > now() - LIMIT 1; - - IF NOT FOUND THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - RETURN json_build_object( - 'valid', true, - 'tenant_id', v_session.tenant_id - ); -END; -$$; - - -ALTER FUNCTION public.validate_support_session(p_token text) OWNER TO supabase_admin; - --- --- Name: whoami(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.whoami() RETURNS TABLE(uid uuid, role text) - LANGUAGE sql STABLE - AS $$ - select auth.uid() as uid, auth.role() as role; -$$; - - -ALTER FUNCTION public.whoami() OWNER TO supabase_admin; - --- --- Name: apply_rls(jsonb, integer); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer DEFAULT (1024 * 1024)) RETURNS SETOF realtime.wal_rls - LANGUAGE plpgsql - AS $$ -declare --- Regclass of the table e.g. public.notes -entity_ regclass = (quote_ident(wal ->> 'schema') || '.' || quote_ident(wal ->> 'table'))::regclass; - --- I, U, D, T: insert, update ... -action realtime.action = ( - case wal ->> 'action' - when 'I' then 'INSERT' - when 'U' then 'UPDATE' - when 'D' then 'DELETE' - else 'ERROR' - end -); - --- Is row level security enabled for the table -is_rls_enabled bool = relrowsecurity from pg_class where oid = entity_; - -subscriptions realtime.subscription[] = array_agg(subs) - from - realtime.subscription subs - where - subs.entity = entity_; - --- Subscription vars -roles regrole[] = array_agg(distinct us.claims_role::text) - from - unnest(subscriptions) us; - -working_role regrole; -claimed_role regrole; -claims jsonb; - -subscription_id uuid; -subscription_has_access bool; -visible_to_subscription_ids uuid[] = '{}'; - --- structured info for wal's columns -columns realtime.wal_column[]; --- previous identity values for update/delete -old_columns realtime.wal_column[]; - -error_record_exceeds_max_size boolean = octet_length(wal::text) > max_record_bytes; - --- Primary jsonb output for record -output jsonb; - -begin -perform set_config('role', null, true); - -columns = - array_agg( - ( - x->>'name', - x->>'type', - x->>'typeoid', - realtime.cast( - (x->'value') #>> '{}', - coalesce( - (x->>'typeoid')::regtype, -- null when wal2json version <= 2.4 - (x->>'type')::regtype - ) - ), - (pks ->> 'name') is not null, - true - )::realtime.wal_column - ) - from - jsonb_array_elements(wal -> 'columns') x - left join jsonb_array_elements(wal -> 'pk') pks - on (x ->> 'name') = (pks ->> 'name'); - -old_columns = - array_agg( - ( - x->>'name', - x->>'type', - x->>'typeoid', - realtime.cast( - (x->'value') #>> '{}', - coalesce( - (x->>'typeoid')::regtype, -- null when wal2json version <= 2.4 - (x->>'type')::regtype - ) - ), - (pks ->> 'name') is not null, - true - )::realtime.wal_column - ) - from - jsonb_array_elements(wal -> 'identity') x - left join jsonb_array_elements(wal -> 'pk') pks - on (x ->> 'name') = (pks ->> 'name'); - -for working_role in select * from unnest(roles) loop - - -- Update `is_selectable` for columns and old_columns - columns = - array_agg( - ( - c.name, - c.type_name, - c.type_oid, - c.value, - c.is_pkey, - pg_catalog.has_column_privilege(working_role, entity_, c.name, 'SELECT') - )::realtime.wal_column - ) - from - unnest(columns) c; - - old_columns = - array_agg( - ( - c.name, - c.type_name, - c.type_oid, - c.value, - c.is_pkey, - pg_catalog.has_column_privilege(working_role, entity_, c.name, 'SELECT') - )::realtime.wal_column - ) - from - unnest(old_columns) c; - - if action <> 'DELETE' and count(1) = 0 from unnest(columns) c where c.is_pkey then - return next ( - jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action - ), - is_rls_enabled, - -- subscriptions is already filtered by entity - (select array_agg(s.subscription_id) from unnest(subscriptions) as s where claims_role = working_role), - array['Error 400: Bad Request, no primary key'] - )::realtime.wal_rls; - - -- The claims role does not have SELECT permission to the primary key of entity - elsif action <> 'DELETE' and sum(c.is_selectable::int) <> count(1) from unnest(columns) c where c.is_pkey then - return next ( - jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action - ), - is_rls_enabled, - (select array_agg(s.subscription_id) from unnest(subscriptions) as s where claims_role = working_role), - array['Error 401: Unauthorized'] - )::realtime.wal_rls; - - else - output = jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action, - 'commit_timestamp', to_char( - ((wal ->> 'timestamp')::timestamptz at time zone 'utc'), - 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"' - ), - 'columns', ( - select - jsonb_agg( - jsonb_build_object( - 'name', pa.attname, - 'type', pt.typname - ) - order by pa.attnum asc - ) - from - pg_attribute pa - join pg_type pt - on pa.atttypid = pt.oid - where - attrelid = entity_ - and attnum > 0 - and pg_catalog.has_column_privilege(working_role, entity_, pa.attname, 'SELECT') - ) - ) - -- Add "record" key for insert and update - || case - when action in ('INSERT', 'UPDATE') then - jsonb_build_object( - 'record', - ( - select - jsonb_object_agg( - -- if unchanged toast, get column name and value from old record - coalesce((c).name, (oc).name), - case - when (c).name is null then (oc).value - else (c).value - end - ) - from - unnest(columns) c - full outer join unnest(old_columns) oc - on (c).name = (oc).name - where - coalesce((c).is_selectable, (oc).is_selectable) - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - ) - ) - else '{}'::jsonb - end - -- Add "old_record" key for update and delete - || case - when action = 'UPDATE' then - jsonb_build_object( - 'old_record', - ( - select jsonb_object_agg((c).name, (c).value) - from unnest(old_columns) c - where - (c).is_selectable - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - ) - ) - when action = 'DELETE' then - jsonb_build_object( - 'old_record', - ( - select jsonb_object_agg((c).name, (c).value) - from unnest(old_columns) c - where - (c).is_selectable - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - and ( not is_rls_enabled or (c).is_pkey ) -- if RLS enabled, we can't secure deletes so filter to pkey - ) - ) - else '{}'::jsonb - end; - - -- Create the prepared statement - if is_rls_enabled and action <> 'DELETE' then - if (select 1 from pg_prepared_statements where name = 'walrus_rls_stmt' limit 1) > 0 then - deallocate walrus_rls_stmt; - end if; - execute realtime.build_prepared_statement_sql('walrus_rls_stmt', entity_, columns); - end if; - - visible_to_subscription_ids = '{}'; - - for subscription_id, claims in ( - select - subs.subscription_id, - subs.claims - from - unnest(subscriptions) subs - where - subs.entity = entity_ - and subs.claims_role = working_role - and ( - realtime.is_visible_through_filters(columns, subs.filters) - or ( - action = 'DELETE' - and realtime.is_visible_through_filters(old_columns, subs.filters) - ) - ) - ) loop - - if not is_rls_enabled or action = 'DELETE' then - visible_to_subscription_ids = visible_to_subscription_ids || subscription_id; - else - -- Check if RLS allows the role to see the record - perform - -- Trim leading and trailing quotes from working_role because set_config - -- doesn't recognize the role as valid if they are included - set_config('role', trim(both '"' from working_role::text), true), - set_config('request.jwt.claims', claims::text, true); - - execute 'execute walrus_rls_stmt' into subscription_has_access; - - if subscription_has_access then - visible_to_subscription_ids = visible_to_subscription_ids || subscription_id; - end if; - end if; - end loop; - - perform set_config('role', null, true); - - return next ( - output, - is_rls_enabled, - visible_to_subscription_ids, - case - when error_record_exceeds_max_size then array['Error 413: Payload Too Large'] - else '{}' - end - )::realtime.wal_rls; - - end if; -end loop; - -perform set_config('role', null, true); -end; -$$; - - -ALTER FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) OWNER TO supabase_admin; - --- --- Name: broadcast_changes(text, text, text, text, text, record, record, text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text DEFAULT 'ROW'::text) RETURNS void - LANGUAGE plpgsql - AS $$ -DECLARE - -- Declare a variable to hold the JSONB representation of the row - row_data jsonb := '{}'::jsonb; -BEGIN - IF level = 'STATEMENT' THEN - RAISE EXCEPTION 'function can only be triggered for each row, not for each statement'; - END IF; - -- Check the operation type and handle accordingly - IF operation = 'INSERT' OR operation = 'UPDATE' OR operation = 'DELETE' THEN - row_data := jsonb_build_object('old_record', OLD, 'record', NEW, 'operation', operation, 'table', table_name, 'schema', table_schema); - PERFORM realtime.send (row_data, event_name, topic_name); - ELSE - RAISE EXCEPTION 'Unexpected operation type: %', operation; - END IF; -EXCEPTION - WHEN OTHERS THEN - RAISE EXCEPTION 'Failed to process the row: %', SQLERRM; -END; - -$$; - - -ALTER FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) OWNER TO supabase_admin; - --- --- Name: build_prepared_statement_sql(text, regclass, realtime.wal_column[]); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) RETURNS text - LANGUAGE sql - AS $$ - /* - Builds a sql string that, if executed, creates a prepared statement to - tests retrive a row from *entity* by its primary key columns. - Example - select realtime.build_prepared_statement_sql('public.notes', '{"id"}'::text[], '{"bigint"}'::text[]) - */ - select - 'prepare ' || prepared_statement_name || ' as - select - exists( - select - 1 - from - ' || entity || ' - where - ' || string_agg(quote_ident(pkc.name) || '=' || quote_nullable(pkc.value #>> '{}') , ' and ') || ' - )' - from - unnest(columns) pkc - where - pkc.is_pkey - group by - entity - $$; - - -ALTER FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) OWNER TO supabase_admin; - --- --- Name: cast(text, regtype); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime."cast"(val text, type_ regtype) RETURNS jsonb - LANGUAGE plpgsql IMMUTABLE - AS $$ - declare - res jsonb; - begin - execute format('select to_jsonb(%L::'|| type_::text || ')', val) into res; - return res; - end - $$; - - -ALTER FUNCTION realtime."cast"(val text, type_ regtype) OWNER TO supabase_admin; - --- --- Name: check_equality_op(realtime.equality_op, regtype, text, text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) RETURNS boolean - LANGUAGE plpgsql IMMUTABLE - AS $$ - /* - Casts *val_1* and *val_2* as type *type_* and check the *op* condition for truthiness - */ - declare - op_symbol text = ( - case - when op = 'eq' then '=' - when op = 'neq' then '!=' - when op = 'lt' then '<' - when op = 'lte' then '<=' - when op = 'gt' then '>' - when op = 'gte' then '>=' - when op = 'in' then '= any' - else 'UNKNOWN OP' - end - ); - res boolean; - begin - execute format( - 'select %L::'|| type_::text || ' ' || op_symbol - || ' ( %L::' - || ( - case - when op = 'in' then type_::text || '[]' - else type_::text end - ) - || ')', val_1, val_2) into res; - return res; - end; - $$; - - -ALTER FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) OWNER TO supabase_admin; - --- --- Name: is_visible_through_filters(realtime.wal_column[], realtime.user_defined_filter[]); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) RETURNS boolean - LANGUAGE sql IMMUTABLE - AS $_$ - /* - Should the record be visible (true) or filtered out (false) after *filters* are applied - */ - select - -- Default to allowed when no filters present - $2 is null -- no filters. this should not happen because subscriptions has a default - or array_length($2, 1) is null -- array length of an empty array is null - or bool_and( - coalesce( - realtime.check_equality_op( - op:=f.op, - type_:=coalesce( - col.type_oid::regtype, -- null when wal2json version <= 2.4 - col.type_name::regtype - ), - -- cast jsonb to text - val_1:=col.value #>> '{}', - val_2:=f.value - ), - false -- if null, filter does not match - ) - ) - from - unnest(filters) f - join unnest(columns) col - on f.column_name = col.name; - $_$; - - -ALTER FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) OWNER TO supabase_admin; - --- --- Name: list_changes(name, name, integer, integer); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) RETURNS SETOF realtime.wal_rls - LANGUAGE sql - SET log_min_messages TO 'fatal' - AS $$ - with pub as ( - select - concat_ws( - ',', - case when bool_or(pubinsert) then 'insert' else null end, - case when bool_or(pubupdate) then 'update' else null end, - case when bool_or(pubdelete) then 'delete' else null end - ) as w2j_actions, - coalesce( - string_agg( - realtime.quote_wal2json(format('%I.%I', schemaname, tablename)::regclass), - ',' - ) filter (where ppt.tablename is not null and ppt.tablename not like '% %'), - '' - ) w2j_add_tables - from - pg_publication pp - left join pg_publication_tables ppt - on pp.pubname = ppt.pubname - where - pp.pubname = publication - group by - pp.pubname - limit 1 - ), - w2j as ( - select - x.*, pub.w2j_add_tables - from - pub, - pg_logical_slot_get_changes( - slot_name, null, max_changes, - 'include-pk', 'true', - 'include-transaction', 'false', - 'include-timestamp', 'true', - 'include-type-oids', 'true', - 'format-version', '2', - 'actions', pub.w2j_actions, - 'add-tables', pub.w2j_add_tables - ) x - ) - select - xyz.wal, - xyz.is_rls_enabled, - xyz.subscription_ids, - xyz.errors - from - w2j, - realtime.apply_rls( - wal := w2j.data::jsonb, - max_record_bytes := max_record_bytes - ) xyz(wal, is_rls_enabled, subscription_ids, errors) - where - w2j.w2j_add_tables <> '' - and xyz.subscription_ids[1] is not null - $$; - - -ALTER FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) OWNER TO supabase_admin; - --- --- Name: quote_wal2json(regclass); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.quote_wal2json(entity regclass) RETURNS text - LANGUAGE sql IMMUTABLE STRICT - AS $$ - select - ( - select string_agg('' || ch,'') - from unnest(string_to_array(nsp.nspname::text, null)) with ordinality x(ch, idx) - where - not (x.idx = 1 and x.ch = '"') - and not ( - x.idx = array_length(string_to_array(nsp.nspname::text, null), 1) - and x.ch = '"' - ) - ) - || '.' - || ( - select string_agg('' || ch,'') - from unnest(string_to_array(pc.relname::text, null)) with ordinality x(ch, idx) - where - not (x.idx = 1 and x.ch = '"') - and not ( - x.idx = array_length(string_to_array(nsp.nspname::text, null), 1) - and x.ch = '"' - ) - ) - from - pg_class pc - join pg_namespace nsp - on pc.relnamespace = nsp.oid - where - pc.oid = entity - $$; - - -ALTER FUNCTION realtime.quote_wal2json(entity regclass) OWNER TO supabase_admin; - --- --- Name: send(jsonb, text, text, boolean); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean DEFAULT true) RETURNS void - LANGUAGE plpgsql - AS $$ -DECLARE - generated_id uuid; - final_payload jsonb; -BEGIN - BEGIN - -- Generate a new UUID for the id - generated_id := gen_random_uuid(); - - -- Check if payload has an 'id' key, if not, add the generated UUID - IF payload ? 'id' THEN - final_payload := payload; - ELSE - final_payload := jsonb_set(payload, '{id}', to_jsonb(generated_id)); - END IF; - - -- Set the topic configuration - EXECUTE format('SET LOCAL realtime.topic TO %L', topic); - - -- Attempt to insert the message - INSERT INTO realtime.messages (id, payload, event, topic, private, extension) - VALUES (generated_id, final_payload, event, topic, private, 'broadcast'); - EXCEPTION - WHEN OTHERS THEN - -- Capture and notify the error - RAISE WARNING 'ErrorSendingBroadcastMessage: %', SQLERRM; - END; -END; -$$; - - -ALTER FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) OWNER TO supabase_admin; - --- --- Name: subscription_check_filters(); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.subscription_check_filters() RETURNS trigger - LANGUAGE plpgsql - AS $$ - /* - Validates that the user defined filters for a subscription: - - refer to valid columns that the claimed role may access - - values are coercable to the correct column type - */ - declare - col_names text[] = coalesce( - array_agg(c.column_name order by c.ordinal_position), - '{}'::text[] - ) - from - information_schema.columns c - where - format('%I.%I', c.table_schema, c.table_name)::regclass = new.entity - and pg_catalog.has_column_privilege( - (new.claims ->> 'role'), - format('%I.%I', c.table_schema, c.table_name)::regclass, - c.column_name, - 'SELECT' - ); - filter realtime.user_defined_filter; - col_type regtype; - - in_val jsonb; - begin - for filter in select * from unnest(new.filters) loop - -- Filtered column is valid - if not filter.column_name = any(col_names) then - raise exception 'invalid column for filter %', filter.column_name; - end if; - - -- Type is sanitized and safe for string interpolation - col_type = ( - select atttypid::regtype - from pg_catalog.pg_attribute - where attrelid = new.entity - and attname = filter.column_name - ); - if col_type is null then - raise exception 'failed to lookup type for column %', filter.column_name; - end if; - - -- Set maximum number of entries for in filter - if filter.op = 'in'::realtime.equality_op then - in_val = realtime.cast(filter.value, (col_type::text || '[]')::regtype); - if coalesce(jsonb_array_length(in_val), 0) > 100 then - raise exception 'too many values for `in` filter. Maximum 100'; - end if; - else - -- raises an exception if value is not coercable to type - perform realtime.cast(filter.value, col_type); - end if; - - end loop; - - -- Apply consistent order to filters so the unique constraint on - -- (subscription_id, entity, filters) can't be tricked by a different filter order - new.filters = coalesce( - array_agg(f order by f.column_name, f.op, f.value), - '{}' - ) from unnest(new.filters) f; - - return new; - end; - $$; - - -ALTER FUNCTION realtime.subscription_check_filters() OWNER TO supabase_admin; - --- --- Name: to_regrole(text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.to_regrole(role_name text) RETURNS regrole - LANGUAGE sql IMMUTABLE - AS $$ select role_name::regrole $$; - - -ALTER FUNCTION realtime.to_regrole(role_name text) OWNER TO supabase_admin; - --- --- Name: topic(); Type: FUNCTION; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE FUNCTION realtime.topic() RETURNS text - LANGUAGE sql STABLE - AS $$ -select nullif(current_setting('realtime.topic', true), '')::text; -$$; - - -ALTER FUNCTION realtime.topic() OWNER TO supabase_realtime_admin; - --- --- Name: can_insert_object(text, text, uuid, jsonb); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb) RETURNS void - LANGUAGE plpgsql - AS $$ -BEGIN - INSERT INTO "storage"."objects" ("bucket_id", "name", "owner", "metadata") VALUES (bucketid, name, owner, metadata); - -- hack to rollback the successful insert - RAISE sqlstate 'PT200' using - message = 'ROLLBACK', - detail = 'rollback successful insert'; -END -$$; - - -ALTER FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb) OWNER TO supabase_storage_admin; - --- --- Name: enforce_bucket_name_length(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.enforce_bucket_name_length() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if length(new.name) > 100 then - raise exception 'bucket name "%" is too long (% characters). Max is 100.', new.name, length(new.name); - end if; - return new; -end; -$$; - - -ALTER FUNCTION storage.enforce_bucket_name_length() OWNER TO supabase_storage_admin; - --- --- Name: extension(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.extension(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -_filename text; -BEGIN - select string_to_array(name, '/') into _parts; - select _parts[array_length(_parts,1)] into _filename; - -- @todo return the last part instead of 2 - return reverse(split_part(reverse(_filename), '.', 1)); -END -$$; - - -ALTER FUNCTION storage.extension(name text) OWNER TO supabase_storage_admin; - --- --- Name: filename(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.filename(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[array_length(_parts,1)]; -END -$$; - - -ALTER FUNCTION storage.filename(name text) OWNER TO supabase_storage_admin; - --- --- Name: foldername(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.foldername(name text) RETURNS text[] - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[1:array_length(_parts,1)-1]; -END -$$; - - -ALTER FUNCTION storage.foldername(name text) OWNER TO supabase_storage_admin; - --- --- Name: get_common_prefix(text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_common_prefix(p_key text, p_prefix text, p_delimiter text) RETURNS text - LANGUAGE sql IMMUTABLE - AS $$ -SELECT CASE - WHEN position(p_delimiter IN substring(p_key FROM length(p_prefix) + 1)) > 0 - THEN left(p_key, length(p_prefix) + position(p_delimiter IN substring(p_key FROM length(p_prefix) + 1))) - ELSE NULL -END; -$$; - - -ALTER FUNCTION storage.get_common_prefix(p_key text, p_prefix text, p_delimiter text) OWNER TO supabase_storage_admin; - --- --- Name: get_size_by_bucket(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_size_by_bucket() RETURNS TABLE(size bigint, bucket_id text) - LANGUAGE plpgsql - AS $$ -BEGIN - return query - select sum((metadata->>'size')::int) as size, obj.bucket_id - from "storage".objects as obj - group by obj.bucket_id; -END -$$; - - -ALTER FUNCTION storage.get_size_by_bucket() OWNER TO supabase_storage_admin; - --- --- Name: list_multipart_uploads_with_delimiter(text, text, text, integer, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer DEFAULT 100, next_key_token text DEFAULT ''::text, next_upload_token text DEFAULT ''::text) RETURNS TABLE(key text, id text, created_at timestamp with time zone) - LANGUAGE plpgsql - AS $_$ -BEGIN - RETURN QUERY EXECUTE - 'SELECT DISTINCT ON(key COLLATE "C") * from ( - SELECT - CASE - WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN - substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) - ELSE - key - END AS key, id, created_at - FROM - storage.s3_multipart_uploads - WHERE - bucket_id = $5 AND - key ILIKE $1 || ''%'' AND - CASE - WHEN $4 != '''' AND $6 = '''' THEN - CASE - WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN - substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) COLLATE "C" > $4 - ELSE - key COLLATE "C" > $4 - END - ELSE - true - END AND - CASE - WHEN $6 != '''' THEN - id COLLATE "C" > $6 - ELSE - true - END - ORDER BY - key COLLATE "C" ASC, created_at ASC) as e order by key COLLATE "C" LIMIT $3' - USING prefix_param, delimiter_param, max_keys, next_key_token, bucket_id, next_upload_token; -END; -$_$; - - -ALTER FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer, next_key_token text, next_upload_token text) OWNER TO supabase_storage_admin; - --- --- Name: list_objects_with_delimiter(text, text, text, integer, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.list_objects_with_delimiter(_bucket_id text, prefix_param text, delimiter_param text, max_keys integer DEFAULT 100, start_after text DEFAULT ''::text, next_token text DEFAULT ''::text, sort_order text DEFAULT 'asc'::text) RETURNS TABLE(name text, id uuid, metadata jsonb, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_peek_name TEXT; - v_current RECORD; - v_common_prefix TEXT; - - -- Configuration - v_is_asc BOOLEAN; - v_prefix TEXT; - v_start TEXT; - v_upper_bound TEXT; - v_file_batch_size INT; - - -- Seek state - v_next_seek TEXT; - v_count INT := 0; - - -- Dynamic SQL for batch query only - v_batch_query TEXT; - -BEGIN - -- ======================================================================== - -- INITIALIZATION - -- ======================================================================== - v_is_asc := lower(coalesce(sort_order, 'asc')) = 'asc'; - v_prefix := coalesce(prefix_param, ''); - v_start := CASE WHEN coalesce(next_token, '') <> '' THEN next_token ELSE coalesce(start_after, '') END; - v_file_batch_size := LEAST(GREATEST(max_keys * 2, 100), 1000); - - -- Calculate upper bound for prefix filtering (bytewise, using COLLATE "C") - IF v_prefix = '' THEN - v_upper_bound := NULL; - ELSIF right(v_prefix, 1) = delimiter_param THEN - v_upper_bound := left(v_prefix, -1) || chr(ascii(delimiter_param) + 1); - ELSE - v_upper_bound := left(v_prefix, -1) || chr(ascii(right(v_prefix, 1)) + 1); - END IF; - - -- Build batch query (dynamic SQL - called infrequently, amortized over many rows) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" >= $2 ' || - 'AND o.name COLLATE "C" < $3 ORDER BY o.name COLLATE "C" ASC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" >= $2 ' || - 'ORDER BY o.name COLLATE "C" ASC LIMIT $4'; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" < $2 ' || - 'AND o.name COLLATE "C" >= $3 ORDER BY o.name COLLATE "C" DESC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" < $2 ' || - 'ORDER BY o.name COLLATE "C" DESC LIMIT $4'; - END IF; - END IF; - - -- ======================================================================== - -- SEEK INITIALIZATION: Determine starting position - -- ======================================================================== - IF v_start = '' THEN - IF v_is_asc THEN - v_next_seek := v_prefix; - ELSE - -- DESC without cursor: find the last item in range - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_prefix AND o.name COLLATE "C" < v_upper_bound - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix <> '' THEN - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - END IF; - - IF v_next_seek IS NOT NULL THEN - v_next_seek := v_next_seek || delimiter_param; - ELSE - RETURN; - END IF; - END IF; - ELSE - -- Cursor provided: determine if it refers to a folder or leaf - IF EXISTS ( - SELECT 1 FROM storage.objects o - WHERE o.bucket_id = _bucket_id - AND o.name COLLATE "C" LIKE v_start || delimiter_param || '%' - LIMIT 1 - ) THEN - -- Cursor refers to a folder - IF v_is_asc THEN - v_next_seek := v_start || chr(ascii(delimiter_param) + 1); - ELSE - v_next_seek := v_start || delimiter_param; - END IF; - ELSE - -- Cursor refers to a leaf object - IF v_is_asc THEN - v_next_seek := v_start || delimiter_param; - ELSE - v_next_seek := v_start; - END IF; - END IF; - END IF; - - -- ======================================================================== - -- MAIN LOOP: Hybrid peek-then-batch algorithm - -- Uses STATIC SQL for peek (hot path) and DYNAMIC SQL for batch - -- ======================================================================== - LOOP - EXIT WHEN v_count >= max_keys; - - -- STEP 1: PEEK using STATIC SQL (plan cached, very fast) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_next_seek AND o.name COLLATE "C" < v_upper_bound - ORDER BY o.name COLLATE "C" ASC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_next_seek - ORDER BY o.name COLLATE "C" ASC LIMIT 1; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - END IF; - END IF; - - EXIT WHEN v_peek_name IS NULL; - - -- STEP 2: Check if this is a FOLDER or FILE - v_common_prefix := storage.get_common_prefix(v_peek_name, v_prefix, delimiter_param); - - IF v_common_prefix IS NOT NULL THEN - -- FOLDER: Emit and skip to next folder (no heap access needed) - name := rtrim(v_common_prefix, delimiter_param); - id := NULL; - updated_at := NULL; - created_at := NULL; - last_accessed_at := NULL; - metadata := NULL; - RETURN NEXT; - v_count := v_count + 1; - - -- Advance seek past the folder range - IF v_is_asc THEN - v_next_seek := left(v_common_prefix, -1) || chr(ascii(delimiter_param) + 1); - ELSE - v_next_seek := v_common_prefix; - END IF; - ELSE - -- FILE: Batch fetch using DYNAMIC SQL (overhead amortized over many rows) - -- For ASC: upper_bound is the exclusive upper limit (< condition) - -- For DESC: prefix is the inclusive lower limit (>= condition) - FOR v_current IN EXECUTE v_batch_query USING _bucket_id, v_next_seek, - CASE WHEN v_is_asc THEN COALESCE(v_upper_bound, v_prefix) ELSE v_prefix END, v_file_batch_size - LOOP - v_common_prefix := storage.get_common_prefix(v_current.name, v_prefix, delimiter_param); - - IF v_common_prefix IS NOT NULL THEN - -- Hit a folder: exit batch, let peek handle it - v_next_seek := v_current.name; - EXIT; - END IF; - - -- Emit file - name := v_current.name; - id := v_current.id; - updated_at := v_current.updated_at; - created_at := v_current.created_at; - last_accessed_at := v_current.last_accessed_at; - metadata := v_current.metadata; - RETURN NEXT; - v_count := v_count + 1; - - -- Advance seek past this file - IF v_is_asc THEN - v_next_seek := v_current.name || delimiter_param; - ELSE - v_next_seek := v_current.name; - END IF; - - EXIT WHEN v_count >= max_keys; - END LOOP; - END IF; - END LOOP; -END; -$_$; - - -ALTER FUNCTION storage.list_objects_with_delimiter(_bucket_id text, prefix_param text, delimiter_param text, max_keys integer, start_after text, next_token text, sort_order text) OWNER TO supabase_storage_admin; - --- --- Name: operation(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.operation() RETURNS text - LANGUAGE plpgsql STABLE - AS $$ -BEGIN - RETURN current_setting('storage.operation', true); -END; -$$; - - -ALTER FUNCTION storage.operation() OWNER TO supabase_storage_admin; - --- --- Name: protect_delete(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.protect_delete() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - -- Check if storage.allow_delete_query is set to 'true' - IF COALESCE(current_setting('storage.allow_delete_query', true), 'false') != 'true' THEN - RAISE EXCEPTION 'Direct deletion from storage tables is not allowed. Use the Storage API instead.' - USING HINT = 'This prevents accidental data loss from orphaned objects.', - ERRCODE = '42501'; - END IF; - RETURN NULL; -END; -$$; - - -ALTER FUNCTION storage.protect_delete() OWNER TO supabase_storage_admin; - --- --- Name: search(text, text, integer, integer, integer, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search(prefix text, bucketname text, limits integer DEFAULT 100, levels integer DEFAULT 1, offsets integer DEFAULT 0, search text DEFAULT ''::text, sortcolumn text DEFAULT 'name'::text, sortorder text DEFAULT 'asc'::text) RETURNS TABLE(name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_peek_name TEXT; - v_current RECORD; - v_common_prefix TEXT; - v_delimiter CONSTANT TEXT := '/'; - - -- Configuration - v_limit INT; - v_prefix TEXT; - v_prefix_lower TEXT; - v_is_asc BOOLEAN; - v_order_by TEXT; - v_sort_order TEXT; - v_upper_bound TEXT; - v_file_batch_size INT; - - -- Dynamic SQL for batch query only - v_batch_query TEXT; - - -- Seek state - v_next_seek TEXT; - v_count INT := 0; - v_skipped INT := 0; -BEGIN - -- ======================================================================== - -- INITIALIZATION - -- ======================================================================== - v_limit := LEAST(coalesce(limits, 100), 1500); - v_prefix := coalesce(prefix, '') || coalesce(search, ''); - v_prefix_lower := lower(v_prefix); - v_is_asc := lower(coalesce(sortorder, 'asc')) = 'asc'; - v_file_batch_size := LEAST(GREATEST(v_limit * 2, 100), 1000); - - -- Validate sort column - CASE lower(coalesce(sortcolumn, 'name')) - WHEN 'name' THEN v_order_by := 'name'; - WHEN 'updated_at' THEN v_order_by := 'updated_at'; - WHEN 'created_at' THEN v_order_by := 'created_at'; - WHEN 'last_accessed_at' THEN v_order_by := 'last_accessed_at'; - ELSE v_order_by := 'name'; - END CASE; - - v_sort_order := CASE WHEN v_is_asc THEN 'asc' ELSE 'desc' END; - - -- ======================================================================== - -- NON-NAME SORTING: Use path_tokens approach (unchanged) - -- ======================================================================== - IF v_order_by != 'name' THEN - RETURN QUERY EXECUTE format( - $sql$ - WITH folders AS ( - SELECT path_tokens[$1] AS folder - FROM storage.objects - WHERE objects.name ILIKE $2 || '%%' - AND bucket_id = $3 - AND array_length(objects.path_tokens, 1) <> $1 - GROUP BY folder - ORDER BY folder %s - ) - (SELECT folder AS "name", - NULL::uuid AS id, - NULL::timestamptz AS updated_at, - NULL::timestamptz AS created_at, - NULL::timestamptz AS last_accessed_at, - NULL::jsonb AS metadata FROM folders) - UNION ALL - (SELECT path_tokens[$1] AS "name", - id, updated_at, created_at, last_accessed_at, metadata - FROM storage.objects - WHERE objects.name ILIKE $2 || '%%' - AND bucket_id = $3 - AND array_length(objects.path_tokens, 1) = $1 - ORDER BY %I %s) - LIMIT $4 OFFSET $5 - $sql$, v_sort_order, v_order_by, v_sort_order - ) USING levels, v_prefix, bucketname, v_limit, offsets; - RETURN; - END IF; - - -- ======================================================================== - -- NAME SORTING: Hybrid skip-scan with batch optimization - -- ======================================================================== - - -- Calculate upper bound for prefix filtering - IF v_prefix_lower = '' THEN - v_upper_bound := NULL; - ELSIF right(v_prefix_lower, 1) = v_delimiter THEN - v_upper_bound := left(v_prefix_lower, -1) || chr(ascii(v_delimiter) + 1); - ELSE - v_upper_bound := left(v_prefix_lower, -1) || chr(ascii(right(v_prefix_lower, 1)) + 1); - END IF; - - -- Build batch query (dynamic SQL - called infrequently, amortized over many rows) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" >= $2 ' || - 'AND lower(o.name) COLLATE "C" < $3 ORDER BY lower(o.name) COLLATE "C" ASC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" >= $2 ' || - 'ORDER BY lower(o.name) COLLATE "C" ASC LIMIT $4'; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" < $2 ' || - 'AND lower(o.name) COLLATE "C" >= $3 ORDER BY lower(o.name) COLLATE "C" DESC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" < $2 ' || - 'ORDER BY lower(o.name) COLLATE "C" DESC LIMIT $4'; - END IF; - END IF; - - -- Initialize seek position - IF v_is_asc THEN - v_next_seek := v_prefix_lower; - ELSE - -- DESC: find the last item in range first (static SQL) - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_prefix_lower AND lower(o.name) COLLATE "C" < v_upper_bound - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix_lower <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - END IF; - - IF v_peek_name IS NOT NULL THEN - v_next_seek := lower(v_peek_name) || v_delimiter; - ELSE - RETURN; - END IF; - END IF; - - -- ======================================================================== - -- MAIN LOOP: Hybrid peek-then-batch algorithm - -- Uses STATIC SQL for peek (hot path) and DYNAMIC SQL for batch - -- ======================================================================== - LOOP - EXIT WHEN v_count >= v_limit; - - -- STEP 1: PEEK using STATIC SQL (plan cached, very fast) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_next_seek AND lower(o.name) COLLATE "C" < v_upper_bound - ORDER BY lower(o.name) COLLATE "C" ASC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_next_seek - ORDER BY lower(o.name) COLLATE "C" ASC LIMIT 1; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix_lower <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - END IF; - END IF; - - EXIT WHEN v_peek_name IS NULL; - - -- STEP 2: Check if this is a FOLDER or FILE - v_common_prefix := storage.get_common_prefix(lower(v_peek_name), v_prefix_lower, v_delimiter); - - IF v_common_prefix IS NOT NULL THEN - -- FOLDER: Handle offset, emit if needed, skip to next folder - IF v_skipped < offsets THEN - v_skipped := v_skipped + 1; - ELSE - name := split_part(rtrim(v_common_prefix, v_delimiter), v_delimiter, levels); - id := NULL; - updated_at := NULL; - created_at := NULL; - last_accessed_at := NULL; - metadata := NULL; - RETURN NEXT; - v_count := v_count + 1; - END IF; - - -- Advance seek past the folder range - IF v_is_asc THEN - v_next_seek := lower(left(v_common_prefix, -1)) || chr(ascii(v_delimiter) + 1); - ELSE - v_next_seek := lower(v_common_prefix); - END IF; - ELSE - -- FILE: Batch fetch using DYNAMIC SQL (overhead amortized over many rows) - -- For ASC: upper_bound is the exclusive upper limit (< condition) - -- For DESC: prefix_lower is the inclusive lower limit (>= condition) - FOR v_current IN EXECUTE v_batch_query - USING bucketname, v_next_seek, - CASE WHEN v_is_asc THEN COALESCE(v_upper_bound, v_prefix_lower) ELSE v_prefix_lower END, v_file_batch_size - LOOP - v_common_prefix := storage.get_common_prefix(lower(v_current.name), v_prefix_lower, v_delimiter); - - IF v_common_prefix IS NOT NULL THEN - -- Hit a folder: exit batch, let peek handle it - v_next_seek := lower(v_current.name); - EXIT; - END IF; - - -- Handle offset skipping - IF v_skipped < offsets THEN - v_skipped := v_skipped + 1; - ELSE - -- Emit file - name := split_part(v_current.name, v_delimiter, levels); - id := v_current.id; - updated_at := v_current.updated_at; - created_at := v_current.created_at; - last_accessed_at := v_current.last_accessed_at; - metadata := v_current.metadata; - RETURN NEXT; - v_count := v_count + 1; - END IF; - - -- Advance seek past this file - IF v_is_asc THEN - v_next_seek := lower(v_current.name) || v_delimiter; - ELSE - v_next_seek := lower(v_current.name); - END IF; - - EXIT WHEN v_count >= v_limit; - END LOOP; - END IF; - END LOOP; -END; -$_$; - - -ALTER FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer, search text, sortcolumn text, sortorder text) OWNER TO supabase_storage_admin; - --- --- Name: search_by_timestamp(text, text, integer, integer, text, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search_by_timestamp(p_prefix text, p_bucket_id text, p_limit integer, p_level integer, p_start_after text, p_sort_order text, p_sort_column text, p_sort_column_after text) RETURNS TABLE(key text, name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_cursor_op text; - v_query text; - v_prefix text; -BEGIN - v_prefix := coalesce(p_prefix, ''); - - IF p_sort_order = 'asc' THEN - v_cursor_op := '>'; - ELSE - v_cursor_op := '<'; - END IF; - - v_query := format($sql$ - WITH raw_objects AS ( - SELECT - o.name AS obj_name, - o.id AS obj_id, - o.updated_at AS obj_updated_at, - o.created_at AS obj_created_at, - o.last_accessed_at AS obj_last_accessed_at, - o.metadata AS obj_metadata, - storage.get_common_prefix(o.name, $1, '/') AS common_prefix - FROM storage.objects o - WHERE o.bucket_id = $2 - AND o.name COLLATE "C" LIKE $1 || '%%' - ), - -- Aggregate common prefixes (folders) - -- Both created_at and updated_at use MIN(obj_created_at) to match the old prefixes table behavior - aggregated_prefixes AS ( - SELECT - rtrim(common_prefix, '/') AS name, - NULL::uuid AS id, - MIN(obj_created_at) AS updated_at, - MIN(obj_created_at) AS created_at, - NULL::timestamptz AS last_accessed_at, - NULL::jsonb AS metadata, - TRUE AS is_prefix - FROM raw_objects - WHERE common_prefix IS NOT NULL - GROUP BY common_prefix - ), - leaf_objects AS ( - SELECT - obj_name AS name, - obj_id AS id, - obj_updated_at AS updated_at, - obj_created_at AS created_at, - obj_last_accessed_at AS last_accessed_at, - obj_metadata AS metadata, - FALSE AS is_prefix - FROM raw_objects - WHERE common_prefix IS NULL - ), - combined AS ( - SELECT * FROM aggregated_prefixes - UNION ALL - SELECT * FROM leaf_objects - ), - filtered AS ( - SELECT * - FROM combined - WHERE ( - $5 = '' - OR ROW( - date_trunc('milliseconds', %I), - name COLLATE "C" - ) %s ROW( - COALESCE(NULLIF($6, '')::timestamptz, 'epoch'::timestamptz), - $5 - ) - ) - ) - SELECT - split_part(name, '/', $3) AS key, - name, - id, - updated_at, - created_at, - last_accessed_at, - metadata - FROM filtered - ORDER BY - COALESCE(date_trunc('milliseconds', %I), 'epoch'::timestamptz) %s, - name COLLATE "C" %s - LIMIT $4 - $sql$, - p_sort_column, - v_cursor_op, - p_sort_column, - p_sort_order, - p_sort_order - ); - - RETURN QUERY EXECUTE v_query - USING v_prefix, p_bucket_id, p_level, p_limit, p_start_after, p_sort_column_after; -END; -$_$; - - -ALTER FUNCTION storage.search_by_timestamp(p_prefix text, p_bucket_id text, p_limit integer, p_level integer, p_start_after text, p_sort_order text, p_sort_column text, p_sort_column_after text) OWNER TO supabase_storage_admin; - --- --- Name: search_v2(text, text, integer, integer, text, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search_v2(prefix text, bucket_name text, limits integer DEFAULT 100, levels integer DEFAULT 1, start_after text DEFAULT ''::text, sort_order text DEFAULT 'asc'::text, sort_column text DEFAULT 'name'::text, sort_column_after text DEFAULT ''::text) RETURNS TABLE(key text, name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $$ -DECLARE - v_sort_col text; - v_sort_ord text; - v_limit int; -BEGIN - -- Cap limit to maximum of 1500 records - v_limit := LEAST(coalesce(limits, 100), 1500); - - -- Validate and normalize sort_order - v_sort_ord := lower(coalesce(sort_order, 'asc')); - IF v_sort_ord NOT IN ('asc', 'desc') THEN - v_sort_ord := 'asc'; - END IF; - - -- Validate and normalize sort_column - v_sort_col := lower(coalesce(sort_column, 'name')); - IF v_sort_col NOT IN ('name', 'updated_at', 'created_at') THEN - v_sort_col := 'name'; - END IF; - - -- Route to appropriate implementation - IF v_sort_col = 'name' THEN - -- Use list_objects_with_delimiter for name sorting (most efficient: O(k * log n)) - RETURN QUERY - SELECT - split_part(l.name, '/', levels) AS key, - l.name AS name, - l.id, - l.updated_at, - l.created_at, - l.last_accessed_at, - l.metadata - FROM storage.list_objects_with_delimiter( - bucket_name, - coalesce(prefix, ''), - '/', - v_limit, - start_after, - '', - v_sort_ord - ) l; - ELSE - -- Use aggregation approach for timestamp sorting - -- Not efficient for large datasets but supports correct pagination - RETURN QUERY SELECT * FROM storage.search_by_timestamp( - prefix, bucket_name, v_limit, levels, start_after, - v_sort_ord, v_sort_col, sort_column_after - ); - END IF; -END; -$$; - - -ALTER FUNCTION storage.search_v2(prefix text, bucket_name text, limits integer, levels integer, start_after text, sort_order text, sort_column text, sort_column_after text) OWNER TO supabase_storage_admin; - --- --- Name: update_updated_at_column(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.update_updated_at_column() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION storage.update_updated_at_column() OWNER TO supabase_storage_admin; - --- --- Name: http_request(); Type: FUNCTION; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE FUNCTION supabase_functions.http_request() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'supabase_functions' - AS $$ - DECLARE - request_id bigint; - payload jsonb; - url text := TG_ARGV[0]::text; - method text := TG_ARGV[1]::text; - headers jsonb DEFAULT '{}'::jsonb; - params jsonb DEFAULT '{}'::jsonb; - timeout_ms integer DEFAULT 1000; - BEGIN - IF url IS NULL OR url = 'null' THEN - RAISE EXCEPTION 'url argument is missing'; - END IF; - - IF method IS NULL OR method = 'null' THEN - RAISE EXCEPTION 'method argument is missing'; - END IF; - - IF TG_ARGV[2] IS NULL OR TG_ARGV[2] = 'null' THEN - headers = '{"Content-Type": "application/json"}'::jsonb; - ELSE - headers = TG_ARGV[2]::jsonb; - END IF; - - IF TG_ARGV[3] IS NULL OR TG_ARGV[3] = 'null' THEN - params = '{}'::jsonb; - ELSE - params = TG_ARGV[3]::jsonb; - END IF; - - IF TG_ARGV[4] IS NULL OR TG_ARGV[4] = 'null' THEN - timeout_ms = 1000; - ELSE - timeout_ms = TG_ARGV[4]::integer; - END IF; - - CASE - WHEN method = 'GET' THEN - SELECT http_get INTO request_id FROM net.http_get( - url, - params, - headers, - timeout_ms - ); - WHEN method = 'POST' THEN - payload = jsonb_build_object( - 'old_record', OLD, - 'record', NEW, - 'type', TG_OP, - 'table', TG_TABLE_NAME, - 'schema', TG_TABLE_SCHEMA - ); - - SELECT http_post INTO request_id FROM net.http_post( - url, - payload, - params, - headers, - timeout_ms - ); - ELSE - RAISE EXCEPTION 'method argument % is invalid', method; - END CASE; - - INSERT INTO supabase_functions.hooks - (hook_table_id, hook_name, request_id) - VALUES - (TG_RELID, TG_NAME, request_id); - - RETURN NEW; - END -$$; - - -ALTER FUNCTION supabase_functions.http_request() OWNER TO supabase_functions_admin; - --- --- Name: extensions; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.extensions ( - id uuid NOT NULL, - type text, - settings jsonb, - tenant_external_id text, - inserted_at timestamp(0) without time zone NOT NULL, - updated_at timestamp(0) without time zone NOT NULL -); - - -ALTER TABLE _realtime.extensions OWNER TO supabase_admin; - --- --- Name: schema_migrations; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.schema_migrations ( - version bigint NOT NULL, - inserted_at timestamp(0) without time zone -); - - -ALTER TABLE _realtime.schema_migrations OWNER TO supabase_admin; - --- --- Name: tenants; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.tenants ( - id uuid NOT NULL, - name text, - external_id text, - jwt_secret text, - max_concurrent_users integer DEFAULT 200 NOT NULL, - inserted_at timestamp(0) without time zone NOT NULL, - updated_at timestamp(0) without time zone NOT NULL, - max_events_per_second integer DEFAULT 100 NOT NULL, - postgres_cdc_default text DEFAULT 'postgres_cdc_rls'::text, - max_bytes_per_second integer DEFAULT 100000 NOT NULL, - max_channels_per_client integer DEFAULT 100 NOT NULL, - max_joins_per_second integer DEFAULT 500 NOT NULL, - suspend boolean DEFAULT false, - jwt_jwks jsonb, - notify_private_alpha boolean DEFAULT false, - private_only boolean DEFAULT false NOT NULL, - migrations_ran integer DEFAULT 0, - broadcast_adapter character varying(255) DEFAULT 'gen_rpc'::character varying, - max_presence_events_per_second integer DEFAULT 1000, - max_payload_size_in_kb integer DEFAULT 3000, - CONSTRAINT jwt_secret_or_jwt_jwks_required CHECK (((jwt_secret IS NOT NULL) OR (jwt_jwks IS NOT NULL))) -); - - -ALTER TABLE _realtime.tenants OWNER TO supabase_admin; - --- --- Name: audit_log_entries; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.audit_log_entries ( - instance_id uuid, - id uuid NOT NULL, - payload json, - created_at timestamp with time zone, - ip_address character varying(64) DEFAULT ''::character varying NOT NULL -); - - -ALTER TABLE auth.audit_log_entries OWNER TO supabase_auth_admin; - --- --- Name: TABLE audit_log_entries; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.audit_log_entries IS 'Auth: Audit trail for user actions.'; - - --- --- Name: flow_state; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.flow_state ( - id uuid NOT NULL, - user_id uuid, - auth_code text, - code_challenge_method auth.code_challenge_method, - code_challenge text, - provider_type text NOT NULL, - provider_access_token text, - provider_refresh_token text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - authentication_method text NOT NULL, - auth_code_issued_at timestamp with time zone, - invite_token text, - referrer text, - oauth_client_state_id uuid, - linking_target_id uuid, - email_optional boolean DEFAULT false NOT NULL -); - - -ALTER TABLE auth.flow_state OWNER TO supabase_auth_admin; - --- --- Name: TABLE flow_state; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.flow_state IS 'Stores metadata for all OAuth/SSO login flows'; - - --- --- Name: identities; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.identities ( - provider_id text NOT NULL, - user_id uuid NOT NULL, - identity_data jsonb NOT NULL, - provider text NOT NULL, - last_sign_in_at timestamp with time zone, - created_at timestamp with time zone, - updated_at timestamp with time zone, - email text GENERATED ALWAYS AS (lower((identity_data ->> 'email'::text))) STORED, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE auth.identities OWNER TO supabase_auth_admin; - --- --- Name: TABLE identities; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.identities IS 'Auth: Stores identities associated to a user.'; - - --- --- Name: COLUMN identities.email; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.identities.email IS 'Auth: Email is a generated column that references the optional email property in the identity_data'; - - --- --- Name: instances; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.instances ( - id uuid NOT NULL, - uuid uuid, - raw_base_config text, - created_at timestamp with time zone, - updated_at timestamp with time zone -); - - -ALTER TABLE auth.instances OWNER TO supabase_auth_admin; - --- --- Name: TABLE instances; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.instances IS 'Auth: Manages users across multiple sites.'; - - --- --- Name: mfa_amr_claims; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_amr_claims ( - session_id uuid NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - authentication_method text NOT NULL, - id uuid NOT NULL -); - - -ALTER TABLE auth.mfa_amr_claims OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_amr_claims; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_amr_claims IS 'auth: stores authenticator method reference claims for multi factor authentication'; - - --- --- Name: mfa_challenges; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_challenges ( - id uuid NOT NULL, - factor_id uuid NOT NULL, - created_at timestamp with time zone NOT NULL, - verified_at timestamp with time zone, - ip_address inet NOT NULL, - otp_code text, - web_authn_session_data jsonb -); - - -ALTER TABLE auth.mfa_challenges OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_challenges; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_challenges IS 'auth: stores metadata about challenge requests made'; - - --- --- Name: mfa_factors; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_factors ( - id uuid NOT NULL, - user_id uuid NOT NULL, - friendly_name text, - factor_type auth.factor_type NOT NULL, - status auth.factor_status NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - secret text, - phone text, - last_challenged_at timestamp with time zone, - web_authn_credential jsonb, - web_authn_aaguid uuid, - last_webauthn_challenge_data jsonb -); - - -ALTER TABLE auth.mfa_factors OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_factors; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_factors IS 'auth: stores metadata about factors'; - - --- --- Name: COLUMN mfa_factors.last_webauthn_challenge_data; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.mfa_factors.last_webauthn_challenge_data IS 'Stores the latest WebAuthn challenge data including attestation/assertion for customer verification'; - - --- --- Name: oauth_authorizations; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_authorizations ( - id uuid NOT NULL, - authorization_id text NOT NULL, - client_id uuid NOT NULL, - user_id uuid, - redirect_uri text NOT NULL, - scope text NOT NULL, - state text, - resource text, - code_challenge text, - code_challenge_method auth.code_challenge_method, - response_type auth.oauth_response_type DEFAULT 'code'::auth.oauth_response_type NOT NULL, - status auth.oauth_authorization_status DEFAULT 'pending'::auth.oauth_authorization_status NOT NULL, - authorization_code text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '00:03:00'::interval) NOT NULL, - approved_at timestamp with time zone, - nonce text, - CONSTRAINT oauth_authorizations_authorization_code_length CHECK ((char_length(authorization_code) <= 255)), - CONSTRAINT oauth_authorizations_code_challenge_length CHECK ((char_length(code_challenge) <= 128)), - CONSTRAINT oauth_authorizations_expires_at_future CHECK ((expires_at > created_at)), - CONSTRAINT oauth_authorizations_nonce_length CHECK ((char_length(nonce) <= 255)), - CONSTRAINT oauth_authorizations_redirect_uri_length CHECK ((char_length(redirect_uri) <= 2048)), - CONSTRAINT oauth_authorizations_resource_length CHECK ((char_length(resource) <= 2048)), - CONSTRAINT oauth_authorizations_scope_length CHECK ((char_length(scope) <= 4096)), - CONSTRAINT oauth_authorizations_state_length CHECK ((char_length(state) <= 4096)) -); - - -ALTER TABLE auth.oauth_authorizations OWNER TO supabase_auth_admin; - --- --- Name: oauth_client_states; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_client_states ( - id uuid NOT NULL, - provider_type text NOT NULL, - code_verifier text, - created_at timestamp with time zone NOT NULL -); - - -ALTER TABLE auth.oauth_client_states OWNER TO supabase_auth_admin; - --- --- Name: TABLE oauth_client_states; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.oauth_client_states IS 'Stores OAuth states for third-party provider authentication flows where Supabase acts as the OAuth client.'; - - --- --- Name: oauth_clients; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_clients ( - id uuid NOT NULL, - client_secret_hash text, - registration_type auth.oauth_registration_type NOT NULL, - redirect_uris text NOT NULL, - grant_types text NOT NULL, - client_name text, - client_uri text, - logo_uri text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - deleted_at timestamp with time zone, - client_type auth.oauth_client_type DEFAULT 'confidential'::auth.oauth_client_type NOT NULL, - token_endpoint_auth_method text NOT NULL, - CONSTRAINT oauth_clients_client_name_length CHECK ((char_length(client_name) <= 1024)), - CONSTRAINT oauth_clients_client_uri_length CHECK ((char_length(client_uri) <= 2048)), - CONSTRAINT oauth_clients_logo_uri_length CHECK ((char_length(logo_uri) <= 2048)), - CONSTRAINT oauth_clients_token_endpoint_auth_method_check CHECK ((token_endpoint_auth_method = ANY (ARRAY['client_secret_basic'::text, 'client_secret_post'::text, 'none'::text]))) -); - - -ALTER TABLE auth.oauth_clients OWNER TO supabase_auth_admin; - --- --- Name: oauth_consents; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_consents ( - id uuid NOT NULL, - user_id uuid NOT NULL, - client_id uuid NOT NULL, - scopes text NOT NULL, - granted_at timestamp with time zone DEFAULT now() NOT NULL, - revoked_at timestamp with time zone, - CONSTRAINT oauth_consents_revoked_after_granted CHECK (((revoked_at IS NULL) OR (revoked_at >= granted_at))), - CONSTRAINT oauth_consents_scopes_length CHECK ((char_length(scopes) <= 2048)), - CONSTRAINT oauth_consents_scopes_not_empty CHECK ((char_length(TRIM(BOTH FROM scopes)) > 0)) -); - - -ALTER TABLE auth.oauth_consents OWNER TO supabase_auth_admin; - --- --- Name: one_time_tokens; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.one_time_tokens ( - id uuid NOT NULL, - user_id uuid NOT NULL, - token_type auth.one_time_token_type NOT NULL, - token_hash text NOT NULL, - relates_to text NOT NULL, - created_at timestamp without time zone DEFAULT now() NOT NULL, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - CONSTRAINT one_time_tokens_token_hash_check CHECK ((char_length(token_hash) > 0)) -); - - -ALTER TABLE auth.one_time_tokens OWNER TO supabase_auth_admin; - --- --- Name: refresh_tokens; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.refresh_tokens ( - instance_id uuid, - id bigint NOT NULL, - token character varying(255), - user_id character varying(255), - revoked boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone, - parent character varying(255), - session_id uuid -); - - -ALTER TABLE auth.refresh_tokens OWNER TO supabase_auth_admin; - --- --- Name: TABLE refresh_tokens; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.refresh_tokens IS 'Auth: Store of tokens used to refresh JWT tokens once they expire.'; - - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE SEQUENCE auth.refresh_tokens_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNER TO supabase_auth_admin; - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNED BY auth.refresh_tokens.id; - - --- --- Name: saml_providers; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.saml_providers ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - entity_id text NOT NULL, - metadata_xml text NOT NULL, - metadata_url text, - attribute_mapping jsonb, - created_at timestamp with time zone, - updated_at timestamp with time zone, - name_id_format text, - CONSTRAINT "entity_id not empty" CHECK ((char_length(entity_id) > 0)), - CONSTRAINT "metadata_url not empty" CHECK (((metadata_url = NULL::text) OR (char_length(metadata_url) > 0))), - CONSTRAINT "metadata_xml not empty" CHECK ((char_length(metadata_xml) > 0)) -); - - -ALTER TABLE auth.saml_providers OWNER TO supabase_auth_admin; - --- --- Name: TABLE saml_providers; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.saml_providers IS 'Auth: Manages SAML Identity Provider connections.'; - - --- --- Name: saml_relay_states; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.saml_relay_states ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - request_id text NOT NULL, - for_email text, - redirect_to text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - flow_state_id uuid, - CONSTRAINT "request_id not empty" CHECK ((char_length(request_id) > 0)) -); - - -ALTER TABLE auth.saml_relay_states OWNER TO supabase_auth_admin; - --- --- Name: TABLE saml_relay_states; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.saml_relay_states IS 'Auth: Contains SAML Relay State information for each Service Provider initiated login.'; - - --- --- Name: schema_migrations; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.schema_migrations ( - version character varying(255) NOT NULL -); - - -ALTER TABLE auth.schema_migrations OWNER TO supabase_auth_admin; - --- --- Name: TABLE schema_migrations; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.schema_migrations IS 'Auth: Manages updates to the auth system.'; - - --- --- Name: sessions; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sessions ( - id uuid NOT NULL, - user_id uuid NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - factor_id uuid, - aal auth.aal_level, - not_after timestamp with time zone, - refreshed_at timestamp without time zone, - user_agent text, - ip inet, - tag text, - oauth_client_id uuid, - refresh_token_hmac_key text, - refresh_token_counter bigint, - scopes text, - CONSTRAINT sessions_scopes_length CHECK ((char_length(scopes) <= 4096)) -); - - -ALTER TABLE auth.sessions OWNER TO supabase_auth_admin; - --- --- Name: TABLE sessions; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sessions IS 'Auth: Stores session data associated to a user.'; - - --- --- Name: COLUMN sessions.not_after; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.not_after IS 'Auth: Not after is a nullable column that contains a timestamp after which the session should be regarded as expired.'; - - --- --- Name: COLUMN sessions.refresh_token_hmac_key; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.refresh_token_hmac_key IS 'Holds a HMAC-SHA256 key used to sign refresh tokens for this session.'; - - --- --- Name: COLUMN sessions.refresh_token_counter; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.refresh_token_counter IS 'Holds the ID (counter) of the last issued refresh token.'; - - --- --- Name: sso_domains; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sso_domains ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - domain text NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - CONSTRAINT "domain not empty" CHECK ((char_length(domain) > 0)) -); - - -ALTER TABLE auth.sso_domains OWNER TO supabase_auth_admin; - --- --- Name: TABLE sso_domains; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sso_domains IS 'Auth: Manages SSO email address domain mapping to an SSO Identity Provider.'; - - --- --- Name: sso_providers; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sso_providers ( - id uuid NOT NULL, - resource_id text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - disabled boolean, - CONSTRAINT "resource_id not empty" CHECK (((resource_id = NULL::text) OR (char_length(resource_id) > 0))) -); - - -ALTER TABLE auth.sso_providers OWNER TO supabase_auth_admin; - --- --- Name: TABLE sso_providers; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sso_providers IS 'Auth: Manages SSO identity provider information; see saml_providers for SAML.'; - - --- --- Name: COLUMN sso_providers.resource_id; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sso_providers.resource_id IS 'Auth: Uniquely identifies a SSO provider according to a user-chosen resource ID (case insensitive), useful in infrastructure as code.'; - - --- --- Name: users; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.users ( - instance_id uuid, - id uuid NOT NULL, - aud character varying(255), - role character varying(255), - email character varying(255), - encrypted_password character varying(255), - email_confirmed_at timestamp with time zone, - invited_at timestamp with time zone, - confirmation_token character varying(255), - confirmation_sent_at timestamp with time zone, - recovery_token character varying(255), - recovery_sent_at timestamp with time zone, - email_change_token_new character varying(255), - email_change character varying(255), - email_change_sent_at timestamp with time zone, - last_sign_in_at timestamp with time zone, - raw_app_meta_data jsonb, - raw_user_meta_data jsonb, - is_super_admin boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone, - phone text DEFAULT NULL::character varying, - phone_confirmed_at timestamp with time zone, - phone_change text DEFAULT ''::character varying, - phone_change_token character varying(255) DEFAULT ''::character varying, - phone_change_sent_at timestamp with time zone, - confirmed_at timestamp with time zone GENERATED ALWAYS AS (LEAST(email_confirmed_at, phone_confirmed_at)) STORED, - email_change_token_current character varying(255) DEFAULT ''::character varying, - email_change_confirm_status smallint DEFAULT 0, - banned_until timestamp with time zone, - reauthentication_token character varying(255) DEFAULT ''::character varying, - reauthentication_sent_at timestamp with time zone, - is_sso_user boolean DEFAULT false NOT NULL, - deleted_at timestamp with time zone, - is_anonymous boolean DEFAULT false NOT NULL, - CONSTRAINT users_email_change_confirm_status_check CHECK (((email_change_confirm_status >= 0) AND (email_change_confirm_status <= 2))) -); - - -ALTER TABLE auth.users OWNER TO supabase_auth_admin; - --- --- Name: TABLE users; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure schema.'; - - --- --- Name: COLUMN users.is_sso_user; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.users.is_sso_user IS 'Auth: Set this column to true when the account comes from SSO. These accounts can have duplicate emails.'; - - --- --- Name: agenda_bloqueios; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_bloqueios ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - tipo text NOT NULL, - titulo text NOT NULL, - data_inicio date NOT NULL, - data_fim date, - hora_inicio time without time zone, - hora_fim time without time zone, - recorrente boolean DEFAULT false NOT NULL, - dia_semana smallint, - observacao text, - origem text DEFAULT 'manual'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT agenda_bloqueios_tipo_check CHECK ((tipo = ANY (ARRAY['feriado_nacional'::text, 'feriado_municipal'::text, 'bloqueio'::text]))) -); - - -ALTER TABLE public.agenda_bloqueios OWNER TO supabase_admin; - --- --- Name: agenda_configuracoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_configuracoes ( - owner_id uuid NOT NULL, - duracao_padrao_minutos integer DEFAULT 50 NOT NULL, - intervalo_padrao_minutos integer DEFAULT 0 NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - usar_horario_admin_custom boolean DEFAULT false NOT NULL, - admin_inicio_visualizacao time without time zone, - admin_fim_visualizacao time without time zone, - admin_slot_visual_minutos integer DEFAULT 30 NOT NULL, - online_ativo boolean DEFAULT false NOT NULL, - online_min_antecedencia_horas integer DEFAULT 24 NOT NULL, - online_max_dias_futuro integer DEFAULT 60 NOT NULL, - online_cancelar_ate_horas integer DEFAULT 12 NOT NULL, - online_reagendar_ate_horas integer DEFAULT 12 NOT NULL, - online_limite_agendamentos_futuros integer DEFAULT 1 NOT NULL, - online_modo text DEFAULT 'automatico'::text NOT NULL, - online_buffer_antes_min integer DEFAULT 0 NOT NULL, - online_buffer_depois_min integer DEFAULT 0 NOT NULL, - online_modalidade text DEFAULT 'ambos'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - usar_granularidade_custom boolean DEFAULT false NOT NULL, - granularidade_min integer, - setup_concluido boolean DEFAULT false NOT NULL, - setup_concluido_em timestamp with time zone, - agenda_view_mode text DEFAULT 'full_24h'::text NOT NULL, - agenda_custom_start time without time zone, - agenda_custom_end time without time zone, - session_duration_min integer DEFAULT 50 NOT NULL, - session_break_min integer DEFAULT 10 NOT NULL, - pausas_semanais jsonb DEFAULT '[]'::jsonb NOT NULL, - setup_clinica_concluido boolean DEFAULT false NOT NULL, - setup_clinica_concluido_em timestamp with time zone, - tenant_id uuid, - jornada_igual_todos boolean DEFAULT true, - CONSTRAINT agenda_configuracoes_admin_slot_visual_minutos_check CHECK ((admin_slot_visual_minutos = ANY (ARRAY[5, 10, 15, 20, 30, 60]))), - CONSTRAINT agenda_configuracoes_check CHECK (((usar_horario_admin_custom = false) OR ((admin_inicio_visualizacao IS NOT NULL) AND (admin_fim_visualizacao IS NOT NULL) AND (admin_fim_visualizacao > admin_inicio_visualizacao)))), - CONSTRAINT agenda_configuracoes_duracao_padrao_minutos_check CHECK (((duracao_padrao_minutos >= 10) AND (duracao_padrao_minutos <= 240))), - CONSTRAINT agenda_configuracoes_granularidade_min_check CHECK (((granularidade_min IS NULL) OR (granularidade_min = ANY (ARRAY[5, 10, 15, 20, 30, 45, 50, 60])))), - CONSTRAINT agenda_configuracoes_intervalo_padrao_minutos_check CHECK (((intervalo_padrao_minutos >= 0) AND (intervalo_padrao_minutos <= 120))), - CONSTRAINT agenda_configuracoes_online_buffer_antes_min_check CHECK (((online_buffer_antes_min >= 0) AND (online_buffer_antes_min <= 120))), - CONSTRAINT agenda_configuracoes_online_buffer_depois_min_check CHECK (((online_buffer_depois_min >= 0) AND (online_buffer_depois_min <= 120))), - CONSTRAINT agenda_configuracoes_online_cancelar_ate_horas_check CHECK (((online_cancelar_ate_horas >= 0) AND (online_cancelar_ate_horas <= 720))), - CONSTRAINT agenda_configuracoes_online_limite_agendamentos_futuros_check CHECK (((online_limite_agendamentos_futuros >= 1) AND (online_limite_agendamentos_futuros <= 10))), - CONSTRAINT agenda_configuracoes_online_max_dias_futuro_check CHECK (((online_max_dias_futuro >= 1) AND (online_max_dias_futuro <= 365))), - CONSTRAINT agenda_configuracoes_online_min_antecedencia_horas_check CHECK (((online_min_antecedencia_horas >= 0) AND (online_min_antecedencia_horas <= 720))), - CONSTRAINT agenda_configuracoes_online_modalidade_check CHECK ((online_modalidade = ANY (ARRAY['online'::text, 'presencial'::text, 'ambos'::text]))), - CONSTRAINT agenda_configuracoes_online_modo_check CHECK ((online_modo = ANY (ARRAY['automatico'::text, 'aprovacao'::text]))), - CONSTRAINT agenda_configuracoes_online_reagendar_ate_horas_check CHECK (((online_reagendar_ate_horas >= 0) AND (online_reagendar_ate_horas <= 720))), - CONSTRAINT session_break_min_chk CHECK (((session_break_min >= 0) AND (session_break_min <= 60))), - CONSTRAINT session_duration_min_chk CHECK (((session_duration_min >= 10) AND (session_duration_min <= 240))) -); - - -ALTER TABLE public.agenda_configuracoes OWNER TO supabase_admin; - --- --- Name: agenda_eventos; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_eventos ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tipo public.tipo_evento_agenda DEFAULT 'sessao'::public.tipo_evento_agenda NOT NULL, - status public.status_evento_agenda DEFAULT 'agendado'::public.status_evento_agenda NOT NULL, - titulo text, - observacoes text, - inicio_em timestamp with time zone NOT NULL, - fim_em timestamp with time zone NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - terapeuta_id uuid, - tenant_id uuid NOT NULL, - visibility_scope text DEFAULT 'public'::text NOT NULL, - mirror_of_event_id uuid, - mirror_source text, - patient_id uuid, - determined_commitment_id uuid, - link_online text, - titulo_custom text, - extra_fields jsonb, - recurrence_id uuid, - recurrence_date date, - modalidade text DEFAULT 'presencial'::text, - price numeric(10,2), - CONSTRAINT agenda_eventos_check CHECK ((fim_em > inicio_em)) -); - - -ALTER TABLE public.agenda_eventos OWNER TO supabase_admin; - --- --- Name: COLUMN agenda_eventos.price; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agenda_eventos.price IS 'Valor da sessão em BRL. Preenchido automaticamente pela tabela professional_pricing do profissional.'; - - --- --- Name: agenda_excecoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_excecoes ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - data date NOT NULL, - hora_inicio time without time zone, - hora_fim time without time zone, - tipo public.tipo_excecao_agenda NOT NULL, - motivo text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - status public.status_excecao_agenda DEFAULT 'ativo'::public.status_excecao_agenda NOT NULL, - fonte text DEFAULT 'manual'::text NOT NULL, - aplicavel_online boolean DEFAULT true NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_excecoes_check CHECK ((((hora_inicio IS NULL) AND (hora_fim IS NULL)) OR ((hora_inicio IS NOT NULL) AND (hora_fim IS NOT NULL) AND (hora_fim > hora_inicio)))), - CONSTRAINT agenda_excecoes_fonte_check CHECK ((fonte = ANY (ARRAY['manual'::text, 'feriado_google'::text, 'sistema'::text]))) -); - - -ALTER TABLE public.agenda_excecoes OWNER TO supabase_admin; - --- --- Name: agenda_online_slots; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_online_slots ( - id bigint NOT NULL, - owner_id uuid NOT NULL, - weekday integer NOT NULL, - "time" time without time zone NOT NULL, - enabled boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_online_slots_weekday_check CHECK ((weekday = ANY (ARRAY[0, 1, 2, 3, 4, 5, 6]))) -); - - -ALTER TABLE public.agenda_online_slots OWNER TO supabase_admin; - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -CREATE SEQUENCE public.agenda_online_slots_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE public.agenda_online_slots_id_seq OWNER TO supabase_admin; - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: supabase_admin --- - -ALTER SEQUENCE public.agenda_online_slots_id_seq OWNED BY public.agenda_online_slots.id; - - --- --- Name: agenda_regras_semanais; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_regras_semanais ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - hora_inicio time without time zone NOT NULL, - hora_fim time without time zone NOT NULL, - modalidade text DEFAULT 'ambos'::text NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_regras_semanais_check CHECK ((hora_fim > hora_inicio)), - CONSTRAINT agenda_regras_semanais_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))), - CONSTRAINT agenda_regras_semanais_modalidade_check CHECK (((modalidade = ANY (ARRAY['online'::text, 'presencial'::text, 'ambos'::text])) OR (modalidade IS NULL))) -); - - -ALTER TABLE public.agenda_regras_semanais OWNER TO supabase_admin; - --- --- Name: agenda_slots_bloqueados_semanais; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_slots_bloqueados_semanais ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - hora_inicio time without time zone NOT NULL, - motivo text, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_slots_bloqueados_semanais_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))) -); - - -ALTER TABLE public.agenda_slots_bloqueados_semanais OWNER TO supabase_admin; - --- --- Name: agenda_slots_regras; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_slots_regras ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - passo_minutos integer NOT NULL, - offset_minutos integer DEFAULT 0 NOT NULL, - buffer_antes_min integer DEFAULT 0 NOT NULL, - buffer_depois_min integer DEFAULT 0 NOT NULL, - min_antecedencia_horas integer DEFAULT 0 NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_slots_regras_buffer_antes_min_check CHECK (((buffer_antes_min >= 0) AND (buffer_antes_min <= 240))), - CONSTRAINT agenda_slots_regras_buffer_depois_min_check CHECK (((buffer_depois_min >= 0) AND (buffer_depois_min <= 240))), - CONSTRAINT agenda_slots_regras_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))), - CONSTRAINT agenda_slots_regras_min_antecedencia_horas_check CHECK (((min_antecedencia_horas >= 0) AND (min_antecedencia_horas <= 720))), - CONSTRAINT agenda_slots_regras_offset_minutos_check CHECK (((offset_minutos >= 0) AND (offset_minutos <= 55))), - CONSTRAINT agenda_slots_regras_passo_minutos_check CHECK (((passo_minutos >= 5) AND (passo_minutos <= 240))) -); - - -ALTER TABLE public.agenda_slots_regras OWNER TO supabase_admin; - --- --- Name: agendador_configuracoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agendador_configuracoes ( - owner_id uuid NOT NULL, - tenant_id uuid, - ativo boolean DEFAULT false NOT NULL, - link_slug text, - imagem_fundo_url text, - imagem_header_url text, - logomarca_url text, - cor_primaria text DEFAULT '#4b6bff'::text, - nome_exibicao text, - endereco text, - botao_como_chegar_ativo boolean DEFAULT true NOT NULL, - maps_url text, - modo_aprovacao text DEFAULT 'aprovacao'::text NOT NULL, - modalidade text DEFAULT 'presencial'::text NOT NULL, - tipos_habilitados jsonb DEFAULT '["primeira", "retorno"]'::jsonb NOT NULL, - duracao_sessao_min integer DEFAULT 50 NOT NULL, - antecedencia_minima_horas integer DEFAULT 24 NOT NULL, - prazo_resposta_horas integer DEFAULT 2 NOT NULL, - reserva_horas integer DEFAULT 2 NOT NULL, - pagamento_obrigatorio boolean DEFAULT false NOT NULL, - pix_chave text, - pix_countdown_minutos integer DEFAULT 20 NOT NULL, - triagem_motivo boolean DEFAULT true NOT NULL, - triagem_como_conheceu boolean DEFAULT false NOT NULL, - verificacao_email boolean DEFAULT false NOT NULL, - exigir_aceite_lgpd boolean DEFAULT true NOT NULL, - mensagem_boas_vindas text, - texto_como_se_preparar text, - texto_termos_lgpd text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - pagamento_modo text DEFAULT 'sem_pagamento'::text NOT NULL, - pagamento_metodos_visiveis text[] DEFAULT '{}'::text[] NOT NULL, - CONSTRAINT agendador_configuracoes_antecedencia_check CHECK (((antecedencia_minima_horas >= 0) AND (antecedencia_minima_horas <= 720))), - CONSTRAINT agendador_configuracoes_duracao_check CHECK (((duracao_sessao_min >= 10) AND (duracao_sessao_min <= 240))), - CONSTRAINT agendador_configuracoes_modalidade_check CHECK ((modalidade = ANY (ARRAY['presencial'::text, 'online'::text, 'ambos'::text]))), - CONSTRAINT agendador_configuracoes_modo_check CHECK ((modo_aprovacao = ANY (ARRAY['automatico'::text, 'aprovacao'::text]))), - CONSTRAINT agendador_configuracoes_pix_countdown_check CHECK (((pix_countdown_minutos >= 5) AND (pix_countdown_minutos <= 120))), - CONSTRAINT agendador_configuracoes_prazo_check CHECK (((prazo_resposta_horas >= 1) AND (prazo_resposta_horas <= 72))), - CONSTRAINT agendador_configuracoes_reserva_check CHECK (((reserva_horas >= 1) AND (reserva_horas <= 48))) -); - - -ALTER TABLE public.agendador_configuracoes OWNER TO supabase_admin; - --- --- Name: COLUMN agendador_configuracoes.pagamento_modo; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agendador_configuracoes.pagamento_modo IS 'sem_pagamento | pagar_na_hora | pix_antecipado'; - - --- --- Name: COLUMN agendador_configuracoes.pagamento_metodos_visiveis; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agendador_configuracoes.pagamento_metodos_visiveis IS 'Métodos exibidos ao paciente quando pagamento_modo = pagar_na_hora. Ex: {pix, deposito, dinheiro, cartao, convenio}'; - - --- --- Name: agendador_solicitacoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agendador_solicitacoes ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - paciente_nome text NOT NULL, - paciente_sobrenome text, - paciente_email text NOT NULL, - paciente_celular text, - paciente_cpf text, - tipo text NOT NULL, - modalidade text NOT NULL, - data_solicitada date NOT NULL, - hora_solicitada time without time zone NOT NULL, - reservado_ate timestamp with time zone, - motivo text, - como_conheceu text, - pix_status text DEFAULT 'pendente'::text, - pix_pago_em timestamp with time zone, - status text DEFAULT 'pendente'::text NOT NULL, - recusado_motivo text, - autorizado_em timestamp with time zone, - autorizado_por uuid, - user_id uuid, - patient_id uuid, - evento_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT agendador_sol_modalidade_check CHECK ((modalidade = ANY (ARRAY['presencial'::text, 'online'::text]))), - CONSTRAINT agendador_sol_pix_check CHECK (((pix_status IS NULL) OR (pix_status = ANY (ARRAY['pendente'::text, 'pago'::text, 'expirado'::text])))), - CONSTRAINT agendador_sol_status_check CHECK ((status = ANY (ARRAY['pendente'::text, 'autorizado'::text, 'recusado'::text, 'expirado'::text, 'convertido'::text]))), - CONSTRAINT agendador_sol_tipo_check CHECK ((tipo = ANY (ARRAY['primeira'::text, 'retorno'::text, 'reagendar'::text]))) -); - - -ALTER TABLE public.agendador_solicitacoes OWNER TO supabase_admin; - --- --- Name: commitment_time_logs; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.commitment_time_logs ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - commitment_id uuid NOT NULL, - calendar_event_id uuid, - source public.commitment_log_source DEFAULT 'manual'::public.commitment_log_source NOT NULL, - started_at timestamp with time zone NOT NULL, - ended_at timestamp with time zone NOT NULL, - minutes integer NOT NULL, - created_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.commitment_time_logs OWNER TO supabase_admin; - --- --- Name: current_tenant_id; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.current_tenant_id AS - SELECT current_setting('request.jwt.claim.tenant_id'::text, true) AS current_setting; - - -ALTER VIEW public.current_tenant_id OWNER TO supabase_admin; - --- --- Name: determined_commitment_fields; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.determined_commitment_fields ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - commitment_id uuid NOT NULL, - key text NOT NULL, - label text NOT NULL, - field_type public.determined_field_type DEFAULT 'text'::public.determined_field_type NOT NULL, - required boolean DEFAULT false NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.determined_commitment_fields OWNER TO supabase_admin; - --- --- Name: determined_commitments; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.determined_commitments ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - created_by uuid, - is_native boolean DEFAULT false NOT NULL, - native_key text, - is_locked boolean DEFAULT false NOT NULL, - active boolean DEFAULT true NOT NULL, - name text NOT NULL, - description text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - bg_color text, - text_color text -); - - -ALTER TABLE public.determined_commitments OWNER TO supabase_admin; - --- --- Name: dev_user_credentials; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.dev_user_credentials ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - email text NOT NULL, - password_dev text NOT NULL, - kind text DEFAULT 'custom'::text NOT NULL, - note text, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.dev_user_credentials OWNER TO supabase_admin; - --- --- Name: entitlements_invalidation; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.entitlements_invalidation ( - owner_id uuid NOT NULL, - changed_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.entitlements_invalidation OWNER TO supabase_admin; - --- --- Name: features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.features ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - description text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - descricao text DEFAULT ''::text NOT NULL, - name text DEFAULT ''::text NOT NULL -); - - -ALTER TABLE public.features OWNER TO supabase_admin; - --- --- Name: COLUMN features.descricao; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.features.descricao IS 'Descrição humana da feature (exibição no admin e documentação).'; - - --- --- Name: feriados; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.feriados ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid, - owner_id uuid, - tipo text DEFAULT 'municipal'::text NOT NULL, - nome text NOT NULL, - data date NOT NULL, - cidade text, - estado text, - observacao text, - bloqueia_sessoes boolean DEFAULT false NOT NULL, - criado_em timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT feriados_tipo_check CHECK ((tipo = ANY (ARRAY['municipal'::text, 'personalizado'::text]))) -); - - -ALTER TABLE public.feriados OWNER TO supabase_admin; - --- --- Name: module_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.module_features ( - module_id uuid NOT NULL, - feature_id uuid NOT NULL, - enabled boolean DEFAULT true NOT NULL, - limits jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.module_features OWNER TO supabase_admin; - --- --- Name: modules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.modules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - name text NOT NULL, - description text, - is_active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.modules OWNER TO supabase_admin; - --- --- Name: plan_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_features ( - plan_id uuid NOT NULL, - feature_id uuid NOT NULL, - enabled boolean DEFAULT true NOT NULL, - limits jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_features OWNER TO supabase_admin; - --- --- Name: tenant_modules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_modules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - module_id uuid NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - settings jsonb, - provider text DEFAULT 'manual'::text NOT NULL, - provider_item_id text, - installed_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_modules OWNER TO supabase_admin; - --- --- Name: owner_feature_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.owner_feature_entitlements AS - WITH base AS ( - SELECT s.user_id AS owner_id, - f.key AS feature_key, - pf.limits, - 'plan'::text AS source - FROM ((public.subscriptions s - JOIN public.plan_features pf ON (((pf.plan_id = s.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))) - WHERE ((s.status = 'active'::text) AND (s.user_id IS NOT NULL)) - UNION ALL - SELECT tm.owner_id, - f.key AS feature_key, - mf.limits, - 'module'::text AS source - FROM (((public.tenant_modules tm - JOIN public.modules m ON (((m.id = tm.module_id) AND (m.is_active = true)))) - JOIN public.module_features mf ON (((mf.module_id = m.id) AND (mf.enabled = true)))) - JOIN public.features f ON ((f.id = mf.feature_id))) - WHERE ((tm.status = 'active'::text) AND (tm.owner_id IS NOT NULL)) - ) - SELECT owner_id, - feature_key, - array_agg(DISTINCT source) AS sources, - jsonb_agg(limits) FILTER (WHERE (limits IS NOT NULL)) AS limits_list - FROM base - GROUP BY owner_id, feature_key; - - -ALTER VIEW public.owner_feature_entitlements OWNER TO supabase_admin; - --- --- Name: owner_users; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.owner_users ( - owner_id uuid NOT NULL, - user_id uuid NOT NULL, - role text DEFAULT 'admin'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.owner_users OWNER TO supabase_admin; - --- --- Name: patient_group_patient; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_group_patient ( - patient_group_id uuid NOT NULL, - patient_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now(), - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_group_patient OWNER TO supabase_admin; - --- --- Name: patient_groups; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_groups ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - nome text NOT NULL, - descricao text, - cor text, - is_active boolean DEFAULT true NOT NULL, - is_system boolean DEFAULT false NOT NULL, - owner_id uuid DEFAULT auth.uid() NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - therapist_id uuid, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_groups OWNER TO supabase_admin; - --- --- Name: patient_intake_requests; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_intake_requests ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - token text NOT NULL, - consent boolean DEFAULT false NOT NULL, - status text DEFAULT 'new'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - converted_patient_id uuid, - rejected_reason text, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - cpf text, - rg text, - cep text, - nome_completo text, - email_principal text, - telefone text, - pais text, - cidade text, - estado text, - endereco text, - numero text, - bairro text, - complemento text, - data_nascimento date, - naturalidade text, - genero text, - estado_civil text, - onde_nos_conheceu text, - encaminhado_por text, - observacoes text, - notas_internas text, - email_alternativo text, - telefone_alternativo text, - profissao text, - escolaridade text, - nacionalidade text, - avatar_url text, - tenant_id uuid, - CONSTRAINT chk_intakes_status CHECK ((status = ANY (ARRAY['new'::text, 'converted'::text, 'rejected'::text]))) -); - - -ALTER TABLE public.patient_intake_requests OWNER TO supabase_admin; - --- --- Name: patient_invites; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_invites ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - token text NOT NULL, - active boolean DEFAULT true NOT NULL, - expires_at timestamp with time zone, - max_uses integer, - uses integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid -); - - -ALTER TABLE public.patient_invites OWNER TO supabase_admin; - --- --- Name: patient_patient_tag; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_patient_tag ( - owner_id uuid NOT NULL, - patient_id uuid NOT NULL, - tag_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_patient_tag OWNER TO supabase_admin; - --- --- Name: patient_tags; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_tags ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - nome text NOT NULL, - cor text, - is_padrao boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_tags OWNER TO supabase_admin; - --- --- Name: patients; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patients ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - nome_completo text NOT NULL, - email_principal text, - telefone text, - created_at timestamp with time zone DEFAULT now(), - owner_id uuid, - avatar_url text, - status text DEFAULT 'Ativo'::text, - last_attended_at timestamp with time zone, - is_native boolean DEFAULT false, - naturalidade text, - data_nascimento date, - rg text, - cpf text, - identification_color text, - genero text, - estado_civil text, - email_alternativo text, - pais text DEFAULT 'Brasil'::text, - cep text, - cidade text, - estado text, - endereco text, - numero text, - bairro text, - complemento text, - escolaridade text, - profissao text, - nome_parente text, - grau_parentesco text, - telefone_alternativo text, - onde_nos_conheceu text, - encaminhado_por text, - nome_responsavel text, - telefone_responsavel text, - cpf_responsavel text, - observacao_responsavel text, - cobranca_no_responsavel boolean DEFAULT false, - observacoes text, - notas_internas text, - updated_at timestamp with time zone DEFAULT now(), - telefone_parente text, - tenant_id uuid NOT NULL, - responsible_member_id uuid NOT NULL, - user_id uuid, - patient_scope text DEFAULT 'clinic'::text NOT NULL, - therapist_member_id uuid, - CONSTRAINT cpf_responsavel_format_check CHECK (((cpf_responsavel IS NULL) OR (cpf_responsavel ~ '^\d{11}$'::text))), - CONSTRAINT patients_cpf_format_check CHECK (((cpf IS NULL) OR (cpf ~ '^\d{11}$'::text))), - CONSTRAINT patients_patient_scope_check CHECK ((patient_scope = ANY (ARRAY['clinic'::text, 'therapist'::text]))), - CONSTRAINT patients_status_check CHECK ((status = ANY (ARRAY['Ativo'::text, 'Inativo'::text, 'Alta'::text, 'Encaminhado'::text]))), - CONSTRAINT patients_therapist_scope_consistency CHECK ((((patient_scope = 'clinic'::text) AND (therapist_member_id IS NULL)) OR ((patient_scope = 'therapist'::text) AND (therapist_member_id IS NOT NULL)))) -); - - -ALTER TABLE public.patients OWNER TO supabase_admin; - --- --- Name: COLUMN patients.avatar_url; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.patients.avatar_url IS 'URL pública da imagem de avatar armazenada no Supabase Storage'; - - --- --- Name: payment_settings; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.payment_settings ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - pix_ativo boolean DEFAULT false NOT NULL, - pix_tipo text DEFAULT 'cpf'::text NOT NULL, - pix_chave text DEFAULT ''::text NOT NULL, - pix_nome_titular text DEFAULT ''::text NOT NULL, - deposito_ativo boolean DEFAULT false NOT NULL, - deposito_banco text DEFAULT ''::text NOT NULL, - deposito_agencia text DEFAULT ''::text NOT NULL, - deposito_conta text DEFAULT ''::text NOT NULL, - deposito_tipo_conta text DEFAULT 'corrente'::text NOT NULL, - deposito_titular text DEFAULT ''::text NOT NULL, - deposito_cpf_cnpj text DEFAULT ''::text NOT NULL, - dinheiro_ativo boolean DEFAULT false NOT NULL, - cartao_ativo boolean DEFAULT false NOT NULL, - cartao_instrucao text DEFAULT ''::text NOT NULL, - convenio_ativo boolean DEFAULT false NOT NULL, - convenio_lista text DEFAULT ''::text NOT NULL, - observacoes_pagamento text DEFAULT ''::text NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.payment_settings OWNER TO supabase_admin; - --- --- Name: plan_prices; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_prices ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - plan_id uuid NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - "interval" text NOT NULL, - amount_cents integer NOT NULL, - is_active boolean DEFAULT true NOT NULL, - active_from timestamp with time zone DEFAULT now() NOT NULL, - active_to timestamp with time zone, - source text DEFAULT 'manual'::text NOT NULL, - provider text, - provider_price_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT plan_prices_amount_cents_check CHECK ((amount_cents >= 0)), - CONSTRAINT plan_prices_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))) -); - - -ALTER TABLE public.plan_prices OWNER TO supabase_admin; - --- --- Name: TABLE plan_prices; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.plan_prices IS 'Histórico de preços por plano (fonte: manual/gateway).'; - - --- --- Name: plan_public; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_public ( - plan_id uuid NOT NULL, - public_name text DEFAULT ''::text NOT NULL, - public_description text DEFAULT ''::text NOT NULL, - badge text, - is_featured boolean DEFAULT false NOT NULL, - is_visible boolean DEFAULT true NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_public OWNER TO supabase_admin; - --- --- Name: TABLE plan_public; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.plan_public IS 'Configuração de vitrine (página pública) dos planos.'; - - --- --- Name: plan_public_bullets; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_public_bullets ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - plan_id uuid NOT NULL, - text text NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - highlight boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_public_bullets OWNER TO supabase_admin; - --- --- Name: plans; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plans ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - name text NOT NULL, - description text, - is_active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - price_cents integer DEFAULT 0 NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - billing_interval text DEFAULT 'month'::text NOT NULL, - target text, - max_supervisees integer, - CONSTRAINT plans_target_check CHECK ((target = ANY (ARRAY['patient'::text, 'therapist'::text, 'clinic'::text, 'supervisor'::text]))) -); - - -ALTER TABLE public.plans OWNER TO supabase_admin; - --- --- Name: COLUMN plans.name; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.name IS 'Nome interno do plano (admin). A key é técnica/imutável.'; - - --- --- Name: COLUMN plans.target; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.target IS 'Público-alvo do plano: patient, therapist ou clinic.'; - - --- --- Name: COLUMN plans.max_supervisees; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.max_supervisees IS 'Limite de terapeutas que podem ser supervisionados. Apenas para planos target=supervisor. NULL = sem limite.'; - - --- --- Name: professional_pricing; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.professional_pricing ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - determined_commitment_id uuid, - price numeric(10,2) NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.professional_pricing OWNER TO supabase_admin; - --- --- Name: profiles; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.profiles ( - id uuid NOT NULL, - role text DEFAULT 'tenant_member'::text NOT NULL, - full_name text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - avatar_url text, - phone text, - bio text, - language text DEFAULT 'pt-BR'::text NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - notify_system_email boolean DEFAULT true NOT NULL, - notify_reminders boolean DEFAULT true NOT NULL, - notify_news boolean DEFAULT false NOT NULL, - account_type text DEFAULT 'free'::text NOT NULL, - platform_roles text[] DEFAULT '{}'::text[] NOT NULL, - CONSTRAINT profiles_account_type_check CHECK ((account_type = ANY (ARRAY['free'::text, 'patient'::text, 'therapist'::text, 'clinic'::text]))), - CONSTRAINT profiles_role_check CHECK ((role = ANY (ARRAY['saas_admin'::text, 'tenant_member'::text, 'portal_user'::text, 'patient'::text]))) -); - - -ALTER TABLE public.profiles OWNER TO supabase_admin; - --- --- Name: COLUMN profiles.account_type; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.account_type IS 'Tipo de conta: free=sem perfil ainda, patient=paciente (imutável), therapist=terapeuta (imutável), clinic=clínica (imutável).'; - - --- --- Name: COLUMN profiles.platform_roles; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.platform_roles IS 'Papéis globais de plataforma, independentes de tenant. Ex: editor de microlearning. Atribuído pelo saas_admin.'; - - --- --- Name: recurrence_exceptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_exceptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - recurrence_id uuid NOT NULL, - tenant_id uuid NOT NULL, - original_date date NOT NULL, - type public.recurrence_exception_type NOT NULL, - new_date date, - new_start_time time without time zone, - new_end_time time without time zone, - modalidade text, - observacoes text, - titulo_custom text, - extra_fields jsonb, - reason text, - agenda_evento_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.recurrence_exceptions OWNER TO supabase_admin; - --- --- Name: recurrence_rules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_rules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - owner_id uuid NOT NULL, - therapist_id uuid, - patient_id uuid, - determined_commitment_id uuid, - type public.recurrence_type DEFAULT 'weekly'::public.recurrence_type NOT NULL, - "interval" smallint DEFAULT 1 NOT NULL, - weekdays smallint[] DEFAULT '{}'::smallint[] NOT NULL, - start_time time without time zone NOT NULL, - end_time time without time zone NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - duration_min smallint DEFAULT 50 NOT NULL, - start_date date NOT NULL, - end_date date, - max_occurrences integer, - open_ended boolean DEFAULT true NOT NULL, - modalidade text DEFAULT 'presencial'::text, - titulo_custom text, - observacoes text, - extra_fields jsonb, - status text DEFAULT 'ativo'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - price numeric(10,2), - CONSTRAINT recurrence_rules_dates_chk CHECK (((end_date IS NULL) OR (end_date >= start_date))), - CONSTRAINT recurrence_rules_interval_chk CHECK (("interval" >= 1)), - CONSTRAINT recurrence_rules_status_check CHECK ((status = ANY (ARRAY['ativo'::text, 'pausado'::text, 'cancelado'::text]))), - CONSTRAINT recurrence_rules_times_chk CHECK ((end_time > start_time)) -); - - -ALTER TABLE public.recurrence_rules OWNER TO supabase_admin; - --- --- Name: saas_admins; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_admins ( - user_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_admins OWNER TO supabase_admin; - --- --- Name: saas_doc_votos; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_doc_votos ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - doc_id uuid NOT NULL, - user_id uuid NOT NULL, - util boolean NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_doc_votos OWNER TO supabase_admin; - --- --- Name: saas_docs; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_docs ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - titulo text NOT NULL, - conteudo text DEFAULT ''::text NOT NULL, - medias jsonb DEFAULT '[]'::jsonb NOT NULL, - tipo_acesso text DEFAULT 'usuario'::text NOT NULL, - pagina_path text NOT NULL, - docs_relacionados uuid[] DEFAULT '{}'::uuid[] NOT NULL, - ativo boolean DEFAULT true NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - categoria text, - exibir_no_faq boolean DEFAULT false NOT NULL, - votos_util integer DEFAULT 0 NOT NULL, - votos_nao_util integer DEFAULT 0 NOT NULL, - CONSTRAINT saas_docs_tipo_acesso_check CHECK ((tipo_acesso = ANY (ARRAY['admin'::text, 'usuario'::text]))) -); - - -ALTER TABLE public.saas_docs OWNER TO supabase_admin; - --- --- Name: COLUMN saas_docs.categoria; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.saas_docs.categoria IS 'Agrupa docs no portal FAQ (ex: Conta, Agenda, Pagamentos)'; - - --- --- Name: COLUMN saas_docs.exibir_no_faq; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.saas_docs.exibir_no_faq IS 'Se true, a doc e seus itens FAQ aparecem no portal de FAQ'; - - --- --- Name: saas_faq; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_faq ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - pergunta text NOT NULL, - categoria text, - publico boolean DEFAULT false NOT NULL, - votos integer DEFAULT 0 NOT NULL, - titulo text, - conteudo text, - tipo_acesso text DEFAULT 'usuario'::text NOT NULL, - pagina_path text NOT NULL, - pagina_label text, - medias jsonb DEFAULT '[]'::jsonb NOT NULL, - faqs_relacionados uuid[] DEFAULT '{}'::uuid[] NOT NULL, - ativo boolean DEFAULT true NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_faq OWNER TO supabase_admin; - --- --- Name: saas_faq_itens; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_faq_itens ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - doc_id uuid NOT NULL, - pergunta text NOT NULL, - resposta text, - ordem integer DEFAULT 0 NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_faq_itens OWNER TO supabase_admin; - --- --- Name: TABLE saas_faq_itens; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.saas_faq_itens IS 'Pares pergunta/resposta vinculados a um documento de ajuda'; - - --- --- Name: subscription_events; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_events ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - subscription_id uuid NOT NULL, - owner_id uuid NOT NULL, - event_type text NOT NULL, - old_plan_id uuid, - new_plan_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - created_by uuid, - source text DEFAULT 'admin_ui'::text, - reason text, - metadata jsonb, - owner_type text NOT NULL, - owner_ref uuid NOT NULL, - CONSTRAINT subscription_events_owner_ref_consistency_chk CHECK ((owner_id = owner_ref)), - CONSTRAINT subscription_events_owner_type_chk CHECK (((owner_type IS NULL) OR (owner_type = ANY (ARRAY['clinic'::text, 'therapist'::text])))) -); - - -ALTER TABLE public.subscription_events OWNER TO supabase_admin; - --- --- Name: subscription_intents_personal; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_personal ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid NOT NULL, - created_by_user_id uuid, - email text NOT NULL, - plan_id uuid NOT NULL, - plan_key text, - "interval" text, - amount_cents integer, - currency text, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'manual'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - subscription_id uuid, - CONSTRAINT sint_personal_interval_check CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::text, 'year'::text])))), - CONSTRAINT sint_personal_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_personal OWNER TO supabase_admin; - --- --- Name: subscription_intents_tenant; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_tenant ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid NOT NULL, - created_by_user_id uuid, - email text NOT NULL, - plan_id uuid NOT NULL, - plan_key text, - "interval" text, - amount_cents integer, - currency text, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'manual'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - tenant_id uuid NOT NULL, - subscription_id uuid, - CONSTRAINT sint_tenant_interval_check CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::text, 'year'::text])))), - CONSTRAINT sint_tenant_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_tenant OWNER TO supabase_admin; - --- --- Name: subscription_intents; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.subscription_intents AS - SELECT t.id, - t.user_id, - t.created_by_user_id, - t.email, - t.plan_id, - t.plan_key, - t."interval", - t.amount_cents, - t.currency, - t.status, - t.source, - t.notes, - t.created_at, - t.paid_at, - t.tenant_id, - t.subscription_id, - 'clinic'::text AS plan_target - FROM public.subscription_intents_tenant t -UNION ALL - SELECT p.id, - p.user_id, - p.created_by_user_id, - p.email, - p.plan_id, - p.plan_key, - p."interval", - p.amount_cents, - p.currency, - p.status, - p.source, - p.notes, - p.created_at, - p.paid_at, - NULL::uuid AS tenant_id, - p.subscription_id, - 'therapist'::text AS plan_target - FROM public.subscription_intents_personal p; - - -ALTER VIEW public.subscription_intents OWNER TO supabase_admin; - --- --- Name: subscription_intents_legacy; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_legacy ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - email text, - plan_key text NOT NULL, - "interval" text NOT NULL, - amount_cents integer NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'landing'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - tenant_id uuid NOT NULL, - created_by_user_id uuid, - CONSTRAINT subscription_intents_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))), - CONSTRAINT subscription_intents_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_legacy OWNER TO supabase_admin; - --- --- Name: support_sessions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.support_sessions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - admin_id uuid NOT NULL, - token text DEFAULT encode(extensions.gen_random_bytes(32), 'hex'::text) NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '01:00:00'::interval) NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.support_sessions OWNER TO supabase_admin; - --- --- Name: tenant_feature_exceptions_log; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_feature_exceptions_log ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - feature_key text NOT NULL, - enabled boolean NOT NULL, - reason text, - created_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_feature_exceptions_log OWNER TO supabase_admin; - --- --- Name: tenant_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_features ( - tenant_id uuid NOT NULL, - feature_key text NOT NULL, - enabled boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_features OWNER TO supabase_admin; - --- --- Name: tenant_invites; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_invites ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - email text NOT NULL, - role text NOT NULL, - token uuid DEFAULT gen_random_uuid() NOT NULL, - invited_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '7 days'::interval) NOT NULL, - accepted_at timestamp with time zone, - accepted_by uuid, - revoked_at timestamp with time zone, - revoked_by uuid, - CONSTRAINT tenant_invites_role_check CHECK ((role = ANY (ARRAY['therapist'::text, 'secretary'::text]))) -); - - -ALTER TABLE public.tenant_invites OWNER TO supabase_admin; - --- --- Name: tenants; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenants ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - name text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - kind text DEFAULT 'saas'::text NOT NULL, - CONSTRAINT tenants_kind_check CHECK ((kind = ANY (ARRAY['therapist'::text, 'clinic_coworking'::text, 'clinic_reception'::text, 'clinic_full'::text, 'clinic'::text, 'saas'::text, 'supervisor'::text]))) -); - - -ALTER TABLE public.tenants OWNER TO supabase_admin; - --- --- Name: COLUMN tenants.kind; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.tenants.kind IS 'Tipo do tenant. Imutável após criação. therapist=terapeuta solo. clinic_coworking/clinic_reception/clinic_full=clínicas. clinic e saas são legados.'; - - --- --- Name: user_settings; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.user_settings ( - user_id uuid NOT NULL, - theme_mode text DEFAULT 'dark'::text NOT NULL, - preset text DEFAULT 'Aura'::text NOT NULL, - primary_color text DEFAULT 'noir'::text NOT NULL, - surface_color text DEFAULT 'slate'::text NOT NULL, - menu_mode text DEFAULT 'static'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.user_settings OWNER TO supabase_admin; - --- --- Name: v_auth_users_public; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_auth_users_public AS - SELECT id AS user_id, - email, - created_at, - last_sign_in_at - FROM auth.users u; - - -ALTER VIEW public.v_auth_users_public OWNER TO supabase_admin; - --- --- Name: v_commitment_totals; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_commitment_totals AS - SELECT c.tenant_id, - c.id AS commitment_id, - (COALESCE(sum(l.minutes), (0)::bigint))::integer AS total_minutes - FROM (public.determined_commitments c - LEFT JOIN public.commitment_time_logs l ON ((l.commitment_id = c.id))) - GROUP BY c.tenant_id, c.id; - - -ALTER VIEW public.v_commitment_totals OWNER TO supabase_admin; - --- --- Name: v_patient_groups_with_counts; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_patient_groups_with_counts AS - SELECT pg.id, - pg.nome, - pg.cor, - pg.owner_id, - pg.is_system, - pg.is_active, - pg.created_at, - pg.updated_at, - (COALESCE(count(pgp.patient_id), (0)::bigint))::integer AS patients_count - FROM (public.patient_groups pg - LEFT JOIN public.patient_group_patient pgp ON ((pgp.patient_group_id = pg.id))) - GROUP BY pg.id, pg.nome, pg.cor, pg.owner_id, pg.is_system, pg.is_active, pg.created_at, pg.updated_at; - - -ALTER VIEW public.v_patient_groups_with_counts OWNER TO supabase_admin; - --- --- Name: v_plan_active_prices; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_plan_active_prices AS - SELECT plan_id, - max( - CASE - WHEN (("interval" = 'month'::text) AND is_active) THEN amount_cents - ELSE NULL::integer - END) AS monthly_cents, - max( - CASE - WHEN (("interval" = 'year'::text) AND is_active) THEN amount_cents - ELSE NULL::integer - END) AS yearly_cents, - max( - CASE - WHEN (("interval" = 'month'::text) AND is_active) THEN currency - ELSE NULL::text - END) AS monthly_currency, - max( - CASE - WHEN (("interval" = 'year'::text) AND is_active) THEN currency - ELSE NULL::text - END) AS yearly_currency - FROM public.plan_prices - GROUP BY plan_id; - - -ALTER VIEW public.v_plan_active_prices OWNER TO supabase_admin; - --- --- Name: v_public_pricing; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_public_pricing AS - SELECT p.id AS plan_id, - p.key AS plan_key, - p.name AS plan_name, - COALESCE(pp.public_name, ''::text) AS public_name, - COALESCE(pp.public_description, ''::text) AS public_description, - pp.badge, - COALESCE(pp.is_featured, false) AS is_featured, - COALESCE(pp.is_visible, true) AS is_visible, - COALESCE(pp.sort_order, 0) AS sort_order, - ap.monthly_cents, - ap.yearly_cents, - ap.monthly_currency, - ap.yearly_currency, - COALESCE(( SELECT jsonb_agg(jsonb_build_object('id', b.id, 'text', b.text, 'highlight', b.highlight, 'sort_order', b.sort_order) ORDER BY b.sort_order, b.created_at) AS jsonb_agg - FROM public.plan_public_bullets b - WHERE (b.plan_id = p.id)), '[]'::jsonb) AS bullets, - p.target AS plan_target - FROM ((public.plans p - LEFT JOIN public.plan_public pp ON ((pp.plan_id = p.id))) - LEFT JOIN public.v_plan_active_prices ap ON ((ap.plan_id = p.id))) - ORDER BY COALESCE(pp.sort_order, 0), p.key; - - -ALTER VIEW public.v_public_pricing OWNER TO supabase_admin; - --- --- Name: v_subscription_feature_mismatch; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_feature_mismatch AS - WITH expected AS ( - SELECT s.user_id AS owner_id, - f.key AS feature_key - FROM ((public.subscriptions s - JOIN public.plan_features pf ON (((pf.plan_id = s.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))) - WHERE ((s.status = 'active'::text) AND (s.tenant_id IS NULL) AND (s.user_id IS NOT NULL)) - ), actual AS ( - SELECT e.owner_id, - e.feature_key - FROM public.owner_feature_entitlements e - ) - SELECT COALESCE(expected.owner_id, actual.owner_id) AS owner_id, - COALESCE(expected.feature_key, actual.feature_key) AS feature_key, - CASE - WHEN ((expected.feature_key IS NOT NULL) AND (actual.feature_key IS NULL)) THEN 'missing_entitlement'::text - WHEN ((expected.feature_key IS NULL) AND (actual.feature_key IS NOT NULL)) THEN 'unexpected_entitlement'::text - ELSE NULL::text - END AS mismatch_type - FROM (expected - FULL JOIN actual ON (((expected.owner_id = actual.owner_id) AND (expected.feature_key = actual.feature_key)))) - WHERE ((expected.feature_key IS NULL) OR (actual.feature_key IS NULL)); - - -ALTER VIEW public.v_subscription_feature_mismatch OWNER TO supabase_admin; - --- --- Name: v_subscription_health; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_health AS - SELECT s.id AS subscription_id, - s.user_id AS owner_id, - s.status, - s.plan_id, - p.key AS plan_key, - s.current_period_start, - s.current_period_end, - s.updated_at, - CASE - WHEN (s.plan_id IS NULL) THEN 'missing_plan'::text - WHEN (p.id IS NULL) THEN 'invalid_plan'::text - WHEN ((s.status = 'active'::text) AND (s.current_period_end IS NOT NULL) AND (s.current_period_end < now())) THEN 'expired_but_active'::text - WHEN ((s.status = 'canceled'::text) AND (s.current_period_end > now())) THEN 'canceled_but_still_in_period'::text - ELSE 'ok'::text - END AS health_status, - CASE - WHEN (s.tenant_id IS NOT NULL) THEN 'clinic'::text - ELSE 'therapist'::text - END AS owner_type, - COALESCE(s.tenant_id, s.user_id) AS owner_ref - FROM (public.subscriptions s - LEFT JOIN public.plans p ON ((p.id = s.plan_id))); - - -ALTER VIEW public.v_subscription_health OWNER TO supabase_admin; - --- --- Name: v_subscription_health_v2; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_health_v2 AS - SELECT s.id AS subscription_id, - s.user_id AS owner_id, - CASE - WHEN (s.tenant_id IS NOT NULL) THEN 'clinic'::text - ELSE 'therapist'::text - END AS owner_type, - COALESCE(s.tenant_id, s.user_id) AS owner_ref, - s.status, - s.plan_id, - p.key AS plan_key, - s.current_period_start, - s.current_period_end, - s.updated_at, - CASE - WHEN (s.plan_id IS NULL) THEN 'missing_plan'::text - WHEN (p.id IS NULL) THEN 'invalid_plan'::text - WHEN ((s.status = 'active'::text) AND (s.current_period_end IS NOT NULL) AND (s.current_period_end < now())) THEN 'expired_but_active'::text - WHEN ((s.status = 'canceled'::text) AND (s.current_period_end > now())) THEN 'canceled_but_still_in_period'::text - ELSE 'ok'::text - END AS health_status - FROM (public.subscriptions s - LEFT JOIN public.plans p ON ((p.id = s.plan_id))); - - -ALTER VIEW public.v_subscription_health_v2 OWNER TO supabase_admin; - --- --- Name: v_tag_patient_counts; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tag_patient_counts AS - SELECT t.id, - t.owner_id, - t.nome, - t.cor, - t.is_padrao, - t.created_at, - t.updated_at, - (COALESCE(count(ppt.patient_id), (0)::bigint))::integer AS pacientes_count, - (COALESCE(count(ppt.patient_id), (0)::bigint))::integer AS patient_count - FROM (public.patient_tags t - LEFT JOIN public.patient_patient_tag ppt ON (((ppt.tag_id = t.id) AND (ppt.owner_id = t.owner_id)))) - GROUP BY t.id, t.owner_id, t.nome, t.cor, t.is_padrao, t.created_at, t.updated_at; - - -ALTER VIEW public.v_tag_patient_counts OWNER TO supabase_admin; - --- --- Name: v_tenant_active_subscription; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_active_subscription AS - SELECT DISTINCT ON (tenant_id) tenant_id, - plan_id, - plan_key, - "interval", - status, - current_period_start, - current_period_end, - created_at - FROM public.subscriptions s - WHERE ((tenant_id IS NOT NULL) AND (status = 'active'::text) AND ((current_period_end IS NULL) OR (current_period_end > now()))) - ORDER BY tenant_id, created_at DESC; - - -ALTER VIEW public.v_tenant_active_subscription OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements AS - SELECT a.tenant_id, - f.key AS feature_key, - true AS allowed - FROM ((public.v_tenant_active_subscription a - JOIN public.plan_features pf ON (((pf.plan_id = a.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))); - - -ALTER VIEW public.v_tenant_entitlements OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements_full; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements_full AS - SELECT a.tenant_id, - f.key AS feature_key, - (pf.enabled = true) AS allowed, - pf.limits, - a.plan_id, - p.key AS plan_key - FROM (((public.v_tenant_active_subscription a - JOIN public.plan_features pf ON ((pf.plan_id = a.plan_id))) - JOIN public.features f ON ((f.id = pf.feature_id))) - JOIN public.plans p ON ((p.id = a.plan_id))); - - -ALTER VIEW public.v_tenant_entitlements_full OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements_json; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements_json AS - SELECT tenant_id, - max(plan_key) AS plan_key, - jsonb_object_agg(feature_key, jsonb_build_object('allowed', allowed, 'limits', COALESCE(limits, '{}'::jsonb)) ORDER BY feature_key) AS entitlements - FROM public.v_tenant_entitlements_full - GROUP BY tenant_id; - - -ALTER VIEW public.v_tenant_entitlements_json OWNER TO supabase_admin; - --- --- Name: v_tenant_feature_exceptions; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_feature_exceptions AS - SELECT tf.tenant_id, - a.plan_key, - tf.feature_key, - 'commercial_exception'::text AS exception_type - FROM ((public.tenant_features tf - JOIN public.v_tenant_active_subscription a ON ((a.tenant_id = tf.tenant_id))) - LEFT JOIN public.v_tenant_entitlements_full v ON (((v.tenant_id = tf.tenant_id) AND (v.feature_key = tf.feature_key)))) - WHERE ((tf.enabled = true) AND (COALESCE(v.allowed, false) = false)); - - -ALTER VIEW public.v_tenant_feature_exceptions OWNER TO supabase_admin; - --- --- Name: v_tenant_feature_mismatch; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_feature_mismatch AS - WITH plan_allowed AS ( - SELECT v.tenant_id, - v.feature_key, - v.allowed - FROM public.v_tenant_entitlements_full v - ), overrides AS ( - SELECT tf.tenant_id, - tf.feature_key, - tf.enabled - FROM public.tenant_features tf - ) - SELECT o.tenant_id, - o.feature_key, - CASE - WHEN ((o.enabled = true) AND (COALESCE(p.allowed, false) = false)) THEN 'unexpected_override'::text - ELSE NULL::text - END AS mismatch_type - FROM (overrides o - LEFT JOIN plan_allowed p ON (((p.tenant_id = o.tenant_id) AND (p.feature_key = o.feature_key)))) - WHERE ((o.enabled = true) AND (COALESCE(p.allowed, false) = false)); - - -ALTER VIEW public.v_tenant_feature_mismatch OWNER TO supabase_admin; - --- --- Name: v_tenant_members_with_profiles; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_members_with_profiles AS - SELECT tm.id AS tenant_member_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at, - p.full_name, - au.email - FROM ((public.tenant_members tm - LEFT JOIN public.profiles p ON ((p.id = tm.user_id))) - LEFT JOIN auth.users au ON ((au.id = tm.user_id))); - - -ALTER VIEW public.v_tenant_members_with_profiles OWNER TO supabase_admin; - --- --- Name: v_tenant_people; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_people AS - SELECT 'member'::text AS type, - m.tenant_id, - m.user_id, - u.email, - m.role, - m.status, - NULL::uuid AS invite_token, - NULL::timestamp with time zone AS expires_at - FROM (public.tenant_members m - JOIN auth.users u ON ((u.id = m.user_id))) -UNION ALL - SELECT 'invite'::text AS type, - i.tenant_id, - NULL::uuid AS user_id, - i.email, - i.role, - 'invited'::text AS status, - i.token AS invite_token, - i.expires_at - FROM public.tenant_invites i - WHERE ((i.accepted_at IS NULL) AND (i.revoked_at IS NULL)); - - -ALTER VIEW public.v_tenant_people OWNER TO supabase_admin; - --- --- Name: v_tenant_staff; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_staff AS - SELECT ('m_'::text || (tm.id)::text) AS row_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at, - p.full_name, - au.email, - NULL::uuid AS invite_token - FROM ((public.tenant_members tm - LEFT JOIN public.profiles p ON ((p.id = tm.user_id))) - LEFT JOIN auth.users au ON ((au.id = tm.user_id))) -UNION ALL - SELECT ('i_'::text || (ti.id)::text) AS row_id, - ti.tenant_id, - NULL::uuid AS user_id, - ti.role, - 'invited'::text AS status, - ti.created_at, - NULL::text AS full_name, - ti.email, - ti.token AS invite_token - FROM public.tenant_invites ti - WHERE ((ti.accepted_at IS NULL) AND (ti.revoked_at IS NULL) AND (ti.expires_at > now())); - - -ALTER VIEW public.v_tenant_staff OWNER TO supabase_admin; - --- --- Name: v_user_active_subscription; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_user_active_subscription AS - SELECT DISTINCT ON (user_id) user_id, - plan_id, - plan_key, - "interval", - status, - current_period_start, - current_period_end, - created_at - FROM public.subscriptions s - WHERE ((tenant_id IS NULL) AND (user_id IS NOT NULL) AND (status = 'active'::text) AND ((current_period_end IS NULL) OR (current_period_end > now()))) - ORDER BY user_id, created_at DESC; - - -ALTER VIEW public.v_user_active_subscription OWNER TO supabase_admin; - --- --- Name: v_user_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_user_entitlements AS - SELECT a.user_id, - f.key AS feature_key, - true AS allowed - FROM ((public.v_user_active_subscription a - JOIN public.plan_features pf ON (((pf.plan_id = a.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))); - - -ALTER VIEW public.v_user_entitlements OWNER TO supabase_admin; - --- --- Name: messages; Type: TABLE; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE TABLE realtime.messages ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -) -PARTITION BY RANGE (inserted_at); - - -ALTER TABLE realtime.messages OWNER TO supabase_realtime_admin; - --- --- Name: messages_2026_03_09; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_09 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_09 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_10; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_10 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_10 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_11; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_11 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_11 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_12; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_12 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_12 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_13; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_13 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_13 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_14; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_14 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_14 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_15; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_15 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_15 OWNER TO supabase_admin; - --- --- Name: schema_migrations; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.schema_migrations ( - version bigint NOT NULL, - inserted_at timestamp(0) without time zone -); - - -ALTER TABLE realtime.schema_migrations OWNER TO supabase_admin; - --- --- Name: subscription; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.subscription ( - id bigint NOT NULL, - subscription_id uuid NOT NULL, - entity regclass NOT NULL, - filters realtime.user_defined_filter[] DEFAULT '{}'::realtime.user_defined_filter[] NOT NULL, - claims jsonb NOT NULL, - claims_role regrole GENERATED ALWAYS AS (realtime.to_regrole((claims ->> 'role'::text))) STORED NOT NULL, - created_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL -); - - -ALTER TABLE realtime.subscription OWNER TO supabase_admin; - --- --- Name: subscription_id_seq; Type: SEQUENCE; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE realtime.subscription ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( - SEQUENCE NAME realtime.subscription_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: buckets; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets ( - id text NOT NULL, - name text NOT NULL, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - public boolean DEFAULT false, - avif_autodetection boolean DEFAULT false, - file_size_limit bigint, - allowed_mime_types text[], - owner_id text, - type storage.buckettype DEFAULT 'STANDARD'::storage.buckettype NOT NULL -); - - -ALTER TABLE storage.buckets OWNER TO supabase_storage_admin; - --- --- Name: COLUMN buckets.owner; Type: COMMENT; Schema: storage; Owner: supabase_storage_admin --- - -COMMENT ON COLUMN storage.buckets.owner IS 'Field is deprecated, use owner_id instead'; - - --- --- Name: buckets_analytics; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets_analytics ( - name text NOT NULL, - type storage.buckettype DEFAULT 'ANALYTICS'::storage.buckettype NOT NULL, - format text DEFAULT 'ICEBERG'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL, - deleted_at timestamp with time zone -); - - -ALTER TABLE storage.buckets_analytics OWNER TO supabase_storage_admin; - --- --- Name: buckets_vectors; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets_vectors ( - id text NOT NULL, - type storage.buckettype DEFAULT 'VECTOR'::storage.buckettype NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.buckets_vectors OWNER TO supabase_storage_admin; - --- --- Name: iceberg_namespaces; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.iceberg_namespaces ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - bucket_name text NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - metadata jsonb DEFAULT '{}'::jsonb NOT NULL, - catalog_id uuid NOT NULL -); - - -ALTER TABLE storage.iceberg_namespaces OWNER TO supabase_storage_admin; - --- --- Name: iceberg_tables; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.iceberg_tables ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - namespace_id uuid NOT NULL, - bucket_name text NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - location text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - remote_table_id text, - shard_key text, - shard_id text, - catalog_id uuid NOT NULL -); - - -ALTER TABLE storage.iceberg_tables OWNER TO supabase_storage_admin; - --- --- Name: migrations; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.migrations ( - id integer NOT NULL, - name character varying(100) NOT NULL, - hash character varying(40) NOT NULL, - executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP -); - - -ALTER TABLE storage.migrations OWNER TO supabase_storage_admin; - --- --- Name: objects; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.objects ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - bucket_id text, - name text, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - last_accessed_at timestamp with time zone DEFAULT now(), - metadata jsonb, - path_tokens text[] GENERATED ALWAYS AS (string_to_array(name, '/'::text)) STORED, - version text, - owner_id text, - user_metadata jsonb -); - - -ALTER TABLE storage.objects OWNER TO supabase_storage_admin; - --- --- Name: COLUMN objects.owner; Type: COMMENT; Schema: storage; Owner: supabase_storage_admin --- - -COMMENT ON COLUMN storage.objects.owner IS 'Field is deprecated, use owner_id instead'; - - --- --- Name: s3_multipart_uploads; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.s3_multipart_uploads ( - id text NOT NULL, - in_progress_size bigint DEFAULT 0 NOT NULL, - upload_signature text NOT NULL, - bucket_id text NOT NULL, - key text NOT NULL COLLATE pg_catalog."C", - version text NOT NULL, - owner_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - user_metadata jsonb -); - - -ALTER TABLE storage.s3_multipart_uploads OWNER TO supabase_storage_admin; - --- --- Name: s3_multipart_uploads_parts; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.s3_multipart_uploads_parts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - upload_id text NOT NULL, - size bigint DEFAULT 0 NOT NULL, - part_number integer NOT NULL, - bucket_id text NOT NULL, - key text NOT NULL COLLATE pg_catalog."C", - etag text NOT NULL, - owner_id text, - version text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.s3_multipart_uploads_parts OWNER TO supabase_storage_admin; - --- --- Name: vector_indexes; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.vector_indexes ( - id text DEFAULT gen_random_uuid() NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - bucket_id text NOT NULL, - data_type text NOT NULL, - dimension integer NOT NULL, - distance_metric text NOT NULL, - metadata_configuration jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.vector_indexes OWNER TO supabase_storage_admin; - --- --- Name: hooks; Type: TABLE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE TABLE supabase_functions.hooks ( - id bigint NOT NULL, - hook_table_id integer NOT NULL, - hook_name text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - request_id bigint -); - - -ALTER TABLE supabase_functions.hooks OWNER TO supabase_functions_admin; - --- --- Name: TABLE hooks; Type: COMMENT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -COMMENT ON TABLE supabase_functions.hooks IS 'Supabase Functions Hooks: Audit trail for triggered hooks.'; - - --- --- Name: hooks_id_seq; Type: SEQUENCE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE SEQUENCE supabase_functions.hooks_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE supabase_functions.hooks_id_seq OWNER TO supabase_functions_admin; - --- --- Name: hooks_id_seq; Type: SEQUENCE OWNED BY; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER SEQUENCE supabase_functions.hooks_id_seq OWNED BY supabase_functions.hooks.id; - - --- --- Name: migrations; Type: TABLE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE TABLE supabase_functions.migrations ( - version text NOT NULL, - inserted_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE supabase_functions.migrations OWNER TO supabase_functions_admin; - --- --- Name: messages_2026_03_09; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_09 FOR VALUES FROM ('2026-03-09 00:00:00') TO ('2026-03-10 00:00:00'); - - --- --- Name: messages_2026_03_10; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_10 FOR VALUES FROM ('2026-03-10 00:00:00') TO ('2026-03-11 00:00:00'); - - --- --- Name: messages_2026_03_11; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_11 FOR VALUES FROM ('2026-03-11 00:00:00') TO ('2026-03-12 00:00:00'); - - --- --- Name: messages_2026_03_12; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_12 FOR VALUES FROM ('2026-03-12 00:00:00') TO ('2026-03-13 00:00:00'); - - --- --- Name: messages_2026_03_13; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_13 FOR VALUES FROM ('2026-03-13 00:00:00') TO ('2026-03-14 00:00:00'); - - --- --- Name: messages_2026_03_14; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_14 FOR VALUES FROM ('2026-03-14 00:00:00') TO ('2026-03-15 00:00:00'); - - --- --- Name: messages_2026_03_15; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_15 FOR VALUES FROM ('2026-03-15 00:00:00') TO ('2026-03-16 00:00:00'); - - --- --- Name: refresh_tokens id; Type: DEFAULT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens ALTER COLUMN id SET DEFAULT nextval('auth.refresh_tokens_id_seq'::regclass); - - --- --- Name: agenda_online_slots id; Type: DEFAULT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots ALTER COLUMN id SET DEFAULT nextval('public.agenda_online_slots_id_seq'::regclass); - - --- --- Name: hooks id; Type: DEFAULT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.hooks ALTER COLUMN id SET DEFAULT nextval('supabase_functions.hooks_id_seq'::regclass); - - --- --- Name: extensions extensions_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.extensions - ADD CONSTRAINT extensions_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.tenants - ADD CONSTRAINT tenants_pkey PRIMARY KEY (id); - - --- --- Name: mfa_amr_claims amr_id_pk; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT amr_id_pk PRIMARY KEY (id); - - --- --- Name: audit_log_entries audit_log_entries_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.audit_log_entries - ADD CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id); - - --- --- Name: flow_state flow_state_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.flow_state - ADD CONSTRAINT flow_state_pkey PRIMARY KEY (id); - - --- --- Name: identities identities_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_pkey PRIMARY KEY (id); - - --- --- Name: identities identities_provider_id_provider_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_provider_id_provider_unique UNIQUE (provider_id, provider); - - --- --- Name: instances instances_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.instances - ADD CONSTRAINT instances_pkey PRIMARY KEY (id); - - --- --- Name: mfa_amr_claims mfa_amr_claims_session_id_authentication_method_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT mfa_amr_claims_session_id_authentication_method_pkey UNIQUE (session_id, authentication_method); - - --- --- Name: mfa_challenges mfa_challenges_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_challenges - ADD CONSTRAINT mfa_challenges_pkey PRIMARY KEY (id); - - --- --- Name: mfa_factors mfa_factors_last_challenged_at_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_last_challenged_at_key UNIQUE (last_challenged_at); - - --- --- Name: mfa_factors mfa_factors_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_pkey PRIMARY KEY (id); - - --- --- Name: oauth_authorizations oauth_authorizations_authorization_code_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_authorization_code_key UNIQUE (authorization_code); - - --- --- Name: oauth_authorizations oauth_authorizations_authorization_id_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_authorization_id_key UNIQUE (authorization_id); - - --- --- Name: oauth_authorizations oauth_authorizations_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_pkey PRIMARY KEY (id); - - --- --- Name: oauth_client_states oauth_client_states_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_client_states - ADD CONSTRAINT oauth_client_states_pkey PRIMARY KEY (id); - - --- --- Name: oauth_clients oauth_clients_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_clients - ADD CONSTRAINT oauth_clients_pkey PRIMARY KEY (id); - - --- --- Name: oauth_consents oauth_consents_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_pkey PRIMARY KEY (id); - - --- --- Name: oauth_consents oauth_consents_user_client_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_user_client_unique UNIQUE (user_id, client_id); - - --- --- Name: one_time_tokens one_time_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.one_time_tokens - ADD CONSTRAINT one_time_tokens_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_token_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_token_unique UNIQUE (token); - - --- --- Name: saml_providers saml_providers_entity_id_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_entity_id_key UNIQUE (entity_id); - - --- --- Name: saml_providers saml_providers_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_pkey PRIMARY KEY (id); - - --- --- Name: saml_relay_states saml_relay_states_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_pkey PRIMARY KEY (id); - - --- --- Name: sso_domains sso_domains_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_domains - ADD CONSTRAINT sso_domains_pkey PRIMARY KEY (id); - - --- --- Name: sso_providers sso_providers_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_providers - ADD CONSTRAINT sso_providers_pkey PRIMARY KEY (id); - - --- --- Name: users users_phone_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_phone_key UNIQUE (phone); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: agenda_bloqueios agenda_bloqueios_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_pkey PRIMARY KEY (id); - - --- --- Name: agenda_configuracoes agenda_configuracoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_configuracoes - ADD CONSTRAINT agenda_configuracoes_pkey PRIMARY KEY (owner_id); - - --- --- Name: agenda_eventos agenda_eventos_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_pkey PRIMARY KEY (id); - - --- --- Name: agenda_eventos agenda_eventos_sem_sobreposicao; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_sem_sobreposicao EXCLUDE USING gist (owner_id WITH =, tstzrange(inicio_em, fim_em, '[)'::text) WITH &&); - - --- --- Name: agenda_excecoes agenda_excecoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_excecoes - ADD CONSTRAINT agenda_excecoes_pkey PRIMARY KEY (id); - - --- --- Name: agenda_online_slots agenda_online_slots_owner_id_weekday_time_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_owner_id_weekday_time_key UNIQUE (owner_id, weekday, "time"); - - --- --- Name: agenda_online_slots agenda_online_slots_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_pkey PRIMARY KEY (id); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_pkey PRIMARY KEY (id); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_unique UNIQUE (owner_id, dia_semana, hora_inicio, hora_fim, modalidade); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key UNIQUE (owner_id, dia_semana, hora_inicio); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_semanais_pkey PRIMARY KEY (id); - - --- --- Name: agenda_slots_regras agenda_slots_regras_owner_id_dia_semana_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_owner_id_dia_semana_key UNIQUE (owner_id, dia_semana); - - --- --- Name: agenda_slots_regras agenda_slots_regras_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_pkey PRIMARY KEY (id); - - --- --- Name: agendador_configuracoes agendador_configuracoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_pkey PRIMARY KEY (owner_id); - - --- --- Name: agendador_solicitacoes agendador_solicitacoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_solicitacoes_pkey PRIMARY KEY (id); - - --- --- Name: commitment_time_logs commitment_time_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitment_fields determined_commitment_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitments determined_commitments_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitments determined_commitments_tenant_native_key_uq; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_tenant_native_key_uq UNIQUE (tenant_id, native_key); - - --- --- Name: dev_user_credentials dev_user_credentials_email_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.dev_user_credentials - ADD CONSTRAINT dev_user_credentials_email_key UNIQUE (email); - - --- --- Name: dev_user_credentials dev_user_credentials_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.dev_user_credentials - ADD CONSTRAINT dev_user_credentials_pkey PRIMARY KEY (id); - - --- --- Name: entitlements_invalidation entitlements_invalidation_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.entitlements_invalidation - ADD CONSTRAINT entitlements_invalidation_pkey PRIMARY KEY (owner_id); - - --- --- Name: features features_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.features - ADD CONSTRAINT features_key_key UNIQUE (key); - - --- --- Name: features features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.features - ADD CONSTRAINT features_pkey PRIMARY KEY (id); - - --- --- Name: feriados feriados_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_pkey PRIMARY KEY (id); - - --- --- Name: feriados feriados_tenant_id_data_nome_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_tenant_id_data_nome_key UNIQUE (tenant_id, data, nome); - - --- --- Name: module_features module_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_pkey PRIMARY KEY (module_id, feature_id); - - --- --- Name: modules modules_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.modules - ADD CONSTRAINT modules_key_key UNIQUE (key); - - --- --- Name: modules modules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.modules - ADD CONSTRAINT modules_pkey PRIMARY KEY (id); - - --- --- Name: owner_users owner_users_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.owner_users - ADD CONSTRAINT owner_users_pkey PRIMARY KEY (owner_id, user_id); - - --- --- Name: patient_group_patient patient_group_patient_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_pkey PRIMARY KEY (patient_group_id, patient_id); - - --- --- Name: patient_groups patient_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_groups - ADD CONSTRAINT patient_groups_pkey PRIMARY KEY (id); - - --- --- Name: patient_intake_requests patient_intake_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_intake_requests - ADD CONSTRAINT patient_intake_requests_pkey PRIMARY KEY (id); - - --- --- Name: patient_invites patient_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_pkey PRIMARY KEY (id); - - --- --- Name: patient_invites patient_invites_token_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_token_key UNIQUE (token); - - --- --- Name: patient_patient_tag patient_patient_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_pkey PRIMARY KEY (patient_id, tag_id); - - --- --- Name: patient_tags patient_tags_owner_name_uniq; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_owner_name_uniq UNIQUE (owner_id, nome); - - --- --- Name: patient_tags patient_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_pkey PRIMARY KEY (id); - - --- --- Name: patients patients_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_pkey PRIMARY KEY (id); - - --- --- Name: payment_settings payment_settings_owner_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_owner_id_key UNIQUE (owner_id); - - --- --- Name: payment_settings payment_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_pkey PRIMARY KEY (id); - - --- --- Name: plan_features plan_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_pkey PRIMARY KEY (plan_id, feature_id); - - --- --- Name: plan_prices plan_prices_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_prices - ADD CONSTRAINT plan_prices_pkey PRIMARY KEY (id); - - --- --- Name: plan_public_bullets plan_public_bullets_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public_bullets - ADD CONSTRAINT plan_public_bullets_pkey PRIMARY KEY (id); - - --- --- Name: plan_public plan_public_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public - ADD CONSTRAINT plan_public_pkey PRIMARY KEY (plan_id); - - --- --- Name: plans plans_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plans - ADD CONSTRAINT plans_key_key UNIQUE (key); - - --- --- Name: plans plans_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plans - ADD CONSTRAINT plans_pkey PRIMARY KEY (id); - - --- --- Name: professional_pricing professional_pricing_owner_commitment_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_owner_commitment_key UNIQUE (owner_id, determined_commitment_id); - - --- --- Name: professional_pricing professional_pricing_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_pkey PRIMARY KEY (id); - - --- --- Name: profiles profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.profiles - ADD CONSTRAINT profiles_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_exceptions recurrence_exceptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_exceptions recurrence_exceptions_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_unique UNIQUE (recurrence_id, original_date); - - --- --- Name: recurrence_rules recurrence_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_pkey PRIMARY KEY (id); - - --- --- Name: saas_admins saas_admins_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_admins - ADD CONSTRAINT saas_admins_pkey PRIMARY KEY (user_id); - - --- --- Name: saas_doc_votos saas_doc_votos_doc_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_doc_id_user_id_key UNIQUE (doc_id, user_id); - - --- --- Name: saas_doc_votos saas_doc_votos_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_pkey PRIMARY KEY (id); - - --- --- Name: saas_docs saas_docs_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_docs - ADD CONSTRAINT saas_docs_pkey PRIMARY KEY (id); - - --- --- Name: saas_faq_itens saas_faq_itens_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq_itens - ADD CONSTRAINT saas_faq_itens_pkey PRIMARY KEY (id); - - --- --- Name: saas_faq saas_faq_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq - ADD CONSTRAINT saas_faq_pkey PRIMARY KEY (id); - - --- --- Name: subscription_events subscription_events_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_events - ADD CONSTRAINT subscription_events_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_personal subscription_intents_personal_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT subscription_intents_personal_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_legacy subscription_intents_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_legacy - ADD CONSTRAINT subscription_intents_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_tenant subscription_intents_tenant_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT subscription_intents_tenant_pkey PRIMARY KEY (id); - - --- --- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id); - - --- --- Name: support_sessions support_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_pkey PRIMARY KEY (id); - - --- --- Name: support_sessions support_sessions_token_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_token_unique UNIQUE (token); - - --- --- Name: tenant_feature_exceptions_log tenant_feature_exceptions_log_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_feature_exceptions_log - ADD CONSTRAINT tenant_feature_exceptions_log_pkey PRIMARY KEY (id); - - --- --- Name: tenant_features tenant_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_features - ADD CONSTRAINT tenant_features_pkey PRIMARY KEY (tenant_id, feature_key); - - --- --- Name: tenant_invites tenant_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_pkey PRIMARY KEY (id); - - --- --- Name: tenant_members tenant_members_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_pkey PRIMARY KEY (id); - - --- --- Name: tenant_members tenant_members_tenant_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_tenant_id_user_id_key UNIQUE (tenant_id, user_id); - - --- --- Name: tenant_modules tenant_modules_owner_id_module_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_owner_id_module_id_key UNIQUE (owner_id, module_id); - - --- --- Name: tenant_modules tenant_modules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_pkey PRIMARY KEY (id); - - --- --- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenants - ADD CONSTRAINT tenants_pkey PRIMARY KEY (id); - - --- --- Name: user_settings user_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.user_settings - ADD CONSTRAINT user_settings_pkey PRIMARY KEY (user_id); - - --- --- Name: messages messages_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER TABLE ONLY realtime.messages - ADD CONSTRAINT messages_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_09 messages_2026_03_09_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_09 - ADD CONSTRAINT messages_2026_03_09_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_10 messages_2026_03_10_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_10 - ADD CONSTRAINT messages_2026_03_10_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_11 messages_2026_03_11_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_11 - ADD CONSTRAINT messages_2026_03_11_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_12 messages_2026_03_12_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_12 - ADD CONSTRAINT messages_2026_03_12_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_13 messages_2026_03_13_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_13 - ADD CONSTRAINT messages_2026_03_13_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_14 messages_2026_03_14_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_14 - ADD CONSTRAINT messages_2026_03_14_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_15 messages_2026_03_15_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_15 - ADD CONSTRAINT messages_2026_03_15_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: subscription pk_subscription; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.subscription - ADD CONSTRAINT pk_subscription PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: buckets_analytics buckets_analytics_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets_analytics - ADD CONSTRAINT buckets_analytics_pkey PRIMARY KEY (id); - - --- --- Name: buckets buckets_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets - ADD CONSTRAINT buckets_pkey PRIMARY KEY (id); - - --- --- Name: buckets_vectors buckets_vectors_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets_vectors - ADD CONSTRAINT buckets_vectors_pkey PRIMARY KEY (id); - - --- --- Name: iceberg_namespaces iceberg_namespaces_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_namespaces - ADD CONSTRAINT iceberg_namespaces_pkey PRIMARY KEY (id); - - --- --- Name: iceberg_tables iceberg_tables_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_name_key; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_name_key UNIQUE (name); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); - - --- --- Name: objects objects_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT objects_pkey PRIMARY KEY (id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_pkey PRIMARY KEY (id); - - --- --- Name: s3_multipart_uploads s3_multipart_uploads_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads - ADD CONSTRAINT s3_multipart_uploads_pkey PRIMARY KEY (id); - - --- --- Name: vector_indexes vector_indexes_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.vector_indexes - ADD CONSTRAINT vector_indexes_pkey PRIMARY KEY (id); - - --- --- Name: hooks hooks_pkey; Type: CONSTRAINT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.hooks - ADD CONSTRAINT hooks_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (version); - - --- --- Name: extensions_tenant_external_id_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE INDEX extensions_tenant_external_id_index ON _realtime.extensions USING btree (tenant_external_id); - - --- --- Name: extensions_tenant_external_id_type_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX extensions_tenant_external_id_type_index ON _realtime.extensions USING btree (tenant_external_id, type); - - --- --- Name: tenants_external_id_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX tenants_external_id_index ON _realtime.tenants USING btree (external_id); - - --- --- Name: audit_logs_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id); - - --- --- Name: confirmation_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX confirmation_token_idx ON auth.users USING btree (confirmation_token) WHERE ((confirmation_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: email_change_token_current_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX email_change_token_current_idx ON auth.users USING btree (email_change_token_current) WHERE ((email_change_token_current)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: email_change_token_new_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX email_change_token_new_idx ON auth.users USING btree (email_change_token_new) WHERE ((email_change_token_new)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: factor_id_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX factor_id_created_at_idx ON auth.mfa_factors USING btree (user_id, created_at); - - --- --- Name: flow_state_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX flow_state_created_at_idx ON auth.flow_state USING btree (created_at DESC); - - --- --- Name: identities_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX identities_email_idx ON auth.identities USING btree (email text_pattern_ops); - - --- --- Name: INDEX identities_email_idx; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON INDEX auth.identities_email_idx IS 'Auth: Ensures indexed queries on the email column'; - - --- --- Name: identities_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX identities_user_id_idx ON auth.identities USING btree (user_id); - - --- --- Name: idx_auth_code; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_auth_code ON auth.flow_state USING btree (auth_code); - - --- --- Name: idx_oauth_client_states_created_at; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_oauth_client_states_created_at ON auth.oauth_client_states USING btree (created_at); - - --- --- Name: idx_user_id_auth_method; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_user_id_auth_method ON auth.flow_state USING btree (user_id, authentication_method); - - --- --- Name: mfa_challenge_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX mfa_challenge_created_at_idx ON auth.mfa_challenges USING btree (created_at DESC); - - --- --- Name: mfa_factors_user_friendly_name_unique; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX mfa_factors_user_friendly_name_unique ON auth.mfa_factors USING btree (friendly_name, user_id) WHERE (TRIM(BOTH FROM friendly_name) <> ''::text); - - --- --- Name: mfa_factors_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX mfa_factors_user_id_idx ON auth.mfa_factors USING btree (user_id); - - --- --- Name: oauth_auth_pending_exp_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_auth_pending_exp_idx ON auth.oauth_authorizations USING btree (expires_at) WHERE (status = 'pending'::auth.oauth_authorization_status); - - --- --- Name: oauth_clients_deleted_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_clients_deleted_at_idx ON auth.oauth_clients USING btree (deleted_at); - - --- --- Name: oauth_consents_active_client_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_active_client_idx ON auth.oauth_consents USING btree (client_id) WHERE (revoked_at IS NULL); - - --- --- Name: oauth_consents_active_user_client_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_active_user_client_idx ON auth.oauth_consents USING btree (user_id, client_id) WHERE (revoked_at IS NULL); - - --- --- Name: oauth_consents_user_order_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_user_order_idx ON auth.oauth_consents USING btree (user_id, granted_at DESC); - - --- --- Name: one_time_tokens_relates_to_hash_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX one_time_tokens_relates_to_hash_idx ON auth.one_time_tokens USING hash (relates_to); - - --- --- Name: one_time_tokens_token_hash_hash_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX one_time_tokens_token_hash_hash_idx ON auth.one_time_tokens USING hash (token_hash); - - --- --- Name: one_time_tokens_user_id_token_type_key; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX one_time_tokens_user_id_token_type_key ON auth.one_time_tokens USING btree (user_id, token_type); - - --- --- Name: reauthentication_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX reauthentication_token_idx ON auth.users USING btree (reauthentication_token) WHERE ((reauthentication_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: recovery_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX recovery_token_idx ON auth.users USING btree (recovery_token) WHERE ((recovery_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: refresh_tokens_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id); - - --- --- Name: refresh_tokens_instance_id_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id); - - --- --- Name: refresh_tokens_parent_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_parent_idx ON auth.refresh_tokens USING btree (parent); - - --- --- Name: refresh_tokens_session_id_revoked_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_session_id_revoked_idx ON auth.refresh_tokens USING btree (session_id, revoked); - - --- --- Name: refresh_tokens_updated_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_updated_at_idx ON auth.refresh_tokens USING btree (updated_at DESC); - - --- --- Name: saml_providers_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_providers_sso_provider_id_idx ON auth.saml_providers USING btree (sso_provider_id); - - --- --- Name: saml_relay_states_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_created_at_idx ON auth.saml_relay_states USING btree (created_at DESC); - - --- --- Name: saml_relay_states_for_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_for_email_idx ON auth.saml_relay_states USING btree (for_email); - - --- --- Name: saml_relay_states_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_sso_provider_id_idx ON auth.saml_relay_states USING btree (sso_provider_id); - - --- --- Name: sessions_not_after_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_not_after_idx ON auth.sessions USING btree (not_after DESC); - - --- --- Name: sessions_oauth_client_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_oauth_client_id_idx ON auth.sessions USING btree (oauth_client_id); - - --- --- Name: sessions_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_user_id_idx ON auth.sessions USING btree (user_id); - - --- --- Name: sso_domains_domain_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX sso_domains_domain_idx ON auth.sso_domains USING btree (lower(domain)); - - --- --- Name: sso_domains_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sso_domains_sso_provider_id_idx ON auth.sso_domains USING btree (sso_provider_id); - - --- --- Name: sso_providers_resource_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX sso_providers_resource_id_idx ON auth.sso_providers USING btree (lower(resource_id)); - - --- --- Name: sso_providers_resource_id_pattern_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sso_providers_resource_id_pattern_idx ON auth.sso_providers USING btree (resource_id text_pattern_ops); - - --- --- Name: unique_phone_factor_per_user; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX unique_phone_factor_per_user ON auth.mfa_factors USING btree (user_id, phone); - - --- --- Name: user_id_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX user_id_created_at_idx ON auth.sessions USING btree (user_id, created_at); - - --- --- Name: users_email_partial_key; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX users_email_partial_key ON auth.users USING btree (email) WHERE (is_sso_user = false); - - --- --- Name: INDEX users_email_partial_key; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON INDEX auth.users_email_partial_key IS 'Auth: A partial unique index that applies only when is_sso_user is false'; - - --- --- Name: users_instance_id_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, lower((email)::text)); - - --- --- Name: users_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id); - - --- --- Name: users_is_anonymous_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_is_anonymous_idx ON auth.users USING btree (is_anonymous); - - --- --- Name: agenda_bloqueios_owner_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_owner_data_idx ON public.agenda_bloqueios USING btree (owner_id, data_inicio, data_fim); - - --- --- Name: agenda_bloqueios_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_owner_id_idx ON public.agenda_bloqueios USING btree (owner_id); - - --- --- Name: agenda_bloqueios_recorrente_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_recorrente_idx ON public.agenda_bloqueios USING btree (owner_id, dia_semana) WHERE (recorrente = true); - - --- --- Name: agenda_bloqueios_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_tenant_id_idx ON public.agenda_bloqueios USING btree (tenant_id); - - --- --- Name: agenda_configuracoes_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_configuracoes_tenant_idx ON public.agenda_configuracoes USING btree (tenant_id); - - --- --- Name: agenda_configuracoes_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_configuracoes_tenant_owner_idx ON public.agenda_configuracoes USING btree (tenant_id, owner_id); - - --- --- Name: agenda_eventos_owner_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_owner_inicio_idx ON public.agenda_eventos USING btree (owner_id, inicio_em); - - --- --- Name: agenda_eventos_owner_terapeuta_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_owner_terapeuta_inicio_idx ON public.agenda_eventos USING btree (owner_id, terapeuta_id, inicio_em); - - --- --- Name: agenda_eventos_recurrence_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_recurrence_idx ON public.agenda_eventos USING btree (recurrence_id) WHERE (recurrence_id IS NOT NULL); - - --- --- Name: agenda_eventos_tenant_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_tenant_inicio_idx ON public.agenda_eventos USING btree (tenant_id, inicio_em); - - --- --- Name: agenda_eventos_tenant_owner_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_tenant_owner_inicio_idx ON public.agenda_eventos USING btree (tenant_id, owner_id, inicio_em); - - --- --- Name: agenda_excecoes_owner_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_owner_data_idx ON public.agenda_excecoes USING btree (owner_id, data); - - --- --- Name: agenda_excecoes_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_tenant_idx ON public.agenda_excecoes USING btree (tenant_id); - - --- --- Name: agenda_excecoes_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_tenant_owner_idx ON public.agenda_excecoes USING btree (tenant_id, owner_id); - - --- --- Name: agenda_online_slots_owner_weekday_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_owner_weekday_idx ON public.agenda_online_slots USING btree (owner_id, weekday); - - --- --- Name: agenda_online_slots_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_tenant_idx ON public.agenda_online_slots USING btree (tenant_id); - - --- --- Name: agenda_online_slots_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_tenant_owner_idx ON public.agenda_online_slots USING btree (tenant_id, owner_id); - - --- --- Name: agenda_regras_semanais_owner_dia_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_owner_dia_idx ON public.agenda_regras_semanais USING btree (owner_id, dia_semana); - - --- --- Name: agenda_regras_semanais_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_tenant_idx ON public.agenda_regras_semanais USING btree (tenant_id); - - --- --- Name: agenda_regras_semanais_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_tenant_owner_idx ON public.agenda_regras_semanais USING btree (tenant_id, owner_id); - - --- --- Name: agenda_slots_bloqueados_semanais_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_bloqueados_semanais_tenant_idx ON public.agenda_slots_bloqueados_semanais USING btree (tenant_id); - - --- --- Name: agenda_slots_bloqueados_semanais_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_bloqueados_semanais_tenant_owner_idx ON public.agenda_slots_bloqueados_semanais USING btree (tenant_id, owner_id); - - --- --- Name: agenda_slots_regras_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_regras_tenant_idx ON public.agenda_slots_regras USING btree (tenant_id); - - --- --- Name: agenda_slots_regras_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_regras_tenant_owner_idx ON public.agenda_slots_regras USING btree (tenant_id, owner_id); - - --- --- Name: agendador_cfg_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_cfg_tenant_idx ON public.agendador_configuracoes USING btree (tenant_id); - - --- --- Name: agendador_sol_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_data_idx ON public.agendador_solicitacoes USING btree (data_solicitada, hora_solicitada); - - --- --- Name: agendador_sol_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_owner_idx ON public.agendador_solicitacoes USING btree (owner_id, status); - - --- --- Name: agendador_sol_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_tenant_idx ON public.agendador_solicitacoes USING btree (tenant_id); - - --- --- Name: commitment_time_logs_calendar_event_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_calendar_event_idx ON public.commitment_time_logs USING btree (calendar_event_id); - - --- --- Name: commitment_time_logs_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_commitment_idx ON public.commitment_time_logs USING btree (commitment_id, created_at DESC); - - --- --- Name: commitment_time_logs_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_tenant_idx ON public.commitment_time_logs USING btree (tenant_id, created_at DESC); - - --- --- Name: determined_commitment_fields_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitment_fields_commitment_idx ON public.determined_commitment_fields USING btree (commitment_id, sort_order); - - --- --- Name: determined_commitment_fields_key_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX determined_commitment_fields_key_uniq ON public.determined_commitment_fields USING btree (commitment_id, key); - - --- --- Name: determined_commitment_fields_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitment_fields_tenant_idx ON public.determined_commitment_fields USING btree (tenant_id); - - --- --- Name: determined_commitments_active_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitments_active_idx ON public.determined_commitments USING btree (tenant_id, active); - - --- --- Name: determined_commitments_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitments_tenant_idx ON public.determined_commitments USING btree (tenant_id); - - --- --- Name: determined_commitments_tenant_name_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX determined_commitments_tenant_name_uniq ON public.determined_commitments USING btree (tenant_id, lower(name)); - - --- --- Name: feriados_global_unique; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX feriados_global_unique ON public.feriados USING btree (data, nome) WHERE (tenant_id IS NULL); - - --- --- Name: idx_agenda_eventos_determined_commitment_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_eventos_determined_commitment_id ON public.agenda_eventos USING btree (determined_commitment_id); - - --- --- Name: idx_agenda_excecoes_owner_data; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_excecoes_owner_data ON public.agenda_excecoes USING btree (owner_id, data); - - --- --- Name: idx_agenda_slots_regras_owner_dia; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_slots_regras_owner_dia ON public.agenda_slots_regras USING btree (owner_id, dia_semana); - - --- --- Name: idx_intakes_converted_patient_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_converted_patient_id ON public.patient_intake_requests USING btree (converted_patient_id); - - --- --- Name: idx_intakes_owner_cpf; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_cpf ON public.patient_intake_requests USING btree (owner_id, cpf); - - --- --- Name: idx_intakes_owner_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_created ON public.patient_intake_requests USING btree (owner_id, created_at DESC); - - --- --- Name: idx_intakes_owner_status_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_status_created ON public.patient_intake_requests USING btree (owner_id, status, created_at DESC); - - --- --- Name: idx_intakes_status_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_status_created ON public.patient_intake_requests USING btree (status, created_at DESC); - - --- --- Name: idx_patient_group_patient_group_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_group_patient_group_id ON public.patient_group_patient USING btree (patient_group_id); - - --- --- Name: idx_patient_groups_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_groups_owner ON public.patient_groups USING btree (owner_id); - - --- --- Name: idx_patient_groups_owner_system_nome; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_groups_owner_system_nome ON public.patient_groups USING btree (owner_id, is_system, nome); - - --- --- Name: idx_patient_tags_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_tags_owner ON public.patient_tags USING btree (owner_id); - - --- --- Name: idx_patients_created_at; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_created_at ON public.patients USING btree (created_at DESC); - - --- --- Name: idx_patients_last_attended; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_last_attended ON public.patients USING btree (last_attended_at DESC); - - --- --- Name: idx_patients_owner_email_principal; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_email_principal ON public.patients USING btree (owner_id, email_principal); - - --- --- Name: idx_patients_owner_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_id ON public.patients USING btree (owner_id); - - --- --- Name: idx_patients_owner_nome; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_nome ON public.patients USING btree (owner_id, nome_completo); - - --- --- Name: idx_patients_responsible_member; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_responsible_member ON public.patients USING btree (responsible_member_id); - - --- --- Name: idx_patients_status; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_status ON public.patients USING btree (status); - - --- --- Name: idx_patients_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_tenant ON public.patients USING btree (tenant_id); - - --- --- Name: idx_patients_tenant_email_norm; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_tenant_email_norm ON public.patients USING btree (tenant_id, lower(TRIM(BOTH FROM email_principal))); - - --- --- Name: idx_pgp_group; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_pgp_group ON public.patient_group_patient USING btree (patient_group_id); - - --- --- Name: idx_pgp_patient; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_pgp_patient ON public.patient_group_patient USING btree (patient_id); - - --- --- Name: idx_ppt_patient; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_ppt_patient ON public.patient_patient_tag USING btree (patient_id); - - --- --- Name: idx_ppt_tag; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_ppt_tag ON public.patient_patient_tag USING btree (tag_id); - - --- --- Name: idx_slots_bloq_owner_dia; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_slots_bloq_owner_dia ON public.agenda_slots_bloqueados_semanais USING btree (owner_id, dia_semana); - - --- --- Name: idx_subscription_intents_plan_interval; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_plan_interval ON public.subscription_intents_legacy USING btree (plan_key, "interval"); - - --- --- Name: idx_subscription_intents_status; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_status ON public.subscription_intents_legacy USING btree (status); - - --- --- Name: idx_subscription_intents_user_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_user_id ON public.subscription_intents_legacy USING btree (user_id); - - --- --- Name: idx_tenant_features_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_features_tenant ON public.tenant_features USING btree (tenant_id); - - --- --- Name: idx_tenant_invites_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_invites_tenant ON public.tenant_invites USING btree (tenant_id); - - --- --- Name: idx_tenant_invites_token; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_invites_token ON public.tenant_invites USING btree (token); - - --- --- Name: ix_plan_prices_plan; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_prices_plan ON public.plan_prices USING btree (plan_id); - - --- --- Name: ix_plan_public_bullets_plan; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_public_bullets_plan ON public.plan_public_bullets USING btree (plan_id); - - --- --- Name: ix_plan_public_sort; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_public_sort ON public.plan_public USING btree (sort_order); - - --- --- Name: patient_group_patient_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_group_patient_tenant_idx ON public.patient_group_patient USING btree (tenant_id); - - --- --- Name: patient_groups_owner_nome_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_groups_owner_nome_uniq ON public.patient_groups USING btree (owner_id, nome); - - --- --- Name: patient_groups_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_groups_tenant_idx ON public.patient_groups USING btree (tenant_id); - - --- --- Name: patient_intake_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_owner_id_idx ON public.patient_intake_requests USING btree (owner_id); - - --- --- Name: patient_intake_requests_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_requests_tenant_idx ON public.patient_intake_requests USING btree (tenant_id); - - --- --- Name: patient_intake_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_status_idx ON public.patient_intake_requests USING btree (status); - - --- --- Name: patient_intake_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_token_idx ON public.patient_intake_requests USING btree (token); - - --- --- Name: patient_invites_one_active_per_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_invites_one_active_per_owner ON public.patient_invites USING btree (owner_id) WHERE (active = true); - - --- --- Name: patient_invites_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_owner_id_idx ON public.patient_invites USING btree (owner_id); - - --- --- Name: patient_invites_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_tenant_idx ON public.patient_invites USING btree (tenant_id); - - --- --- Name: patient_invites_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_token_idx ON public.patient_invites USING btree (token); - - --- --- Name: patient_patient_tag_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_patient_tag_tenant_idx ON public.patient_patient_tag USING btree (tenant_id); - - --- --- Name: patient_tags_owner_name_uq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_tags_owner_name_uq ON public.patient_tags USING btree (owner_id, lower(nome)); - - --- --- Name: patient_tags_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_tags_tenant_idx ON public.patient_tags USING btree (tenant_id); - - --- --- Name: payment_settings_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX payment_settings_tenant_id_idx ON public.payment_settings USING btree (tenant_id); - - --- --- Name: ppt_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_owner_idx ON public.patient_patient_tag USING btree (owner_id); - - --- --- Name: ppt_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_patient_idx ON public.patient_patient_tag USING btree (patient_id); - - --- --- Name: ppt_tag_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_tag_idx ON public.patient_patient_tag USING btree (tag_id); - - --- --- Name: professional_pricing_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX professional_pricing_tenant_idx ON public.professional_pricing USING btree (tenant_id); - - --- --- Name: recurrence_exceptions_rule_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_exceptions_rule_idx ON public.recurrence_exceptions USING btree (recurrence_id); - - --- --- Name: recurrence_exceptions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_exceptions_tenant_idx ON public.recurrence_exceptions USING btree (tenant_id); - - --- --- Name: recurrence_rules_active_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_active_idx ON public.recurrence_rules USING btree (owner_id, status) WHERE (status = 'ativo'::text); - - --- --- Name: recurrence_rules_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_owner_idx ON public.recurrence_rules USING btree (owner_id); - - --- --- Name: recurrence_rules_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_patient_idx ON public.recurrence_rules USING btree (patient_id); - - --- --- Name: recurrence_rules_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_tenant_idx ON public.recurrence_rules USING btree (tenant_id); - - --- --- Name: saas_doc_votos_doc_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_doc_votos_doc_id_idx ON public.saas_doc_votos USING btree (doc_id); - - --- --- Name: saas_doc_votos_user_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_doc_votos_user_id_idx ON public.saas_doc_votos USING btree (user_id); - - --- --- Name: saas_docs_categoria_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_categoria_idx ON public.saas_docs USING btree (categoria); - - --- --- Name: saas_docs_exibir_no_faq_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_exibir_no_faq_idx ON public.saas_docs USING btree (exibir_no_faq) WHERE (exibir_no_faq = true); - - --- --- Name: saas_docs_path_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_path_ativo_idx ON public.saas_docs USING btree (pagina_path, ativo); - - --- --- Name: saas_faq_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_ativo_idx ON public.saas_faq USING btree (ativo); - - --- --- Name: saas_faq_categoria_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_categoria_idx ON public.saas_faq USING btree (categoria); - - --- --- Name: saas_faq_fts_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_fts_idx ON public.saas_faq USING gin (to_tsvector('portuguese'::regconfig, ((COALESCE(pergunta, ''::text) || ' '::text) || COALESCE(conteudo, ''::text)))); - - --- --- Name: saas_faq_itens_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_itens_ativo_idx ON public.saas_faq_itens USING btree (ativo); - - --- --- Name: saas_faq_itens_doc_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_itens_doc_id_idx ON public.saas_faq_itens USING btree (doc_id); - - --- --- Name: saas_faq_pagina_path_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_pagina_path_idx ON public.saas_faq USING btree (pagina_path); - - --- --- Name: saas_faq_publico_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_publico_idx ON public.saas_faq USING btree (publico); - - --- --- Name: saas_faq_votos_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_votos_idx ON public.saas_faq USING btree (votos DESC); - - --- --- Name: sint_personal_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_personal_created_idx ON public.subscription_intents_personal USING btree (created_at DESC); - - --- --- Name: sint_personal_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_personal_status_idx ON public.subscription_intents_personal USING btree (status); - - --- --- Name: sint_tenant_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_created_idx ON public.subscription_intents_tenant USING btree (created_at DESC); - - --- --- Name: sint_tenant_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_status_idx ON public.subscription_intents_tenant USING btree (status); - - --- --- Name: sint_tenant_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_tenant_idx ON public.subscription_intents_tenant USING btree (tenant_id); - - --- --- Name: subscription_events_created_at_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_created_at_idx ON public.subscription_events USING btree (created_at DESC); - - --- --- Name: subscription_events_owner_ref_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_owner_ref_idx ON public.subscription_events USING btree (owner_type, owner_ref); - - --- --- Name: subscription_events_sub_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_sub_created_idx ON public.subscription_events USING btree (subscription_id, created_at DESC); - - --- --- Name: subscription_events_subscription_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_subscription_id_idx ON public.subscription_events USING btree (subscription_id); - - --- --- Name: subscriptions_one_active_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_tenant ON public.subscriptions USING btree (tenant_id) WHERE (status = 'active'::text); - - --- --- Name: subscriptions_one_active_per_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_user ON public.subscriptions USING btree (user_id) WHERE (status = 'active'::text); - - --- --- Name: subscriptions_one_active_per_user_personal; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_user_personal ON public.subscriptions USING btree (user_id) WHERE ((tenant_id IS NULL) AND (status = 'active'::text)); - - --- --- Name: subscriptions_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_owner_idx ON public.subscriptions USING btree (user_id); - - --- --- Name: subscriptions_plan_key_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_plan_key_idx ON public.subscriptions USING btree (plan_key); - - --- --- Name: subscriptions_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_status_idx ON public.subscriptions USING btree (status); - - --- --- Name: subscriptions_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_id_idx ON public.subscriptions USING btree (tenant_id); - - --- --- Name: subscriptions_tenant_period_end_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_period_end_idx ON public.subscriptions USING btree (tenant_id, current_period_end); - - --- --- Name: subscriptions_tenant_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_status_idx ON public.subscriptions USING btree (tenant_id, status); - - --- --- Name: subscriptions_user_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_user_status_idx ON public.subscriptions USING btree (user_id, status, created_at DESC); - - --- --- Name: support_sessions_expires_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_expires_idx ON public.support_sessions USING btree (expires_at); - - --- --- Name: support_sessions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_tenant_idx ON public.support_sessions USING btree (tenant_id); - - --- --- Name: support_sessions_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_token_idx ON public.support_sessions USING btree (token); - - --- --- Name: tenant_members_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_members_tenant_idx ON public.tenant_members USING btree (tenant_id); - - --- --- Name: tenant_members_user_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_members_user_idx ON public.tenant_members USING btree (user_id); - - --- --- Name: tenant_modules_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_modules_owner_idx ON public.tenant_modules USING btree (owner_id); - - --- --- Name: unique_member_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX unique_member_per_tenant ON public.tenant_members USING btree (tenant_id, user_id); - - --- --- Name: uq_patients_tenant_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_patients_tenant_user ON public.patients USING btree (tenant_id, user_id) WHERE (user_id IS NOT NULL); - - --- --- Name: uq_plan_price_active; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_plan_price_active ON public.plan_prices USING btree (plan_id, "interval", currency) WHERE ((is_active = true) AND (active_to IS NULL)); - - --- --- Name: uq_plan_prices_active; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_plan_prices_active ON public.plan_prices USING btree (plan_id, "interval") WHERE (is_active = true); - - --- --- Name: uq_subscriptions_active_by_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_subscriptions_active_by_tenant ON public.subscriptions USING btree (tenant_id) WHERE ((tenant_id IS NOT NULL) AND (status = 'active'::text)); - - --- --- Name: uq_subscriptions_active_personal_by_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_subscriptions_active_personal_by_user ON public.subscriptions USING btree (user_id) WHERE ((tenant_id IS NULL) AND (status = 'active'::text)); - - --- --- Name: uq_tenant_invites_pending; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_tenant_invites_pending ON public.tenant_invites USING btree (tenant_id, lower(email), role) WHERE ((accepted_at IS NULL) AND (revoked_at IS NULL)); - - --- --- Name: uq_tenant_members_tenant_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_tenant_members_tenant_user ON public.tenant_members USING btree (tenant_id, user_id); - - --- --- Name: ux_subscriptions_active_per_personal_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX ux_subscriptions_active_per_personal_user ON public.subscriptions USING btree (user_id) WHERE ((status = 'active'::text) AND (tenant_id IS NULL)); - - --- --- Name: ux_subscriptions_active_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX ux_subscriptions_active_per_tenant ON public.subscriptions USING btree (tenant_id) WHERE ((status = 'active'::text) AND (tenant_id IS NOT NULL)); - - --- --- Name: ix_realtime_subscription_entity; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX ix_realtime_subscription_entity ON realtime.subscription USING btree (entity); - - --- --- Name: messages_inserted_at_topic_index; Type: INDEX; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE INDEX messages_inserted_at_topic_index ON ONLY realtime.messages USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_09_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_09_inserted_at_topic_idx ON realtime.messages_2026_03_09 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_10_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_10_inserted_at_topic_idx ON realtime.messages_2026_03_10 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_11_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_11_inserted_at_topic_idx ON realtime.messages_2026_03_11 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_12_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_12_inserted_at_topic_idx ON realtime.messages_2026_03_12 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_13_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_13_inserted_at_topic_idx ON realtime.messages_2026_03_13 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_14_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_14_inserted_at_topic_idx ON realtime.messages_2026_03_14 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_15_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_15_inserted_at_topic_idx ON realtime.messages_2026_03_15 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: subscription_subscription_id_entity_filters_key; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscription_subscription_id_entity_filters_key ON realtime.subscription USING btree (subscription_id, entity, filters); - - --- --- Name: bname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bname ON storage.buckets USING btree (name); - - --- --- Name: bucketid_objname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bucketid_objname ON storage.objects USING btree (bucket_id, name); - - --- --- Name: buckets_analytics_unique_name_idx; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX buckets_analytics_unique_name_idx ON storage.buckets_analytics USING btree (name) WHERE (deleted_at IS NULL); - - --- --- Name: idx_iceberg_namespaces_bucket_id; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_namespaces_bucket_id ON storage.iceberg_namespaces USING btree (catalog_id, name); - - --- --- Name: idx_iceberg_tables_location; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_tables_location ON storage.iceberg_tables USING btree (location); - - --- --- Name: idx_iceberg_tables_namespace_id; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_tables_namespace_id ON storage.iceberg_tables USING btree (catalog_id, namespace_id, name); - - --- --- Name: idx_multipart_uploads_list; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_multipart_uploads_list ON storage.s3_multipart_uploads USING btree (bucket_id, key, created_at); - - --- --- Name: idx_objects_bucket_id_name; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_objects_bucket_id_name ON storage.objects USING btree (bucket_id, name COLLATE "C"); - - --- --- Name: idx_objects_bucket_id_name_lower; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_objects_bucket_id_name_lower ON storage.objects USING btree (bucket_id, lower(name) COLLATE "C"); - - --- --- Name: name_prefix_search; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX name_prefix_search ON storage.objects USING btree (name text_pattern_ops); - - --- --- Name: vector_indexes_name_bucket_id_idx; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX vector_indexes_name_bucket_id_idx ON storage.vector_indexes USING btree (name, bucket_id); - - --- --- Name: supabase_functions_hooks_h_table_id_h_name_idx; Type: INDEX; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE INDEX supabase_functions_hooks_h_table_id_h_name_idx ON supabase_functions.hooks USING btree (hook_table_id, hook_name); - - --- --- Name: supabase_functions_hooks_request_id_idx; Type: INDEX; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE INDEX supabase_functions_hooks_request_id_idx ON supabase_functions.hooks USING btree (request_id); - - --- --- Name: messages_2026_03_09_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_09_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_09_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_09_pkey; - - --- --- Name: messages_2026_03_10_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_10_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_10_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_10_pkey; - - --- --- Name: messages_2026_03_11_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_11_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_11_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_11_pkey; - - --- --- Name: messages_2026_03_12_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_12_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_12_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_12_pkey; - - --- --- Name: messages_2026_03_13_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_13_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_13_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_13_pkey; - - --- --- Name: messages_2026_03_14_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_14_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_14_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_14_pkey; - - --- --- Name: messages_2026_03_15_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_15_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_15_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_15_pkey; - - --- --- Name: users on_auth_user_created; Type: TRIGGER; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.handle_new_user(); - - --- --- Name: users trg_seed_patient_groups; Type: TRIGGER; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TRIGGER trg_seed_patient_groups AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.on_new_user_seed_patient_groups(); - - --- --- Name: agenda_bloqueios agenda_bloqueios_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER agenda_bloqueios_updated_at BEFORE UPDATE ON public.agenda_bloqueios FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agendador_configuracoes agendador_slug_trigger; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER agendador_slug_trigger BEFORE INSERT OR UPDATE ON public.agendador_configuracoes FOR EACH ROW EXECUTE FUNCTION public.agendador_gerar_slug(); - - --- --- Name: tenant_members prevent_saas_membership_trigger; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER prevent_saas_membership_trigger BEFORE INSERT ON public.tenant_members FOR EACH ROW EXECUTE FUNCTION public.prevent_saas_membership(); - - --- --- Name: agenda_configuracoes tg_agenda_configuracoes_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_configuracoes_updated_at BEFORE UPDATE ON public.agenda_configuracoes FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_eventos tg_agenda_eventos_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_eventos_updated_at BEFORE UPDATE ON public.agenda_eventos FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_excecoes tg_agenda_excecoes_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_excecoes_updated_at BEFORE UPDATE ON public.agenda_excecoes FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_regras_semanais tg_agenda_regras_semanais_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_regras_semanais_updated_at BEFORE UPDATE ON public.agenda_regras_semanais FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: recurrence_rules tg_recurrence_rules_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_recurrence_rules_updated_at BEFORE UPDATE ON public.recurrence_rules FOR EACH ROW EXECUTE FUNCTION public.set_updated_at_recurrence(); - - --- --- Name: plan_public tr_plan_public_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tr_plan_public_updated_at BEFORE UPDATE ON public.plan_public FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: profiles trg_account_type_immutable; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_account_type_immutable BEFORE UPDATE OF account_type ON public.profiles FOR EACH ROW EXECUTE FUNCTION public.guard_account_type_immutable(); - - --- --- Name: agenda_configuracoes trg_agenda_cfg_sync; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_cfg_sync BEFORE INSERT OR UPDATE ON public.agenda_configuracoes FOR EACH ROW EXECUTE FUNCTION public.agenda_cfg_sync(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_del; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_del AFTER DELETE ON public.agenda_eventos FOR EACH ROW WHEN (((old.mirror_of_event_id IS NULL) AND (old.tenant_id = old.owner_id))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_ins; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_ins AFTER INSERT ON public.agenda_eventos FOR EACH ROW WHEN (((new.mirror_of_event_id IS NULL) AND (new.tenant_id = new.owner_id) AND (new.visibility_scope = ANY (ARRAY['busy_only'::text, 'private'::text])))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_upd; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_upd AFTER UPDATE ON public.agenda_eventos FOR EACH ROW WHEN (((new.mirror_of_event_id IS NULL) AND (new.tenant_id = new.owner_id) AND ((new.visibility_scope IS DISTINCT FROM old.visibility_scope) OR (new.inicio_em IS DISTINCT FROM old.inicio_em) OR (new.fim_em IS DISTINCT FROM old.fim_em) OR (new.owner_id IS DISTINCT FROM old.owner_id) OR (new.tenant_id IS DISTINCT FROM old.tenant_id)))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_regras_semanais trg_agenda_regras_semanais_no_overlap; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_regras_semanais_no_overlap BEFORE INSERT OR UPDATE ON public.agenda_regras_semanais FOR EACH ROW EXECUTE FUNCTION public.fn_agenda_regras_semanais_no_overlap(); - - --- --- Name: determined_commitment_fields trg_determined_commitment_fields_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_determined_commitment_fields_updated_at BEFORE UPDATE ON public.determined_commitment_fields FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: determined_commitments trg_determined_commitments_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_determined_commitments_updated_at BEFORE UPDATE ON public.determined_commitments FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: plans trg_no_change_core_plan_key; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_change_core_plan_key BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_change_core_plan_key(); - - --- --- Name: plans trg_no_change_plan_target; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_change_plan_target BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_change_plan_target(); - - --- --- Name: plans trg_no_delete_core_plans; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_delete_core_plans BEFORE DELETE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_delete_core_plans(); - - --- --- Name: tenant_members trg_patient_cannot_own_tenant; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_cannot_own_tenant BEFORE INSERT OR UPDATE ON public.tenant_members FOR EACH ROW EXECUTE FUNCTION public.guard_patient_cannot_own_tenant(); - - --- --- Name: patient_groups trg_patient_groups_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_groups_set_updated_at BEFORE UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patient_intake_requests trg_patient_intake_requests_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_intake_requests_updated_at BEFORE UPDATE ON public.patient_intake_requests FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patient_tags trg_patient_tags_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_tags_set_updated_at BEFORE UPDATE ON public.patient_tags FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patients trg_patients_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patients_updated_at BEFORE UPDATE ON public.patients FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patients trg_patients_validate_members; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patients_validate_members BEFORE INSERT OR UPDATE OF tenant_id, responsible_member_id, patient_scope, therapist_member_id ON public.patients FOR EACH ROW EXECUTE FUNCTION public.patients_validate_member_consistency(); - - --- --- Name: payment_settings trg_payment_settings_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_payment_settings_updated_at BEFORE UPDATE ON public.payment_settings FOR EACH ROW EXECUTE FUNCTION public.update_payment_settings_updated_at(); - - --- --- Name: patient_groups trg_prevent_promoting_to_system; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_prevent_promoting_to_system BEFORE UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.prevent_promoting_to_system(); - - --- --- Name: patient_groups trg_prevent_system_group_changes; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_prevent_system_group_changes BEFORE DELETE OR UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.prevent_system_group_changes(); - - --- --- Name: professional_pricing trg_professional_pricing_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_professional_pricing_updated_at BEFORE UPDATE ON public.professional_pricing FOR EACH ROW EXECUTE FUNCTION public.update_professional_pricing_updated_at(); - - --- --- Name: profiles trg_profiles_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_profiles_updated_at BEFORE UPDATE ON public.profiles FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: subscription_intents trg_subscription_intents_view_insert; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_subscription_intents_view_insert INSTEAD OF INSERT ON public.subscription_intents FOR EACH ROW EXECUTE FUNCTION public.subscription_intents_view_insert(); - - --- --- Name: subscriptions trg_subscriptions_validate_scope; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_subscriptions_validate_scope BEFORE INSERT OR UPDATE ON public.subscriptions FOR EACH ROW EXECUTE FUNCTION public.subscriptions_validate_scope(); - - --- --- Name: tenant_features trg_tenant_features_guard_with_plan; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_features_guard_with_plan BEFORE INSERT OR UPDATE ON public.tenant_features FOR EACH ROW EXECUTE FUNCTION public.tenant_features_guard_with_plan(); - - --- --- Name: tenant_features trg_tenant_features_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_features_updated_at BEFORE UPDATE ON public.tenant_features FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: tenants trg_tenant_kind_immutable; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_kind_immutable BEFORE UPDATE OF kind ON public.tenants FOR EACH ROW EXECUTE FUNCTION public.guard_tenant_kind_immutable(); - - --- --- Name: user_settings trg_user_settings_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_user_settings_updated_at BEFORE UPDATE ON public.user_settings FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: subscription tr_check_filters; Type: TRIGGER; Schema: realtime; Owner: supabase_admin --- - -CREATE TRIGGER tr_check_filters BEFORE INSERT OR UPDATE ON realtime.subscription FOR EACH ROW EXECUTE FUNCTION realtime.subscription_check_filters(); - - --- --- Name: buckets enforce_bucket_name_length_trigger; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER enforce_bucket_name_length_trigger BEFORE INSERT OR UPDATE OF name ON storage.buckets FOR EACH ROW EXECUTE FUNCTION storage.enforce_bucket_name_length(); - - --- --- Name: buckets protect_buckets_delete; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER protect_buckets_delete BEFORE DELETE ON storage.buckets FOR EACH STATEMENT EXECUTE FUNCTION storage.protect_delete(); - - --- --- Name: objects protect_objects_delete; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER protect_objects_delete BEFORE DELETE ON storage.objects FOR EACH STATEMENT EXECUTE FUNCTION storage.protect_delete(); - - --- --- Name: objects update_objects_updated_at; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER update_objects_updated_at BEFORE UPDATE ON storage.objects FOR EACH ROW EXECUTE FUNCTION storage.update_updated_at_column(); - - --- --- Name: extensions extensions_tenant_external_id_fkey; Type: FK CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.extensions - ADD CONSTRAINT extensions_tenant_external_id_fkey FOREIGN KEY (tenant_external_id) REFERENCES _realtime.tenants(external_id) ON DELETE CASCADE; - - --- --- Name: identities identities_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: mfa_amr_claims mfa_amr_claims_session_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT mfa_amr_claims_session_id_fkey FOREIGN KEY (session_id) REFERENCES auth.sessions(id) ON DELETE CASCADE; - - --- --- Name: mfa_challenges mfa_challenges_auth_factor_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_challenges - ADD CONSTRAINT mfa_challenges_auth_factor_id_fkey FOREIGN KEY (factor_id) REFERENCES auth.mfa_factors(id) ON DELETE CASCADE; - - --- --- Name: mfa_factors mfa_factors_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: oauth_authorizations oauth_authorizations_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_client_id_fkey FOREIGN KEY (client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: oauth_authorizations oauth_authorizations_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: oauth_consents oauth_consents_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_client_id_fkey FOREIGN KEY (client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: oauth_consents oauth_consents_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: one_time_tokens one_time_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.one_time_tokens - ADD CONSTRAINT one_time_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: refresh_tokens refresh_tokens_session_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_session_id_fkey FOREIGN KEY (session_id) REFERENCES auth.sessions(id) ON DELETE CASCADE; - - --- --- Name: saml_providers saml_providers_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: saml_relay_states saml_relay_states_flow_state_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_flow_state_id_fkey FOREIGN KEY (flow_state_id) REFERENCES auth.flow_state(id) ON DELETE CASCADE; - - --- --- Name: saml_relay_states saml_relay_states_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: sessions sessions_oauth_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_oauth_client_id_fkey FOREIGN KEY (oauth_client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: sessions sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: sso_domains sso_domains_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_domains - ADD CONSTRAINT sso_domains_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: agenda_bloqueios agenda_bloqueios_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agenda_bloqueios agenda_bloqueios_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE SET NULL; - - --- --- Name: agenda_configuracoes agenda_configuracoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_configuracoes - ADD CONSTRAINT agenda_configuracoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_eventos agenda_eventos_determined_commitment_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_determined_commitment_fk FOREIGN KEY (determined_commitment_id) REFERENCES public.determined_commitments(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.recurrence_rules(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_terapeuta_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_terapeuta_fk FOREIGN KEY (terapeuta_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: agenda_excecoes agenda_excecoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_excecoes - ADD CONSTRAINT agenda_excecoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_online_slots agenda_online_slots_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agenda_online_slots agenda_online_slots_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_semanais_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_slots_regras agenda_slots_regras_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agendador_configuracoes agendador_configuracoes_owner_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_owner_fk FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agendador_configuracoes agendador_configuracoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agendador_solicitacoes agendador_sol_owner_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_sol_owner_fk FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agendador_solicitacoes agendador_sol_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_sol_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: commitment_time_logs commitment_time_logs_calendar_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_calendar_event_id_fkey FOREIGN KEY (calendar_event_id) REFERENCES public.agenda_eventos(id) ON DELETE SET NULL; - - --- --- Name: commitment_time_logs commitment_time_logs_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.determined_commitments(id) ON DELETE CASCADE; - - --- --- Name: commitment_time_logs commitment_time_logs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: determined_commitment_fields determined_commitment_fields_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.determined_commitments(id) ON DELETE CASCADE; - - --- --- Name: determined_commitment_fields determined_commitment_fields_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: determined_commitments determined_commitments_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: feriados feriados_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: feriados feriados_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: module_features module_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.features(id) ON DELETE CASCADE; - - --- --- Name: module_features module_features_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.modules(id) ON DELETE CASCADE; - - --- --- Name: patient_group_patient patient_group_patient_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_group_patient patient_group_patient_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_groups patient_groups_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_groups - ADD CONSTRAINT patient_groups_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_intake_requests patient_intake_requests_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_intake_requests - ADD CONSTRAINT patient_intake_requests_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_invites patient_invites_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag patient_patient_tag_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.patient_tags(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag patient_patient_tag_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_tags patient_tags_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patients patients_responsible_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_responsible_member_id_fkey FOREIGN KEY (responsible_member_id) REFERENCES public.tenant_members(id) ON DELETE RESTRICT; - - --- --- Name: patients patients_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patients patients_therapist_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_therapist_member_id_fkey FOREIGN KEY (therapist_member_id) REFERENCES public.tenant_members(id); - - --- --- Name: patients patients_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: payment_settings payment_settings_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: payment_settings payment_settings_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: plan_features plan_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.features(id) ON DELETE CASCADE; - - --- --- Name: plan_features plan_features_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_prices plan_prices_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_prices - ADD CONSTRAINT plan_prices_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_public_bullets plan_public_bullets_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public_bullets - ADD CONSTRAINT plan_public_bullets_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_public plan_public_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public - ADD CONSTRAINT plan_public_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag ppt_patient_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT ppt_patient_fk FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag ppt_tag_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT ppt_tag_fk FOREIGN KEY (tag_id) REFERENCES public.patient_tags(id) ON DELETE CASCADE; - - --- --- Name: professional_pricing professional_pricing_determined_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_determined_commitment_id_fkey FOREIGN KEY (determined_commitment_id) REFERENCES public.determined_commitments(id) ON DELETE SET NULL; - - --- --- Name: professional_pricing professional_pricing_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: profiles profiles_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.profiles - ADD CONSTRAINT profiles_id_fkey FOREIGN KEY (id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: recurrence_exceptions recurrence_exceptions_agenda_evento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_agenda_evento_id_fkey FOREIGN KEY (agenda_evento_id) REFERENCES public.agenda_eventos(id) ON DELETE SET NULL; - - --- --- Name: recurrence_exceptions recurrence_exceptions_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.recurrence_rules(id) ON DELETE CASCADE; - - --- --- Name: saas_admins saas_admins_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_admins - ADD CONSTRAINT saas_admins_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: saas_doc_votos saas_doc_votos_doc_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_doc_id_fkey FOREIGN KEY (doc_id) REFERENCES public.saas_docs(id) ON DELETE CASCADE; - - --- --- Name: saas_doc_votos saas_doc_votos_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: saas_faq_itens saas_faq_itens_doc_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq_itens - ADD CONSTRAINT saas_faq_itens_doc_id_fkey FOREIGN KEY (doc_id) REFERENCES public.saas_docs(id) ON DELETE CASCADE; - - --- --- Name: subscription_intents_personal sint_personal_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT sint_personal_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE SET NULL; - - --- --- Name: subscription_intents_tenant sint_tenant_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT sint_tenant_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE SET NULL; - - --- --- Name: subscription_events subscription_events_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_events - ADD CONSTRAINT subscription_events_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE CASCADE; - - --- --- Name: subscription_intents_personal subscription_intents_personal_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT subscription_intents_personal_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: subscription_intents_tenant subscription_intents_tenant_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT subscription_intents_tenant_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: subscription_intents_legacy subscription_intents_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_legacy - ADD CONSTRAINT subscription_intents_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: subscriptions subscriptions_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_owner_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: subscriptions subscriptions_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: support_sessions support_sessions_admin_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_admin_fk FOREIGN KEY (admin_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: support_sessions support_sessions_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_features tenant_features_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_features - ADD CONSTRAINT tenant_features_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_invites tenant_invites_accepted_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_accepted_by_fkey FOREIGN KEY (accepted_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_invited_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_invited_by_fkey FOREIGN KEY (invited_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_revoked_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_revoked_by_fkey FOREIGN KEY (revoked_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_members tenant_members_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_members tenant_members_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: tenant_modules tenant_modules_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.modules(id) ON DELETE CASCADE; - - --- --- Name: tenant_modules tenant_modules_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: user_settings user_settings_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.user_settings - ADD CONSTRAINT user_settings_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: iceberg_namespaces iceberg_namespaces_catalog_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_namespaces - ADD CONSTRAINT iceberg_namespaces_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES storage.buckets_analytics(id) ON DELETE CASCADE; - - --- --- Name: iceberg_tables iceberg_tables_catalog_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES storage.buckets_analytics(id) ON DELETE CASCADE; - - --- --- Name: iceberg_tables iceberg_tables_namespace_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_namespace_id_fkey FOREIGN KEY (namespace_id) REFERENCES storage.iceberg_namespaces(id) ON DELETE CASCADE; - - --- --- Name: objects objects_bucketId_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT "objects_bucketId_fkey" FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads s3_multipart_uploads_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads - ADD CONSTRAINT s3_multipart_uploads_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_upload_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_upload_id_fkey FOREIGN KEY (upload_id) REFERENCES storage.s3_multipart_uploads(id) ON DELETE CASCADE; - - --- --- Name: vector_indexes vector_indexes_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.vector_indexes - ADD CONSTRAINT vector_indexes_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets_vectors(id); - - --- --- Name: audit_log_entries; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.audit_log_entries ENABLE ROW LEVEL SECURITY; - --- --- Name: flow_state; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.flow_state ENABLE ROW LEVEL SECURITY; - --- --- Name: identities; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.identities ENABLE ROW LEVEL SECURITY; - --- --- Name: instances; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.instances ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_amr_claims; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_amr_claims ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_challenges; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_challenges ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_factors; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_factors ENABLE ROW LEVEL SECURITY; - --- --- Name: one_time_tokens; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.one_time_tokens ENABLE ROW LEVEL SECURITY; - --- --- Name: refresh_tokens; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.refresh_tokens ENABLE ROW LEVEL SECURITY; - --- --- Name: saml_providers; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.saml_providers ENABLE ROW LEVEL SECURITY; - --- --- Name: saml_relay_states; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.saml_relay_states ENABLE ROW LEVEL SECURITY; - --- --- Name: schema_migrations; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.schema_migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: sessions; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sessions ENABLE ROW LEVEL SECURITY; - --- --- Name: sso_domains; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sso_domains ENABLE ROW LEVEL SECURITY; - --- --- Name: sso_providers; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sso_providers ENABLE ROW LEVEL SECURITY; - --- --- Name: users; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.users ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_bloqueios ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_configuracoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_configuracoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_configuracoes agenda_configuracoes_clinic_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_clinic_read ON public.agenda_configuracoes FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_configuracoes agenda_configuracoes_clinic_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_clinic_write ON public.agenda_configuracoes USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_configuracoes agenda_configuracoes_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_owner ON public.agenda_configuracoes USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_eventos; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_eventos ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_eventos agenda_eventos_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_delete ON public.agenda_eventos FOR DELETE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.delete'::text))); - - --- --- Name: agenda_eventos agenda_eventos_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_insert ON public.agenda_eventos FOR INSERT WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.create'::text))); - - --- --- Name: agenda_eventos agenda_eventos_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_owner_all ON public.agenda_eventos TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_eventos agenda_eventos_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_select ON public.agenda_eventos FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_eventos agenda_eventos_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_update ON public.agenda_eventos FOR UPDATE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_excecoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_excecoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_excecoes agenda_excecoes_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_owner ON public.agenda_excecoes USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_excecoes agenda_excecoes_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_select ON public.agenda_excecoes FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_excecoes agenda_excecoes_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_write ON public.agenda_excecoes USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_online_slots; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_online_slots ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_online_slots agenda_online_slots_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_owner ON public.agenda_online_slots USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_online_slots agenda_online_slots_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_select ON public.agenda_online_slots FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_online_slots agenda_online_slots_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_write ON public.agenda_online_slots USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_regras_semanais; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_regras_semanais ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_regras_semanais agenda_regras_semanais_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_owner ON public.agenda_regras_semanais USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_select ON public.agenda_regras_semanais FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_write ON public.agenda_regras_semanais USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_slots_bloqueados_semanais; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_slots_bloqueados_semanais ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_bloqueados_semanais_select ON public.agenda_slots_bloqueados_semanais FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_bloqueados_semanais_write ON public.agenda_slots_bloqueados_semanais USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_slots_regras; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_slots_regras ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_slots_regras agenda_slots_regras_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_regras_select ON public.agenda_slots_regras FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_slots_regras agenda_slots_regras_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_regras_write ON public.agenda_slots_regras USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agendador_configuracoes agendador_cfg_public_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_public_read ON public.agendador_configuracoes FOR SELECT TO anon USING (((ativo = true) AND (link_slug IS NOT NULL))); - - --- --- Name: agendador_configuracoes agendador_cfg_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_select ON public.agendador_configuracoes FOR SELECT USING ((auth.uid() = owner_id)); - - --- --- Name: agendador_configuracoes agendador_cfg_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_write ON public.agendador_configuracoes USING ((auth.uid() = owner_id)) WITH CHECK ((auth.uid() = owner_id)); - - --- --- Name: agendador_configuracoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agendador_configuracoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agendador_solicitacoes agendador_sol_owner_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_owner_select ON public.agendador_solicitacoes FOR SELECT USING ((auth.uid() = owner_id)); - - --- --- Name: agendador_solicitacoes agendador_sol_owner_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_owner_write ON public.agendador_solicitacoes USING ((auth.uid() = owner_id)) WITH CHECK ((auth.uid() = owner_id)); - - --- --- Name: agendador_solicitacoes agendador_sol_patient_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_patient_read ON public.agendador_solicitacoes FOR SELECT TO authenticated USING (((auth.uid() = user_id) OR (auth.uid() = owner_id))); - - --- --- Name: agendador_solicitacoes agendador_sol_public_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_public_insert ON public.agendador_solicitacoes FOR INSERT TO anon WITH CHECK (true); - - --- --- Name: agendador_solicitacoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agendador_solicitacoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios bloqueios_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_delete ON public.agenda_bloqueios FOR DELETE TO authenticated USING ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_insert ON public.agenda_bloqueios FOR INSERT TO authenticated WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_select_clinic; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_select_clinic ON public.agenda_bloqueios FOR SELECT TO authenticated USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE ((tenant_members.user_id = auth.uid()) AND (tenant_members.role = ANY (ARRAY['admin'::text, 'clinic_admin'::text, 'tenant_admin'::text, 'secretary'::text])))))); - - --- --- Name: agenda_bloqueios bloqueios_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_select_own ON public.agenda_bloqueios FOR SELECT TO authenticated USING ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_update ON public.agenda_bloqueios FOR UPDATE TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: saas_docs clinic_admin_read_all_docs; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY clinic_admin_read_all_docs ON public.saas_docs FOR SELECT TO authenticated USING (((ativo = true) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['clinic_admin'::text, 'tenant_admin'::text]))))))); - - --- --- Name: commitment_time_logs; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.commitment_time_logs ENABLE ROW LEVEL SECURITY; - --- --- Name: commitment_time_logs ctl_delete_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_delete_for_active_member ON public.commitment_time_logs FOR DELETE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_insert_for_active_member ON public.commitment_time_logs FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_select_for_active_member ON public.commitment_time_logs FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_update_for_active_member ON public.commitment_time_logs FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_delete_custom_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_delete_custom_for_active_member ON public.determined_commitments FOR DELETE TO authenticated USING (((is_native = false) AND (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: determined_commitments dc_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_insert_for_active_member ON public.determined_commitments FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_select_for_active_member ON public.determined_commitments FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_update_for_active_member ON public.determined_commitments FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_delete_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_delete_for_active_member ON public.determined_commitment_fields FOR DELETE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_insert_for_active_member ON public.determined_commitment_fields FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_select_for_active_member ON public.determined_commitment_fields FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_update_for_active_member ON public.determined_commitment_fields FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: agenda_bloqueios delete own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "delete own" ON public.agenda_bloqueios FOR DELETE USING ((owner_id = auth.uid())); - - --- --- Name: determined_commitment_fields; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.determined_commitment_fields ENABLE ROW LEVEL SECURITY; - --- --- Name: determined_commitments; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.determined_commitments ENABLE ROW LEVEL SECURITY; - --- --- Name: dev_user_credentials dev_creds_select_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dev_creds_select_saas_admin ON public.dev_user_credentials FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))); - - --- --- Name: dev_user_credentials dev_creds_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dev_creds_write_saas_admin ON public.dev_user_credentials TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))); - - --- --- Name: dev_user_credentials; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.dev_user_credentials ENABLE ROW LEVEL SECURITY; - --- --- Name: entitlements_invalidation ent_inv_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_select_own ON public.entitlements_invalidation FOR SELECT USING (((owner_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: entitlements_invalidation ent_inv_update_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_update_saas ON public.entitlements_invalidation FOR UPDATE USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: entitlements_invalidation ent_inv_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_write_saas ON public.entitlements_invalidation FOR INSERT WITH CHECK (public.is_saas_admin()); - - --- --- Name: entitlements_invalidation; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.entitlements_invalidation ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq faq_admin_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_admin_write ON public.saas_faq TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['saas_admin'::text, 'tenant_admin'::text, 'clinic_admin'::text])))))); - - --- --- Name: saas_faq faq_auth_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_auth_read ON public.saas_faq FOR SELECT TO authenticated USING ((ativo = true)); - - --- --- Name: saas_faq_itens faq_itens_admin_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_itens_admin_write ON public.saas_faq_itens TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['saas_admin'::text, 'tenant_admin'::text, 'clinic_admin'::text])))))); - - --- --- Name: saas_faq_itens faq_itens_auth_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_itens_auth_read ON public.saas_faq_itens FOR SELECT TO authenticated USING (((ativo = true) AND (EXISTS ( SELECT 1 - FROM public.saas_docs d - WHERE ((d.id = saas_faq_itens.doc_id) AND (d.ativo = true)))))); - - --- --- Name: saas_faq faq_public_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_public_read ON public.saas_faq FOR SELECT USING (((publico = true) AND (ativo = true))); - - --- --- Name: features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.features ENABLE ROW LEVEL SECURITY; - --- --- Name: features features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY features_read_authenticated ON public.features FOR SELECT TO authenticated USING (true); - - --- --- Name: features features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY features_write_saas_admin ON public.features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: feriados; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.feriados ENABLE ROW LEVEL SECURITY; - --- --- Name: feriados feriados_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_delete ON public.feriados FOR DELETE USING ((owner_id = auth.uid())); - - --- --- Name: feriados feriados_global_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_global_select ON public.feriados FOR SELECT USING ((tenant_id IS NULL)); - - --- --- Name: feriados feriados_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_insert ON public.feriados FOR INSERT WITH CHECK ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_delete ON public.feriados FOR DELETE USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_insert ON public.feriados FOR INSERT WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_select ON public.feriados FOR SELECT USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_select ON public.feriados FOR SELECT USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: agenda_bloqueios insert own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "insert own" ON public.agenda_bloqueios FOR INSERT WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: module_features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.module_features ENABLE ROW LEVEL SECURITY; - --- --- Name: module_features module_features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY module_features_read_authenticated ON public.module_features FOR SELECT TO authenticated USING (true); - - --- --- Name: module_features module_features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY module_features_write_saas_admin ON public.module_features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: modules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.modules ENABLE ROW LEVEL SECURITY; - --- --- Name: modules modules_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY modules_read_authenticated ON public.modules FOR SELECT TO authenticated USING (true); - - --- --- Name: modules modules_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY modules_write_saas_admin ON public.modules TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: owner_users; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.owner_users ENABLE ROW LEVEL SECURITY; - --- --- Name: owner_users owner_users: user can read own links; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "owner_users: user can read own links" ON public.owner_users FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: patient_group_patient; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_group_patient ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_group_patient patient_group_patient_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_owner_all ON public.patient_group_patient TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.patients p - WHERE ((p.id = patient_group_patient.patient_id) AND (p.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.patients p - WHERE ((p.id = patient_group_patient.patient_id) AND (p.owner_id = auth.uid()))))); - - --- --- Name: patient_group_patient patient_group_patient_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_select ON public.patient_group_patient FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_group_patient patient_group_patient_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_write ON public.patient_group_patient USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_groups; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_groups ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_groups patient_groups_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_owner_all ON public.patient_groups TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_groups patient_groups_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_select ON public.patient_groups FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_groups patient_groups_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_write ON public.patient_groups USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_intake_requests; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_intake_requests ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_intake_requests patient_intake_requests_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_owner_all ON public.patient_intake_requests TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_intake_requests patient_intake_requests_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_select ON public.patient_intake_requests FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_intake_requests patient_intake_requests_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_write ON public.patient_intake_requests USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_invites; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_invites ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_invites patient_invites_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_owner_all ON public.patient_invites TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_invites patient_invites_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_select ON public.patient_invites FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_invites patient_invites_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_write ON public.patient_invites USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_patient_tag; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_patient_tag ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_patient_tag patient_patient_tag_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_owner_all ON public.patient_patient_tag TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_patient_tag patient_patient_tag_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_select ON public.patient_patient_tag FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_patient_tag patient_patient_tag_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_write ON public.patient_patient_tag USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_tags; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_tags ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_tags patient_tags_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_owner_all ON public.patient_tags TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_tags patient_tags_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_select ON public.patient_tags FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_tags patient_tags_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_write ON public.patient_tags USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patients; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patients ENABLE ROW LEVEL SECURITY; - --- --- Name: patients patients_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_delete ON public.patients FOR DELETE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.delete'::text))); - - --- --- Name: patients patients_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_insert ON public.patients FOR INSERT WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.create'::text))); - - --- --- Name: patients patients_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_owner_all ON public.patients TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patients patients_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_select ON public.patients FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patients patients_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_update ON public.patients FOR UPDATE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: payment_settings; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.payment_settings ENABLE ROW LEVEL SECURITY; - --- --- Name: payment_settings payment_settings: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "payment_settings: owner full access" ON public.payment_settings USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: plan_features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.plan_features ENABLE ROW LEVEL SECURITY; - --- --- Name: plan_features plan_features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plan_features_read_authenticated ON public.plan_features FOR SELECT TO authenticated USING (true); - - --- --- Name: plan_features plan_features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plan_features_write_saas_admin ON public.plan_features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: plans; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.plans ENABLE ROW LEVEL SECURITY; - --- --- Name: plans plans_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plans_read_authenticated ON public.plans FOR SELECT TO authenticated USING (true); - - --- --- Name: plans plans_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plans_write_saas_admin ON public.plans TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: professional_pricing; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.professional_pricing ENABLE ROW LEVEL SECURITY; - --- --- Name: professional_pricing professional_pricing: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "professional_pricing: owner full access" ON public.professional_pricing USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: profiles; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY; - --- --- Name: profiles profiles_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_insert_own ON public.profiles FOR INSERT WITH CHECK ((id = auth.uid())); - - --- --- Name: profiles profiles_read_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_read_saas_admin ON public.profiles FOR SELECT USING (public.is_saas_admin()); - - --- --- Name: profiles profiles_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_select_own ON public.profiles FOR SELECT USING ((id = auth.uid())); - - --- --- Name: profiles profiles_update_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_update_own ON public.profiles FOR UPDATE USING ((id = auth.uid())) WITH CHECK ((id = auth.uid())); - - --- --- Name: features read features (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read features (auth)" ON public.features FOR SELECT TO authenticated USING (true); - - --- --- Name: plan_features read plan_features (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read plan_features (auth)" ON public.plan_features FOR SELECT TO authenticated USING (true); - - --- --- Name: plans read plans (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read plans (auth)" ON public.plans FOR SELECT TO authenticated USING (true); - - --- --- Name: recurrence_exceptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_exceptions ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_exceptions recurrence_exceptions_tenant; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_exceptions_tenant ON public.recurrence_exceptions TO authenticated USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))) WITH CHECK ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: recurrence_rules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_rules ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_rules recurrence_rules_clinic_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_clinic_read ON public.recurrence_rules FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: recurrence_rules recurrence_rules_clinic_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_clinic_write ON public.recurrence_rules USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: recurrence_rules recurrence_rules_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_owner ON public.recurrence_rules TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: subscription_intents_legacy saas_admin can read subscription_intents; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "saas_admin can read subscription_intents" ON public.subscription_intents_legacy FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))); - - --- --- Name: subscription_intents_legacy saas_admin can update subscription_intents; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "saas_admin can update subscription_intents" ON public.subscription_intents_legacy FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))); - - --- --- Name: saas_docs saas_admin_full_access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY saas_admin_full_access ON public.saas_docs TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: saas_admins; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_admins ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_admins saas_admins_select_self; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY saas_admins_select_self ON public.saas_admins FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: saas_doc_votos; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_doc_votos ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_docs; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_docs ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_faq ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq_itens; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_faq_itens ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios select own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "select own" ON public.agenda_bloqueios FOR SELECT USING ((owner_id = auth.uid())); - - --- --- Name: subscription_events; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscription_events ENABLE ROW LEVEL SECURITY; - --- --- Name: subscription_events subscription_events_read_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_events_read_saas ON public.subscription_events FOR SELECT USING (public.is_saas_admin()); - - --- --- Name: subscription_events subscription_events_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_events_write_saas ON public.subscription_events FOR INSERT WITH CHECK (public.is_saas_admin()); - - --- --- Name: subscription_intents_legacy subscription_intents_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_intents_insert_own ON public.subscription_intents_legacy FOR INSERT TO authenticated WITH CHECK ((user_id = auth.uid())); - - --- --- Name: subscription_intents_legacy; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscription_intents_legacy ENABLE ROW LEVEL SECURITY; - --- --- Name: subscription_intents_legacy subscription_intents_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_intents_select_own ON public.subscription_intents_legacy FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: subscriptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscriptions ENABLE ROW LEVEL SECURITY; - --- --- Name: subscriptions subscriptions read own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "subscriptions read own" ON public.subscriptions FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: subscriptions subscriptions: read if linked owner_users; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "subscriptions: read if linked owner_users" ON public.subscriptions FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.owner_users ou - WHERE ((ou.owner_id = subscriptions.user_id) AND (ou.user_id = auth.uid()))))); - - --- --- Name: subscriptions subscriptions_insert_own_personal; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_insert_own_personal ON public.subscriptions FOR INSERT TO authenticated WITH CHECK (((user_id = auth.uid()) AND (tenant_id IS NULL))); - - --- --- Name: subscriptions subscriptions_no_direct_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_no_direct_update ON public.subscriptions FOR UPDATE TO authenticated USING (false) WITH CHECK (false); - - --- --- Name: subscriptions subscriptions_read_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_read_own ON public.subscriptions FOR SELECT TO authenticated USING (((user_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: subscriptions subscriptions_select_for_tenant_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_select_for_tenant_members ON public.subscriptions FOR SELECT TO authenticated USING (((tenant_id IS NOT NULL) AND (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = subscriptions.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: subscriptions subscriptions_select_own_personal; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_select_own_personal ON public.subscriptions FOR SELECT TO authenticated USING (((user_id = auth.uid()) AND (tenant_id IS NULL))); - - --- --- Name: subscriptions subscriptions_update_only_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_update_only_saas_admin ON public.subscriptions FOR UPDATE TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: support_sessions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.support_sessions ENABLE ROW LEVEL SECURITY; - --- --- Name: support_sessions support_sessions_saas_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_delete ON public.support_sessions FOR DELETE USING (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: support_sessions support_sessions_saas_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_insert ON public.support_sessions FOR INSERT WITH CHECK (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: support_sessions support_sessions_saas_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_select ON public.support_sessions FOR SELECT USING (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: tenant_members; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenant_members ENABLE ROW LEVEL SECURITY; - --- --- Name: tenant_members tenant_members_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_members_write_saas ON public.tenant_members TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenant_modules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenant_modules ENABLE ROW LEVEL SECURITY; - --- --- Name: tenant_modules tenant_modules_read_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_modules_read_own ON public.tenant_modules FOR SELECT TO authenticated USING (((owner_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: tenant_modules tenant_modules_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_modules_write_saas ON public.tenant_modules TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenants; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenants ENABLE ROW LEVEL SECURITY; - --- --- Name: tenants tenants_read_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenants_read_members ON public.tenants FOR SELECT TO authenticated USING ((public.is_saas_admin() OR (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = tenants.id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: tenants tenants_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenants_write_saas ON public.tenants TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenant_members tm_select_admin_all_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tm_select_admin_all_members ON public.tenant_members FOR SELECT TO authenticated USING (public.is_tenant_admin(tenant_id)); - - --- --- Name: tenant_members tm_select_own_membership; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tm_select_own_membership ON public.tenant_members FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: agenda_bloqueios update own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "update own" ON public.agenda_bloqueios FOR UPDATE USING ((owner_id = auth.uid())); - - --- --- Name: user_settings; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.user_settings ENABLE ROW LEVEL SECURITY; - --- --- Name: user_settings user_settings_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_insert_own ON public.user_settings FOR INSERT WITH CHECK ((user_id = auth.uid())); - - --- --- Name: user_settings user_settings_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_select_own ON public.user_settings FOR SELECT USING ((user_id = auth.uid())); - - --- --- Name: user_settings user_settings_update_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_update_own ON public.user_settings FOR UPDATE USING ((user_id = auth.uid())) WITH CHECK ((user_id = auth.uid())); - - --- --- Name: saas_docs users_read_usuario_docs; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY users_read_usuario_docs ON public.saas_docs FOR SELECT TO authenticated USING (((ativo = true) AND (tipo_acesso = 'usuario'::text))); - - --- --- Name: saas_doc_votos votos_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY votos_select_own ON public.saas_doc_votos FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: saas_doc_votos votos_upsert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY votos_upsert_own ON public.saas_doc_votos TO authenticated USING ((user_id = auth.uid())) WITH CHECK ((user_id = auth.uid())); - - --- --- Name: messages; Type: ROW SECURITY; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY; - --- --- Name: objects agendador_storage_owner_delete; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_delete ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_owner_insert; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_insert ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_owner_update; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_update ON storage.objects FOR UPDATE TO authenticated USING (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_public_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_public_read ON storage.objects FOR SELECT USING ((bucket_id = 'agendador'::text)); - - --- --- Name: objects avatars_delete_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_delete_own ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_delete_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_delete_own_folder ON storage.objects FOR DELETE USING (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: objects avatars_insert_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_insert_own ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_insert_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_insert_own_folder ON storage.objects FOR INSERT WITH CHECK (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: objects avatars_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_read ON storage.objects FOR SELECT USING ((bucket_id = 'avatars'::text)); - - --- --- Name: objects avatars_select_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_select_own ON storage.objects FOR SELECT TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_update_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_update_own ON storage.objects FOR UPDATE TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))) WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_update_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_update_own_folder ON storage.objects FOR UPDATE USING (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))) WITH CHECK (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: buckets; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets ENABLE ROW LEVEL SECURITY; - --- --- Name: buckets_analytics; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets_analytics ENABLE ROW LEVEL SECURITY; - --- --- Name: buckets_vectors; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets_vectors ENABLE ROW LEVEL SECURITY; - --- --- Name: iceberg_namespaces; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.iceberg_namespaces ENABLE ROW LEVEL SECURITY; - --- --- Name: iceberg_tables; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.iceberg_tables ENABLE ROW LEVEL SECURITY; - --- --- Name: objects intake_read_anon; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_read_anon ON storage.objects FOR SELECT TO anon USING (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_read_public; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_read_public ON storage.objects FOR SELECT USING (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_upload_anon; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_upload_anon ON storage.objects FOR INSERT TO anon WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_upload_public; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_upload_public ON storage.objects FOR INSERT WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: migrations; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: objects; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY; - --- --- Name: objects public_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY public_read ON storage.objects FOR SELECT USING ((bucket_id = 'saas-docs'::text)); - - --- --- Name: s3_multipart_uploads; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.s3_multipart_uploads ENABLE ROW LEVEL SECURITY; - --- --- Name: s3_multipart_uploads_parts; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.s3_multipart_uploads_parts ENABLE ROW LEVEL SECURITY; - --- --- Name: objects saas_admin_delete; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY saas_admin_delete ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'saas-docs'::text) AND (EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid()))))); - - --- --- Name: objects saas_admin_upload; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY saas_admin_upload ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'saas-docs'::text) AND (EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid()))))); - - --- --- Name: vector_indexes; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.vector_indexes ENABLE ROW LEVEL SECURITY; - --- --- Name: supabase_realtime; Type: PUBLICATION; Schema: -; Owner: postgres --- - -CREATE PUBLICATION supabase_realtime WITH (publish = 'insert, update, delete, truncate'); - - -ALTER PUBLICATION supabase_realtime OWNER TO postgres; - --- --- Name: SCHEMA auth; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA auth TO anon; -GRANT USAGE ON SCHEMA auth TO authenticated; -GRANT USAGE ON SCHEMA auth TO service_role; -GRANT ALL ON SCHEMA auth TO supabase_auth_admin; -GRANT ALL ON SCHEMA auth TO dashboard_user; -GRANT USAGE ON SCHEMA auth TO postgres; - - --- --- Name: SCHEMA extensions; Type: ACL; Schema: -; Owner: postgres --- - -GRANT USAGE ON SCHEMA extensions TO anon; -GRANT USAGE ON SCHEMA extensions TO authenticated; -GRANT USAGE ON SCHEMA extensions TO service_role; -GRANT ALL ON SCHEMA extensions TO dashboard_user; - - --- --- Name: SCHEMA net; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA net TO supabase_functions_admin; -GRANT USAGE ON SCHEMA net TO postgres; -GRANT USAGE ON SCHEMA net TO anon; -GRANT USAGE ON SCHEMA net TO authenticated; -GRANT USAGE ON SCHEMA net TO service_role; - - --- --- Name: SCHEMA public; Type: ACL; Schema: -; Owner: pg_database_owner --- - -GRANT USAGE ON SCHEMA public TO postgres; -GRANT USAGE ON SCHEMA public TO anon; -GRANT USAGE ON SCHEMA public TO authenticated; -GRANT USAGE ON SCHEMA public TO service_role; - - --- --- Name: SCHEMA realtime; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA realtime TO postgres; -GRANT USAGE ON SCHEMA realtime TO anon; -GRANT USAGE ON SCHEMA realtime TO authenticated; -GRANT USAGE ON SCHEMA realtime TO service_role; -GRANT ALL ON SCHEMA realtime TO supabase_realtime_admin; - - --- --- Name: SCHEMA storage; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA storage TO postgres WITH GRANT OPTION; -GRANT USAGE ON SCHEMA storage TO anon; -GRANT USAGE ON SCHEMA storage TO authenticated; -GRANT USAGE ON SCHEMA storage TO service_role; -GRANT ALL ON SCHEMA storage TO supabase_storage_admin WITH GRANT OPTION; -GRANT ALL ON SCHEMA storage TO dashboard_user; - - --- --- Name: SCHEMA supabase_functions; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA supabase_functions TO postgres; -GRANT USAGE ON SCHEMA supabase_functions TO anon; -GRANT USAGE ON SCHEMA supabase_functions TO authenticated; -GRANT USAGE ON SCHEMA supabase_functions TO service_role; -GRANT ALL ON SCHEMA supabase_functions TO supabase_functions_admin; - - --- --- Name: SCHEMA vault; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA vault TO postgres WITH GRANT OPTION; -GRANT USAGE ON SCHEMA vault TO service_role; - - --- --- Name: FUNCTION citextin(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextin(cstring) TO postgres; -GRANT ALL ON FUNCTION public.citextin(cstring) TO anon; -GRANT ALL ON FUNCTION public.citextin(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.citextin(cstring) TO service_role; - - --- --- Name: FUNCTION citextout(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextout(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO service_role; - - --- --- Name: FUNCTION citextrecv(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextrecv(internal) TO postgres; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO anon; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO authenticated; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO service_role; - - --- --- Name: FUNCTION citextsend(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO service_role; - - --- --- Name: FUNCTION gbtreekey16_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey16_out(public.gbtreekey16); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO service_role; - - --- --- Name: FUNCTION gbtreekey2_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey2_out(public.gbtreekey2); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO service_role; - - --- --- Name: FUNCTION gbtreekey32_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey32_out(public.gbtreekey32); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO service_role; - - --- --- Name: FUNCTION gbtreekey4_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey4_out(public.gbtreekey4); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO service_role; - - --- --- Name: FUNCTION gbtreekey8_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey8_out(public.gbtreekey8); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO service_role; - - --- --- Name: FUNCTION gbtreekey_var_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey_var_out(public.gbtreekey_var); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO service_role; - - --- --- Name: FUNCTION gtrgm_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO service_role; - - --- --- Name: FUNCTION gtrgm_out(public.gtrgm); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO service_role; - - --- --- Name: FUNCTION citext(boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(boolean) TO postgres; -GRANT ALL ON FUNCTION public.citext(boolean) TO anon; -GRANT ALL ON FUNCTION public.citext(boolean) TO authenticated; -GRANT ALL ON FUNCTION public.citext(boolean) TO service_role; - - --- --- Name: FUNCTION citext(character); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(character) TO postgres; -GRANT ALL ON FUNCTION public.citext(character) TO anon; -GRANT ALL ON FUNCTION public.citext(character) TO authenticated; -GRANT ALL ON FUNCTION public.citext(character) TO service_role; - - --- --- Name: FUNCTION citext(inet); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(inet) TO postgres; -GRANT ALL ON FUNCTION public.citext(inet) TO anon; -GRANT ALL ON FUNCTION public.citext(inet) TO authenticated; -GRANT ALL ON FUNCTION public.citext(inet) TO service_role; - - --- --- Name: FUNCTION email(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.email() TO dashboard_user; - - --- --- Name: FUNCTION jwt(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.jwt() TO postgres; -GRANT ALL ON FUNCTION auth.jwt() TO dashboard_user; - - --- --- Name: FUNCTION role(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.role() TO dashboard_user; - - --- --- Name: FUNCTION uid(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.uid() TO dashboard_user; - - --- --- Name: FUNCTION armor(bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.armor(bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.armor(bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION armor(bytea, text[], text[]); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.armor(bytea, text[], text[]) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.armor(bytea, text[], text[]) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION crypt(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.crypt(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.crypt(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION dearmor(text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.dearmor(text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.dearmor(text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION decrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.decrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.decrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION decrypt_iv(bytea, bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.decrypt_iv(bytea, bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.decrypt_iv(bytea, bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION digest(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.digest(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.digest(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION digest(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.digest(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.digest(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION encrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.encrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.encrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION encrypt_iv(bytea, bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.encrypt_iv(bytea, bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.encrypt_iv(bytea, bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_random_bytes(integer); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_random_bytes(integer) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_random_bytes(integer) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_random_uuid(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_random_uuid() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_random_uuid() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_salt(text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_salt(text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_salt(text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_salt(text, integer); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_salt(text, integer) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_salt(text, integer) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION grant_pg_cron_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION extensions.grant_pg_cron_access() FROM supabase_admin; -GRANT ALL ON FUNCTION extensions.grant_pg_cron_access() TO supabase_admin WITH GRANT OPTION; -GRANT ALL ON FUNCTION extensions.grant_pg_cron_access() TO dashboard_user; - - --- --- Name: FUNCTION grant_pg_graphql_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.grant_pg_graphql_access() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION grant_pg_net_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION extensions.grant_pg_net_access() FROM supabase_admin; -GRANT ALL ON FUNCTION extensions.grant_pg_net_access() TO supabase_admin WITH GRANT OPTION; -GRANT ALL ON FUNCTION extensions.grant_pg_net_access() TO dashboard_user; - - --- --- Name: FUNCTION hmac(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.hmac(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.hmac(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION hmac(text, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.hmac(text, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.hmac(text, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT shared_blk_read_time double precision, OUT shared_blk_write_time double precision, OUT local_blk_read_time double precision, OUT local_blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision, OUT jit_deform_count bigint, OUT jit_deform_time double precision, OUT stats_since timestamp with time zone, OUT minmax_stats_since timestamp with time zone); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT shared_blk_read_time double precision, OUT shared_blk_write_time double precision, OUT local_blk_read_time double precision, OUT local_blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision, OUT jit_deform_count bigint, OUT jit_deform_time double precision, OUT stats_since timestamp with time zone, OUT minmax_stats_since timestamp with time zone) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements_reset(userid oid, dbid oid, queryid bigint, minmax_only boolean); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements_reset(userid oid, dbid oid, queryid bigint, minmax_only boolean) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_armor_headers(text, OUT key text, OUT value text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_armor_headers(text, OUT key text, OUT value text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_armor_headers(text, OUT key text, OUT value text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_key_id(bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_key_id(bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_key_id(bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt(text, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt(text, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt_bytea(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt_bytea(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt_bytea(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt_bytea(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt(text, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt_bytea(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt_bytea(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgrst_ddl_watch(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgrst_ddl_watch() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgrst_drop_watch(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgrst_drop_watch() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION set_graphql_placeholder(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.set_graphql_placeholder() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v1(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v1() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v1() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v1mc(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v1mc() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v1mc() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v3(namespace uuid, name text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v3(namespace uuid, name text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v3(namespace uuid, name text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v4(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v4() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v4() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v5(namespace uuid, name text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v5(namespace uuid, name text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v5(namespace uuid, name text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_nil(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_nil() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_nil() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_dns(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_dns() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_dns() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_oid(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_oid() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_oid() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_url(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_url() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_url() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_x500(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_x500() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_x500() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION graphql("operationName" text, query text, variables jsonb, extensions jsonb); Type: ACL; Schema: graphql_public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO postgres; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO anon; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO authenticated; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO service_role; - - --- --- Name: FUNCTION http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer); Type: ACL; Schema: net; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO anon; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO authenticated; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO service_role; - - --- --- Name: FUNCTION http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer); Type: ACL; Schema: net; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO anon; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO authenticated; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO service_role; - - --- --- Name: FUNCTION pg_reload_conf(); Type: ACL; Schema: pg_catalog; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION pg_catalog.pg_reload_conf() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION get_auth(p_usename text); Type: ACL; Schema: pgbouncer; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION pgbouncer.get_auth(p_usename text) FROM PUBLIC; -GRANT ALL ON FUNCTION pgbouncer.get_auth(p_usename text) TO pgbouncer; - - --- --- Name: FUNCTION __rls_ping(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.__rls_ping() TO postgres; -GRANT ALL ON FUNCTION public.__rls_ping() TO anon; -GRANT ALL ON FUNCTION public.__rls_ping() TO authenticated; -GRANT ALL ON FUNCTION public.__rls_ping() TO service_role; - - --- --- Name: TABLE subscriptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscriptions TO postgres; -GRANT ALL ON TABLE public.subscriptions TO anon; -GRANT ALL ON TABLE public.subscriptions TO authenticated; -GRANT ALL ON TABLE public.subscriptions TO service_role; - - --- --- Name: FUNCTION activate_subscription_from_intent(p_intent_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO anon; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO service_role; - - --- --- Name: FUNCTION admin_fix_plan_target(p_plan_key text, p_new_target text); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) FROM PUBLIC; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO postgres; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO anon; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO authenticated; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO service_role; - - --- --- Name: FUNCTION agenda_cfg_sync(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO postgres; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO anon; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO authenticated; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO service_role; - - --- --- Name: FUNCTION agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO postgres; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO anon; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO authenticated; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO service_role; - - --- --- Name: FUNCTION agendador_gerar_slug(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO postgres; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO anon; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO authenticated; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO service_role; - - --- --- Name: FUNCTION agendador_slots_disponiveis(p_slug text, p_data date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO postgres; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO anon; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO authenticated; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO service_role; - - --- --- Name: FUNCTION cancel_recurrence_from(p_recurrence_id uuid, p_from_date date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO postgres; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO anon; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO authenticated; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO service_role; - - --- --- Name: FUNCTION cancel_subscription(p_subscription_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO anon; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO service_role; - - --- --- Name: FUNCTION cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO postgres; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO anon; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO authenticated; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO service_role; - - --- --- Name: FUNCTION cash_dist(money, money); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO postgres; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO anon; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO authenticated; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO service_role; - - --- --- Name: FUNCTION change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO anon; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO service_role; - - --- --- Name: FUNCTION citext_cmp(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_eq(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_ge(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_gt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_hash(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO service_role; - - --- --- Name: FUNCTION citext_hash_extended(public.citext, bigint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO postgres; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO anon; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO authenticated; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO service_role; - - --- --- Name: FUNCTION citext_larger(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_le(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_lt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_ne(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_cmp(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_ge(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_gt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_le(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_lt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_smaller(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION create_clinic_tenant(p_name text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO postgres; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO anon; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO authenticated; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO service_role; - - --- --- Name: FUNCTION create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO postgres; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO anon; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO authenticated; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO service_role; - - --- --- Name: FUNCTION create_patient_intake_request_v2(p_token text, p_payload jsonb); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) FROM PUBLIC; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO postgres; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO anon; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO authenticated; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO service_role; - - --- --- Name: FUNCTION create_support_session(p_tenant_id uuid, p_ttl_minutes integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO postgres; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO anon; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO authenticated; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO service_role; - - --- --- Name: FUNCTION current_member_id(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION current_member_role(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION date_dist(date, date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.date_dist(date, date) TO postgres; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO anon; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO authenticated; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO service_role; - - --- --- Name: FUNCTION delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid); Type: ACL; Schema: public; Owner: postgres --- - -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO anon; -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO service_role; - - --- --- Name: FUNCTION delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO anon; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO service_role; - - --- --- Name: FUNCTION dev_list_auth_users(p_limit integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO postgres; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO anon; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO service_role; - - --- --- Name: FUNCTION dev_list_custom_users(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.dev_list_custom_users() FROM PUBLIC; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO postgres; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO anon; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO service_role; - - --- --- Name: FUNCTION dev_list_intent_leads(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.dev_list_intent_leads() FROM PUBLIC; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO postgres; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO anon; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO service_role; - - --- --- Name: FUNCTION dev_public_debug_snapshot(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO postgres; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO anon; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO authenticated; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO service_role; - - --- --- Name: FUNCTION ensure_personal_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO postgres; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO anon; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO service_role; - - --- --- Name: FUNCTION ensure_personal_tenant_for_user(p_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO service_role; - - --- --- Name: FUNCTION faq_votar(faq_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO anon; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO service_role; - - --- --- Name: FUNCTION fix_all_subscription_mismatches(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO postgres; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO anon; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO authenticated; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO service_role; - - --- --- Name: FUNCTION float4_dist(real, real); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO postgres; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO anon; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO authenticated; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO service_role; - - --- --- Name: FUNCTION float8_dist(double precision, double precision); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO postgres; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO anon; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO authenticated; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO service_role; - - --- --- Name: FUNCTION fn_agenda_regras_semanais_no_overlap(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO postgres; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO anon; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO authenticated; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO service_role; - - --- --- Name: FUNCTION gbt_bit_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_consistent(internal, bit, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_consistent(internal, boolean, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bpchar_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bpchar_consistent(internal, character, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_consistent(internal, bytea, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_consistent(internal, money, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_distance(internal, money, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_consistent(internal, date, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_distance(internal, date, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_consistent(internal, anyenum, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_consistent(internal, real, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_distance(internal, real, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_consistent(internal, double precision, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_distance(internal, double precision, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_consistent(internal, inet, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_consistent(internal, smallint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_distance(internal, smallint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_consistent(internal, integer, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_distance(internal, integer, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_consistent(internal, bigint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_distance(internal, bigint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_consistent(internal, interval, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_distance(internal, interval, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_consistent(internal, macaddr, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_consistent(internal, numeric, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_consistent(internal, oid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_distance(internal, oid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_consistent(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_distance(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_timetz_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_consistent(internal, uuid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_var_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_var_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO service_role; - - --- --- Name: FUNCTION get_my_email(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.get_my_email() FROM PUBLIC; -GRANT ALL ON FUNCTION public.get_my_email() TO postgres; -GRANT ALL ON FUNCTION public.get_my_email() TO anon; -GRANT ALL ON FUNCTION public.get_my_email() TO authenticated; -GRANT ALL ON FUNCTION public.get_my_email() TO service_role; - - --- --- Name: FUNCTION gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gin_extract_value_trgm(text, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO service_role; - - --- --- Name: FUNCTION gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_distance(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_options(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_same(public.gtrgm, public.gtrgm, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION guard_account_type_immutable(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO postgres; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO anon; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO authenticated; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO service_role; - - --- --- Name: FUNCTION guard_locked_commitment(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO postgres; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO anon; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO authenticated; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO service_role; - - --- --- Name: FUNCTION guard_no_change_core_plan_key(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO anon; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO service_role; - - --- --- Name: FUNCTION guard_no_change_plan_target(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO anon; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO service_role; - - --- --- Name: FUNCTION guard_no_delete_core_plans(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO anon; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO service_role; - - --- --- Name: FUNCTION guard_patient_cannot_own_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO postgres; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO anon; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO service_role; - - --- --- Name: FUNCTION guard_tenant_kind_immutable(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO postgres; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO anon; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO authenticated; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO service_role; - - --- --- Name: FUNCTION handle_new_user(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.handle_new_user() TO postgres; -GRANT ALL ON FUNCTION public.handle_new_user() TO anon; -GRANT ALL ON FUNCTION public.handle_new_user() TO authenticated; -GRANT ALL ON FUNCTION public.handle_new_user() TO service_role; - - --- --- Name: FUNCTION handle_new_user_create_personal_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO postgres; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO anon; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO service_role; - - --- --- Name: FUNCTION has_feature(p_owner_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION int2_dist(smallint, smallint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO postgres; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO anon; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO authenticated; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO service_role; - - --- --- Name: FUNCTION int4_dist(integer, integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO postgres; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO anon; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO authenticated; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO service_role; - - --- --- Name: FUNCTION int8_dist(bigint, bigint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO postgres; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO anon; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO authenticated; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO service_role; - - --- --- Name: FUNCTION interval_dist(interval, interval); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO postgres; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO anon; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO authenticated; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO service_role; - - --- --- Name: FUNCTION is_clinic_tenant(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_saas_admin(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_saas_admin() TO postgres; -GRANT ALL ON FUNCTION public.is_saas_admin() TO anon; -GRANT ALL ON FUNCTION public.is_saas_admin() TO authenticated; -GRANT ALL ON FUNCTION public.is_saas_admin() TO service_role; - - --- --- Name: FUNCTION is_tenant_admin(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_tenant_member(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_therapist_tenant(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION jwt_email(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.jwt_email() TO postgres; -GRANT ALL ON FUNCTION public.jwt_email() TO anon; -GRANT ALL ON FUNCTION public.jwt_email() TO authenticated; -GRANT ALL ON FUNCTION public.jwt_email() TO service_role; - - --- --- Name: FUNCTION my_tenants(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.my_tenants() TO postgres; -GRANT ALL ON FUNCTION public.my_tenants() TO anon; -GRANT ALL ON FUNCTION public.my_tenants() TO authenticated; -GRANT ALL ON FUNCTION public.my_tenants() TO service_role; - - --- --- Name: FUNCTION oid_dist(oid, oid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO postgres; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO anon; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO authenticated; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO service_role; - - --- --- Name: FUNCTION on_new_user_seed_patient_groups(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO postgres; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO anon; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO authenticated; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO service_role; - - --- --- Name: FUNCTION patients_validate_member_consistency(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO postgres; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO anon; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO authenticated; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO service_role; - - --- --- Name: FUNCTION patients_validate_responsible_member_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO postgres; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO anon; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO service_role; - - --- --- Name: FUNCTION prevent_promoting_to_system(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO postgres; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO anon; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO service_role; - - --- --- Name: FUNCTION prevent_saas_membership(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO postgres; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO anon; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO service_role; - - --- --- Name: FUNCTION prevent_system_group_changes(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO postgres; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO anon; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO service_role; - - --- --- Name: FUNCTION provision_account_tenant(p_user_id uuid, p_kind text, p_name text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO postgres; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO anon; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO authenticated; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO service_role; - - --- --- Name: FUNCTION reactivate_subscription(p_subscription_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO anon; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO service_role; - - --- --- Name: FUNCTION rebuild_owner_entitlements(p_owner_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO anon; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO service_role; - - --- --- Name: FUNCTION regexp_match(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_match(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_matches(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_matches(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_replace(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_replace(public.citext, public.citext, text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_array(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_array(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_table(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_table(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION replace(public.citext, public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION revoke_support_session(p_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO postgres; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO anon; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO authenticated; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO service_role; - - --- --- Name: FUNCTION rotate_patient_invite_token(p_new_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO postgres; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO anon; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO authenticated; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO service_role; - - --- --- Name: FUNCTION saas_votar_doc(p_doc_id uuid, p_util boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO postgres; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO anon; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO authenticated; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO service_role; - - --- --- Name: FUNCTION seed_determined_commitments(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION set_limit(real); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_limit(real) TO postgres; -GRANT ALL ON FUNCTION public.set_limit(real) TO anon; -GRANT ALL ON FUNCTION public.set_limit(real) TO authenticated; -GRANT ALL ON FUNCTION public.set_limit(real) TO service_role; - - --- --- Name: FUNCTION set_owner_id(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_owner_id() TO postgres; -GRANT ALL ON FUNCTION public.set_owner_id() TO anon; -GRANT ALL ON FUNCTION public.set_owner_id() TO authenticated; -GRANT ALL ON FUNCTION public.set_owner_id() TO service_role; - - --- --- Name: FUNCTION set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO postgres; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO anon; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO authenticated; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO service_role; - - --- --- Name: FUNCTION set_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_updated_at() TO service_role; - - --- --- Name: FUNCTION set_updated_at_recurrence(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO postgres; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO anon; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO authenticated; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO service_role; - - --- --- Name: FUNCTION show_limit(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.show_limit() TO postgres; -GRANT ALL ON FUNCTION public.show_limit() TO anon; -GRANT ALL ON FUNCTION public.show_limit() TO authenticated; -GRANT ALL ON FUNCTION public.show_limit() TO service_role; - - --- --- Name: FUNCTION show_trgm(text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.show_trgm(text) TO postgres; -GRANT ALL ON FUNCTION public.show_trgm(text) TO anon; -GRANT ALL ON FUNCTION public.show_trgm(text) TO authenticated; -GRANT ALL ON FUNCTION public.show_trgm(text) TO service_role; - - --- --- Name: FUNCTION similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity(text, text) TO service_role; - - --- --- Name: FUNCTION similarity_dist(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO service_role; - - --- --- Name: FUNCTION similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION split_part(public.citext, public.citext, integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO postgres; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO anon; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO authenticated; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO service_role; - - --- --- Name: FUNCTION split_recurrence_at(p_recurrence_id uuid, p_from_date date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO postgres; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO anon; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO authenticated; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_dist_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_dist_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION strpos(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION subscription_intents_view_insert(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO postgres; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO anon; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO authenticated; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO service_role; - - --- --- Name: FUNCTION subscriptions_validate_scope(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO postgres; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO anon; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO authenticated; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO service_role; - - --- --- Name: FUNCTION sync_busy_mirror_agenda_eventos(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO postgres; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO anon; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO authenticated; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO service_role; - - --- --- Name: FUNCTION tenant_accept_invite(p_token uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO service_role; - - --- --- Name: TABLE tenant_members; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_members TO postgres; -GRANT SELECT,REFERENCES,TRIGGER,TRUNCATE,MAINTAIN ON TABLE public.tenant_members TO authenticated; -GRANT ALL ON TABLE public.tenant_members TO service_role; - - --- --- Name: FUNCTION tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_feature_allowed(p_tenant_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION tenant_feature_enabled(p_tenant_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION tenant_features_guard_with_plan(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO postgres; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO anon; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO authenticated; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO service_role; - - --- --- Name: FUNCTION tenant_has_feature(_tenant_id uuid, _feature text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO anon; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO service_role; - - --- --- Name: FUNCTION tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) FROM PUBLIC; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO anon; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO service_role; - - --- --- Name: FUNCTION tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO service_role; - - --- --- Name: FUNCTION texticlike(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticlike(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticnlike(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticnlike(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticregexeq(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticregexeq(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticregexne(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticregexne(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION time_dist(time without time zone, time without time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO postgres; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO anon; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO authenticated; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO service_role; - - --- --- Name: FUNCTION toggle_plan(owner uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO postgres; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO anon; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO authenticated; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO service_role; - - --- --- Name: FUNCTION transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO postgres; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO anon; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO authenticated; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO service_role; - - --- --- Name: FUNCTION translate(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION ts_dist(timestamp without time zone, timestamp without time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO postgres; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO anon; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO authenticated; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO service_role; - - --- --- Name: FUNCTION tstz_dist(timestamp with time zone, timestamp with time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO postgres; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO anon; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO authenticated; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO service_role; - - --- --- Name: FUNCTION update_payment_settings_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO anon; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO service_role; - - --- --- Name: FUNCTION update_professional_pricing_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO anon; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO service_role; - - --- --- Name: FUNCTION user_has_feature(_user_id uuid, _feature text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO postgres; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO anon; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO authenticated; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO service_role; - - --- --- Name: FUNCTION validate_support_session(p_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO postgres; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO anon; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO authenticated; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO service_role; - - --- --- Name: FUNCTION whoami(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.whoami() TO postgres; -GRANT ALL ON FUNCTION public.whoami() TO anon; -GRANT ALL ON FUNCTION public.whoami() TO authenticated; -GRANT ALL ON FUNCTION public.whoami() TO service_role; - - --- --- Name: FUNCTION word_similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_dist_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_dist_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION apply_rls(wal jsonb, max_record_bytes integer); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO postgres; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO anon; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO authenticated; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO service_role; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO supabase_realtime_admin; - - --- --- Name: FUNCTION broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) TO postgres; -GRANT ALL ON FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) TO dashboard_user; - - --- --- Name: FUNCTION build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO postgres; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO anon; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO authenticated; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO service_role; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO supabase_realtime_admin; - - --- --- Name: FUNCTION "cast"(val text, type_ regtype); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO postgres; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO dashboard_user; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO anon; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO authenticated; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO service_role; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO supabase_realtime_admin; - - --- --- Name: FUNCTION check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO postgres; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO anon; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO authenticated; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO service_role; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO supabase_realtime_admin; - - --- --- Name: FUNCTION is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO postgres; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO anon; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO authenticated; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO service_role; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO supabase_realtime_admin; - - --- --- Name: FUNCTION list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO postgres; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO anon; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO authenticated; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO service_role; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO supabase_realtime_admin; - - --- --- Name: FUNCTION quote_wal2json(entity regclass); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO postgres; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO anon; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO authenticated; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO service_role; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO supabase_realtime_admin; - - --- --- Name: FUNCTION send(payload jsonb, event text, topic text, private boolean); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) TO postgres; -GRANT ALL ON FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) TO dashboard_user; - - --- --- Name: FUNCTION subscription_check_filters(); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO postgres; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO dashboard_user; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO anon; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO authenticated; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO service_role; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO supabase_realtime_admin; - - --- --- Name: FUNCTION to_regrole(role_name text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO postgres; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO anon; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO authenticated; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO service_role; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO supabase_realtime_admin; - - --- --- Name: FUNCTION topic(); Type: ACL; Schema: realtime; Owner: supabase_realtime_admin --- - -GRANT ALL ON FUNCTION realtime.topic() TO postgres; -GRANT ALL ON FUNCTION realtime.topic() TO dashboard_user; - - --- --- Name: FUNCTION http_request(); Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -REVOKE ALL ON FUNCTION supabase_functions.http_request() FROM PUBLIC; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO postgres; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO anon; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO authenticated; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO service_role; - - --- --- Name: FUNCTION _crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault._crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault._crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea) TO service_role; - - --- --- Name: FUNCTION create_secret(new_secret text, new_name text, new_description text, new_key_id uuid); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault.create_secret(new_secret text, new_name text, new_description text, new_key_id uuid) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault.create_secret(new_secret text, new_name text, new_description text, new_key_id uuid) TO service_role; - - --- --- Name: FUNCTION update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault.update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault.update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid) TO service_role; - - --- --- Name: FUNCTION max(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.max(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.max(public.citext) TO anon; -GRANT ALL ON FUNCTION public.max(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.max(public.citext) TO service_role; - - --- --- Name: FUNCTION min(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.min(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.min(public.citext) TO anon; -GRANT ALL ON FUNCTION public.min(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.min(public.citext) TO service_role; - - --- --- Name: TABLE audit_log_entries; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.audit_log_entries TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.audit_log_entries TO postgres; -GRANT SELECT ON TABLE auth.audit_log_entries TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE flow_state; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.flow_state TO postgres; -GRANT SELECT ON TABLE auth.flow_state TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.flow_state TO dashboard_user; - - --- --- Name: TABLE identities; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.identities TO postgres; -GRANT SELECT ON TABLE auth.identities TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.identities TO dashboard_user; - - --- --- Name: TABLE instances; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.instances TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.instances TO postgres; -GRANT SELECT ON TABLE auth.instances TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE mfa_amr_claims; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_amr_claims TO postgres; -GRANT SELECT ON TABLE auth.mfa_amr_claims TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_amr_claims TO dashboard_user; - - --- --- Name: TABLE mfa_challenges; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_challenges TO postgres; -GRANT SELECT ON TABLE auth.mfa_challenges TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_challenges TO dashboard_user; - - --- --- Name: TABLE mfa_factors; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_factors TO postgres; -GRANT SELECT ON TABLE auth.mfa_factors TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_factors TO dashboard_user; - - --- --- Name: TABLE oauth_authorizations; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_authorizations TO postgres; -GRANT ALL ON TABLE auth.oauth_authorizations TO dashboard_user; - - --- --- Name: TABLE oauth_client_states; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_client_states TO postgres; -GRANT ALL ON TABLE auth.oauth_client_states TO dashboard_user; - - --- --- Name: TABLE oauth_clients; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_clients TO postgres; -GRANT ALL ON TABLE auth.oauth_clients TO dashboard_user; - - --- --- Name: TABLE oauth_consents; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_consents TO postgres; -GRANT ALL ON TABLE auth.oauth_consents TO dashboard_user; - - --- --- Name: TABLE one_time_tokens; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.one_time_tokens TO postgres; -GRANT SELECT ON TABLE auth.one_time_tokens TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.one_time_tokens TO dashboard_user; - - --- --- Name: TABLE refresh_tokens; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.refresh_tokens TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.refresh_tokens TO postgres; -GRANT SELECT ON TABLE auth.refresh_tokens TO postgres WITH GRANT OPTION; - - --- --- Name: SEQUENCE refresh_tokens_id_seq; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO dashboard_user; -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO postgres; - - --- --- Name: TABLE saml_providers; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.saml_providers TO postgres; -GRANT SELECT ON TABLE auth.saml_providers TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.saml_providers TO dashboard_user; - - --- --- Name: TABLE saml_relay_states; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.saml_relay_states TO postgres; -GRANT SELECT ON TABLE auth.saml_relay_states TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.saml_relay_states TO dashboard_user; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT SELECT ON TABLE auth.schema_migrations TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE sessions; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sessions TO postgres; -GRANT SELECT ON TABLE auth.sessions TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sessions TO dashboard_user; - - --- --- Name: TABLE sso_domains; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sso_domains TO postgres; -GRANT SELECT ON TABLE auth.sso_domains TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sso_domains TO dashboard_user; - - --- --- Name: TABLE sso_providers; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sso_providers TO postgres; -GRANT SELECT ON TABLE auth.sso_providers TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sso_providers TO dashboard_user; - - --- --- Name: TABLE users; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.users TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.users TO postgres; -GRANT SELECT ON TABLE auth.users TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE pg_stat_statements; Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON TABLE extensions.pg_stat_statements TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE pg_stat_statements_info; Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON TABLE extensions.pg_stat_statements_info TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE agenda_bloqueios; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_bloqueios TO postgres; -GRANT ALL ON TABLE public.agenda_bloqueios TO anon; -GRANT ALL ON TABLE public.agenda_bloqueios TO authenticated; -GRANT ALL ON TABLE public.agenda_bloqueios TO service_role; - - --- --- Name: TABLE agenda_configuracoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_configuracoes TO postgres; -GRANT ALL ON TABLE public.agenda_configuracoes TO anon; -GRANT ALL ON TABLE public.agenda_configuracoes TO authenticated; -GRANT ALL ON TABLE public.agenda_configuracoes TO service_role; - - --- --- Name: TABLE agenda_eventos; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_eventos TO postgres; -GRANT ALL ON TABLE public.agenda_eventos TO anon; -GRANT ALL ON TABLE public.agenda_eventos TO authenticated; -GRANT ALL ON TABLE public.agenda_eventos TO service_role; - - --- --- Name: TABLE agenda_excecoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_excecoes TO postgres; -GRANT ALL ON TABLE public.agenda_excecoes TO anon; -GRANT ALL ON TABLE public.agenda_excecoes TO authenticated; -GRANT ALL ON TABLE public.agenda_excecoes TO service_role; - - --- --- Name: TABLE agenda_online_slots; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_online_slots TO postgres; -GRANT ALL ON TABLE public.agenda_online_slots TO anon; -GRANT ALL ON TABLE public.agenda_online_slots TO authenticated; -GRANT ALL ON TABLE public.agenda_online_slots TO service_role; - - --- --- Name: SEQUENCE agenda_online_slots_id_seq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO postgres; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO anon; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO authenticated; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO service_role; - - --- --- Name: TABLE agenda_regras_semanais; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_regras_semanais TO postgres; -GRANT ALL ON TABLE public.agenda_regras_semanais TO anon; -GRANT ALL ON TABLE public.agenda_regras_semanais TO authenticated; -GRANT ALL ON TABLE public.agenda_regras_semanais TO service_role; - - --- --- Name: TABLE agenda_slots_bloqueados_semanais; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO postgres; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO anon; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO authenticated; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO service_role; - - --- --- Name: TABLE agenda_slots_regras; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_slots_regras TO postgres; -GRANT ALL ON TABLE public.agenda_slots_regras TO anon; -GRANT ALL ON TABLE public.agenda_slots_regras TO authenticated; -GRANT ALL ON TABLE public.agenda_slots_regras TO service_role; - - --- --- Name: TABLE agendador_configuracoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agendador_configuracoes TO postgres; -GRANT ALL ON TABLE public.agendador_configuracoes TO anon; -GRANT ALL ON TABLE public.agendador_configuracoes TO authenticated; -GRANT ALL ON TABLE public.agendador_configuracoes TO service_role; - - --- --- Name: TABLE agendador_solicitacoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agendador_solicitacoes TO postgres; -GRANT ALL ON TABLE public.agendador_solicitacoes TO anon; -GRANT ALL ON TABLE public.agendador_solicitacoes TO authenticated; -GRANT ALL ON TABLE public.agendador_solicitacoes TO service_role; - - --- --- Name: TABLE commitment_time_logs; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.commitment_time_logs TO postgres; -GRANT ALL ON TABLE public.commitment_time_logs TO anon; -GRANT ALL ON TABLE public.commitment_time_logs TO authenticated; -GRANT ALL ON TABLE public.commitment_time_logs TO service_role; - - --- --- Name: TABLE current_tenant_id; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.current_tenant_id TO postgres; -GRANT ALL ON TABLE public.current_tenant_id TO anon; -GRANT ALL ON TABLE public.current_tenant_id TO authenticated; -GRANT ALL ON TABLE public.current_tenant_id TO service_role; - - --- --- Name: TABLE determined_commitment_fields; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.determined_commitment_fields TO postgres; -GRANT ALL ON TABLE public.determined_commitment_fields TO anon; -GRANT ALL ON TABLE public.determined_commitment_fields TO authenticated; -GRANT ALL ON TABLE public.determined_commitment_fields TO service_role; - - --- --- Name: TABLE determined_commitments; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.determined_commitments TO postgres; -GRANT ALL ON TABLE public.determined_commitments TO anon; -GRANT ALL ON TABLE public.determined_commitments TO authenticated; -GRANT ALL ON TABLE public.determined_commitments TO service_role; - - --- --- Name: TABLE dev_user_credentials; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.dev_user_credentials TO postgres; -GRANT ALL ON TABLE public.dev_user_credentials TO anon; -GRANT ALL ON TABLE public.dev_user_credentials TO authenticated; -GRANT ALL ON TABLE public.dev_user_credentials TO service_role; - - --- --- Name: TABLE entitlements_invalidation; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.entitlements_invalidation TO postgres; -GRANT ALL ON TABLE public.entitlements_invalidation TO anon; -GRANT ALL ON TABLE public.entitlements_invalidation TO authenticated; -GRANT ALL ON TABLE public.entitlements_invalidation TO service_role; - - --- --- Name: TABLE features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.features TO postgres; -GRANT ALL ON TABLE public.features TO anon; -GRANT ALL ON TABLE public.features TO authenticated; -GRANT ALL ON TABLE public.features TO service_role; - - --- --- Name: TABLE feriados; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.feriados TO postgres; -GRANT ALL ON TABLE public.feriados TO anon; -GRANT ALL ON TABLE public.feriados TO authenticated; -GRANT ALL ON TABLE public.feriados TO service_role; - - --- --- Name: TABLE module_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.module_features TO postgres; -GRANT ALL ON TABLE public.module_features TO anon; -GRANT ALL ON TABLE public.module_features TO authenticated; -GRANT ALL ON TABLE public.module_features TO service_role; - - --- --- Name: TABLE modules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.modules TO postgres; -GRANT ALL ON TABLE public.modules TO anon; -GRANT ALL ON TABLE public.modules TO authenticated; -GRANT ALL ON TABLE public.modules TO service_role; - - --- --- Name: TABLE plan_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_features TO postgres; -GRANT ALL ON TABLE public.plan_features TO anon; -GRANT ALL ON TABLE public.plan_features TO authenticated; -GRANT ALL ON TABLE public.plan_features TO service_role; - - --- --- Name: TABLE tenant_modules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_modules TO postgres; -GRANT ALL ON TABLE public.tenant_modules TO anon; -GRANT ALL ON TABLE public.tenant_modules TO authenticated; -GRANT ALL ON TABLE public.tenant_modules TO service_role; - - --- --- Name: TABLE owner_feature_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.owner_feature_entitlements TO postgres; -GRANT ALL ON TABLE public.owner_feature_entitlements TO anon; -GRANT ALL ON TABLE public.owner_feature_entitlements TO authenticated; -GRANT ALL ON TABLE public.owner_feature_entitlements TO service_role; - - --- --- Name: TABLE owner_users; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.owner_users TO postgres; -GRANT ALL ON TABLE public.owner_users TO anon; -GRANT ALL ON TABLE public.owner_users TO authenticated; -GRANT ALL ON TABLE public.owner_users TO service_role; - - --- --- Name: TABLE patient_group_patient; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_group_patient TO postgres; -GRANT ALL ON TABLE public.patient_group_patient TO anon; -GRANT ALL ON TABLE public.patient_group_patient TO authenticated; -GRANT ALL ON TABLE public.patient_group_patient TO service_role; - - --- --- Name: TABLE patient_groups; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_groups TO postgres; -GRANT ALL ON TABLE public.patient_groups TO anon; -GRANT ALL ON TABLE public.patient_groups TO authenticated; -GRANT ALL ON TABLE public.patient_groups TO service_role; - - --- --- Name: TABLE patient_intake_requests; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_intake_requests TO postgres; -GRANT ALL ON TABLE public.patient_intake_requests TO authenticated; -GRANT ALL ON TABLE public.patient_intake_requests TO service_role; - - --- --- Name: TABLE patient_invites; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_invites TO postgres; -GRANT ALL ON TABLE public.patient_invites TO authenticated; -GRANT ALL ON TABLE public.patient_invites TO service_role; - - --- --- Name: TABLE patient_patient_tag; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_patient_tag TO postgres; -GRANT ALL ON TABLE public.patient_patient_tag TO anon; -GRANT ALL ON TABLE public.patient_patient_tag TO authenticated; -GRANT ALL ON TABLE public.patient_patient_tag TO service_role; - - --- --- Name: TABLE patient_tags; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_tags TO postgres; -GRANT ALL ON TABLE public.patient_tags TO anon; -GRANT ALL ON TABLE public.patient_tags TO authenticated; -GRANT ALL ON TABLE public.patient_tags TO service_role; - - --- --- Name: TABLE patients; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patients TO postgres; -GRANT ALL ON TABLE public.patients TO anon; -GRANT ALL ON TABLE public.patients TO authenticated; -GRANT ALL ON TABLE public.patients TO service_role; - - --- --- Name: TABLE payment_settings; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.payment_settings TO postgres; -GRANT ALL ON TABLE public.payment_settings TO anon; -GRANT ALL ON TABLE public.payment_settings TO authenticated; -GRANT ALL ON TABLE public.payment_settings TO service_role; - - --- --- Name: TABLE plan_prices; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_prices TO postgres; -GRANT ALL ON TABLE public.plan_prices TO anon; -GRANT ALL ON TABLE public.plan_prices TO authenticated; -GRANT ALL ON TABLE public.plan_prices TO service_role; - - --- --- Name: TABLE plan_public; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_public TO postgres; -GRANT ALL ON TABLE public.plan_public TO anon; -GRANT ALL ON TABLE public.plan_public TO authenticated; -GRANT ALL ON TABLE public.plan_public TO service_role; - - --- --- Name: TABLE plan_public_bullets; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_public_bullets TO postgres; -GRANT ALL ON TABLE public.plan_public_bullets TO anon; -GRANT ALL ON TABLE public.plan_public_bullets TO authenticated; -GRANT ALL ON TABLE public.plan_public_bullets TO service_role; - - --- --- Name: TABLE plans; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plans TO postgres; -GRANT ALL ON TABLE public.plans TO anon; -GRANT ALL ON TABLE public.plans TO authenticated; -GRANT ALL ON TABLE public.plans TO service_role; - - --- --- Name: TABLE professional_pricing; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.professional_pricing TO postgres; -GRANT ALL ON TABLE public.professional_pricing TO anon; -GRANT ALL ON TABLE public.professional_pricing TO authenticated; -GRANT ALL ON TABLE public.professional_pricing TO service_role; - - --- --- Name: TABLE profiles; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.profiles TO postgres; -GRANT ALL ON TABLE public.profiles TO anon; -GRANT ALL ON TABLE public.profiles TO authenticated; -GRANT ALL ON TABLE public.profiles TO service_role; - - --- --- Name: TABLE recurrence_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_exceptions TO postgres; -GRANT ALL ON TABLE public.recurrence_exceptions TO anon; -GRANT ALL ON TABLE public.recurrence_exceptions TO authenticated; -GRANT ALL ON TABLE public.recurrence_exceptions TO service_role; - - --- --- Name: TABLE recurrence_rules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_rules TO postgres; -GRANT ALL ON TABLE public.recurrence_rules TO anon; -GRANT ALL ON TABLE public.recurrence_rules TO authenticated; -GRANT ALL ON TABLE public.recurrence_rules TO service_role; - - --- --- Name: TABLE saas_admins; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_admins TO postgres; -GRANT ALL ON TABLE public.saas_admins TO anon; -GRANT ALL ON TABLE public.saas_admins TO authenticated; -GRANT ALL ON TABLE public.saas_admins TO service_role; - - --- --- Name: TABLE saas_doc_votos; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_doc_votos TO postgres; -GRANT ALL ON TABLE public.saas_doc_votos TO anon; -GRANT ALL ON TABLE public.saas_doc_votos TO authenticated; -GRANT ALL ON TABLE public.saas_doc_votos TO service_role; - - --- --- Name: TABLE saas_docs; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_docs TO postgres; -GRANT ALL ON TABLE public.saas_docs TO anon; -GRANT ALL ON TABLE public.saas_docs TO authenticated; -GRANT ALL ON TABLE public.saas_docs TO service_role; - - --- --- Name: TABLE saas_faq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_faq TO postgres; -GRANT ALL ON TABLE public.saas_faq TO anon; -GRANT ALL ON TABLE public.saas_faq TO authenticated; -GRANT ALL ON TABLE public.saas_faq TO service_role; - - --- --- Name: TABLE saas_faq_itens; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_faq_itens TO postgres; -GRANT ALL ON TABLE public.saas_faq_itens TO anon; -GRANT ALL ON TABLE public.saas_faq_itens TO authenticated; -GRANT ALL ON TABLE public.saas_faq_itens TO service_role; - - --- --- Name: TABLE subscription_events; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_events TO postgres; -GRANT ALL ON TABLE public.subscription_events TO anon; -GRANT ALL ON TABLE public.subscription_events TO authenticated; -GRANT ALL ON TABLE public.subscription_events TO service_role; - - --- --- Name: TABLE subscription_intents_personal; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_personal TO postgres; -GRANT ALL ON TABLE public.subscription_intents_personal TO anon; -GRANT ALL ON TABLE public.subscription_intents_personal TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_personal TO service_role; - - --- --- Name: TABLE subscription_intents_tenant; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_tenant TO postgres; -GRANT ALL ON TABLE public.subscription_intents_tenant TO anon; -GRANT ALL ON TABLE public.subscription_intents_tenant TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_tenant TO service_role; - - --- --- Name: TABLE subscription_intents; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents TO postgres; -GRANT ALL ON TABLE public.subscription_intents TO anon; -GRANT ALL ON TABLE public.subscription_intents TO authenticated; -GRANT ALL ON TABLE public.subscription_intents TO service_role; - - --- --- Name: TABLE subscription_intents_legacy; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_legacy TO postgres; -GRANT ALL ON TABLE public.subscription_intents_legacy TO anon; -GRANT ALL ON TABLE public.subscription_intents_legacy TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_legacy TO service_role; - - --- --- Name: TABLE support_sessions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.support_sessions TO postgres; -GRANT ALL ON TABLE public.support_sessions TO anon; -GRANT ALL ON TABLE public.support_sessions TO authenticated; -GRANT ALL ON TABLE public.support_sessions TO service_role; - - --- --- Name: TABLE tenant_feature_exceptions_log; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO postgres; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO anon; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO authenticated; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO service_role; - - --- --- Name: TABLE tenant_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_features TO postgres; -GRANT ALL ON TABLE public.tenant_features TO anon; -GRANT ALL ON TABLE public.tenant_features TO authenticated; -GRANT ALL ON TABLE public.tenant_features TO service_role; - - --- --- Name: TABLE tenant_invites; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_invites TO postgres; -GRANT ALL ON TABLE public.tenant_invites TO authenticated; -GRANT ALL ON TABLE public.tenant_invites TO service_role; - - --- --- Name: TABLE tenants; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenants TO postgres; -GRANT ALL ON TABLE public.tenants TO anon; -GRANT ALL ON TABLE public.tenants TO authenticated; -GRANT ALL ON TABLE public.tenants TO service_role; - - --- --- Name: TABLE user_settings; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.user_settings TO postgres; -GRANT ALL ON TABLE public.user_settings TO anon; -GRANT ALL ON TABLE public.user_settings TO authenticated; -GRANT ALL ON TABLE public.user_settings TO service_role; - - --- --- Name: TABLE v_auth_users_public; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_auth_users_public TO postgres; -GRANT ALL ON TABLE public.v_auth_users_public TO anon; -GRANT ALL ON TABLE public.v_auth_users_public TO authenticated; -GRANT ALL ON TABLE public.v_auth_users_public TO service_role; - - --- --- Name: TABLE v_commitment_totals; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_commitment_totals TO postgres; -GRANT ALL ON TABLE public.v_commitment_totals TO anon; -GRANT ALL ON TABLE public.v_commitment_totals TO authenticated; -GRANT ALL ON TABLE public.v_commitment_totals TO service_role; - - --- --- Name: TABLE v_patient_groups_with_counts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO postgres; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO anon; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO authenticated; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO service_role; - - --- --- Name: TABLE v_plan_active_prices; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_plan_active_prices TO postgres; -GRANT ALL ON TABLE public.v_plan_active_prices TO anon; -GRANT ALL ON TABLE public.v_plan_active_prices TO authenticated; -GRANT ALL ON TABLE public.v_plan_active_prices TO service_role; - - --- --- Name: TABLE v_public_pricing; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_public_pricing TO postgres; -GRANT ALL ON TABLE public.v_public_pricing TO anon; -GRANT ALL ON TABLE public.v_public_pricing TO authenticated; -GRANT ALL ON TABLE public.v_public_pricing TO service_role; - - --- --- Name: TABLE v_subscription_feature_mismatch; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO postgres; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO anon; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO authenticated; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO service_role; - - --- --- Name: TABLE v_subscription_health; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_health TO postgres; -GRANT ALL ON TABLE public.v_subscription_health TO anon; -GRANT ALL ON TABLE public.v_subscription_health TO authenticated; -GRANT ALL ON TABLE public.v_subscription_health TO service_role; - - --- --- Name: TABLE v_subscription_health_v2; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_health_v2 TO postgres; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO anon; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO authenticated; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO service_role; - - --- --- Name: TABLE v_tag_patient_counts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tag_patient_counts TO postgres; -GRANT ALL ON TABLE public.v_tag_patient_counts TO anon; -GRANT ALL ON TABLE public.v_tag_patient_counts TO authenticated; -GRANT ALL ON TABLE public.v_tag_patient_counts TO service_role; - - --- --- Name: TABLE v_tenant_active_subscription; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_active_subscription TO postgres; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO anon; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO authenticated; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO service_role; - - --- --- Name: TABLE v_tenant_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements TO service_role; - - --- --- Name: TABLE v_tenant_entitlements_full; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO service_role; - - --- --- Name: TABLE v_tenant_entitlements_json; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO service_role; - - --- --- Name: TABLE v_tenant_feature_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO postgres; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO anon; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO authenticated; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO service_role; - - --- --- Name: TABLE v_tenant_feature_mismatch; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO postgres; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO anon; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO authenticated; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO service_role; - - --- --- Name: TABLE v_tenant_members_with_profiles; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO postgres; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO anon; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO authenticated; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO service_role; - - --- --- Name: TABLE v_tenant_people; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_people TO postgres; -GRANT ALL ON TABLE public.v_tenant_people TO anon; -GRANT ALL ON TABLE public.v_tenant_people TO authenticated; -GRANT ALL ON TABLE public.v_tenant_people TO service_role; - - --- --- Name: TABLE v_tenant_staff; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_staff TO postgres; -GRANT ALL ON TABLE public.v_tenant_staff TO anon; -GRANT ALL ON TABLE public.v_tenant_staff TO authenticated; -GRANT ALL ON TABLE public.v_tenant_staff TO service_role; - - --- --- Name: TABLE v_user_active_subscription; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_user_active_subscription TO postgres; -GRANT ALL ON TABLE public.v_user_active_subscription TO anon; -GRANT ALL ON TABLE public.v_user_active_subscription TO authenticated; -GRANT ALL ON TABLE public.v_user_active_subscription TO service_role; - - --- --- Name: TABLE v_user_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_user_entitlements TO postgres; -GRANT ALL ON TABLE public.v_user_entitlements TO anon; -GRANT ALL ON TABLE public.v_user_entitlements TO authenticated; -GRANT ALL ON TABLE public.v_user_entitlements TO service_role; - - --- --- Name: TABLE messages; Type: ACL; Schema: realtime; Owner: supabase_realtime_admin --- - -GRANT ALL ON TABLE realtime.messages TO postgres; -GRANT ALL ON TABLE realtime.messages TO dashboard_user; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO anon; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO authenticated; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO service_role; - - --- --- Name: TABLE messages_2026_03_09; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_09 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_09 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_10; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_10 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_10 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_11; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_11 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_11 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_12; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_12 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_12 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_13; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_13 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_13 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_14; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_14 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_14 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_15; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_15 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_15 TO dashboard_user; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.schema_migrations TO postgres; -GRANT ALL ON TABLE realtime.schema_migrations TO dashboard_user; -GRANT SELECT ON TABLE realtime.schema_migrations TO anon; -GRANT SELECT ON TABLE realtime.schema_migrations TO authenticated; -GRANT SELECT ON TABLE realtime.schema_migrations TO service_role; -GRANT ALL ON TABLE realtime.schema_migrations TO supabase_realtime_admin; - - --- --- Name: TABLE subscription; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.subscription TO postgres; -GRANT ALL ON TABLE realtime.subscription TO dashboard_user; -GRANT SELECT ON TABLE realtime.subscription TO anon; -GRANT SELECT ON TABLE realtime.subscription TO authenticated; -GRANT SELECT ON TABLE realtime.subscription TO service_role; -GRANT ALL ON TABLE realtime.subscription TO supabase_realtime_admin; - - --- --- Name: SEQUENCE subscription_id_seq; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO postgres; -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO dashboard_user; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO anon; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO authenticated; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO service_role; -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO supabase_realtime_admin; - - --- --- Name: TABLE buckets; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE storage.buckets TO service_role; -GRANT ALL ON TABLE storage.buckets TO authenticated; -GRANT ALL ON TABLE storage.buckets TO anon; - - --- --- Name: TABLE buckets_analytics; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets_analytics TO service_role; -GRANT ALL ON TABLE storage.buckets_analytics TO authenticated; -GRANT ALL ON TABLE storage.buckets_analytics TO anon; - - --- --- Name: TABLE buckets_vectors; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT SELECT ON TABLE storage.buckets_vectors TO service_role; -GRANT SELECT ON TABLE storage.buckets_vectors TO authenticated; -GRANT SELECT ON TABLE storage.buckets_vectors TO anon; - - --- --- Name: TABLE iceberg_namespaces; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.iceberg_namespaces TO service_role; -GRANT SELECT ON TABLE storage.iceberg_namespaces TO authenticated; -GRANT SELECT ON TABLE storage.iceberg_namespaces TO anon; - - --- --- Name: TABLE iceberg_tables; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.iceberg_tables TO service_role; -GRANT SELECT ON TABLE storage.iceberg_tables TO authenticated; -GRANT SELECT ON TABLE storage.iceberg_tables TO anon; - - --- --- Name: TABLE objects; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.objects TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE storage.objects TO service_role; -GRANT ALL ON TABLE storage.objects TO authenticated; -GRANT ALL ON TABLE storage.objects TO anon; - - --- --- Name: TABLE s3_multipart_uploads; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.s3_multipart_uploads TO service_role; -GRANT SELECT ON TABLE storage.s3_multipart_uploads TO authenticated; -GRANT SELECT ON TABLE storage.s3_multipart_uploads TO anon; - - --- --- Name: TABLE s3_multipart_uploads_parts; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.s3_multipart_uploads_parts TO service_role; -GRANT SELECT ON TABLE storage.s3_multipart_uploads_parts TO authenticated; -GRANT SELECT ON TABLE storage.s3_multipart_uploads_parts TO anon; - - --- --- Name: TABLE vector_indexes; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT SELECT ON TABLE storage.vector_indexes TO service_role; -GRANT SELECT ON TABLE storage.vector_indexes TO authenticated; -GRANT SELECT ON TABLE storage.vector_indexes TO anon; - - --- --- Name: TABLE hooks; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON TABLE supabase_functions.hooks TO postgres; -GRANT ALL ON TABLE supabase_functions.hooks TO anon; -GRANT ALL ON TABLE supabase_functions.hooks TO authenticated; -GRANT ALL ON TABLE supabase_functions.hooks TO service_role; - - --- --- Name: SEQUENCE hooks_id_seq; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO postgres; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO anon; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO authenticated; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO service_role; - - --- --- Name: TABLE migrations; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON TABLE supabase_functions.migrations TO postgres; -GRANT ALL ON TABLE supabase_functions.migrations TO anon; -GRANT ALL ON TABLE supabase_functions.migrations TO authenticated; -GRANT ALL ON TABLE supabase_functions.migrations TO service_role; - - --- --- Name: TABLE secrets; Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT SELECT,REFERENCES,DELETE,TRUNCATE ON TABLE vault.secrets TO postgres WITH GRANT OPTION; -GRANT SELECT,DELETE ON TABLE vault.secrets TO service_role; - - --- --- Name: TABLE decrypted_secrets; Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT SELECT,REFERENCES,DELETE,TRUNCATE ON TABLE vault.decrypted_secrets TO postgres WITH GRANT OPTION; -GRANT SELECT,DELETE ON TABLE vault.decrypted_secrets TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON SEQUENCES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON FUNCTIONS TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON TABLES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON SEQUENCES TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON FUNCTIONS TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON TABLES TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON SEQUENCES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON FUNCTIONS TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON TABLES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO service_role; - - --- --- Name: issue_graphql_placeholder; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_graphql_placeholder ON sql_drop - WHEN TAG IN ('DROP EXTENSION') - EXECUTE FUNCTION extensions.set_graphql_placeholder(); - - -ALTER EVENT TRIGGER issue_graphql_placeholder OWNER TO supabase_admin; - --- --- Name: issue_pg_cron_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_cron_access ON ddl_command_end - WHEN TAG IN ('CREATE EXTENSION') - EXECUTE FUNCTION extensions.grant_pg_cron_access(); - - -ALTER EVENT TRIGGER issue_pg_cron_access OWNER TO supabase_admin; - --- --- Name: issue_pg_graphql_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_graphql_access ON ddl_command_end - WHEN TAG IN ('CREATE FUNCTION') - EXECUTE FUNCTION extensions.grant_pg_graphql_access(); - - -ALTER EVENT TRIGGER issue_pg_graphql_access OWNER TO supabase_admin; - --- --- Name: issue_pg_net_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_net_access ON ddl_command_end - WHEN TAG IN ('CREATE EXTENSION') - EXECUTE FUNCTION extensions.grant_pg_net_access(); - - -ALTER EVENT TRIGGER issue_pg_net_access OWNER TO supabase_admin; - --- --- Name: pgrst_ddl_watch; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER pgrst_ddl_watch ON ddl_command_end - EXECUTE FUNCTION extensions.pgrst_ddl_watch(); - - -ALTER EVENT TRIGGER pgrst_ddl_watch OWNER TO supabase_admin; - --- --- Name: pgrst_drop_watch; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop - EXECUTE FUNCTION extensions.pgrst_drop_watch(); - - -ALTER EVENT TRIGGER pgrst_drop_watch OWNER TO supabase_admin; - --- --- PostgreSQL database dump complete --- - -\unrestrict 9bHVG2mCJlFIsM9VG52U52tbNZAgdYvv06RBgjMuM391ZzgcAGwa0O040leLtAl - diff --git a/DBS/2026-03-14/schema.sql b/DBS/2026-03-14/schema.sql deleted file mode 100644 index 8bfb3c2..0000000 --- a/DBS/2026-03-14/schema.sql +++ /dev/null @@ -1,21773 +0,0 @@ --- --- PostgreSQL database dump --- - -\restrict yeY9H8V42lbJiLOWXgm32d7gqvrbttAXIQpuhmJAUW6CcywchAbLQWIAldNEVsZ - --- Dumped from database version 17.6 --- Dumped by pg_dump version 17.6 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET transaction_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- Name: _realtime; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA _realtime; - - -ALTER SCHEMA _realtime OWNER TO postgres; - --- --- Name: auth; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA auth; - - -ALTER SCHEMA auth OWNER TO supabase_admin; - --- --- Name: extensions; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA extensions; - - -ALTER SCHEMA extensions OWNER TO postgres; - --- --- Name: graphql; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA graphql; - - -ALTER SCHEMA graphql OWNER TO supabase_admin; - --- --- Name: graphql_public; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA graphql_public; - - -ALTER SCHEMA graphql_public OWNER TO supabase_admin; - --- --- Name: pg_net; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions; - - --- --- Name: EXTENSION pg_net; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_net IS 'Async HTTP'; - - --- --- Name: pgbouncer; Type: SCHEMA; Schema: -; Owner: pgbouncer --- - -CREATE SCHEMA pgbouncer; - - -ALTER SCHEMA pgbouncer OWNER TO pgbouncer; - --- --- Name: realtime; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA realtime; - - -ALTER SCHEMA realtime OWNER TO supabase_admin; - --- --- Name: storage; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA storage; - - -ALTER SCHEMA storage OWNER TO supabase_admin; - --- --- Name: supabase_functions; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA supabase_functions; - - -ALTER SCHEMA supabase_functions OWNER TO supabase_admin; - --- --- Name: vault; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA vault; - - -ALTER SCHEMA vault OWNER TO supabase_admin; - --- --- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public; - - --- --- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST'; - - --- --- Name: citext; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; - - --- --- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings'; - - --- --- Name: pg_graphql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; - - --- --- Name: EXTENSION pg_graphql; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; - - --- --- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA extensions; - - --- --- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed'; - - --- --- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; - - --- --- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; - - --- --- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions; - - --- --- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; - - --- --- Name: supabase_vault; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS supabase_vault WITH SCHEMA vault; - - --- --- Name: EXTENSION supabase_vault; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION supabase_vault IS 'Supabase Vault Extension'; - - --- --- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions; - - --- --- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; - - --- --- Name: aal_level; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.aal_level AS ENUM ( - 'aal1', - 'aal2', - 'aal3' -); - - -ALTER TYPE auth.aal_level OWNER TO supabase_auth_admin; - --- --- Name: code_challenge_method; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.code_challenge_method AS ENUM ( - 's256', - 'plain' -); - - -ALTER TYPE auth.code_challenge_method OWNER TO supabase_auth_admin; - --- --- Name: factor_status; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.factor_status AS ENUM ( - 'unverified', - 'verified' -); - - -ALTER TYPE auth.factor_status OWNER TO supabase_auth_admin; - --- --- Name: factor_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.factor_type AS ENUM ( - 'totp', - 'webauthn', - 'phone' -); - - -ALTER TYPE auth.factor_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_authorization_status; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_authorization_status AS ENUM ( - 'pending', - 'approved', - 'denied', - 'expired' -); - - -ALTER TYPE auth.oauth_authorization_status OWNER TO supabase_auth_admin; - --- --- Name: oauth_client_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_client_type AS ENUM ( - 'public', - 'confidential' -); - - -ALTER TYPE auth.oauth_client_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_registration_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_registration_type AS ENUM ( - 'dynamic', - 'manual' -); - - -ALTER TYPE auth.oauth_registration_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_response_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_response_type AS ENUM ( - 'code' -); - - -ALTER TYPE auth.oauth_response_type OWNER TO supabase_auth_admin; - --- --- Name: one_time_token_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.one_time_token_type AS ENUM ( - 'confirmation_token', - 'reauthentication_token', - 'recovery_token', - 'email_change_token_new', - 'email_change_token_current', - 'phone_change_token' -); - - -ALTER TYPE auth.one_time_token_type OWNER TO supabase_auth_admin; - --- --- Name: commitment_log_source; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.commitment_log_source AS ENUM ( - 'manual', - 'auto' -); - - -ALTER TYPE public.commitment_log_source OWNER TO supabase_admin; - --- --- Name: determined_field_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.determined_field_type AS ENUM ( - 'text', - 'textarea', - 'number', - 'date', - 'select', - 'boolean' -); - - -ALTER TYPE public.determined_field_type OWNER TO supabase_admin; - --- --- Name: recurrence_exception_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.recurrence_exception_type AS ENUM ( - 'cancel_session', - 'reschedule_session', - 'patient_missed', - 'therapist_canceled', - 'holiday_block' -); - - -ALTER TYPE public.recurrence_exception_type OWNER TO supabase_admin; - --- --- Name: recurrence_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.recurrence_type AS ENUM ( - 'weekly', - 'biweekly', - 'monthly', - 'yearly', - 'custom_weekdays' -); - - -ALTER TYPE public.recurrence_type OWNER TO supabase_admin; - --- --- Name: status_agenda_serie; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_agenda_serie AS ENUM ( - 'ativo', - 'pausado', - 'cancelado' -); - - -ALTER TYPE public.status_agenda_serie OWNER TO supabase_admin; - --- --- Name: status_evento_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_evento_agenda AS ENUM ( - 'agendado', - 'realizado', - 'faltou', - 'cancelado', - 'remarcar' -); - - -ALTER TYPE public.status_evento_agenda OWNER TO supabase_admin; - --- --- Name: status_excecao_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_excecao_agenda AS ENUM ( - 'pendente', - 'ativo', - 'arquivado' -); - - -ALTER TYPE public.status_excecao_agenda OWNER TO supabase_admin; - --- --- Name: tipo_evento_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.tipo_evento_agenda AS ENUM ( - 'sessao', - 'bloqueio' -); - - -ALTER TYPE public.tipo_evento_agenda OWNER TO supabase_admin; - --- --- Name: tipo_excecao_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.tipo_excecao_agenda AS ENUM ( - 'bloqueio', - 'horario_extra' -); - - -ALTER TYPE public.tipo_excecao_agenda OWNER TO supabase_admin; - --- --- Name: action; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.action AS ENUM ( - 'INSERT', - 'UPDATE', - 'DELETE', - 'TRUNCATE', - 'ERROR' -); - - -ALTER TYPE realtime.action OWNER TO supabase_admin; - --- --- Name: equality_op; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.equality_op AS ENUM ( - 'eq', - 'neq', - 'lt', - 'lte', - 'gt', - 'gte', - 'in' -); - - -ALTER TYPE realtime.equality_op OWNER TO supabase_admin; - --- --- Name: user_defined_filter; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.user_defined_filter AS ( - column_name text, - op realtime.equality_op, - value text -); - - -ALTER TYPE realtime.user_defined_filter OWNER TO supabase_admin; - --- --- Name: wal_column; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.wal_column AS ( - name text, - type_name text, - type_oid oid, - value jsonb, - is_pkey boolean, - is_selectable boolean -); - - -ALTER TYPE realtime.wal_column OWNER TO supabase_admin; - --- --- Name: wal_rls; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.wal_rls AS ( - wal jsonb, - is_rls_enabled boolean, - subscription_ids uuid[], - errors text[] -); - - -ALTER TYPE realtime.wal_rls OWNER TO supabase_admin; - --- --- Name: buckettype; Type: TYPE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TYPE storage.buckettype AS ENUM ( - 'STANDARD', - 'ANALYTICS', - 'VECTOR' -); - - -ALTER TYPE storage.buckettype OWNER TO supabase_storage_admin; - --- --- Name: email(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.email() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION email(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.email() IS 'Deprecated. Use auth.jwt() -> ''email'' instead.'; - - --- --- Name: jwt(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.jwt() OWNER TO supabase_auth_admin; - --- --- Name: role(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.role() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION role(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.role() IS 'Deprecated. Use auth.jwt() -> ''role'' instead.'; - - --- --- Name: uid(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.uid() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION uid(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.uid() IS 'Deprecated. Use auth.jwt() -> ''sub'' instead.'; - - --- --- Name: grant_pg_cron_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_cron_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT - FROM pg_event_trigger_ddl_commands() AS ev - JOIN pg_extension AS ext - ON ev.objid = ext.oid - WHERE ext.extname = 'pg_cron' - ) - THEN - grant usage on schema cron to postgres with grant option; - - alter default privileges in schema cron grant all on tables to postgres with grant option; - alter default privileges in schema cron grant all on functions to postgres with grant option; - alter default privileges in schema cron grant all on sequences to postgres with grant option; - - alter default privileges for user supabase_admin in schema cron grant all - on sequences to postgres with grant option; - alter default privileges for user supabase_admin in schema cron grant all - on tables to postgres with grant option; - alter default privileges for user supabase_admin in schema cron grant all - on functions to postgres with grant option; - - grant all privileges on all tables in schema cron to postgres with grant option; - revoke all on table cron.job from postgres; - grant select on table cron.job to postgres with grant option; - END IF; -END; -$$; - - -ALTER FUNCTION extensions.grant_pg_cron_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_cron_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_cron_access() IS 'Grants access to pg_cron'; - - --- --- Name: grant_pg_graphql_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_graphql_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $_$ -DECLARE - func_is_graphql_resolve bool; -BEGIN - func_is_graphql_resolve = ( - SELECT n.proname = 'resolve' - FROM pg_event_trigger_ddl_commands() AS ev - LEFT JOIN pg_catalog.pg_proc AS n - ON ev.objid = n.oid - ); - - IF func_is_graphql_resolve - THEN - -- Update public wrapper to pass all arguments through to the pg_graphql resolve func - DROP FUNCTION IF EXISTS graphql_public.graphql; - create or replace function graphql_public.graphql( - "operationName" text default null, - query text default null, - variables jsonb default null, - extensions jsonb default null - ) - returns jsonb - language sql - as $$ - select graphql.resolve( - query := query, - variables := coalesce(variables, '{}'), - "operationName" := "operationName", - extensions := extensions - ); - $$; - - -- This hook executes when `graphql.resolve` is created. That is not necessarily the last - -- function in the extension so we need to grant permissions on existing entities AND - -- update default permissions to any others that are created after `graphql.resolve` - grant usage on schema graphql to postgres, anon, authenticated, service_role; - grant select on all tables in schema graphql to postgres, anon, authenticated, service_role; - grant execute on all functions in schema graphql to postgres, anon, authenticated, service_role; - grant all on all sequences in schema graphql to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on tables to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on functions to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on sequences to postgres, anon, authenticated, service_role; - - -- Allow postgres role to allow granting usage on graphql and graphql_public schemas to custom roles - grant usage on schema graphql_public to postgres with grant option; - grant usage on schema graphql to postgres with grant option; - END IF; - -END; -$_$; - - -ALTER FUNCTION extensions.grant_pg_graphql_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_graphql_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_graphql_access() IS 'Grants access to pg_graphql'; - - --- --- Name: grant_pg_net_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_net_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM pg_event_trigger_ddl_commands() AS ev - JOIN pg_extension AS ext - ON ev.objid = ext.oid - WHERE ext.extname = 'pg_net' - ) - THEN - GRANT USAGE ON SCHEMA net TO supabase_functions_admin, postgres, anon, authenticated, service_role; - - ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER; - ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER; - - ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; - ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; - - REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; - REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; - - GRANT EXECUTE ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role; - GRANT EXECUTE ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role; - END IF; -END; -$$; - - -ALTER FUNCTION extensions.grant_pg_net_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_net_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_net_access() IS 'Grants access to pg_net'; - - --- --- Name: pgrst_ddl_watch(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.pgrst_ddl_watch() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -DECLARE - cmd record; -BEGIN - FOR cmd IN SELECT * FROM pg_event_trigger_ddl_commands() - LOOP - IF cmd.command_tag IN ( - 'CREATE SCHEMA', 'ALTER SCHEMA' - , 'CREATE TABLE', 'CREATE TABLE AS', 'SELECT INTO', 'ALTER TABLE' - , 'CREATE FOREIGN TABLE', 'ALTER FOREIGN TABLE' - , 'CREATE VIEW', 'ALTER VIEW' - , 'CREATE MATERIALIZED VIEW', 'ALTER MATERIALIZED VIEW' - , 'CREATE FUNCTION', 'ALTER FUNCTION' - , 'CREATE TRIGGER' - , 'CREATE TYPE', 'ALTER TYPE' - , 'CREATE RULE' - , 'COMMENT' - ) - -- don't notify in case of CREATE TEMP table or other objects created on pg_temp - AND cmd.schema_name is distinct from 'pg_temp' - THEN - NOTIFY pgrst, 'reload schema'; - END IF; - END LOOP; -END; $$; - - -ALTER FUNCTION extensions.pgrst_ddl_watch() OWNER TO supabase_admin; - --- --- Name: pgrst_drop_watch(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.pgrst_drop_watch() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -DECLARE - obj record; -BEGIN - FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects() - LOOP - IF obj.object_type IN ( - 'schema' - , 'table' - , 'foreign table' - , 'view' - , 'materialized view' - , 'function' - , 'trigger' - , 'type' - , 'rule' - ) - AND obj.is_temporary IS false -- no pg_temp objects - THEN - NOTIFY pgrst, 'reload schema'; - END IF; - END LOOP; -END; $$; - - -ALTER FUNCTION extensions.pgrst_drop_watch() OWNER TO supabase_admin; - --- --- Name: set_graphql_placeholder(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.set_graphql_placeholder() RETURNS event_trigger - LANGUAGE plpgsql - AS $_$ - DECLARE - graphql_is_dropped bool; - BEGIN - graphql_is_dropped = ( - SELECT ev.schema_name = 'graphql_public' - FROM pg_event_trigger_dropped_objects() AS ev - WHERE ev.schema_name = 'graphql_public' - ); - - IF graphql_is_dropped - THEN - create or replace function graphql_public.graphql( - "operationName" text default null, - query text default null, - variables jsonb default null, - extensions jsonb default null - ) - returns jsonb - language plpgsql - as $$ - DECLARE - server_version float; - BEGIN - server_version = (SELECT (SPLIT_PART((select version()), ' ', 2))::float); - - IF server_version >= 14 THEN - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql extension is not enabled.' - ) - ) - ); - ELSE - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql is only available on projects running Postgres 14 onwards.' - ) - ) - ); - END IF; - END; - $$; - END IF; - - END; -$_$; - - -ALTER FUNCTION extensions.set_graphql_placeholder() OWNER TO supabase_admin; - --- --- Name: FUNCTION set_graphql_placeholder(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.set_graphql_placeholder() IS 'Reintroduces placeholder function for graphql_public.graphql'; - - --- --- Name: get_auth(text); Type: FUNCTION; Schema: pgbouncer; Owner: supabase_admin --- - -CREATE FUNCTION pgbouncer.get_auth(p_usename text) RETURNS TABLE(username text, password text) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO '' - AS $_$ -begin - raise debug 'PgBouncer auth request: %', p_usename; - - return query - select - rolname::text, - case when rolvaliduntil < now() - then null - else rolpassword::text - end - from pg_authid - where rolname=$1 and rolcanlogin; -end; -$_$; - - -ALTER FUNCTION pgbouncer.get_auth(p_usename text) OWNER TO supabase_admin; - --- --- Name: __rls_ping(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.__rls_ping() RETURNS text - LANGUAGE sql STABLE - AS $$ - select 'ok'::text; -$$; - - -ALTER FUNCTION public.__rls_ping() OWNER TO supabase_admin; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- Name: subscriptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscriptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - plan_id uuid NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - current_period_start timestamp with time zone, - current_period_end timestamp with time zone, - cancel_at_period_end boolean DEFAULT false NOT NULL, - provider text DEFAULT 'manual'::text NOT NULL, - provider_customer_id text, - provider_subscription_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid, - plan_key text, - "interval" text, - source text DEFAULT 'manual'::text NOT NULL, - started_at timestamp with time zone DEFAULT now() NOT NULL, - canceled_at timestamp with time zone, - activated_at timestamp with time zone, - past_due_since timestamp with time zone, - suspended_at timestamp with time zone, - suspended_reason text, - cancelled_at timestamp with time zone, - cancel_reason text, - expired_at timestamp with time zone, - CONSTRAINT subscriptions_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))), - CONSTRAINT subscriptions_owner_xor CHECK ((((tenant_id IS NOT NULL) AND (user_id IS NULL)) OR ((tenant_id IS NULL) AND (user_id IS NOT NULL)))), - CONSTRAINT subscriptions_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'active'::text, 'past_due'::text, 'suspended'::text, 'cancelled'::text, 'expired'::text]))) -); - - -ALTER TABLE public.subscriptions OWNER TO supabase_admin; - --- --- Name: activate_subscription_from_intent(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_intent record; - v_sub public.subscriptions; - v_days int; - v_user_id uuid; - v_plan_id uuid; - v_target text; -begin - -- lê pela VIEW unificada - select * into v_intent - from public.subscription_intents - where id = p_intent_id; - - if not found then - raise exception 'Intent não encontrado: %', p_intent_id; - end if; - - if v_intent.status <> 'paid' then - raise exception 'Intent precisa estar paid para ativar assinatura'; - end if; - - -- resolve target e plan_id via plans.key - select p.id, p.target - into v_plan_id, v_target - from public.plans p - where p.key = v_intent.plan_key - limit 1; - - if v_plan_id is null then - raise exception 'Plano não encontrado em plans.key = %', v_intent.plan_key; - end if; - - v_target := lower(coalesce(v_target, '')); - - -- ✅ supervisor adicionado - if v_target not in ('clinic', 'therapist', 'supervisor') then - raise exception 'Target inválido em plans.target: %', v_target; - end if; - - -- regra por target - if v_target = 'clinic' then - if v_intent.tenant_id is null then - raise exception 'Intent sem tenant_id'; - end if; - else - -- therapist ou supervisor: vinculado ao user - v_user_id := v_intent.user_id; - if v_user_id is null then - v_user_id := v_intent.created_by_user_id; - end if; - end if; - - if v_target in ('therapist', 'supervisor') and v_user_id is null then - raise exception 'Não foi possível determinar user_id para assinatura %.', v_target; - end if; - - -- cancela assinatura ativa anterior - if v_target = 'clinic' then - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where tenant_id = v_intent.tenant_id - and plan_id = v_plan_id - and status = 'active'; - else - -- therapist ou supervisor - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where user_id = v_user_id - and plan_id = v_plan_id - and status = 'active' - and tenant_id is null; - end if; - - -- duração do plano (30 dias para mensal) - v_days := case - when lower(coalesce(v_intent.interval, 'month')) = 'year' then 365 - else 30 - end; - - -- cria nova assinatura - insert into public.subscriptions ( - user_id, - plan_id, - status, - started_at, - expires_at, - cancelled_at, - activated_at, - tenant_id, - plan_key, - interval, - source, - created_at, - updated_at - ) - values ( - case when v_target = 'clinic' then null else v_user_id end, - v_plan_id, - 'active', - now(), - now() + make_interval(days => v_days), - null, - now(), - case when v_target = 'clinic' then v_intent.tenant_id else null end, - v_intent.plan_key, - v_intent.interval, - 'manual', - now(), - now() - ) - returning * into v_sub; - - -- grava vínculo intent → subscription - if v_target = 'clinic' then - update public.subscription_intents_tenant - set subscription_id = v_sub.id - where id = p_intent_id; - else - update public.subscription_intents_personal - set subscription_id = v_sub.id - where id = p_intent_id; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) OWNER TO supabase_admin; - --- --- Name: admin_fix_plan_target(text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- (opcional) restringe targets válidos - if p_new_target not in ('clinic','therapist') then - raise exception 'Target inválido: %', p_new_target using errcode='P0001'; - end if; - - -- trava o plano - select id into v_plan_id - from public.plans - where key = p_plan_key - for update; - - if v_plan_id is null then - raise exception 'Plano não encontrado: %', p_plan_key using errcode='P0001'; - end if; - - -- segurança: não mexer se existe subscription - if exists (select 1 from public.subscriptions s where s.plan_id = v_plan_id) then - raise exception 'Plano % possui subscriptions. Migração bloqueada.', p_plan_key using errcode='P0001'; - end if; - - -- liga bypass SOMENTE nesta transação - perform set_config('app.plan_migration_bypass', '1', true); - - update public.plans - set target = p_new_target - where id = v_plan_id; - -end -$$; - - -ALTER FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) OWNER TO supabase_admin; - --- --- Name: agenda_cfg_sync(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agenda_cfg_sync() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.agenda_view_mode = 'custom' then - new.usar_horario_admin_custom := true; - new.admin_inicio_visualizacao := new.agenda_custom_start; - new.admin_fim_visualizacao := new.agenda_custom_end; - else - new.usar_horario_admin_custom := false; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.agenda_cfg_sync() OWNER TO supabase_admin; - --- --- Name: agendador_dias_disponiveis(text, integer, integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) RETURNS TABLE(data date, tem_slots boolean) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_agora timestamptz; - v_data date; - v_data_inicio date; - v_data_fim date; - v_db_dow int; - v_tem_slot boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - AND (v_data::text || ' ' || s.time::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo' - >= v_agora + (v_antecedencia || ' hours')::interval - ) INTO v_tem_slot; - - IF v_tem_slot THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - - -ALTER FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) OWNER TO supabase_admin; - --- --- Name: agendador_gerar_slug(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_gerar_slug() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_slug text; - v_exists boolean; -BEGIN - -- só gera se ativou e não tem slug ainda - IF NEW.ativo = true AND (NEW.link_slug IS NULL OR NEW.link_slug = '') THEN - LOOP - v_slug := lower(substring(replace(gen_random_uuid()::text, '-', ''), 1, 8)); - SELECT EXISTS ( - SELECT 1 FROM public.agendador_configuracoes - WHERE link_slug = v_slug AND owner_id <> NEW.owner_id - ) INTO v_exists; - EXIT WHEN NOT v_exists; - END LOOP; - NEW.link_slug := v_slug; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.agendador_gerar_slug() OWNER TO supabase_admin; - --- --- Name: agendador_slots_disponiveis(text, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) RETURNS TABLE(hora time without time zone, disponivel boolean) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_antecedencia int; - v_agora timestamptz; - v_db_dow int; - v_slot time; - v_slot_fim time; - v_slot_ts timestamptz; - v_ocupado boolean; - -- loop de recorrências - v_rule RECORD; - v_rule_start_dow int; - v_first_occ date; - v_day_diff int; - v_ex_type text; -BEGIN - SELECT c.owner_id, c.duracao_sessao_min, c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; - - FOR v_slot IN - SELECT s.time - FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - ORDER BY s.time - LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - v_ocupado := false; - - -- ── Antecedência mínima ────────────────────────────────────────────────── - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo'; - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- ── Eventos avulsos internos (agenda_eventos) ──────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos e - WHERE e.owner_id = v_owner_id - AND e.status::text NOT IN ('cancelado', 'faltou') - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::date = p_data - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (e.fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Recorrências ativas (recurrence_rules) ─────────────────────────────── - -- Loop explícito para evitar erros de tipo no cálculo do ciclo semanal - IF NOT v_ocupado THEN - FOR v_rule IN - SELECT - r.id, - r.start_date::date AS start_date, - r.end_date::date AS end_date, - r.start_time::time AS start_time, - r.end_time::time AS end_time, - COALESCE(r.interval, 1)::int AS interval - FROM public.recurrence_rules r - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND p_data >= r.start_date::date - AND (r.end_date IS NULL OR p_data <= r.end_date::date) - AND v_db_dow = ANY(r.weekdays) - AND r.start_time::time < v_slot_fim - AND r.end_time::time > v_slot - LOOP - -- Calcula a primeira ocorrência do dia-da-semana a partir do start_date - v_rule_start_dow := extract(dow from v_rule.start_date)::int; - v_first_occ := v_rule.start_date - + (((v_db_dow - v_rule_start_dow + 7) % 7))::int; - v_day_diff := (p_data - v_first_occ)::int; - - -- Ocorrência válida: diff >= 0 e divisível pelo ciclo semanal - IF v_day_diff >= 0 AND v_day_diff % (7 * v_rule.interval) = 0 THEN - - -- Verifica se há exceção para esta data - v_ex_type := NULL; - SELECT ex.type INTO v_ex_type - FROM public.recurrence_exceptions ex - WHERE ex.recurrence_id = v_rule.id - AND ex.original_date = p_data - LIMIT 1; - - -- Sem exceção, ou exceção que não cancela → bloqueia o slot - IF v_ex_type IS NULL OR v_ex_type NOT IN ( - 'cancel_session', 'patient_missed', - 'therapist_canceled', 'holiday_block', - 'reschedule_session' - ) THEN - v_ocupado := true; - EXIT; -- já basta uma regra que conflite - END IF; - - END IF; - END LOOP; - END IF; - - -- ── Recorrências remarcadas para este dia (reschedule → new_date = p_data) ─ - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 - FROM public.recurrence_exceptions ex - JOIN public.recurrence_rules r ON r.id = ex.recurrence_id - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND ex.type = 'reschedule_session' - AND ex.new_date = p_data - AND COALESCE(ex.new_start_time, r.start_time)::time < v_slot_fim - AND COALESCE(ex.new_end_time, r.end_time)::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Solicitações públicas pendentes ────────────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes sol - WHERE sol.owner_id = v_owner_id - AND sol.status = 'pendente' - AND sol.data_solicitada = p_data - AND sol.hora_solicitada = v_slot - AND (sol.reservado_ate IS NULL OR sol.reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END LOOP; -END; -$$; - - -ALTER FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) OWNER TO supabase_admin; - --- --- Name: cancel_recurrence_from(uuid, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -BEGIN - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - status = CASE - WHEN p_from_date <= start_date THEN 'cancelado' - ELSE status - END, - updated_at = now() - WHERE id = p_recurrence_id; -END; -$$; - - -ALTER FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) OWNER TO supabase_admin; - --- --- Name: cancel_subscription(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancel_subscription(p_subscription_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'canceled' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'canceled', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'canceled', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Cancelamento manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'active') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION public.cancel_subscription(p_subscription_id uuid) OWNER TO supabase_admin; - --- --- Name: cancelar_eventos_serie(uuid, timestamp with time zone); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone DEFAULT now()) RETURNS integer - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_count integer; -BEGIN - UPDATE public.agenda_eventos - SET status = 'cancelado', - updated_at = now() - WHERE serie_id = p_serie_id - AND inicio_em >= p_a_partir_de - AND status NOT IN ('realizado', 'cancelado'); - - GET DIAGNOSTICS v_count = ROW_COUNT; - RETURN v_count; -END; -$$; - - -ALTER FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) OWNER TO supabase_admin; - --- --- Name: FUNCTION cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone); Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) IS 'Cancela todos os eventos futuros de uma série a partir de p_a_partir_de (inclusive). - Não cancela eventos já realizados.'; - - --- --- Name: change_subscription_plan(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_old_plan uuid; - v_new_key text; - - v_owner_type text; - v_owner_ref uuid; - - v_new_target text; - v_sub_target text; -begin - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - v_old_plan := v_sub.plan_id; - - if v_old_plan = p_new_plan_id then - return v_sub; - end if; - - select key, target - into v_new_key, v_new_target - from public.plans - where id = p_new_plan_id; - - if v_new_key is null then - raise exception 'Plano não encontrado'; - end if; - - v_new_target := lower(coalesce(v_new_target, '')); - - v_sub_target := case - when v_sub.tenant_id is not null then 'clinic' - else 'therapist' - end; - - if v_new_target <> v_sub_target then - raise exception 'Plano inválido para este tipo de assinatura. Assinatura é % e o plano é %.', - v_sub_target, v_new_target - using errcode = 'P0001'; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set plan_id = p_new_plan_id, - plan_key = v_new_key, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'plan_changed', - v_old_plan, - p_new_plan_id, - auth.uid(), - 'Plan change via DEV menu', - 'dev_menu', - jsonb_build_object( - 'previous_plan', v_old_plan, - 'new_plan', p_new_plan_id, - 'new_plan_key', v_new_key, - 'new_plan_target', v_new_target - ) - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation (owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) OWNER TO supabase_admin; - --- --- Name: create_clinic_tenant(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_clinic_tenant(p_name text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_tenant uuid; - v_name text; -begin - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Not authenticated'; - end if; - - v_name := nullif(trim(coalesce(p_name, '')), ''); - if v_name is null then - v_name := 'Clínica'; - end if; - - insert into public.tenants (name, kind, created_at) - values (v_name, 'clinic', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION public.create_clinic_tenant(p_name text) OWNER TO supabase_admin; - --- --- Name: create_patient_intake_request(text, text, text, text, text, boolean); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text DEFAULT NULL::text, p_phone text DEFAULT NULL::text, p_notes text DEFAULT NULL::text, p_consent boolean DEFAULT false) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_owner uuid; - v_active boolean; - v_expires timestamptz; - v_max_uses int; - v_uses int; - v_id uuid; -begin - select owner_id, active, expires_at, max_uses, uses - into v_owner, v_active, v_expires, v_max_uses, v_uses - from public.patient_invites - where token = p_token - limit 1; - - if v_owner is null then - raise exception 'Token inválido'; - end if; - - if v_active is not true then - raise exception 'Link desativado'; - end if; - - if v_expires is not null and now() > v_expires then - raise exception 'Link expirado'; - end if; - - if v_max_uses is not null and v_uses >= v_max_uses then - raise exception 'Limite de uso atingido'; - end if; - - if p_name is null or length(trim(p_name)) = 0 then - raise exception 'Nome é obrigatório'; - end if; - - insert into public.patient_intake_requests - (owner_id, token, name, email, phone, notes, consent, status) - values - (v_owner, p_token, trim(p_name), - nullif(lower(trim(p_email)), ''), - nullif(trim(p_phone), ''), - nullif(trim(p_notes), ''), - coalesce(p_consent, false), - 'new') - returning id into v_id; - - update public.patient_invites - set uses = uses + 1 - where token = p_token; - - return v_id; -end; -$$; - - -ALTER FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) OWNER TO supabase_admin; - --- --- Name: create_patient_intake_request_v2(text, jsonb); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $_$ -declare - v_owner_id uuid; - v_intake_id uuid; - v_birth_raw text; - v_birth date; -begin - select owner_id - into v_owner_id - from public.patient_invites - where token = p_token; - - if v_owner_id is null then - raise exception 'Token inválido ou expirado'; - end if; - - v_birth_raw := nullif(trim(coalesce( - p_payload->>'data_nascimento', - '' - )), ''); - - v_birth := case - when v_birth_raw is null then null - when v_birth_raw ~ '^\d{4}-\d{2}-\d{2}$' then v_birth_raw::date - when v_birth_raw ~ '^\d{2}-\d{2}-\d{4}$' then to_date(v_birth_raw, 'DD-MM-YYYY') - else null - end; - - insert into public.patient_intake_requests ( - owner_id, - token, - status, - consent, - - nome_completo, - email_principal, - telefone, - - avatar_url, -- 🔥 AQUI - - data_nascimento, - cpf, - rg, - genero, - estado_civil, - profissao, - escolaridade, - nacionalidade, - naturalidade, - - cep, - pais, - cidade, - estado, - endereco, - numero, - complemento, - bairro, - - observacoes, - notas_internas, - - encaminhado_por, - onde_nos_conheceu - ) - values ( - v_owner_id, - p_token, - 'new', - coalesce((p_payload->>'consent')::boolean, false), - - nullif(trim(p_payload->>'nome_completo'), ''), - nullif(trim(p_payload->>'email_principal'), ''), - nullif(regexp_replace(coalesce(p_payload->>'telefone',''), '\D', '', 'g'), ''), - - nullif(trim(p_payload->>'avatar_url'), ''), -- 🔥 AQUI - - v_birth, - nullif(regexp_replace(coalesce(p_payload->>'cpf',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'rg'), ''), - nullif(trim(p_payload->>'genero'), ''), - nullif(trim(p_payload->>'estado_civil'), ''), - nullif(trim(p_payload->>'profissao'), ''), - nullif(trim(p_payload->>'escolaridade'), ''), - nullif(trim(p_payload->>'nacionalidade'), ''), - nullif(trim(p_payload->>'naturalidade'), ''), - - nullif(regexp_replace(coalesce(p_payload->>'cep',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'pais'), ''), - nullif(trim(p_payload->>'cidade'), ''), - nullif(trim(p_payload->>'estado'), ''), - nullif(trim(p_payload->>'endereco'), ''), - nullif(trim(p_payload->>'numero'), ''), - nullif(trim(p_payload->>'complemento'), ''), - nullif(trim(p_payload->>'bairro'), ''), - - nullif(trim(p_payload->>'observacoes'), ''), - nullif(trim(p_payload->>'notas_internas'), ''), - - nullif(trim(p_payload->>'encaminhado_por'), ''), - nullif(trim(p_payload->>'onde_nos_conheceu'), '') - ) - returning id into v_intake_id; - - return v_intake_id; -end; -$_$; - - -ALTER FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) OWNER TO supabase_admin; - --- --- Name: create_support_session(uuid, integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer DEFAULT 60) RETURNS json - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_admin_id uuid; - v_role text; - v_token text; - v_expires timestamp with time zone; - v_session support_sessions; -BEGIN - -- Verifica autenticação - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - -- Verifica role saas_admin - SELECT role INTO v_role - FROM public.profiles - WHERE id = v_admin_id; - - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado. Somente saas_admin pode criar sessões de suporte.' - USING ERRCODE = 'P0002'; - END IF; - - -- Valida TTL (1 a 120 minutos) - IF p_ttl_minutes < 1 OR p_ttl_minutes > 120 THEN - RAISE EXCEPTION 'TTL inválido. Use entre 1 e 120 minutos.' - USING ERRCODE = 'P0003'; - END IF; - - -- Valida tenant - IF NOT EXISTS (SELECT 1 FROM public.tenants WHERE id = p_tenant_id) THEN - RAISE EXCEPTION 'Tenant não encontrado.' - USING ERRCODE = 'P0004'; - END IF; - - -- Gera token único (64 chars hex, sem pgcrypto) - v_token := replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', ''); - v_expires := now() + (p_ttl_minutes || ' minutes')::interval; - - -- Insere sessão - INSERT INTO public.support_sessions (tenant_id, admin_id, token, expires_at) - VALUES (p_tenant_id, v_admin_id, v_token, v_expires) - RETURNING * INTO v_session; - - RETURN json_build_object( - 'token', v_session.token, - 'expires_at', v_session.expires_at, - 'session_id', v_session.id - ); -END; -$$; - - -ALTER FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) OWNER TO supabase_admin; - --- --- Name: current_member_id(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.current_member_id(p_tenant_id uuid) RETURNS uuid - LANGUAGE sql STABLE - AS $$ - select tm.id - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION public.current_member_id(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: current_member_role(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.current_member_role(p_tenant_id uuid) RETURNS text - LANGUAGE sql STABLE - AS $$ - select tm.role - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION public.current_member_role(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: delete_commitment_full(uuid, uuid); Type: FUNCTION; Schema: public; Owner: postgres --- - -CREATE FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields int := 0; - v_logs int := 0; - v_parent int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_fields = row_count; - - delete from public.commitment_time_logs - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_logs = row_count; - - delete from public.determined_commitments - where tenant_id = p_tenant_id - and id = p_commitment_id; - get diagnostics v_parent = row_count; - - if v_parent <> 1 then - raise exception 'Parent not deleted (RLS/owner issue).'; - end if; - - return jsonb_build_object( - 'ok', true, - 'deleted', jsonb_build_object( - 'fields', v_fields, - 'logs', v_logs, - 'commitment', v_parent - ) - ); -end; -$$; - - -ALTER FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) OWNER TO postgres; - --- --- Name: delete_determined_commitment(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields_deleted int := 0; - v_logs_deleted int := 0; - v_commitment_deleted int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found for tenant'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields f - where f.tenant_id = p_tenant_id - and f.commitment_id = p_commitment_id; - get diagnostics v_fields_deleted = row_count; - - delete from public.commitment_time_logs l - where l.tenant_id = p_tenant_id - and l.commitment_id = p_commitment_id; - get diagnostics v_logs_deleted = row_count; - - delete from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - get diagnostics v_commitment_deleted = row_count; - - if v_commitment_deleted <> 1 then - raise exception 'Delete did not remove the commitment (tenant mismatch?)'; - end if; - - return jsonb_build_object( - 'ok', true, - 'tenant_id', p_tenant_id, - 'commitment_id', p_commitment_id, - 'deleted', jsonb_build_object( - 'fields', v_fields_deleted, - 'logs', v_logs_deleted, - 'commitment', v_commitment_deleted - ) - ); -end; -$$; - - -ALTER FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) OWNER TO supabase_admin; - --- --- Name: dev_list_auth_users(integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_auth_users(p_limit integer DEFAULT 50) RETURNS TABLE(id uuid, email text, created_at timestamp with time zone) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -begin - -- só saas_admin pode ver - if not exists ( - select 1 - from public.profiles p - where p.id = auth.uid() - and p.role = 'saas_admin' - ) then - return; - end if; - - return query - select - u.id, - u.email, - u.created_at - from auth.users u - order by u.created_at desc - limit greatest(1, least(coalesce(p_limit, 50), 500)); -end; -$$; - - -ALTER FUNCTION public.dev_list_auth_users(p_limit integer) OWNER TO supabase_admin; - --- --- Name: dev_list_custom_users(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_custom_users() RETURNS TABLE(user_id uuid, email text, created_at timestamp with time zone, global_role text, tenant_role text, tenant_id uuid, password_dev text, kind text) - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - with base as ( - select - u.id as user_id, - lower(u.email) as email, - u.created_at - from auth.users u - where lower(u.email) not in ( - 'clinic@agenciapsi.com.br', - 'therapist@agenciapsi.com.br', - 'patient@agenciapsi.com.br', - 'saas@agenciapsi.com.br' - ) - ), - prof as ( - select p.id, p.role as global_role - from public.profiles p - ), - last_membership as ( - select distinct on (tm.user_id) - tm.user_id, - tm.tenant_id, - tm.role as tenant_role, - tm.created_at - from public.tenant_members tm - where tm.status = 'active' - order by tm.user_id, tm.created_at desc - ) - select - b.user_id, - b.email, - b.created_at, - pr.global_role, - lm.tenant_role, - lm.tenant_id, - dc.password_dev, - dc.kind - from base b - left join prof pr on pr.id = b.user_id - left join last_membership lm on lm.user_id = b.user_id - left join public.dev_user_credentials dc on lower(dc.email) = b.email - order by b.created_at desc; -$$; - - -ALTER FUNCTION public.dev_list_custom_users() OWNER TO supabase_admin; - --- --- Name: dev_list_intent_leads(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_intent_leads() RETURNS TABLE(email text, last_intent_at timestamp with time zone, plan_key text, billing_interval text, status text, tenant_id uuid) - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - select - lower(si.email) as email, - max(si.created_at) as last_intent_at, - (array_agg(si.plan_key order by si.created_at desc))[1] as plan_key, - (array_agg(si.interval order by si.created_at desc))[1] as billing_interval, - (array_agg(si.status order by si.created_at desc))[1] as status, - (array_agg(si.tenant_id order by si.created_at desc))[1] as tenant_id - from public.subscription_intents si - where si.email is not null - and not exists ( - select 1 - from auth.users au - where lower(au.email) = lower(si.email) - ) - group by lower(si.email) - order by max(si.created_at) desc; -$$; - - -ALTER FUNCTION public.dev_list_intent_leads() OWNER TO supabase_admin; - --- --- Name: dev_public_debug_snapshot(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_public_debug_snapshot() RETURNS TABLE(users_total integer, tenants_total integer, intents_new_total integer, latest_intents jsonb) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $_$ -declare - v_latest jsonb; -begin - select jsonb_agg( - jsonb_build_object( - 'created_at', si.created_at, - 'email_masked', - regexp_replace(lower(si.email), '(^.).*(@.*$)', '\1***\2'), - 'plan_key', si.plan_key, - 'status', si.status - ) - order by si.created_at desc - ) - into v_latest - from ( - select si.* - from public.subscription_intents si - where si.email is not null - order by si.created_at desc - limit 5 - ) si; - - return query - select - (select count(*)::int from auth.users) as users_total, - (select count(*)::int from public.tenants) as tenants_total, - (select count(*)::int from public.subscription_intents where status = 'new') as intents_new_total, - coalesce(v_latest, '[]'::jsonb) as latest_intents; -end; -$_$; - - -ALTER FUNCTION public.dev_public_debug_snapshot() OWNER TO supabase_admin; - --- --- Name: ensure_personal_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.ensure_personal_tenant() RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_uid uuid; - v_existing uuid; -BEGIN - v_uid := auth.uid(); - IF v_uid IS NULL THEN - RAISE EXCEPTION 'Not authenticated'; - END IF; - - SELECT tm.tenant_id INTO v_existing - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = v_uid - AND tm.status = 'active' - AND t.kind IN ('therapist', 'saas') - ORDER BY tm.created_at DESC - LIMIT 1; - - IF v_existing IS NOT NULL THEN - RETURN v_existing; - END IF; - - RETURN public.provision_account_tenant(v_uid, 'therapist'); -END; -$$; - - -ALTER FUNCTION public.ensure_personal_tenant() OWNER TO supabase_admin; - --- --- Name: ensure_personal_tenant_for_user(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_existing uuid; - v_tenant uuid; - v_email text; - v_name text; -begin - v_uid := p_user_id; - if v_uid is null then - raise exception 'Missing user id'; - end if; - - -- só considera tenant pessoal (kind='saas') - select tm.tenant_id - into v_existing - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = v_uid - and tm.status = 'active' - and t.kind = 'saas' - order by tm.created_at desc - limit 1; - - if v_existing is not null then - return v_existing; - end if; - - select email into v_email - from auth.users - where id = v_uid; - - v_name := coalesce(split_part(v_email, '@', 1), 'Conta'); - - insert into public.tenants (name, kind, created_at) - values (v_name || ' (Pessoal)', 'saas', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) OWNER TO supabase_admin; - --- --- Name: faq_votar(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.faq_votar(faq_id uuid) RETURNS void - LANGUAGE sql SECURITY DEFINER - AS $$ - update public.saas_faq - set votos = votos + 1, - updated_at = now() - where id = faq_id - and ativo = true; -$$; - - -ALTER FUNCTION public.faq_votar(faq_id uuid) OWNER TO supabase_admin; - --- --- Name: fix_all_subscription_mismatches(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.fix_all_subscription_mismatches() RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - r record; -begin - for r in - select distinct s.user_id as owner_id - from public.subscriptions s - where s.status = 'active' - and s.user_id is not null - loop - perform public.rebuild_owner_entitlements(r.owner_id); - end loop; -end; -$$; - - -ALTER FUNCTION public.fix_all_subscription_mismatches() OWNER TO supabase_admin; - --- --- Name: fn_agenda_regras_semanais_no_overlap(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.fn_agenda_regras_semanais_no_overlap() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_count int; -begin - if new.ativo is false then - return new; - end if; - - select count(*) into v_count - from public.agenda_regras_semanais r - where r.owner_id = new.owner_id - and r.dia_semana = new.dia_semana - and r.ativo is true - and (tg_op = 'INSERT' or r.id <> new.id) - and (new.hora_inicio < r.hora_fim and new.hora_fim > r.hora_inicio); - - if v_count > 0 then - raise exception 'Janela sobreposta: já existe uma regra ativa nesse intervalo.'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.fn_agenda_regras_semanais_no_overlap() OWNER TO supabase_admin; - --- --- Name: get_my_email(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.get_my_email() RETURNS text - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ - select lower(email) - from auth.users - where id = auth.uid(); -$$; - - -ALTER FUNCTION public.get_my_email() OWNER TO supabase_admin; - --- --- Name: guard_account_type_immutable(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_account_type_immutable() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF OLD.account_type <> 'free' AND NEW.account_type IS DISTINCT FROM OLD.account_type THEN - RAISE EXCEPTION 'account_type é imutável após escolha (atual: "%" para tentativa: "%"). Para mudar de perfil, crie uma nova conta.', OLD.account_type, NEW.account_type - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_account_type_immutable() OWNER TO supabase_admin; - --- --- Name: guard_locked_commitment(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_locked_commitment() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if (old.is_locked = true) then - if (tg_op = 'DELETE') then - raise exception 'Compromisso bloqueado não pode ser excluído.'; - end if; - - if (tg_op = 'UPDATE') then - if (new.active = false) then - raise exception 'Compromisso bloqueado não pode ser desativado.'; - end if; - - -- trava renomear (mantém o "Sessão" sempre igual) - if (new.name is distinct from old.name) then - raise exception 'Compromisso bloqueado não pode ser renomeado.'; - end if; - - -- se quiser travar descrição também, descomente: - -- if (new.description is distinct from old.description) then - -- raise exception 'Compromisso bloqueado não pode alterar descrição.'; - -- end if; - end if; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.guard_locked_commitment() OWNER TO supabase_admin; - --- --- Name: guard_no_change_core_plan_key(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_change_core_plan_key() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') - and new.key is distinct from old.key then - raise exception 'Não é permitido alterar a key do plano padrão (%).', old.key - using errcode = 'P0001'; - end if; - - return new; -end $$; - - -ALTER FUNCTION public.guard_no_change_core_plan_key() OWNER TO supabase_admin; - --- --- Name: guard_no_change_plan_target(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_change_plan_target() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_bypass text; -begin - -- bypass controlado por sessão/transação: - -- só passa se app.plan_migration_bypass = '1' - v_bypass := current_setting('app.plan_migration_bypass', true); - - if v_bypass = '1' then - return new; - end if; - - -- comportamento original (bloqueia qualquer mudança) - if new.target is distinct from old.target then - raise exception 'Não é permitido alterar target do plano (%) de % para %.', - old.key, old.target, new.target - using errcode = 'P0001'; - end if; - - return new; -end -$$; - - -ALTER FUNCTION public.guard_no_change_plan_target() OWNER TO supabase_admin; - --- --- Name: guard_no_delete_core_plans(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_delete_core_plans() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') then - raise exception 'Plano padrão (%) não pode ser removido.', old.key - using errcode = 'P0001'; - end if; - - return old; -end $$; - - -ALTER FUNCTION public.guard_no_delete_core_plans() OWNER TO supabase_admin; - --- --- Name: guard_patient_cannot_own_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_patient_cannot_own_tenant() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_account_type text; -BEGIN - SELECT account_type INTO v_account_type - FROM public.profiles - WHERE id = NEW.user_id; - - IF v_account_type = 'patient' AND NEW.role IN ('tenant_admin', 'therapist') THEN - RAISE EXCEPTION 'Usuário com perfil "patient" não pode ser proprietário ou terapeuta de um tenant. Se tornou profissional? Crie uma nova conta.' - USING ERRCODE = 'P0001'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_patient_cannot_own_tenant() OWNER TO supabase_admin; - --- --- Name: guard_tenant_kind_immutable(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_tenant_kind_immutable() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF NEW.kind IS DISTINCT FROM OLD.kind THEN - RAISE EXCEPTION 'tenants.kind é imutável após criação. Tentativa de alterar "%" para "%".', OLD.kind, NEW.kind - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_tenant_kind_immutable() OWNER TO supabase_admin; - --- --- Name: handle_new_user(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.handle_new_user() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -BEGIN - INSERT INTO public.profiles (id, role, account_type) - VALUES (NEW.id, 'portal_user', 'free') - ON CONFLICT (id) DO NOTHING; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.handle_new_user() OWNER TO supabase_admin; - --- --- Name: handle_new_user_create_personal_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.handle_new_user_create_personal_tenant() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -BEGIN - -- Desabilitado. Tenant criado no onboarding via provision_account_tenant(). - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.handle_new_user_create_personal_tenant() OWNER TO supabase_admin; - --- --- Name: has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.owner_feature_entitlements e - where e.owner_id = p_owner_id - and e.feature_key = p_feature_key - ); -$$; - - -ALTER FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: is_clinic_tenant(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_clinic_tenant(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id - AND t.kind IN ('clinic', 'clinic_coworking', 'clinic_reception', 'clinic_full') - ); -$$; - - -ALTER FUNCTION public.is_clinic_tenant(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_saas_admin(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_saas_admin() RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 from public.saas_admins sa - where sa.user_id = auth.uid() - ); -$$; - - -ALTER FUNCTION public.is_saas_admin() OWNER TO supabase_admin; - --- --- Name: is_tenant_admin(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_tenant_admin(p_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and tm.status = 'active' - ); -$$; - - -ALTER FUNCTION public.is_tenant_admin(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_tenant_member(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_tenant_member(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.tenant_members m - where m.tenant_id = _tenant_id - and m.user_id = auth.uid() - and m.status = 'active' - ); -$$; - - -ALTER FUNCTION public.is_tenant_member(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_therapist_tenant(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_therapist_tenant(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id AND t.kind = 'therapist' - ); -$$; - - -ALTER FUNCTION public.is_therapist_tenant(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: jwt_email(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.jwt_email() RETURNS text - LANGUAGE sql STABLE - AS $$ - select nullif(lower(current_setting('request.jwt.claim.email', true)), ''); -$$; - - -ALTER FUNCTION public.jwt_email() OWNER TO supabase_admin; - --- --- Name: my_tenants(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.my_tenants() RETURNS TABLE(tenant_id uuid, role text, status text, kind text) - LANGUAGE sql STABLE - AS $$ - select - tm.tenant_id, - tm.role, - tm.status, - t.kind - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = auth.uid(); -$$; - - -ALTER FUNCTION public.my_tenants() OWNER TO supabase_admin; - --- --- Name: on_new_user_seed_patient_groups(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.on_new_user_seed_patient_groups() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - BEGIN - PERFORM public.seed_default_patient_groups(NEW.id); - RETURN NEW; - END; - $$; - - -ALTER FUNCTION public.on_new_user_seed_patient_groups() OWNER TO supabase_admin; - --- --- Name: patients_validate_member_consistency(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.patients_validate_member_consistency() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_tenant_responsible uuid; - v_tenant_therapist uuid; -BEGIN - -- responsible_member sempre deve existir e ser do tenant - SELECT tenant_id INTO v_tenant_responsible - FROM public.tenant_members - WHERE id = NEW.responsible_member_id; - - IF v_tenant_responsible IS NULL THEN - RAISE EXCEPTION 'Responsible member not found'; - END IF; - - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'tenant_id is required'; - END IF; - - IF v_tenant_responsible <> NEW.tenant_id THEN - RAISE EXCEPTION 'Responsible member must belong to the same tenant'; - END IF; - - -- therapist scope: therapist_member_id deve existir e ser do mesmo tenant - IF NEW.patient_scope = 'therapist' THEN - IF NEW.therapist_member_id IS NULL THEN - RAISE EXCEPTION 'therapist_member_id is required when patient_scope=therapist'; - END IF; - - SELECT tenant_id INTO v_tenant_therapist - FROM public.tenant_members - WHERE id = NEW.therapist_member_id; - - IF v_tenant_therapist IS NULL THEN - RAISE EXCEPTION 'Therapist member not found'; - END IF; - - IF v_tenant_therapist <> NEW.tenant_id THEN - RAISE EXCEPTION 'Therapist member must belong to the same tenant'; - END IF; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.patients_validate_member_consistency() OWNER TO supabase_admin; - --- --- Name: patients_validate_responsible_member_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.patients_validate_responsible_member_tenant() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - m_tenant uuid; -begin - select tenant_id into m_tenant - from public.tenant_members - where id = new.responsible_member_id; - - if m_tenant is null then - raise exception 'Responsible member not found'; - end if; - - if new.tenant_id is null then - raise exception 'tenant_id is required'; - end if; - - if m_tenant <> new.tenant_id then - raise exception 'Responsible member must belong to the same tenant'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.patients_validate_responsible_member_tenant() OWNER TO supabase_admin; - --- --- Name: prevent_promoting_to_system(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_promoting_to_system() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.is_system = true and old.is_system is distinct from true then - raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.'; - end if; - return new; -end; -$$; - - -ALTER FUNCTION public.prevent_promoting_to_system() OWNER TO supabase_admin; - --- --- Name: prevent_saas_membership(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_saas_membership() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM public.profiles - WHERE id = NEW.user_id - AND role = 'saas_admin' - ) THEN - RAISE EXCEPTION 'SaaS admin cannot belong to tenant'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.prevent_saas_membership() OWNER TO supabase_admin; - --- --- Name: prevent_system_group_changes(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_system_group_changes() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - -- Se for grupo do sistema, regras rígidas: - if old.is_system = true then - - -- nunca pode deletar - if tg_op = 'DELETE' then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - if tg_op = 'UPDATE' then - -- permite SOMENTE mudar tenant_id e/ou updated_at - -- qualquer mudança de conteúdo permanece proibida - if - new.nome is distinct from old.nome or - new.descricao is distinct from old.descricao or - new.cor is distinct from old.cor or - new.is_active is distinct from old.is_active or - new.is_system is distinct from old.is_system or - new.owner_id is distinct from old.owner_id or - new.therapist_id is distinct from old.therapist_id or - new.created_at is distinct from old.created_at - then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - -- chegou aqui: só tenant_id/updated_at mudaram -> ok - return new; - end if; - - end if; - - -- não-system: deixa passar - if tg_op = 'DELETE' then - return old; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.prevent_system_group_changes() OWNER TO supabase_admin; - --- --- Name: provision_account_tenant(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text DEFAULT NULL::text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_tenant_id uuid; - v_account_type text; - v_name text; -BEGIN - IF p_kind NOT IN ('therapist', 'clinic_coworking', 'clinic_reception', 'clinic_full') THEN - RAISE EXCEPTION 'kind inválido: "%". Use: therapist, clinic_coworking, clinic_reception, clinic_full.', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_account_type := CASE WHEN p_kind = 'therapist' THEN 'therapist' ELSE 'clinic' END; - - IF EXISTS ( - SELECT 1 - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = p_user_id - AND tm.role = 'tenant_admin' - AND tm.status = 'active' - AND t.kind = p_kind - ) THEN - RAISE EXCEPTION 'Usuário já possui um tenant do tipo "%".', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_name := COALESCE( - NULLIF(TRIM(p_name), ''), - ( - SELECT COALESCE(NULLIF(TRIM(pr.full_name), ''), SPLIT_PART(au.email, '@', 1)) - FROM public.profiles pr - JOIN auth.users au ON au.id = pr.id - WHERE pr.id = p_user_id - ), - 'Conta' - ); - - INSERT INTO public.tenants (name, kind, created_at) - VALUES (v_name, p_kind, now()) - RETURNING id INTO v_tenant_id; - - INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) - VALUES (v_tenant_id, p_user_id, 'tenant_admin', 'active', now()); - - UPDATE public.profiles - SET account_type = v_account_type - WHERE id = p_user_id; - - PERFORM public.seed_determined_commitments(v_tenant_id); - - RETURN v_tenant_id; -END; -$$; - - -ALTER FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) OWNER TO supabase_admin; - --- --- Name: FUNCTION provision_account_tenant(p_user_id uuid, p_kind text, p_name text); Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) IS 'Cria o tenant do tipo correto e atualiza account_type no profile. Chamar no onboarding após escolha/pagamento de plano therapist ou clinic. p_kind: therapist | clinic_coworking | clinic_reception | clinic_full'; - - --- --- Name: reactivate_subscription(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.reactivate_subscription(p_subscription_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'active' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'active', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'reactivated', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Reativação manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'canceled') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION public.reactivate_subscription(p_subscription_id uuid) OWNER TO supabase_admin; - --- --- Name: rebuild_owner_entitlements(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- Plano ativo do owner (owner = subscriptions.user_id) - select s.plan_id - into v_plan_id - from public.subscriptions s - where s.user_id = p_owner_id - and s.status = 'active' - order by s.created_at desc - limit 1; - - -- Sempre zera entitlements do owner (rebuild) - delete from public.owner_feature_entitlements e - where e.owner_id = p_owner_id; - - -- Se não tem assinatura ativa, acabou - if v_plan_id is null then - return; - end if; - - -- Recria entitlements esperados pelo plano - insert into public.owner_feature_entitlements (owner_id, feature_key, sources, limits_list) - select - p_owner_id as owner_id, - f.key as feature_key, - array['plan'::text] as sources, - '{}'::jsonb as limits_list - from public.plan_features pf - join public.features f on f.id = pf.feature_id - where pf.plan_id = v_plan_id; - -end; -$$; - - -ALTER FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) OWNER TO supabase_admin; - --- --- Name: revoke_support_session(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.revoke_support_session(p_token text) RETURNS boolean - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_admin_id uuid; - v_role text; -BEGIN - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - SELECT role INTO v_role FROM public.profiles WHERE id = v_admin_id; - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado.' USING ERRCODE = 'P0002'; - END IF; - - DELETE FROM public.support_sessions - WHERE token = p_token - AND admin_id = v_admin_id; - - RETURN FOUND; -END; -$$; - - -ALTER FUNCTION public.revoke_support_session(p_token text) OWNER TO supabase_admin; - --- --- Name: rotate_patient_invite_token(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.rotate_patient_invite_token(p_new_token text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_uid uuid; - v_id uuid; -begin - -- pega o usuário logado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Usuário não autenticado'; - end if; - - -- desativa tokens antigos ativos do usuário - update public.patient_invites - set active = false - where owner_id = v_uid - and active = true; - - -- cria novo token - insert into public.patient_invites (owner_id, token, active) - values (v_uid, p_new_token, true) - returning id into v_id; - - return v_id; -end; -$$; - - -ALTER FUNCTION public.rotate_patient_invite_token(p_new_token text) OWNER TO supabase_admin; - --- --- Name: saas_votar_doc(uuid, boolean); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid := auth.uid(); - v_voto_antigo boolean; -begin - if v_uid is null then - raise exception 'Não autenticado'; - end if; - - -- Verifica se já votou - select util into v_voto_antigo - from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - if found then - -- Já votou igual → cancela o voto (toggle) - if v_voto_antigo = p_util then - delete from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util - (case when p_util then 1 else 0 end)), - votos_nao_util = greatest(0, votos_nao_util - (case when not p_util then 1 else 0 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'removido', 'util', null); - else - -- Mudou de voto - update public.saas_doc_votos set util = p_util, updated_at = now() - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util + (case when p_util then 1 else -1 end)), - votos_nao_util = greatest(0, votos_nao_util + (case when not p_util then 1 else -1 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'atualizado', 'util', p_util); - end if; - else - -- Primeiro voto - insert into public.saas_doc_votos (doc_id, user_id, util) - values (p_doc_id, v_uid, p_util); - - update public.saas_docs set - votos_util = votos_util + (case when p_util then 1 else 0 end), - votos_nao_util = votos_nao_util + (case when not p_util then 1 else 0 end), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'registrado', 'util', p_util); - end if; -end; -$$; - - -ALTER FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) OWNER TO supabase_admin; - --- --- Name: seed_determined_commitments(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.seed_determined_commitments(p_tenant_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_id uuid; -begin - -- Sessão (locked + sempre ativa) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'session' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'session', true, true, 'Sessão', 'Sessão com paciente'); - end if; - - -- Leitura - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'reading', false, true, 'Leitura', 'Praticar leitura'); - end if; - - -- Supervisão - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'supervision', false, true, 'Supervisão', 'Supervisão'); - end if; - - -- Aula ✅ (corrigido) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'class', false, false, 'Aula', 'Dar aula'); - end if; - - -- Análise pessoal - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal'); - end if; - - -- ------------------------------------------------------- - -- Campos padrão (idempotentes por (commitment_id, key)) - -- ------------------------------------------------------- - - -- Leitura - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'book') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'book', 'Livro', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'author') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'author', 'Autor', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Supervisão - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'supervisor') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'supervisor', 'Supervisor', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'topic') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'topic', 'Assunto', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Aula - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'theme') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'theme', 'Tema', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'group') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'group', 'Turma', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Análise - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'analyst') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'analyst', 'Analista', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'focus') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'focus', 'Foco', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; -end; -$$; - - -ALTER FUNCTION public.seed_determined_commitments(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: set_insurance_plans_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_insurance_plans_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN NEW.updated_at = now(); RETURN NEW; END; $$; - - -ALTER FUNCTION public.set_insurance_plans_updated_at() OWNER TO supabase_admin; - --- --- Name: set_owner_id(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_owner_id() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.owner_id is null then - new.owner_id := auth.uid(); - end if; - return new; -end; -$$; - - -ALTER FUNCTION public.set_owner_id() OWNER TO supabase_admin; - --- --- Name: set_services_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_services_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.set_services_updated_at() OWNER TO supabase_admin; - --- --- Name: set_tenant_feature_exception(uuid, text, boolean, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text DEFAULT NULL::text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -begin - -- ✅ Só owner ou admin do tenant podem alterar features - if not exists ( - select 1 from public.tenant_members - where tenant_id = p_tenant_id - and user_id = auth.uid() - and role in ('owner', 'admin') - and status = 'active' - ) then - raise exception 'Acesso negado: apenas owner/admin pode alterar features do tenant.'; - end if; - - insert into public.tenant_features (tenant_id, feature_key, enabled) - values (p_tenant_id, p_feature_key, p_enabled) - on conflict (tenant_id, feature_key) - do update set enabled = excluded.enabled; - - insert into public.tenant_feature_exceptions_log ( - tenant_id, feature_key, enabled, reason, created_by - ) values ( - p_tenant_id, p_feature_key, p_enabled, p_reason, auth.uid() - ); -end; -$$; - - -ALTER FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) OWNER TO supabase_admin; - --- --- Name: set_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - new.updated_at = now(); - return new; -end; -$$; - - -ALTER FUNCTION public.set_updated_at() OWNER TO supabase_admin; - --- --- Name: set_updated_at_recurrence(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_updated_at_recurrence() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN NEW.updated_at = now(); RETURN NEW; END; -$$; - - -ALTER FUNCTION public.set_updated_at_recurrence() OWNER TO supabase_admin; - --- --- Name: split_recurrence_at(uuid, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_old public.recurrence_rules; - v_new_id uuid; -BEGIN - -- busca a regra original - SELECT * INTO v_old - FROM public.recurrence_rules - WHERE id = p_recurrence_id; - - IF NOT FOUND THEN - RAISE EXCEPTION 'recurrence_rule % não encontrada', p_recurrence_id; - END IF; - - -- encerra a regra antiga na data anterior - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - updated_at = now() - WHERE id = p_recurrence_id; - - -- cria nova regra a partir de p_from_date - INSERT INTO public.recurrence_rules ( - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - start_date, end_date, max_occurrences, open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - ) - SELECT - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - p_from_date, v_old.end_date, v_old.max_occurrences, v_old.open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - FROM public.recurrence_rules - WHERE id = p_recurrence_id - RETURNING id INTO v_new_id; - - RETURN v_new_id; -END; -$$; - - -ALTER FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) OWNER TO supabase_admin; - --- --- Name: subscription_intents_view_insert(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.subscription_intents_view_insert() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_target text; - v_plan_id uuid; -begin - select p.id, p.target into v_plan_id, v_target - from public.plans p - where p.key = new.plan_key; - - if v_plan_id is null then - raise exception 'Plano inválido: plan_key=%', new.plan_key; - end if; - - if lower(v_target) = 'clinic' then - if new.tenant_id is null then - raise exception 'Intenção clinic exige tenant_id.'; - end if; - - insert into public.subscription_intents_tenant ( - id, tenant_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.tenant_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := 'clinic'; - return new; - end if; - - -- therapist ou supervisor → tabela personal - if lower(v_target) in ('therapist', 'supervisor') then - insert into public.subscription_intents_personal ( - id, user_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.user_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := lower(v_target); -- 'therapist' ou 'supervisor' - return new; - end if; - - raise exception 'Target de plano não suportado: %', v_target; -end; -$$; - - -ALTER FUNCTION public.subscription_intents_view_insert() OWNER TO supabase_admin; - --- --- Name: subscriptions_validate_scope(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.subscriptions_validate_scope() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target IN ('therapist', 'supervisor') THEN - -- supervisor é pessoal como therapist - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura % não deve ter tenant_id.', v_target; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura % exige user_id.', v_target; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.subscriptions_validate_scope() OWNER TO supabase_admin; - --- --- Name: sync_busy_mirror_agenda_eventos(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.sync_busy_mirror_agenda_eventos() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - clinic_tenant uuid; - is_personal boolean; - should_mirror boolean; -begin - -- Anti-recursão: espelho não espelha - if (tg_op <> 'DELETE') then - if new.mirror_of_event_id is not null then - return new; - end if; - else - if old.mirror_of_event_id is not null then - return old; - end if; - end if; - - -- Define se é pessoal e se deve espelhar - if (tg_op = 'DELETE') then - is_personal := (old.tenant_id = old.owner_id); - should_mirror := (old.visibility_scope in ('busy_only','private')); - else - is_personal := (new.tenant_id = new.owner_id); - should_mirror := (new.visibility_scope in ('busy_only','private')); - end if; - - -- Se não é pessoal, não faz nada - if not is_personal then - if (tg_op = 'DELETE') then - return old; - end if; - return new; - end if; - - -- DELETE: remove espelhos existentes - if (tg_op = 'DELETE') then - delete from public.agenda_eventos e - where e.mirror_of_event_id = old.id - and e.mirror_source = 'personal_busy_mirror'; - - return old; - end if; - - -- INSERT/UPDATE: - -- Se não deve espelhar, remove espelhos e sai - if not should_mirror then - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror'; - - return new; - end if; - - -- Para cada clínica onde o usuário é therapist active, cria/atualiza o "Ocupado" - for clinic_tenant in - select tm.tenant_id - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id <> new.owner_id - loop - insert into public.agenda_eventos ( - tenant_id, - owner_id, - terapeuta_id, - paciente_id, - tipo, - status, - titulo, - observacoes, - inicio_em, - fim_em, - mirror_of_event_id, - mirror_source, - visibility_scope, - created_at, - updated_at - ) values ( - clinic_tenant, - new.owner_id, - new.owner_id, - null, - 'bloqueio'::public.tipo_evento_agenda, - 'agendado'::public.status_evento_agenda, - 'Ocupado', - null, - new.inicio_em, - new.fim_em, - new.id, - 'personal_busy_mirror', - 'public', - now(), - now() - ) - on conflict (tenant_id, mirror_of_event_id) where mirror_of_event_id is not null - do update set - owner_id = excluded.owner_id, - terapeuta_id = excluded.terapeuta_id, - tipo = excluded.tipo, - status = excluded.status, - titulo = excluded.titulo, - observacoes = excluded.observacoes, - inicio_em = excluded.inicio_em, - fim_em = excluded.fim_em, - updated_at = now(); - end loop; - - -- Limpa espelhos de clínicas onde o vínculo therapist active não existe mais - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror' - and not exists ( - select 1 - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id = e.tenant_id - ); - - return new; -end; -$$; - - -ALTER FUNCTION public.sync_busy_mirror_agenda_eventos() OWNER TO supabase_admin; - --- --- Name: tenant_accept_invite(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_accept_invite(p_token uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_uid uuid; - v_email text; - v_invite public.tenant_invites%rowtype; -begin - -- 1) precisa estar autenticado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'not_authenticated' using errcode = 'P0001'; - end if; - - -- 2) pega email real do usuário logado sem depender do JWT claim - select u.email - into v_email - from auth.users u - where u.id = v_uid; - - if v_email is null or length(trim(v_email)) = 0 then - raise exception 'missing_user_email' using errcode = 'P0001'; - end if; - - -- 3) carrega o invite e trava linha (evita 2 aceites concorrentes) - select * - into v_invite - from public.tenant_invites i - where i.token = p_token - for update; - - if not found then - raise exception 'invite_not_found' using errcode = 'P0001'; - end if; - - -- 4) validações de estado - if v_invite.revoked_at is not null then - raise exception 'invite_revoked' using errcode = 'P0001'; - end if; - - if v_invite.accepted_at is not null then - raise exception 'invite_already_accepted' using errcode = 'P0001'; - end if; - - if v_invite.expires_at is not null and v_invite.expires_at <= now() then - raise exception 'invite_expired' using errcode = 'P0001'; - end if; - - -- 5) valida email (case-insensitive) - if lower(trim(v_invite.email)) <> lower(trim(v_email)) then - raise exception 'email_mismatch' using errcode = 'P0001'; - end if; - - -- 6) consome o invite - update public.tenant_invites - set accepted_at = now(), - accepted_by = v_uid - where id = v_invite.id; - - -- 7) cria ou reativa o membership - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_invite.tenant_id, v_uid, v_invite.role, 'active', now()) - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active'; - - -- 8) retorno útil pro front (você já tenta ler tenant_id no AcceptInvitePage) - return jsonb_build_object( - 'ok', true, - 'tenant_id', v_invite.tenant_id, - 'role', v_invite.role - ); -end; -$$; - - -ALTER FUNCTION public.tenant_accept_invite(p_token uuid) OWNER TO supabase_admin; - --- --- Name: tenant_members; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_members ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - user_id uuid NOT NULL, - role text NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_members OWNER TO supabase_admin; - --- --- Name: tenant_add_member_by_email(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text DEFAULT 'therapist'::text) RETURNS public.tenant_members - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_target_uid uuid; - v_member public.tenant_members%rowtype; - v_is_admin boolean; - v_email text; -begin - if p_tenant_id is null then - raise exception 'tenant_id é obrigatório'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'email é obrigatório'; - end if; - - -- valida role permitida - if p_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'role inválida: %', p_role; - end if; - - -- apenas admin do tenant (role real no banco) - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and coalesce(tm.status,'active') = 'active' - ) into v_is_admin; - - if not v_is_admin then - raise exception 'sem permissão: apenas admin da clínica pode adicionar membros'; - end if; - - -- acha usuário pelo e-mail no Supabase Auth - select u.id - into v_target_uid - from auth.users u - where lower(u.email) = v_email - limit 1; - - if v_target_uid is null then - raise exception 'nenhum usuário encontrado com este e-mail'; - end if; - - -- cria ou reativa membro - insert into public.tenant_members (tenant_id, user_id, role, status) - values (p_tenant_id, v_target_uid, p_role, 'active') - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active' - returning * into v_member; - - return v_member; -end; -$$; - - -ALTER FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_feature_allowed(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.v_tenant_entitlements v - where v.tenant_id = p_tenant_id - and v.feature_key = p_feature_key - and coalesce(v.allowed, false) = true - ); -$$; - - -ALTER FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: tenant_feature_enabled(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select coalesce( - (select tf.enabled - from public.tenant_features tf - where tf.tenant_id = p_tenant_id and tf.feature_key = p_feature_key), - false - ); -$$; - - -ALTER FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: tenant_features_guard_with_plan(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_features_guard_with_plan() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_allowed boolean; -begin - -- só valida quando está habilitando - if new.enabled is distinct from true then - return new; - end if; - - -- permitido pelo plano do tenant? - select exists ( - select 1 - from public.v_tenant_entitlements_full v - where v.tenant_id = new.tenant_id - and v.feature_key = new.feature_key - and v.allowed = true - ) - into v_allowed; - - if not v_allowed then - raise exception 'Feature % não permitida pelo plano atual do tenant %.', - new.feature_key, new.tenant_id - using errcode = 'P0001'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.tenant_features_guard_with_plan() OWNER TO supabase_admin; - --- --- Name: tenant_has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select - exists ( - select 1 - from public.v_tenant_entitlements e - where e.tenant_id = _tenant_id - and e.feature_key = _feature - and e.allowed = true - ) - or exists ( - select 1 - from public.tenant_features tf - where tf.tenant_id = _tenant_id - and tf.feature_key = _feature - and tf.enabled = true - ); -$$; - - -ALTER FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) OWNER TO supabase_admin; - --- --- Name: tenant_invite_member_by_email(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_email text; - v_my_email text; - v_token uuid; - v_updated int; -begin - -- validações básicas - if p_tenant_id is null then - raise exception 'tenant_id inválido' using errcode = 'P0001'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'Informe um email' using errcode = 'P0001'; - end if; - - -- role permitido (ajuste se quiser) - if p_role is null or p_role not in ('therapist', 'secretary') then - raise exception 'Role inválido (use therapist/secretary)' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: auto-convite - v_my_email := public.get_my_email(); - if v_my_email is not null and v_email = v_my_email then - raise exception 'Você não pode convidar o seu próprio email.' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: já é membro ativo do tenant - if exists ( - select 1 - from tenant_members tm - join auth.users au on au.id = tm.user_id - where tm.tenant_id = p_tenant_id - and tm.status = 'active' - and lower(au.email) = v_email - ) then - raise exception 'Este email já está vinculado a esta clínica.' using errcode = 'P0001'; - end if; - - -- ✅ permissão: só admin do tenant pode convidar - if not exists ( - select 1 - from tenant_members me - where me.tenant_id = p_tenant_id - and me.user_id = auth.uid() - and me.status = 'active' - and me.role in ('tenant_admin','clinic_admin') - ) then - raise exception 'Sem permissão para convidar membros.' using errcode = 'P0001'; - end if; - - -- Gera token (reenvio simples / regeneração) - v_token := gen_random_uuid(); - - -- 1) tenta "regerar" um convite pendente existente (mesmo email) - update tenant_invites - set token = v_token, - role = p_role, - created_at = now(), - expires_at = now() + interval '7 days', - accepted_at = null, - revoked_at = null - where tenant_id = p_tenant_id - and lower(email) = v_email - and accepted_at is null - and revoked_at is null; - - get diagnostics v_updated = row_count; - - -- 2) se não atualizou nada, cria convite novo - if v_updated = 0 then - insert into tenant_invites (tenant_id, email, role, token, created_at, expires_at) - values (p_tenant_id, v_email, p_role, v_token, now(), now() + interval '7 days'); - end if; - - return v_token; -end; -$$; - - -ALTER FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_reactivate_member(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - update public.tenant_members - set status = 'active' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_remove_member(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -declare - v_role text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - -- pega role atual do membro (se não existir, erro) - select role into v_role - from public.tenant_members - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if v_role is null then - raise exception 'membership_not_found'; - end if; - - -- trava: se for therapist, não pode remover com eventos futuros - if v_role = 'therapist' then - if exists ( - select 1 - from public.agenda_eventos e - where e.owner_id = p_tenant_id - and e.terapeuta_id = p_member_user_id - and e.inicio_em >= now() - and e.status::text not in ('cancelado','cancelled','canceled') - limit 1 - ) then - raise exception 'cannot_remove_therapist_with_future_events'; - end if; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_remove_member_soft(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_revoke_invite(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -declare - v_email text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - v_email := lower(trim(p_email)); - - update public.tenant_invites - set revoked_at = now(), - revoked_by = auth.uid() - where tenant_id = p_tenant_id - and lower(email) = v_email - and role = p_role - and accepted_at is null - and revoked_at is null; - - if not found then - raise exception 'invite_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_set_member_status(uuid, uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida status (adapte aos seus valores reais) - if p_new_status not in ('active','inactive','suspended','invited') then - raise exception 'invalid_status: %', p_new_status; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita desativar a si mesmo (opcional) - if p_member_user_id = auth.uid() and p_new_status <> 'active' then - raise exception 'cannot_disable_self'; - end if; - - update public.tenant_members - set status = p_new_status - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) OWNER TO supabase_admin; - --- --- Name: tenant_update_member_role(uuid, uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - -- exige auth - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida role - if p_new_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'invalid_role: %', p_new_role; - end if; - - -- somente tenant_admin ativo pode alterar role - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita o admin remover o próprio admin sem querer (opcional mas recomendado) - if p_member_user_id = auth.uid() and p_new_role <> 'tenant_admin' then - raise exception 'cannot_demote_self'; - end if; - - update public.tenant_members - set role = p_new_role - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) OWNER TO supabase_admin; - --- --- Name: toggle_plan(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.toggle_plan(owner uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - current_key text; - new_key text; -begin - select p.key into current_key - from subscriptions s - join plans p on p.id = s.plan_id - where s.owner_id = owner - and s.status = 'active'; - - new_key := case - when current_key = 'pro' then 'free' - else 'pro' - end; - - update subscriptions s - set plan_id = p.id - from plans p - where p.key = new_key - and s.owner_id = owner - and s.status = 'active'; -end; -$$; - - -ALTER FUNCTION public.toggle_plan(owner uuid) OWNER TO supabase_admin; - --- --- Name: transition_subscription(uuid, text, text, jsonb); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text DEFAULT NULL::text, p_metadata jsonb DEFAULT NULL::jsonb) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_uid uuid; - v_is_allowed boolean := false; -begin - v_uid := auth.uid(); - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id; - - if not found then - raise exception 'Assinatura não encontrada'; - end if; - - -- ===================================================== - -- 🔐 BLOCO DE AUTORIZAÇÃO - -- ===================================================== - - -- 1) SaaS admin pode tudo - if is_saas_admin() then - v_is_allowed := true; - end if; - - -- 2) Assinatura pessoal (therapist) - if not v_is_allowed - and v_sub.tenant_id is null - and v_sub.user_id = v_uid then - v_is_allowed := true; - end if; - - -- 3) Assinatura de clinic (tenant) - if not v_is_allowed - and v_sub.tenant_id is not null then - - if exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = v_sub.tenant_id - and tm.user_id = v_uid - and tm.status = 'active' - and tm.role = 'tenant_admin' - ) then - v_is_allowed := true; - end if; - - end if; - - if not v_is_allowed then - raise exception 'Sem permissão para transicionar esta assinatura'; - end if; - - -- ===================================================== - -- 🧠 TRANSIÇÃO - -- ===================================================== - - update public.subscriptions - set status = p_to_status, - updated_at = now(), - cancelled_at = case when p_to_status = 'cancelled' then now() else cancelled_at end, - suspended_at = case when p_to_status = 'suspended' then now() else suspended_at end, - past_due_since = case when p_to_status = 'past_due' then now() else past_due_since end, - expired_at = case when p_to_status = 'expired' then now() else expired_at end, - activated_at = case when p_to_status = 'active' then now() else activated_at end - where id = p_subscription_id - returning * into v_sub; - - -- ===================================================== - -- 🧾 EVENT LOG - -- ===================================================== - - insert into public.subscription_events ( - subscription_id, - owner_id, - event_type, - created_at, - created_by, - source, - reason, - metadata, - owner_type, - owner_ref - ) - values ( - v_sub.id, - coalesce(v_sub.tenant_id, v_sub.user_id), - 'status_changed', - now(), - v_uid, - 'manual_transition', - p_reason, - p_metadata, - case when v_sub.tenant_id is not null then 'tenant' else 'personal' end, - coalesce(v_sub.tenant_id, v_sub.user_id) - ); - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) OWNER TO supabase_admin; - --- --- Name: update_payment_settings_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.update_payment_settings_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.update_payment_settings_updated_at() OWNER TO supabase_admin; - --- --- Name: update_professional_pricing_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.update_professional_pricing_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.update_professional_pricing_updated_at() OWNER TO supabase_admin; - --- --- Name: user_has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.user_has_feature(_user_id uuid, _feature text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.v_user_entitlements e - where e.user_id = _user_id - and e.feature_key = _feature - and e.allowed = true - ); -$$; - - -ALTER FUNCTION public.user_has_feature(_user_id uuid, _feature text) OWNER TO supabase_admin; - --- --- Name: validate_support_session(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.validate_support_session(p_token text) RETURNS json - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_session support_sessions; -BEGIN - IF p_token IS NULL OR length(trim(p_token)) < 32 THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - SELECT * INTO v_session - FROM public.support_sessions - WHERE token = p_token - AND expires_at > now() - LIMIT 1; - - IF NOT FOUND THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - RETURN json_build_object( - 'valid', true, - 'tenant_id', v_session.tenant_id - ); -END; -$$; - - -ALTER FUNCTION public.validate_support_session(p_token text) OWNER TO supabase_admin; - --- --- Name: whoami(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.whoami() RETURNS TABLE(uid uuid, role text) - LANGUAGE sql STABLE - AS $$ - select auth.uid() as uid, auth.role() as role; -$$; - - -ALTER FUNCTION public.whoami() OWNER TO supabase_admin; - --- --- Name: apply_rls(jsonb, integer); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer DEFAULT (1024 * 1024)) RETURNS SETOF realtime.wal_rls - LANGUAGE plpgsql - AS $$ -declare --- Regclass of the table e.g. public.notes -entity_ regclass = (quote_ident(wal ->> 'schema') || '.' || quote_ident(wal ->> 'table'))::regclass; - --- I, U, D, T: insert, update ... -action realtime.action = ( - case wal ->> 'action' - when 'I' then 'INSERT' - when 'U' then 'UPDATE' - when 'D' then 'DELETE' - else 'ERROR' - end -); - --- Is row level security enabled for the table -is_rls_enabled bool = relrowsecurity from pg_class where oid = entity_; - -subscriptions realtime.subscription[] = array_agg(subs) - from - realtime.subscription subs - where - subs.entity = entity_; - --- Subscription vars -roles regrole[] = array_agg(distinct us.claims_role::text) - from - unnest(subscriptions) us; - -working_role regrole; -claimed_role regrole; -claims jsonb; - -subscription_id uuid; -subscription_has_access bool; -visible_to_subscription_ids uuid[] = '{}'; - --- structured info for wal's columns -columns realtime.wal_column[]; --- previous identity values for update/delete -old_columns realtime.wal_column[]; - -error_record_exceeds_max_size boolean = octet_length(wal::text) > max_record_bytes; - --- Primary jsonb output for record -output jsonb; - -begin -perform set_config('role', null, true); - -columns = - array_agg( - ( - x->>'name', - x->>'type', - x->>'typeoid', - realtime.cast( - (x->'value') #>> '{}', - coalesce( - (x->>'typeoid')::regtype, -- null when wal2json version <= 2.4 - (x->>'type')::regtype - ) - ), - (pks ->> 'name') is not null, - true - )::realtime.wal_column - ) - from - jsonb_array_elements(wal -> 'columns') x - left join jsonb_array_elements(wal -> 'pk') pks - on (x ->> 'name') = (pks ->> 'name'); - -old_columns = - array_agg( - ( - x->>'name', - x->>'type', - x->>'typeoid', - realtime.cast( - (x->'value') #>> '{}', - coalesce( - (x->>'typeoid')::regtype, -- null when wal2json version <= 2.4 - (x->>'type')::regtype - ) - ), - (pks ->> 'name') is not null, - true - )::realtime.wal_column - ) - from - jsonb_array_elements(wal -> 'identity') x - left join jsonb_array_elements(wal -> 'pk') pks - on (x ->> 'name') = (pks ->> 'name'); - -for working_role in select * from unnest(roles) loop - - -- Update `is_selectable` for columns and old_columns - columns = - array_agg( - ( - c.name, - c.type_name, - c.type_oid, - c.value, - c.is_pkey, - pg_catalog.has_column_privilege(working_role, entity_, c.name, 'SELECT') - )::realtime.wal_column - ) - from - unnest(columns) c; - - old_columns = - array_agg( - ( - c.name, - c.type_name, - c.type_oid, - c.value, - c.is_pkey, - pg_catalog.has_column_privilege(working_role, entity_, c.name, 'SELECT') - )::realtime.wal_column - ) - from - unnest(old_columns) c; - - if action <> 'DELETE' and count(1) = 0 from unnest(columns) c where c.is_pkey then - return next ( - jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action - ), - is_rls_enabled, - -- subscriptions is already filtered by entity - (select array_agg(s.subscription_id) from unnest(subscriptions) as s where claims_role = working_role), - array['Error 400: Bad Request, no primary key'] - )::realtime.wal_rls; - - -- The claims role does not have SELECT permission to the primary key of entity - elsif action <> 'DELETE' and sum(c.is_selectable::int) <> count(1) from unnest(columns) c where c.is_pkey then - return next ( - jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action - ), - is_rls_enabled, - (select array_agg(s.subscription_id) from unnest(subscriptions) as s where claims_role = working_role), - array['Error 401: Unauthorized'] - )::realtime.wal_rls; - - else - output = jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action, - 'commit_timestamp', to_char( - ((wal ->> 'timestamp')::timestamptz at time zone 'utc'), - 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"' - ), - 'columns', ( - select - jsonb_agg( - jsonb_build_object( - 'name', pa.attname, - 'type', pt.typname - ) - order by pa.attnum asc - ) - from - pg_attribute pa - join pg_type pt - on pa.atttypid = pt.oid - where - attrelid = entity_ - and attnum > 0 - and pg_catalog.has_column_privilege(working_role, entity_, pa.attname, 'SELECT') - ) - ) - -- Add "record" key for insert and update - || case - when action in ('INSERT', 'UPDATE') then - jsonb_build_object( - 'record', - ( - select - jsonb_object_agg( - -- if unchanged toast, get column name and value from old record - coalesce((c).name, (oc).name), - case - when (c).name is null then (oc).value - else (c).value - end - ) - from - unnest(columns) c - full outer join unnest(old_columns) oc - on (c).name = (oc).name - where - coalesce((c).is_selectable, (oc).is_selectable) - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - ) - ) - else '{}'::jsonb - end - -- Add "old_record" key for update and delete - || case - when action = 'UPDATE' then - jsonb_build_object( - 'old_record', - ( - select jsonb_object_agg((c).name, (c).value) - from unnest(old_columns) c - where - (c).is_selectable - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - ) - ) - when action = 'DELETE' then - jsonb_build_object( - 'old_record', - ( - select jsonb_object_agg((c).name, (c).value) - from unnest(old_columns) c - where - (c).is_selectable - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - and ( not is_rls_enabled or (c).is_pkey ) -- if RLS enabled, we can't secure deletes so filter to pkey - ) - ) - else '{}'::jsonb - end; - - -- Create the prepared statement - if is_rls_enabled and action <> 'DELETE' then - if (select 1 from pg_prepared_statements where name = 'walrus_rls_stmt' limit 1) > 0 then - deallocate walrus_rls_stmt; - end if; - execute realtime.build_prepared_statement_sql('walrus_rls_stmt', entity_, columns); - end if; - - visible_to_subscription_ids = '{}'; - - for subscription_id, claims in ( - select - subs.subscription_id, - subs.claims - from - unnest(subscriptions) subs - where - subs.entity = entity_ - and subs.claims_role = working_role - and ( - realtime.is_visible_through_filters(columns, subs.filters) - or ( - action = 'DELETE' - and realtime.is_visible_through_filters(old_columns, subs.filters) - ) - ) - ) loop - - if not is_rls_enabled or action = 'DELETE' then - visible_to_subscription_ids = visible_to_subscription_ids || subscription_id; - else - -- Check if RLS allows the role to see the record - perform - -- Trim leading and trailing quotes from working_role because set_config - -- doesn't recognize the role as valid if they are included - set_config('role', trim(both '"' from working_role::text), true), - set_config('request.jwt.claims', claims::text, true); - - execute 'execute walrus_rls_stmt' into subscription_has_access; - - if subscription_has_access then - visible_to_subscription_ids = visible_to_subscription_ids || subscription_id; - end if; - end if; - end loop; - - perform set_config('role', null, true); - - return next ( - output, - is_rls_enabled, - visible_to_subscription_ids, - case - when error_record_exceeds_max_size then array['Error 413: Payload Too Large'] - else '{}' - end - )::realtime.wal_rls; - - end if; -end loop; - -perform set_config('role', null, true); -end; -$$; - - -ALTER FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) OWNER TO supabase_admin; - --- --- Name: broadcast_changes(text, text, text, text, text, record, record, text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text DEFAULT 'ROW'::text) RETURNS void - LANGUAGE plpgsql - AS $$ -DECLARE - -- Declare a variable to hold the JSONB representation of the row - row_data jsonb := '{}'::jsonb; -BEGIN - IF level = 'STATEMENT' THEN - RAISE EXCEPTION 'function can only be triggered for each row, not for each statement'; - END IF; - -- Check the operation type and handle accordingly - IF operation = 'INSERT' OR operation = 'UPDATE' OR operation = 'DELETE' THEN - row_data := jsonb_build_object('old_record', OLD, 'record', NEW, 'operation', operation, 'table', table_name, 'schema', table_schema); - PERFORM realtime.send (row_data, event_name, topic_name); - ELSE - RAISE EXCEPTION 'Unexpected operation type: %', operation; - END IF; -EXCEPTION - WHEN OTHERS THEN - RAISE EXCEPTION 'Failed to process the row: %', SQLERRM; -END; - -$$; - - -ALTER FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) OWNER TO supabase_admin; - --- --- Name: build_prepared_statement_sql(text, regclass, realtime.wal_column[]); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) RETURNS text - LANGUAGE sql - AS $$ - /* - Builds a sql string that, if executed, creates a prepared statement to - tests retrive a row from *entity* by its primary key columns. - Example - select realtime.build_prepared_statement_sql('public.notes', '{"id"}'::text[], '{"bigint"}'::text[]) - */ - select - 'prepare ' || prepared_statement_name || ' as - select - exists( - select - 1 - from - ' || entity || ' - where - ' || string_agg(quote_ident(pkc.name) || '=' || quote_nullable(pkc.value #>> '{}') , ' and ') || ' - )' - from - unnest(columns) pkc - where - pkc.is_pkey - group by - entity - $$; - - -ALTER FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) OWNER TO supabase_admin; - --- --- Name: cast(text, regtype); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime."cast"(val text, type_ regtype) RETURNS jsonb - LANGUAGE plpgsql IMMUTABLE - AS $$ - declare - res jsonb; - begin - execute format('select to_jsonb(%L::'|| type_::text || ')', val) into res; - return res; - end - $$; - - -ALTER FUNCTION realtime."cast"(val text, type_ regtype) OWNER TO supabase_admin; - --- --- Name: check_equality_op(realtime.equality_op, regtype, text, text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) RETURNS boolean - LANGUAGE plpgsql IMMUTABLE - AS $$ - /* - Casts *val_1* and *val_2* as type *type_* and check the *op* condition for truthiness - */ - declare - op_symbol text = ( - case - when op = 'eq' then '=' - when op = 'neq' then '!=' - when op = 'lt' then '<' - when op = 'lte' then '<=' - when op = 'gt' then '>' - when op = 'gte' then '>=' - when op = 'in' then '= any' - else 'UNKNOWN OP' - end - ); - res boolean; - begin - execute format( - 'select %L::'|| type_::text || ' ' || op_symbol - || ' ( %L::' - || ( - case - when op = 'in' then type_::text || '[]' - else type_::text end - ) - || ')', val_1, val_2) into res; - return res; - end; - $$; - - -ALTER FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) OWNER TO supabase_admin; - --- --- Name: is_visible_through_filters(realtime.wal_column[], realtime.user_defined_filter[]); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) RETURNS boolean - LANGUAGE sql IMMUTABLE - AS $_$ - /* - Should the record be visible (true) or filtered out (false) after *filters* are applied - */ - select - -- Default to allowed when no filters present - $2 is null -- no filters. this should not happen because subscriptions has a default - or array_length($2, 1) is null -- array length of an empty array is null - or bool_and( - coalesce( - realtime.check_equality_op( - op:=f.op, - type_:=coalesce( - col.type_oid::regtype, -- null when wal2json version <= 2.4 - col.type_name::regtype - ), - -- cast jsonb to text - val_1:=col.value #>> '{}', - val_2:=f.value - ), - false -- if null, filter does not match - ) - ) - from - unnest(filters) f - join unnest(columns) col - on f.column_name = col.name; - $_$; - - -ALTER FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) OWNER TO supabase_admin; - --- --- Name: list_changes(name, name, integer, integer); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) RETURNS SETOF realtime.wal_rls - LANGUAGE sql - SET log_min_messages TO 'fatal' - AS $$ - with pub as ( - select - concat_ws( - ',', - case when bool_or(pubinsert) then 'insert' else null end, - case when bool_or(pubupdate) then 'update' else null end, - case when bool_or(pubdelete) then 'delete' else null end - ) as w2j_actions, - coalesce( - string_agg( - realtime.quote_wal2json(format('%I.%I', schemaname, tablename)::regclass), - ',' - ) filter (where ppt.tablename is not null and ppt.tablename not like '% %'), - '' - ) w2j_add_tables - from - pg_publication pp - left join pg_publication_tables ppt - on pp.pubname = ppt.pubname - where - pp.pubname = publication - group by - pp.pubname - limit 1 - ), - w2j as ( - select - x.*, pub.w2j_add_tables - from - pub, - pg_logical_slot_get_changes( - slot_name, null, max_changes, - 'include-pk', 'true', - 'include-transaction', 'false', - 'include-timestamp', 'true', - 'include-type-oids', 'true', - 'format-version', '2', - 'actions', pub.w2j_actions, - 'add-tables', pub.w2j_add_tables - ) x - ) - select - xyz.wal, - xyz.is_rls_enabled, - xyz.subscription_ids, - xyz.errors - from - w2j, - realtime.apply_rls( - wal := w2j.data::jsonb, - max_record_bytes := max_record_bytes - ) xyz(wal, is_rls_enabled, subscription_ids, errors) - where - w2j.w2j_add_tables <> '' - and xyz.subscription_ids[1] is not null - $$; - - -ALTER FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) OWNER TO supabase_admin; - --- --- Name: quote_wal2json(regclass); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.quote_wal2json(entity regclass) RETURNS text - LANGUAGE sql IMMUTABLE STRICT - AS $$ - select - ( - select string_agg('' || ch,'') - from unnest(string_to_array(nsp.nspname::text, null)) with ordinality x(ch, idx) - where - not (x.idx = 1 and x.ch = '"') - and not ( - x.idx = array_length(string_to_array(nsp.nspname::text, null), 1) - and x.ch = '"' - ) - ) - || '.' - || ( - select string_agg('' || ch,'') - from unnest(string_to_array(pc.relname::text, null)) with ordinality x(ch, idx) - where - not (x.idx = 1 and x.ch = '"') - and not ( - x.idx = array_length(string_to_array(nsp.nspname::text, null), 1) - and x.ch = '"' - ) - ) - from - pg_class pc - join pg_namespace nsp - on pc.relnamespace = nsp.oid - where - pc.oid = entity - $$; - - -ALTER FUNCTION realtime.quote_wal2json(entity regclass) OWNER TO supabase_admin; - --- --- Name: send(jsonb, text, text, boolean); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean DEFAULT true) RETURNS void - LANGUAGE plpgsql - AS $$ -DECLARE - generated_id uuid; - final_payload jsonb; -BEGIN - BEGIN - -- Generate a new UUID for the id - generated_id := gen_random_uuid(); - - -- Check if payload has an 'id' key, if not, add the generated UUID - IF payload ? 'id' THEN - final_payload := payload; - ELSE - final_payload := jsonb_set(payload, '{id}', to_jsonb(generated_id)); - END IF; - - -- Set the topic configuration - EXECUTE format('SET LOCAL realtime.topic TO %L', topic); - - -- Attempt to insert the message - INSERT INTO realtime.messages (id, payload, event, topic, private, extension) - VALUES (generated_id, final_payload, event, topic, private, 'broadcast'); - EXCEPTION - WHEN OTHERS THEN - -- Capture and notify the error - RAISE WARNING 'ErrorSendingBroadcastMessage: %', SQLERRM; - END; -END; -$$; - - -ALTER FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) OWNER TO supabase_admin; - --- --- Name: subscription_check_filters(); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.subscription_check_filters() RETURNS trigger - LANGUAGE plpgsql - AS $$ - /* - Validates that the user defined filters for a subscription: - - refer to valid columns that the claimed role may access - - values are coercable to the correct column type - */ - declare - col_names text[] = coalesce( - array_agg(c.column_name order by c.ordinal_position), - '{}'::text[] - ) - from - information_schema.columns c - where - format('%I.%I', c.table_schema, c.table_name)::regclass = new.entity - and pg_catalog.has_column_privilege( - (new.claims ->> 'role'), - format('%I.%I', c.table_schema, c.table_name)::regclass, - c.column_name, - 'SELECT' - ); - filter realtime.user_defined_filter; - col_type regtype; - - in_val jsonb; - begin - for filter in select * from unnest(new.filters) loop - -- Filtered column is valid - if not filter.column_name = any(col_names) then - raise exception 'invalid column for filter %', filter.column_name; - end if; - - -- Type is sanitized and safe for string interpolation - col_type = ( - select atttypid::regtype - from pg_catalog.pg_attribute - where attrelid = new.entity - and attname = filter.column_name - ); - if col_type is null then - raise exception 'failed to lookup type for column %', filter.column_name; - end if; - - -- Set maximum number of entries for in filter - if filter.op = 'in'::realtime.equality_op then - in_val = realtime.cast(filter.value, (col_type::text || '[]')::regtype); - if coalesce(jsonb_array_length(in_val), 0) > 100 then - raise exception 'too many values for `in` filter. Maximum 100'; - end if; - else - -- raises an exception if value is not coercable to type - perform realtime.cast(filter.value, col_type); - end if; - - end loop; - - -- Apply consistent order to filters so the unique constraint on - -- (subscription_id, entity, filters) can't be tricked by a different filter order - new.filters = coalesce( - array_agg(f order by f.column_name, f.op, f.value), - '{}' - ) from unnest(new.filters) f; - - return new; - end; - $$; - - -ALTER FUNCTION realtime.subscription_check_filters() OWNER TO supabase_admin; - --- --- Name: to_regrole(text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.to_regrole(role_name text) RETURNS regrole - LANGUAGE sql IMMUTABLE - AS $$ select role_name::regrole $$; - - -ALTER FUNCTION realtime.to_regrole(role_name text) OWNER TO supabase_admin; - --- --- Name: topic(); Type: FUNCTION; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE FUNCTION realtime.topic() RETURNS text - LANGUAGE sql STABLE - AS $$ -select nullif(current_setting('realtime.topic', true), '')::text; -$$; - - -ALTER FUNCTION realtime.topic() OWNER TO supabase_realtime_admin; - --- --- Name: can_insert_object(text, text, uuid, jsonb); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb) RETURNS void - LANGUAGE plpgsql - AS $$ -BEGIN - INSERT INTO "storage"."objects" ("bucket_id", "name", "owner", "metadata") VALUES (bucketid, name, owner, metadata); - -- hack to rollback the successful insert - RAISE sqlstate 'PT200' using - message = 'ROLLBACK', - detail = 'rollback successful insert'; -END -$$; - - -ALTER FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb) OWNER TO supabase_storage_admin; - --- --- Name: enforce_bucket_name_length(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.enforce_bucket_name_length() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if length(new.name) > 100 then - raise exception 'bucket name "%" is too long (% characters). Max is 100.', new.name, length(new.name); - end if; - return new; -end; -$$; - - -ALTER FUNCTION storage.enforce_bucket_name_length() OWNER TO supabase_storage_admin; - --- --- Name: extension(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.extension(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -_filename text; -BEGIN - select string_to_array(name, '/') into _parts; - select _parts[array_length(_parts,1)] into _filename; - -- @todo return the last part instead of 2 - return reverse(split_part(reverse(_filename), '.', 1)); -END -$$; - - -ALTER FUNCTION storage.extension(name text) OWNER TO supabase_storage_admin; - --- --- Name: filename(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.filename(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[array_length(_parts,1)]; -END -$$; - - -ALTER FUNCTION storage.filename(name text) OWNER TO supabase_storage_admin; - --- --- Name: foldername(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.foldername(name text) RETURNS text[] - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[1:array_length(_parts,1)-1]; -END -$$; - - -ALTER FUNCTION storage.foldername(name text) OWNER TO supabase_storage_admin; - --- --- Name: get_common_prefix(text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_common_prefix(p_key text, p_prefix text, p_delimiter text) RETURNS text - LANGUAGE sql IMMUTABLE - AS $$ -SELECT CASE - WHEN position(p_delimiter IN substring(p_key FROM length(p_prefix) + 1)) > 0 - THEN left(p_key, length(p_prefix) + position(p_delimiter IN substring(p_key FROM length(p_prefix) + 1))) - ELSE NULL -END; -$$; - - -ALTER FUNCTION storage.get_common_prefix(p_key text, p_prefix text, p_delimiter text) OWNER TO supabase_storage_admin; - --- --- Name: get_size_by_bucket(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_size_by_bucket() RETURNS TABLE(size bigint, bucket_id text) - LANGUAGE plpgsql - AS $$ -BEGIN - return query - select sum((metadata->>'size')::int) as size, obj.bucket_id - from "storage".objects as obj - group by obj.bucket_id; -END -$$; - - -ALTER FUNCTION storage.get_size_by_bucket() OWNER TO supabase_storage_admin; - --- --- Name: list_multipart_uploads_with_delimiter(text, text, text, integer, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer DEFAULT 100, next_key_token text DEFAULT ''::text, next_upload_token text DEFAULT ''::text) RETURNS TABLE(key text, id text, created_at timestamp with time zone) - LANGUAGE plpgsql - AS $_$ -BEGIN - RETURN QUERY EXECUTE - 'SELECT DISTINCT ON(key COLLATE "C") * from ( - SELECT - CASE - WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN - substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) - ELSE - key - END AS key, id, created_at - FROM - storage.s3_multipart_uploads - WHERE - bucket_id = $5 AND - key ILIKE $1 || ''%'' AND - CASE - WHEN $4 != '''' AND $6 = '''' THEN - CASE - WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN - substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) COLLATE "C" > $4 - ELSE - key COLLATE "C" > $4 - END - ELSE - true - END AND - CASE - WHEN $6 != '''' THEN - id COLLATE "C" > $6 - ELSE - true - END - ORDER BY - key COLLATE "C" ASC, created_at ASC) as e order by key COLLATE "C" LIMIT $3' - USING prefix_param, delimiter_param, max_keys, next_key_token, bucket_id, next_upload_token; -END; -$_$; - - -ALTER FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer, next_key_token text, next_upload_token text) OWNER TO supabase_storage_admin; - --- --- Name: list_objects_with_delimiter(text, text, text, integer, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.list_objects_with_delimiter(_bucket_id text, prefix_param text, delimiter_param text, max_keys integer DEFAULT 100, start_after text DEFAULT ''::text, next_token text DEFAULT ''::text, sort_order text DEFAULT 'asc'::text) RETURNS TABLE(name text, id uuid, metadata jsonb, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_peek_name TEXT; - v_current RECORD; - v_common_prefix TEXT; - - -- Configuration - v_is_asc BOOLEAN; - v_prefix TEXT; - v_start TEXT; - v_upper_bound TEXT; - v_file_batch_size INT; - - -- Seek state - v_next_seek TEXT; - v_count INT := 0; - - -- Dynamic SQL for batch query only - v_batch_query TEXT; - -BEGIN - -- ======================================================================== - -- INITIALIZATION - -- ======================================================================== - v_is_asc := lower(coalesce(sort_order, 'asc')) = 'asc'; - v_prefix := coalesce(prefix_param, ''); - v_start := CASE WHEN coalesce(next_token, '') <> '' THEN next_token ELSE coalesce(start_after, '') END; - v_file_batch_size := LEAST(GREATEST(max_keys * 2, 100), 1000); - - -- Calculate upper bound for prefix filtering (bytewise, using COLLATE "C") - IF v_prefix = '' THEN - v_upper_bound := NULL; - ELSIF right(v_prefix, 1) = delimiter_param THEN - v_upper_bound := left(v_prefix, -1) || chr(ascii(delimiter_param) + 1); - ELSE - v_upper_bound := left(v_prefix, -1) || chr(ascii(right(v_prefix, 1)) + 1); - END IF; - - -- Build batch query (dynamic SQL - called infrequently, amortized over many rows) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" >= $2 ' || - 'AND o.name COLLATE "C" < $3 ORDER BY o.name COLLATE "C" ASC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" >= $2 ' || - 'ORDER BY o.name COLLATE "C" ASC LIMIT $4'; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" < $2 ' || - 'AND o.name COLLATE "C" >= $3 ORDER BY o.name COLLATE "C" DESC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" < $2 ' || - 'ORDER BY o.name COLLATE "C" DESC LIMIT $4'; - END IF; - END IF; - - -- ======================================================================== - -- SEEK INITIALIZATION: Determine starting position - -- ======================================================================== - IF v_start = '' THEN - IF v_is_asc THEN - v_next_seek := v_prefix; - ELSE - -- DESC without cursor: find the last item in range - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_prefix AND o.name COLLATE "C" < v_upper_bound - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix <> '' THEN - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - END IF; - - IF v_next_seek IS NOT NULL THEN - v_next_seek := v_next_seek || delimiter_param; - ELSE - RETURN; - END IF; - END IF; - ELSE - -- Cursor provided: determine if it refers to a folder or leaf - IF EXISTS ( - SELECT 1 FROM storage.objects o - WHERE o.bucket_id = _bucket_id - AND o.name COLLATE "C" LIKE v_start || delimiter_param || '%' - LIMIT 1 - ) THEN - -- Cursor refers to a folder - IF v_is_asc THEN - v_next_seek := v_start || chr(ascii(delimiter_param) + 1); - ELSE - v_next_seek := v_start || delimiter_param; - END IF; - ELSE - -- Cursor refers to a leaf object - IF v_is_asc THEN - v_next_seek := v_start || delimiter_param; - ELSE - v_next_seek := v_start; - END IF; - END IF; - END IF; - - -- ======================================================================== - -- MAIN LOOP: Hybrid peek-then-batch algorithm - -- Uses STATIC SQL for peek (hot path) and DYNAMIC SQL for batch - -- ======================================================================== - LOOP - EXIT WHEN v_count >= max_keys; - - -- STEP 1: PEEK using STATIC SQL (plan cached, very fast) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_next_seek AND o.name COLLATE "C" < v_upper_bound - ORDER BY o.name COLLATE "C" ASC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_next_seek - ORDER BY o.name COLLATE "C" ASC LIMIT 1; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - END IF; - END IF; - - EXIT WHEN v_peek_name IS NULL; - - -- STEP 2: Check if this is a FOLDER or FILE - v_common_prefix := storage.get_common_prefix(v_peek_name, v_prefix, delimiter_param); - - IF v_common_prefix IS NOT NULL THEN - -- FOLDER: Emit and skip to next folder (no heap access needed) - name := rtrim(v_common_prefix, delimiter_param); - id := NULL; - updated_at := NULL; - created_at := NULL; - last_accessed_at := NULL; - metadata := NULL; - RETURN NEXT; - v_count := v_count + 1; - - -- Advance seek past the folder range - IF v_is_asc THEN - v_next_seek := left(v_common_prefix, -1) || chr(ascii(delimiter_param) + 1); - ELSE - v_next_seek := v_common_prefix; - END IF; - ELSE - -- FILE: Batch fetch using DYNAMIC SQL (overhead amortized over many rows) - -- For ASC: upper_bound is the exclusive upper limit (< condition) - -- For DESC: prefix is the inclusive lower limit (>= condition) - FOR v_current IN EXECUTE v_batch_query USING _bucket_id, v_next_seek, - CASE WHEN v_is_asc THEN COALESCE(v_upper_bound, v_prefix) ELSE v_prefix END, v_file_batch_size - LOOP - v_common_prefix := storage.get_common_prefix(v_current.name, v_prefix, delimiter_param); - - IF v_common_prefix IS NOT NULL THEN - -- Hit a folder: exit batch, let peek handle it - v_next_seek := v_current.name; - EXIT; - END IF; - - -- Emit file - name := v_current.name; - id := v_current.id; - updated_at := v_current.updated_at; - created_at := v_current.created_at; - last_accessed_at := v_current.last_accessed_at; - metadata := v_current.metadata; - RETURN NEXT; - v_count := v_count + 1; - - -- Advance seek past this file - IF v_is_asc THEN - v_next_seek := v_current.name || delimiter_param; - ELSE - v_next_seek := v_current.name; - END IF; - - EXIT WHEN v_count >= max_keys; - END LOOP; - END IF; - END LOOP; -END; -$_$; - - -ALTER FUNCTION storage.list_objects_with_delimiter(_bucket_id text, prefix_param text, delimiter_param text, max_keys integer, start_after text, next_token text, sort_order text) OWNER TO supabase_storage_admin; - --- --- Name: operation(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.operation() RETURNS text - LANGUAGE plpgsql STABLE - AS $$ -BEGIN - RETURN current_setting('storage.operation', true); -END; -$$; - - -ALTER FUNCTION storage.operation() OWNER TO supabase_storage_admin; - --- --- Name: protect_delete(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.protect_delete() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - -- Check if storage.allow_delete_query is set to 'true' - IF COALESCE(current_setting('storage.allow_delete_query', true), 'false') != 'true' THEN - RAISE EXCEPTION 'Direct deletion from storage tables is not allowed. Use the Storage API instead.' - USING HINT = 'This prevents accidental data loss from orphaned objects.', - ERRCODE = '42501'; - END IF; - RETURN NULL; -END; -$$; - - -ALTER FUNCTION storage.protect_delete() OWNER TO supabase_storage_admin; - --- --- Name: search(text, text, integer, integer, integer, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search(prefix text, bucketname text, limits integer DEFAULT 100, levels integer DEFAULT 1, offsets integer DEFAULT 0, search text DEFAULT ''::text, sortcolumn text DEFAULT 'name'::text, sortorder text DEFAULT 'asc'::text) RETURNS TABLE(name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_peek_name TEXT; - v_current RECORD; - v_common_prefix TEXT; - v_delimiter CONSTANT TEXT := '/'; - - -- Configuration - v_limit INT; - v_prefix TEXT; - v_prefix_lower TEXT; - v_is_asc BOOLEAN; - v_order_by TEXT; - v_sort_order TEXT; - v_upper_bound TEXT; - v_file_batch_size INT; - - -- Dynamic SQL for batch query only - v_batch_query TEXT; - - -- Seek state - v_next_seek TEXT; - v_count INT := 0; - v_skipped INT := 0; -BEGIN - -- ======================================================================== - -- INITIALIZATION - -- ======================================================================== - v_limit := LEAST(coalesce(limits, 100), 1500); - v_prefix := coalesce(prefix, '') || coalesce(search, ''); - v_prefix_lower := lower(v_prefix); - v_is_asc := lower(coalesce(sortorder, 'asc')) = 'asc'; - v_file_batch_size := LEAST(GREATEST(v_limit * 2, 100), 1000); - - -- Validate sort column - CASE lower(coalesce(sortcolumn, 'name')) - WHEN 'name' THEN v_order_by := 'name'; - WHEN 'updated_at' THEN v_order_by := 'updated_at'; - WHEN 'created_at' THEN v_order_by := 'created_at'; - WHEN 'last_accessed_at' THEN v_order_by := 'last_accessed_at'; - ELSE v_order_by := 'name'; - END CASE; - - v_sort_order := CASE WHEN v_is_asc THEN 'asc' ELSE 'desc' END; - - -- ======================================================================== - -- NON-NAME SORTING: Use path_tokens approach (unchanged) - -- ======================================================================== - IF v_order_by != 'name' THEN - RETURN QUERY EXECUTE format( - $sql$ - WITH folders AS ( - SELECT path_tokens[$1] AS folder - FROM storage.objects - WHERE objects.name ILIKE $2 || '%%' - AND bucket_id = $3 - AND array_length(objects.path_tokens, 1) <> $1 - GROUP BY folder - ORDER BY folder %s - ) - (SELECT folder AS "name", - NULL::uuid AS id, - NULL::timestamptz AS updated_at, - NULL::timestamptz AS created_at, - NULL::timestamptz AS last_accessed_at, - NULL::jsonb AS metadata FROM folders) - UNION ALL - (SELECT path_tokens[$1] AS "name", - id, updated_at, created_at, last_accessed_at, metadata - FROM storage.objects - WHERE objects.name ILIKE $2 || '%%' - AND bucket_id = $3 - AND array_length(objects.path_tokens, 1) = $1 - ORDER BY %I %s) - LIMIT $4 OFFSET $5 - $sql$, v_sort_order, v_order_by, v_sort_order - ) USING levels, v_prefix, bucketname, v_limit, offsets; - RETURN; - END IF; - - -- ======================================================================== - -- NAME SORTING: Hybrid skip-scan with batch optimization - -- ======================================================================== - - -- Calculate upper bound for prefix filtering - IF v_prefix_lower = '' THEN - v_upper_bound := NULL; - ELSIF right(v_prefix_lower, 1) = v_delimiter THEN - v_upper_bound := left(v_prefix_lower, -1) || chr(ascii(v_delimiter) + 1); - ELSE - v_upper_bound := left(v_prefix_lower, -1) || chr(ascii(right(v_prefix_lower, 1)) + 1); - END IF; - - -- Build batch query (dynamic SQL - called infrequently, amortized over many rows) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" >= $2 ' || - 'AND lower(o.name) COLLATE "C" < $3 ORDER BY lower(o.name) COLLATE "C" ASC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" >= $2 ' || - 'ORDER BY lower(o.name) COLLATE "C" ASC LIMIT $4'; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" < $2 ' || - 'AND lower(o.name) COLLATE "C" >= $3 ORDER BY lower(o.name) COLLATE "C" DESC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" < $2 ' || - 'ORDER BY lower(o.name) COLLATE "C" DESC LIMIT $4'; - END IF; - END IF; - - -- Initialize seek position - IF v_is_asc THEN - v_next_seek := v_prefix_lower; - ELSE - -- DESC: find the last item in range first (static SQL) - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_prefix_lower AND lower(o.name) COLLATE "C" < v_upper_bound - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix_lower <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - END IF; - - IF v_peek_name IS NOT NULL THEN - v_next_seek := lower(v_peek_name) || v_delimiter; - ELSE - RETURN; - END IF; - END IF; - - -- ======================================================================== - -- MAIN LOOP: Hybrid peek-then-batch algorithm - -- Uses STATIC SQL for peek (hot path) and DYNAMIC SQL for batch - -- ======================================================================== - LOOP - EXIT WHEN v_count >= v_limit; - - -- STEP 1: PEEK using STATIC SQL (plan cached, very fast) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_next_seek AND lower(o.name) COLLATE "C" < v_upper_bound - ORDER BY lower(o.name) COLLATE "C" ASC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_next_seek - ORDER BY lower(o.name) COLLATE "C" ASC LIMIT 1; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix_lower <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - END IF; - END IF; - - EXIT WHEN v_peek_name IS NULL; - - -- STEP 2: Check if this is a FOLDER or FILE - v_common_prefix := storage.get_common_prefix(lower(v_peek_name), v_prefix_lower, v_delimiter); - - IF v_common_prefix IS NOT NULL THEN - -- FOLDER: Handle offset, emit if needed, skip to next folder - IF v_skipped < offsets THEN - v_skipped := v_skipped + 1; - ELSE - name := split_part(rtrim(v_common_prefix, v_delimiter), v_delimiter, levels); - id := NULL; - updated_at := NULL; - created_at := NULL; - last_accessed_at := NULL; - metadata := NULL; - RETURN NEXT; - v_count := v_count + 1; - END IF; - - -- Advance seek past the folder range - IF v_is_asc THEN - v_next_seek := lower(left(v_common_prefix, -1)) || chr(ascii(v_delimiter) + 1); - ELSE - v_next_seek := lower(v_common_prefix); - END IF; - ELSE - -- FILE: Batch fetch using DYNAMIC SQL (overhead amortized over many rows) - -- For ASC: upper_bound is the exclusive upper limit (< condition) - -- For DESC: prefix_lower is the inclusive lower limit (>= condition) - FOR v_current IN EXECUTE v_batch_query - USING bucketname, v_next_seek, - CASE WHEN v_is_asc THEN COALESCE(v_upper_bound, v_prefix_lower) ELSE v_prefix_lower END, v_file_batch_size - LOOP - v_common_prefix := storage.get_common_prefix(lower(v_current.name), v_prefix_lower, v_delimiter); - - IF v_common_prefix IS NOT NULL THEN - -- Hit a folder: exit batch, let peek handle it - v_next_seek := lower(v_current.name); - EXIT; - END IF; - - -- Handle offset skipping - IF v_skipped < offsets THEN - v_skipped := v_skipped + 1; - ELSE - -- Emit file - name := split_part(v_current.name, v_delimiter, levels); - id := v_current.id; - updated_at := v_current.updated_at; - created_at := v_current.created_at; - last_accessed_at := v_current.last_accessed_at; - metadata := v_current.metadata; - RETURN NEXT; - v_count := v_count + 1; - END IF; - - -- Advance seek past this file - IF v_is_asc THEN - v_next_seek := lower(v_current.name) || v_delimiter; - ELSE - v_next_seek := lower(v_current.name); - END IF; - - EXIT WHEN v_count >= v_limit; - END LOOP; - END IF; - END LOOP; -END; -$_$; - - -ALTER FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer, search text, sortcolumn text, sortorder text) OWNER TO supabase_storage_admin; - --- --- Name: search_by_timestamp(text, text, integer, integer, text, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search_by_timestamp(p_prefix text, p_bucket_id text, p_limit integer, p_level integer, p_start_after text, p_sort_order text, p_sort_column text, p_sort_column_after text) RETURNS TABLE(key text, name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_cursor_op text; - v_query text; - v_prefix text; -BEGIN - v_prefix := coalesce(p_prefix, ''); - - IF p_sort_order = 'asc' THEN - v_cursor_op := '>'; - ELSE - v_cursor_op := '<'; - END IF; - - v_query := format($sql$ - WITH raw_objects AS ( - SELECT - o.name AS obj_name, - o.id AS obj_id, - o.updated_at AS obj_updated_at, - o.created_at AS obj_created_at, - o.last_accessed_at AS obj_last_accessed_at, - o.metadata AS obj_metadata, - storage.get_common_prefix(o.name, $1, '/') AS common_prefix - FROM storage.objects o - WHERE o.bucket_id = $2 - AND o.name COLLATE "C" LIKE $1 || '%%' - ), - -- Aggregate common prefixes (folders) - -- Both created_at and updated_at use MIN(obj_created_at) to match the old prefixes table behavior - aggregated_prefixes AS ( - SELECT - rtrim(common_prefix, '/') AS name, - NULL::uuid AS id, - MIN(obj_created_at) AS updated_at, - MIN(obj_created_at) AS created_at, - NULL::timestamptz AS last_accessed_at, - NULL::jsonb AS metadata, - TRUE AS is_prefix - FROM raw_objects - WHERE common_prefix IS NOT NULL - GROUP BY common_prefix - ), - leaf_objects AS ( - SELECT - obj_name AS name, - obj_id AS id, - obj_updated_at AS updated_at, - obj_created_at AS created_at, - obj_last_accessed_at AS last_accessed_at, - obj_metadata AS metadata, - FALSE AS is_prefix - FROM raw_objects - WHERE common_prefix IS NULL - ), - combined AS ( - SELECT * FROM aggregated_prefixes - UNION ALL - SELECT * FROM leaf_objects - ), - filtered AS ( - SELECT * - FROM combined - WHERE ( - $5 = '' - OR ROW( - date_trunc('milliseconds', %I), - name COLLATE "C" - ) %s ROW( - COALESCE(NULLIF($6, '')::timestamptz, 'epoch'::timestamptz), - $5 - ) - ) - ) - SELECT - split_part(name, '/', $3) AS key, - name, - id, - updated_at, - created_at, - last_accessed_at, - metadata - FROM filtered - ORDER BY - COALESCE(date_trunc('milliseconds', %I), 'epoch'::timestamptz) %s, - name COLLATE "C" %s - LIMIT $4 - $sql$, - p_sort_column, - v_cursor_op, - p_sort_column, - p_sort_order, - p_sort_order - ); - - RETURN QUERY EXECUTE v_query - USING v_prefix, p_bucket_id, p_level, p_limit, p_start_after, p_sort_column_after; -END; -$_$; - - -ALTER FUNCTION storage.search_by_timestamp(p_prefix text, p_bucket_id text, p_limit integer, p_level integer, p_start_after text, p_sort_order text, p_sort_column text, p_sort_column_after text) OWNER TO supabase_storage_admin; - --- --- Name: search_v2(text, text, integer, integer, text, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search_v2(prefix text, bucket_name text, limits integer DEFAULT 100, levels integer DEFAULT 1, start_after text DEFAULT ''::text, sort_order text DEFAULT 'asc'::text, sort_column text DEFAULT 'name'::text, sort_column_after text DEFAULT ''::text) RETURNS TABLE(key text, name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $$ -DECLARE - v_sort_col text; - v_sort_ord text; - v_limit int; -BEGIN - -- Cap limit to maximum of 1500 records - v_limit := LEAST(coalesce(limits, 100), 1500); - - -- Validate and normalize sort_order - v_sort_ord := lower(coalesce(sort_order, 'asc')); - IF v_sort_ord NOT IN ('asc', 'desc') THEN - v_sort_ord := 'asc'; - END IF; - - -- Validate and normalize sort_column - v_sort_col := lower(coalesce(sort_column, 'name')); - IF v_sort_col NOT IN ('name', 'updated_at', 'created_at') THEN - v_sort_col := 'name'; - END IF; - - -- Route to appropriate implementation - IF v_sort_col = 'name' THEN - -- Use list_objects_with_delimiter for name sorting (most efficient: O(k * log n)) - RETURN QUERY - SELECT - split_part(l.name, '/', levels) AS key, - l.name AS name, - l.id, - l.updated_at, - l.created_at, - l.last_accessed_at, - l.metadata - FROM storage.list_objects_with_delimiter( - bucket_name, - coalesce(prefix, ''), - '/', - v_limit, - start_after, - '', - v_sort_ord - ) l; - ELSE - -- Use aggregation approach for timestamp sorting - -- Not efficient for large datasets but supports correct pagination - RETURN QUERY SELECT * FROM storage.search_by_timestamp( - prefix, bucket_name, v_limit, levels, start_after, - v_sort_ord, v_sort_col, sort_column_after - ); - END IF; -END; -$$; - - -ALTER FUNCTION storage.search_v2(prefix text, bucket_name text, limits integer, levels integer, start_after text, sort_order text, sort_column text, sort_column_after text) OWNER TO supabase_storage_admin; - --- --- Name: update_updated_at_column(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.update_updated_at_column() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION storage.update_updated_at_column() OWNER TO supabase_storage_admin; - --- --- Name: http_request(); Type: FUNCTION; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE FUNCTION supabase_functions.http_request() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'supabase_functions' - AS $$ - DECLARE - request_id bigint; - payload jsonb; - url text := TG_ARGV[0]::text; - method text := TG_ARGV[1]::text; - headers jsonb DEFAULT '{}'::jsonb; - params jsonb DEFAULT '{}'::jsonb; - timeout_ms integer DEFAULT 1000; - BEGIN - IF url IS NULL OR url = 'null' THEN - RAISE EXCEPTION 'url argument is missing'; - END IF; - - IF method IS NULL OR method = 'null' THEN - RAISE EXCEPTION 'method argument is missing'; - END IF; - - IF TG_ARGV[2] IS NULL OR TG_ARGV[2] = 'null' THEN - headers = '{"Content-Type": "application/json"}'::jsonb; - ELSE - headers = TG_ARGV[2]::jsonb; - END IF; - - IF TG_ARGV[3] IS NULL OR TG_ARGV[3] = 'null' THEN - params = '{}'::jsonb; - ELSE - params = TG_ARGV[3]::jsonb; - END IF; - - IF TG_ARGV[4] IS NULL OR TG_ARGV[4] = 'null' THEN - timeout_ms = 1000; - ELSE - timeout_ms = TG_ARGV[4]::integer; - END IF; - - CASE - WHEN method = 'GET' THEN - SELECT http_get INTO request_id FROM net.http_get( - url, - params, - headers, - timeout_ms - ); - WHEN method = 'POST' THEN - payload = jsonb_build_object( - 'old_record', OLD, - 'record', NEW, - 'type', TG_OP, - 'table', TG_TABLE_NAME, - 'schema', TG_TABLE_SCHEMA - ); - - SELECT http_post INTO request_id FROM net.http_post( - url, - payload, - params, - headers, - timeout_ms - ); - ELSE - RAISE EXCEPTION 'method argument % is invalid', method; - END CASE; - - INSERT INTO supabase_functions.hooks - (hook_table_id, hook_name, request_id) - VALUES - (TG_RELID, TG_NAME, request_id); - - RETURN NEW; - END -$$; - - -ALTER FUNCTION supabase_functions.http_request() OWNER TO supabase_functions_admin; - --- --- Name: extensions; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.extensions ( - id uuid NOT NULL, - type text, - settings jsonb, - tenant_external_id text, - inserted_at timestamp(0) without time zone NOT NULL, - updated_at timestamp(0) without time zone NOT NULL -); - - -ALTER TABLE _realtime.extensions OWNER TO supabase_admin; - --- --- Name: schema_migrations; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.schema_migrations ( - version bigint NOT NULL, - inserted_at timestamp(0) without time zone -); - - -ALTER TABLE _realtime.schema_migrations OWNER TO supabase_admin; - --- --- Name: tenants; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.tenants ( - id uuid NOT NULL, - name text, - external_id text, - jwt_secret text, - max_concurrent_users integer DEFAULT 200 NOT NULL, - inserted_at timestamp(0) without time zone NOT NULL, - updated_at timestamp(0) without time zone NOT NULL, - max_events_per_second integer DEFAULT 100 NOT NULL, - postgres_cdc_default text DEFAULT 'postgres_cdc_rls'::text, - max_bytes_per_second integer DEFAULT 100000 NOT NULL, - max_channels_per_client integer DEFAULT 100 NOT NULL, - max_joins_per_second integer DEFAULT 500 NOT NULL, - suspend boolean DEFAULT false, - jwt_jwks jsonb, - notify_private_alpha boolean DEFAULT false, - private_only boolean DEFAULT false NOT NULL, - migrations_ran integer DEFAULT 0, - broadcast_adapter character varying(255) DEFAULT 'gen_rpc'::character varying, - max_presence_events_per_second integer DEFAULT 1000, - max_payload_size_in_kb integer DEFAULT 3000, - CONSTRAINT jwt_secret_or_jwt_jwks_required CHECK (((jwt_secret IS NOT NULL) OR (jwt_jwks IS NOT NULL))) -); - - -ALTER TABLE _realtime.tenants OWNER TO supabase_admin; - --- --- Name: audit_log_entries; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.audit_log_entries ( - instance_id uuid, - id uuid NOT NULL, - payload json, - created_at timestamp with time zone, - ip_address character varying(64) DEFAULT ''::character varying NOT NULL -); - - -ALTER TABLE auth.audit_log_entries OWNER TO supabase_auth_admin; - --- --- Name: TABLE audit_log_entries; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.audit_log_entries IS 'Auth: Audit trail for user actions.'; - - --- --- Name: flow_state; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.flow_state ( - id uuid NOT NULL, - user_id uuid, - auth_code text, - code_challenge_method auth.code_challenge_method, - code_challenge text, - provider_type text NOT NULL, - provider_access_token text, - provider_refresh_token text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - authentication_method text NOT NULL, - auth_code_issued_at timestamp with time zone, - invite_token text, - referrer text, - oauth_client_state_id uuid, - linking_target_id uuid, - email_optional boolean DEFAULT false NOT NULL -); - - -ALTER TABLE auth.flow_state OWNER TO supabase_auth_admin; - --- --- Name: TABLE flow_state; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.flow_state IS 'Stores metadata for all OAuth/SSO login flows'; - - --- --- Name: identities; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.identities ( - provider_id text NOT NULL, - user_id uuid NOT NULL, - identity_data jsonb NOT NULL, - provider text NOT NULL, - last_sign_in_at timestamp with time zone, - created_at timestamp with time zone, - updated_at timestamp with time zone, - email text GENERATED ALWAYS AS (lower((identity_data ->> 'email'::text))) STORED, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE auth.identities OWNER TO supabase_auth_admin; - --- --- Name: TABLE identities; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.identities IS 'Auth: Stores identities associated to a user.'; - - --- --- Name: COLUMN identities.email; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.identities.email IS 'Auth: Email is a generated column that references the optional email property in the identity_data'; - - --- --- Name: instances; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.instances ( - id uuid NOT NULL, - uuid uuid, - raw_base_config text, - created_at timestamp with time zone, - updated_at timestamp with time zone -); - - -ALTER TABLE auth.instances OWNER TO supabase_auth_admin; - --- --- Name: TABLE instances; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.instances IS 'Auth: Manages users across multiple sites.'; - - --- --- Name: mfa_amr_claims; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_amr_claims ( - session_id uuid NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - authentication_method text NOT NULL, - id uuid NOT NULL -); - - -ALTER TABLE auth.mfa_amr_claims OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_amr_claims; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_amr_claims IS 'auth: stores authenticator method reference claims for multi factor authentication'; - - --- --- Name: mfa_challenges; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_challenges ( - id uuid NOT NULL, - factor_id uuid NOT NULL, - created_at timestamp with time zone NOT NULL, - verified_at timestamp with time zone, - ip_address inet NOT NULL, - otp_code text, - web_authn_session_data jsonb -); - - -ALTER TABLE auth.mfa_challenges OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_challenges; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_challenges IS 'auth: stores metadata about challenge requests made'; - - --- --- Name: mfa_factors; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_factors ( - id uuid NOT NULL, - user_id uuid NOT NULL, - friendly_name text, - factor_type auth.factor_type NOT NULL, - status auth.factor_status NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - secret text, - phone text, - last_challenged_at timestamp with time zone, - web_authn_credential jsonb, - web_authn_aaguid uuid, - last_webauthn_challenge_data jsonb -); - - -ALTER TABLE auth.mfa_factors OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_factors; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_factors IS 'auth: stores metadata about factors'; - - --- --- Name: COLUMN mfa_factors.last_webauthn_challenge_data; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.mfa_factors.last_webauthn_challenge_data IS 'Stores the latest WebAuthn challenge data including attestation/assertion for customer verification'; - - --- --- Name: oauth_authorizations; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_authorizations ( - id uuid NOT NULL, - authorization_id text NOT NULL, - client_id uuid NOT NULL, - user_id uuid, - redirect_uri text NOT NULL, - scope text NOT NULL, - state text, - resource text, - code_challenge text, - code_challenge_method auth.code_challenge_method, - response_type auth.oauth_response_type DEFAULT 'code'::auth.oauth_response_type NOT NULL, - status auth.oauth_authorization_status DEFAULT 'pending'::auth.oauth_authorization_status NOT NULL, - authorization_code text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '00:03:00'::interval) NOT NULL, - approved_at timestamp with time zone, - nonce text, - CONSTRAINT oauth_authorizations_authorization_code_length CHECK ((char_length(authorization_code) <= 255)), - CONSTRAINT oauth_authorizations_code_challenge_length CHECK ((char_length(code_challenge) <= 128)), - CONSTRAINT oauth_authorizations_expires_at_future CHECK ((expires_at > created_at)), - CONSTRAINT oauth_authorizations_nonce_length CHECK ((char_length(nonce) <= 255)), - CONSTRAINT oauth_authorizations_redirect_uri_length CHECK ((char_length(redirect_uri) <= 2048)), - CONSTRAINT oauth_authorizations_resource_length CHECK ((char_length(resource) <= 2048)), - CONSTRAINT oauth_authorizations_scope_length CHECK ((char_length(scope) <= 4096)), - CONSTRAINT oauth_authorizations_state_length CHECK ((char_length(state) <= 4096)) -); - - -ALTER TABLE auth.oauth_authorizations OWNER TO supabase_auth_admin; - --- --- Name: oauth_client_states; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_client_states ( - id uuid NOT NULL, - provider_type text NOT NULL, - code_verifier text, - created_at timestamp with time zone NOT NULL -); - - -ALTER TABLE auth.oauth_client_states OWNER TO supabase_auth_admin; - --- --- Name: TABLE oauth_client_states; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.oauth_client_states IS 'Stores OAuth states for third-party provider authentication flows where Supabase acts as the OAuth client.'; - - --- --- Name: oauth_clients; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_clients ( - id uuid NOT NULL, - client_secret_hash text, - registration_type auth.oauth_registration_type NOT NULL, - redirect_uris text NOT NULL, - grant_types text NOT NULL, - client_name text, - client_uri text, - logo_uri text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - deleted_at timestamp with time zone, - client_type auth.oauth_client_type DEFAULT 'confidential'::auth.oauth_client_type NOT NULL, - token_endpoint_auth_method text NOT NULL, - CONSTRAINT oauth_clients_client_name_length CHECK ((char_length(client_name) <= 1024)), - CONSTRAINT oauth_clients_client_uri_length CHECK ((char_length(client_uri) <= 2048)), - CONSTRAINT oauth_clients_logo_uri_length CHECK ((char_length(logo_uri) <= 2048)), - CONSTRAINT oauth_clients_token_endpoint_auth_method_check CHECK ((token_endpoint_auth_method = ANY (ARRAY['client_secret_basic'::text, 'client_secret_post'::text, 'none'::text]))) -); - - -ALTER TABLE auth.oauth_clients OWNER TO supabase_auth_admin; - --- --- Name: oauth_consents; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_consents ( - id uuid NOT NULL, - user_id uuid NOT NULL, - client_id uuid NOT NULL, - scopes text NOT NULL, - granted_at timestamp with time zone DEFAULT now() NOT NULL, - revoked_at timestamp with time zone, - CONSTRAINT oauth_consents_revoked_after_granted CHECK (((revoked_at IS NULL) OR (revoked_at >= granted_at))), - CONSTRAINT oauth_consents_scopes_length CHECK ((char_length(scopes) <= 2048)), - CONSTRAINT oauth_consents_scopes_not_empty CHECK ((char_length(TRIM(BOTH FROM scopes)) > 0)) -); - - -ALTER TABLE auth.oauth_consents OWNER TO supabase_auth_admin; - --- --- Name: one_time_tokens; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.one_time_tokens ( - id uuid NOT NULL, - user_id uuid NOT NULL, - token_type auth.one_time_token_type NOT NULL, - token_hash text NOT NULL, - relates_to text NOT NULL, - created_at timestamp without time zone DEFAULT now() NOT NULL, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - CONSTRAINT one_time_tokens_token_hash_check CHECK ((char_length(token_hash) > 0)) -); - - -ALTER TABLE auth.one_time_tokens OWNER TO supabase_auth_admin; - --- --- Name: refresh_tokens; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.refresh_tokens ( - instance_id uuid, - id bigint NOT NULL, - token character varying(255), - user_id character varying(255), - revoked boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone, - parent character varying(255), - session_id uuid -); - - -ALTER TABLE auth.refresh_tokens OWNER TO supabase_auth_admin; - --- --- Name: TABLE refresh_tokens; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.refresh_tokens IS 'Auth: Store of tokens used to refresh JWT tokens once they expire.'; - - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE SEQUENCE auth.refresh_tokens_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNER TO supabase_auth_admin; - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNED BY auth.refresh_tokens.id; - - --- --- Name: saml_providers; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.saml_providers ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - entity_id text NOT NULL, - metadata_xml text NOT NULL, - metadata_url text, - attribute_mapping jsonb, - created_at timestamp with time zone, - updated_at timestamp with time zone, - name_id_format text, - CONSTRAINT "entity_id not empty" CHECK ((char_length(entity_id) > 0)), - CONSTRAINT "metadata_url not empty" CHECK (((metadata_url = NULL::text) OR (char_length(metadata_url) > 0))), - CONSTRAINT "metadata_xml not empty" CHECK ((char_length(metadata_xml) > 0)) -); - - -ALTER TABLE auth.saml_providers OWNER TO supabase_auth_admin; - --- --- Name: TABLE saml_providers; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.saml_providers IS 'Auth: Manages SAML Identity Provider connections.'; - - --- --- Name: saml_relay_states; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.saml_relay_states ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - request_id text NOT NULL, - for_email text, - redirect_to text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - flow_state_id uuid, - CONSTRAINT "request_id not empty" CHECK ((char_length(request_id) > 0)) -); - - -ALTER TABLE auth.saml_relay_states OWNER TO supabase_auth_admin; - --- --- Name: TABLE saml_relay_states; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.saml_relay_states IS 'Auth: Contains SAML Relay State information for each Service Provider initiated login.'; - - --- --- Name: schema_migrations; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.schema_migrations ( - version character varying(255) NOT NULL -); - - -ALTER TABLE auth.schema_migrations OWNER TO supabase_auth_admin; - --- --- Name: TABLE schema_migrations; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.schema_migrations IS 'Auth: Manages updates to the auth system.'; - - --- --- Name: sessions; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sessions ( - id uuid NOT NULL, - user_id uuid NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - factor_id uuid, - aal auth.aal_level, - not_after timestamp with time zone, - refreshed_at timestamp without time zone, - user_agent text, - ip inet, - tag text, - oauth_client_id uuid, - refresh_token_hmac_key text, - refresh_token_counter bigint, - scopes text, - CONSTRAINT sessions_scopes_length CHECK ((char_length(scopes) <= 4096)) -); - - -ALTER TABLE auth.sessions OWNER TO supabase_auth_admin; - --- --- Name: TABLE sessions; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sessions IS 'Auth: Stores session data associated to a user.'; - - --- --- Name: COLUMN sessions.not_after; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.not_after IS 'Auth: Not after is a nullable column that contains a timestamp after which the session should be regarded as expired.'; - - --- --- Name: COLUMN sessions.refresh_token_hmac_key; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.refresh_token_hmac_key IS 'Holds a HMAC-SHA256 key used to sign refresh tokens for this session.'; - - --- --- Name: COLUMN sessions.refresh_token_counter; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.refresh_token_counter IS 'Holds the ID (counter) of the last issued refresh token.'; - - --- --- Name: sso_domains; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sso_domains ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - domain text NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - CONSTRAINT "domain not empty" CHECK ((char_length(domain) > 0)) -); - - -ALTER TABLE auth.sso_domains OWNER TO supabase_auth_admin; - --- --- Name: TABLE sso_domains; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sso_domains IS 'Auth: Manages SSO email address domain mapping to an SSO Identity Provider.'; - - --- --- Name: sso_providers; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sso_providers ( - id uuid NOT NULL, - resource_id text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - disabled boolean, - CONSTRAINT "resource_id not empty" CHECK (((resource_id = NULL::text) OR (char_length(resource_id) > 0))) -); - - -ALTER TABLE auth.sso_providers OWNER TO supabase_auth_admin; - --- --- Name: TABLE sso_providers; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sso_providers IS 'Auth: Manages SSO identity provider information; see saml_providers for SAML.'; - - --- --- Name: COLUMN sso_providers.resource_id; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sso_providers.resource_id IS 'Auth: Uniquely identifies a SSO provider according to a user-chosen resource ID (case insensitive), useful in infrastructure as code.'; - - --- --- Name: users; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.users ( - instance_id uuid, - id uuid NOT NULL, - aud character varying(255), - role character varying(255), - email character varying(255), - encrypted_password character varying(255), - email_confirmed_at timestamp with time zone, - invited_at timestamp with time zone, - confirmation_token character varying(255), - confirmation_sent_at timestamp with time zone, - recovery_token character varying(255), - recovery_sent_at timestamp with time zone, - email_change_token_new character varying(255), - email_change character varying(255), - email_change_sent_at timestamp with time zone, - last_sign_in_at timestamp with time zone, - raw_app_meta_data jsonb, - raw_user_meta_data jsonb, - is_super_admin boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone, - phone text DEFAULT NULL::character varying, - phone_confirmed_at timestamp with time zone, - phone_change text DEFAULT ''::character varying, - phone_change_token character varying(255) DEFAULT ''::character varying, - phone_change_sent_at timestamp with time zone, - confirmed_at timestamp with time zone GENERATED ALWAYS AS (LEAST(email_confirmed_at, phone_confirmed_at)) STORED, - email_change_token_current character varying(255) DEFAULT ''::character varying, - email_change_confirm_status smallint DEFAULT 0, - banned_until timestamp with time zone, - reauthentication_token character varying(255) DEFAULT ''::character varying, - reauthentication_sent_at timestamp with time zone, - is_sso_user boolean DEFAULT false NOT NULL, - deleted_at timestamp with time zone, - is_anonymous boolean DEFAULT false NOT NULL, - CONSTRAINT users_email_change_confirm_status_check CHECK (((email_change_confirm_status >= 0) AND (email_change_confirm_status <= 2))) -); - - -ALTER TABLE auth.users OWNER TO supabase_auth_admin; - --- --- Name: TABLE users; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure schema.'; - - --- --- Name: COLUMN users.is_sso_user; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.users.is_sso_user IS 'Auth: Set this column to true when the account comes from SSO. These accounts can have duplicate emails.'; - - --- --- Name: agenda_bloqueios; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_bloqueios ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - tipo text NOT NULL, - titulo text NOT NULL, - data_inicio date NOT NULL, - data_fim date, - hora_inicio time without time zone, - hora_fim time without time zone, - recorrente boolean DEFAULT false NOT NULL, - dia_semana smallint, - observacao text, - origem text DEFAULT 'manual'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT agenda_bloqueios_tipo_check CHECK ((tipo = ANY (ARRAY['feriado_nacional'::text, 'feriado_municipal'::text, 'bloqueio'::text]))) -); - - -ALTER TABLE public.agenda_bloqueios OWNER TO supabase_admin; - --- --- Name: agenda_configuracoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_configuracoes ( - owner_id uuid NOT NULL, - duracao_padrao_minutos integer DEFAULT 50 NOT NULL, - intervalo_padrao_minutos integer DEFAULT 0 NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - usar_horario_admin_custom boolean DEFAULT false NOT NULL, - admin_inicio_visualizacao time without time zone, - admin_fim_visualizacao time without time zone, - admin_slot_visual_minutos integer DEFAULT 30 NOT NULL, - online_ativo boolean DEFAULT false NOT NULL, - online_min_antecedencia_horas integer DEFAULT 24 NOT NULL, - online_max_dias_futuro integer DEFAULT 60 NOT NULL, - online_cancelar_ate_horas integer DEFAULT 12 NOT NULL, - online_reagendar_ate_horas integer DEFAULT 12 NOT NULL, - online_limite_agendamentos_futuros integer DEFAULT 1 NOT NULL, - online_modo text DEFAULT 'automatico'::text NOT NULL, - online_buffer_antes_min integer DEFAULT 0 NOT NULL, - online_buffer_depois_min integer DEFAULT 0 NOT NULL, - online_modalidade text DEFAULT 'ambos'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - usar_granularidade_custom boolean DEFAULT false NOT NULL, - granularidade_min integer, - setup_concluido boolean DEFAULT false NOT NULL, - setup_concluido_em timestamp with time zone, - agenda_view_mode text DEFAULT 'full_24h'::text NOT NULL, - agenda_custom_start time without time zone, - agenda_custom_end time without time zone, - session_duration_min integer DEFAULT 50 NOT NULL, - session_break_min integer DEFAULT 10 NOT NULL, - pausas_semanais jsonb DEFAULT '[]'::jsonb NOT NULL, - setup_clinica_concluido boolean DEFAULT false NOT NULL, - setup_clinica_concluido_em timestamp with time zone, - tenant_id uuid, - jornada_igual_todos boolean DEFAULT true, - slot_mode text DEFAULT 'fixed'::text NOT NULL, - CONSTRAINT agenda_configuracoes_admin_slot_visual_minutos_check CHECK ((admin_slot_visual_minutos = ANY (ARRAY[5, 10, 15, 20, 30, 60]))), - CONSTRAINT agenda_configuracoes_check CHECK (((usar_horario_admin_custom = false) OR ((admin_inicio_visualizacao IS NOT NULL) AND (admin_fim_visualizacao IS NOT NULL) AND (admin_fim_visualizacao > admin_inicio_visualizacao)))), - CONSTRAINT agenda_configuracoes_duracao_padrao_minutos_check CHECK (((duracao_padrao_minutos >= 10) AND (duracao_padrao_minutos <= 240))), - CONSTRAINT agenda_configuracoes_granularidade_min_check CHECK (((granularidade_min IS NULL) OR (granularidade_min = ANY (ARRAY[5, 10, 15, 20, 30, 45, 50, 60])))), - CONSTRAINT agenda_configuracoes_intervalo_padrao_minutos_check CHECK (((intervalo_padrao_minutos >= 0) AND (intervalo_padrao_minutos <= 120))), - CONSTRAINT agenda_configuracoes_online_buffer_antes_min_check CHECK (((online_buffer_antes_min >= 0) AND (online_buffer_antes_min <= 120))), - CONSTRAINT agenda_configuracoes_online_buffer_depois_min_check CHECK (((online_buffer_depois_min >= 0) AND (online_buffer_depois_min <= 120))), - CONSTRAINT agenda_configuracoes_online_cancelar_ate_horas_check CHECK (((online_cancelar_ate_horas >= 0) AND (online_cancelar_ate_horas <= 720))), - CONSTRAINT agenda_configuracoes_online_limite_agendamentos_futuros_check CHECK (((online_limite_agendamentos_futuros >= 1) AND (online_limite_agendamentos_futuros <= 10))), - CONSTRAINT agenda_configuracoes_online_max_dias_futuro_check CHECK (((online_max_dias_futuro >= 1) AND (online_max_dias_futuro <= 365))), - CONSTRAINT agenda_configuracoes_online_min_antecedencia_horas_check CHECK (((online_min_antecedencia_horas >= 0) AND (online_min_antecedencia_horas <= 720))), - CONSTRAINT agenda_configuracoes_online_modalidade_check CHECK ((online_modalidade = ANY (ARRAY['online'::text, 'presencial'::text, 'ambos'::text]))), - CONSTRAINT agenda_configuracoes_online_modo_check CHECK ((online_modo = ANY (ARRAY['automatico'::text, 'aprovacao'::text]))), - CONSTRAINT agenda_configuracoes_online_reagendar_ate_horas_check CHECK (((online_reagendar_ate_horas >= 0) AND (online_reagendar_ate_horas <= 720))), - CONSTRAINT agenda_configuracoes_slot_mode_chk CHECK ((slot_mode = ANY (ARRAY['fixed'::text, 'dynamic'::text]))), - CONSTRAINT session_break_min_chk CHECK (((session_break_min >= 0) AND (session_break_min <= 60))), - CONSTRAINT session_duration_min_chk CHECK (((session_duration_min >= 10) AND (session_duration_min <= 240))) -); - - -ALTER TABLE public.agenda_configuracoes OWNER TO supabase_admin; - --- --- Name: agenda_eventos; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_eventos ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tipo public.tipo_evento_agenda DEFAULT 'sessao'::public.tipo_evento_agenda NOT NULL, - status public.status_evento_agenda DEFAULT 'agendado'::public.status_evento_agenda NOT NULL, - titulo text, - observacoes text, - inicio_em timestamp with time zone NOT NULL, - fim_em timestamp with time zone NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - terapeuta_id uuid, - tenant_id uuid NOT NULL, - visibility_scope text DEFAULT 'public'::text NOT NULL, - mirror_of_event_id uuid, - mirror_source text, - patient_id uuid, - determined_commitment_id uuid, - link_online text, - titulo_custom text, - extra_fields jsonb, - recurrence_id uuid, - recurrence_date date, - modalidade text DEFAULT 'presencial'::text, - price numeric(10,2), - billing_contract_id uuid, - billed boolean DEFAULT false NOT NULL, - services_customized boolean DEFAULT false NOT NULL, - insurance_plan_id uuid, - insurance_guide_number text, - insurance_value numeric(10,2), - insurance_plan_service_id uuid, - CONSTRAINT agenda_eventos_check CHECK ((fim_em > inicio_em)) -); - - -ALTER TABLE public.agenda_eventos OWNER TO supabase_admin; - --- --- Name: COLUMN agenda_eventos.price; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agenda_eventos.price IS 'Valor da sessão em BRL. Preenchido automaticamente pela tabela professional_pricing do profissional.'; - - --- --- Name: agenda_excecoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_excecoes ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - data date NOT NULL, - hora_inicio time without time zone, - hora_fim time without time zone, - tipo public.tipo_excecao_agenda NOT NULL, - motivo text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - status public.status_excecao_agenda DEFAULT 'ativo'::public.status_excecao_agenda NOT NULL, - fonte text DEFAULT 'manual'::text NOT NULL, - aplicavel_online boolean DEFAULT true NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_excecoes_check CHECK ((((hora_inicio IS NULL) AND (hora_fim IS NULL)) OR ((hora_inicio IS NOT NULL) AND (hora_fim IS NOT NULL) AND (hora_fim > hora_inicio)))), - CONSTRAINT agenda_excecoes_fonte_check CHECK ((fonte = ANY (ARRAY['manual'::text, 'feriado_google'::text, 'sistema'::text]))) -); - - -ALTER TABLE public.agenda_excecoes OWNER TO supabase_admin; - --- --- Name: agenda_online_slots; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_online_slots ( - id bigint NOT NULL, - owner_id uuid NOT NULL, - weekday integer NOT NULL, - "time" time without time zone NOT NULL, - enabled boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_online_slots_weekday_check CHECK ((weekday = ANY (ARRAY[0, 1, 2, 3, 4, 5, 6]))) -); - - -ALTER TABLE public.agenda_online_slots OWNER TO supabase_admin; - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -CREATE SEQUENCE public.agenda_online_slots_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE public.agenda_online_slots_id_seq OWNER TO supabase_admin; - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: supabase_admin --- - -ALTER SEQUENCE public.agenda_online_slots_id_seq OWNED BY public.agenda_online_slots.id; - - --- --- Name: agenda_regras_semanais; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_regras_semanais ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - hora_inicio time without time zone NOT NULL, - hora_fim time without time zone NOT NULL, - modalidade text DEFAULT 'ambos'::text NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_regras_semanais_check CHECK ((hora_fim > hora_inicio)), - CONSTRAINT agenda_regras_semanais_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))), - CONSTRAINT agenda_regras_semanais_modalidade_check CHECK (((modalidade = ANY (ARRAY['online'::text, 'presencial'::text, 'ambos'::text])) OR (modalidade IS NULL))) -); - - -ALTER TABLE public.agenda_regras_semanais OWNER TO supabase_admin; - --- --- Name: agenda_slots_bloqueados_semanais; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_slots_bloqueados_semanais ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - hora_inicio time without time zone NOT NULL, - motivo text, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_slots_bloqueados_semanais_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))) -); - - -ALTER TABLE public.agenda_slots_bloqueados_semanais OWNER TO supabase_admin; - --- --- Name: agenda_slots_regras; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_slots_regras ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - passo_minutos integer NOT NULL, - offset_minutos integer DEFAULT 0 NOT NULL, - buffer_antes_min integer DEFAULT 0 NOT NULL, - buffer_depois_min integer DEFAULT 0 NOT NULL, - min_antecedencia_horas integer DEFAULT 0 NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_slots_regras_buffer_antes_min_check CHECK (((buffer_antes_min >= 0) AND (buffer_antes_min <= 240))), - CONSTRAINT agenda_slots_regras_buffer_depois_min_check CHECK (((buffer_depois_min >= 0) AND (buffer_depois_min <= 240))), - CONSTRAINT agenda_slots_regras_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))), - CONSTRAINT agenda_slots_regras_min_antecedencia_horas_check CHECK (((min_antecedencia_horas >= 0) AND (min_antecedencia_horas <= 720))), - CONSTRAINT agenda_slots_regras_offset_minutos_check CHECK (((offset_minutos >= 0) AND (offset_minutos <= 55))), - CONSTRAINT agenda_slots_regras_passo_minutos_check CHECK (((passo_minutos >= 5) AND (passo_minutos <= 240))) -); - - -ALTER TABLE public.agenda_slots_regras OWNER TO supabase_admin; - --- --- Name: agendador_configuracoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agendador_configuracoes ( - owner_id uuid NOT NULL, - tenant_id uuid, - ativo boolean DEFAULT false NOT NULL, - link_slug text, - imagem_fundo_url text, - imagem_header_url text, - logomarca_url text, - cor_primaria text DEFAULT '#4b6bff'::text, - nome_exibicao text, - endereco text, - botao_como_chegar_ativo boolean DEFAULT true NOT NULL, - maps_url text, - modo_aprovacao text DEFAULT 'aprovacao'::text NOT NULL, - modalidade text DEFAULT 'presencial'::text NOT NULL, - tipos_habilitados jsonb DEFAULT '["primeira", "retorno"]'::jsonb NOT NULL, - duracao_sessao_min integer DEFAULT 50 NOT NULL, - antecedencia_minima_horas integer DEFAULT 24 NOT NULL, - prazo_resposta_horas integer DEFAULT 2 NOT NULL, - reserva_horas integer DEFAULT 2 NOT NULL, - pagamento_obrigatorio boolean DEFAULT false NOT NULL, - pix_chave text, - pix_countdown_minutos integer DEFAULT 20 NOT NULL, - triagem_motivo boolean DEFAULT true NOT NULL, - triagem_como_conheceu boolean DEFAULT false NOT NULL, - verificacao_email boolean DEFAULT false NOT NULL, - exigir_aceite_lgpd boolean DEFAULT true NOT NULL, - mensagem_boas_vindas text, - texto_como_se_preparar text, - texto_termos_lgpd text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - pagamento_modo text DEFAULT 'sem_pagamento'::text NOT NULL, - pagamento_metodos_visiveis text[] DEFAULT '{}'::text[] NOT NULL, - CONSTRAINT agendador_configuracoes_antecedencia_check CHECK (((antecedencia_minima_horas >= 0) AND (antecedencia_minima_horas <= 720))), - CONSTRAINT agendador_configuracoes_duracao_check CHECK (((duracao_sessao_min >= 10) AND (duracao_sessao_min <= 240))), - CONSTRAINT agendador_configuracoes_modalidade_check CHECK ((modalidade = ANY (ARRAY['presencial'::text, 'online'::text, 'ambos'::text]))), - CONSTRAINT agendador_configuracoes_modo_check CHECK ((modo_aprovacao = ANY (ARRAY['automatico'::text, 'aprovacao'::text]))), - CONSTRAINT agendador_configuracoes_pix_countdown_check CHECK (((pix_countdown_minutos >= 5) AND (pix_countdown_minutos <= 120))), - CONSTRAINT agendador_configuracoes_prazo_check CHECK (((prazo_resposta_horas >= 1) AND (prazo_resposta_horas <= 72))), - CONSTRAINT agendador_configuracoes_reserva_check CHECK (((reserva_horas >= 1) AND (reserva_horas <= 48))) -); - - -ALTER TABLE public.agendador_configuracoes OWNER TO supabase_admin; - --- --- Name: COLUMN agendador_configuracoes.pagamento_modo; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agendador_configuracoes.pagamento_modo IS 'sem_pagamento | pagar_na_hora | pix_antecipado'; - - --- --- Name: COLUMN agendador_configuracoes.pagamento_metodos_visiveis; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agendador_configuracoes.pagamento_metodos_visiveis IS 'Métodos exibidos ao paciente quando pagamento_modo = pagar_na_hora. Ex: {pix, deposito, dinheiro, cartao, convenio}'; - - --- --- Name: agendador_solicitacoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agendador_solicitacoes ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - paciente_nome text NOT NULL, - paciente_sobrenome text, - paciente_email text NOT NULL, - paciente_celular text, - paciente_cpf text, - tipo text NOT NULL, - modalidade text NOT NULL, - data_solicitada date NOT NULL, - hora_solicitada time without time zone NOT NULL, - reservado_ate timestamp with time zone, - motivo text, - como_conheceu text, - pix_status text DEFAULT 'pendente'::text, - pix_pago_em timestamp with time zone, - status text DEFAULT 'pendente'::text NOT NULL, - recusado_motivo text, - autorizado_em timestamp with time zone, - autorizado_por uuid, - user_id uuid, - patient_id uuid, - evento_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT agendador_sol_modalidade_check CHECK ((modalidade = ANY (ARRAY['presencial'::text, 'online'::text]))), - CONSTRAINT agendador_sol_pix_check CHECK (((pix_status IS NULL) OR (pix_status = ANY (ARRAY['pendente'::text, 'pago'::text, 'expirado'::text])))), - CONSTRAINT agendador_sol_status_check CHECK ((status = ANY (ARRAY['pendente'::text, 'autorizado'::text, 'recusado'::text, 'expirado'::text, 'convertido'::text]))), - CONSTRAINT agendador_sol_tipo_check CHECK ((tipo = ANY (ARRAY['primeira'::text, 'retorno'::text, 'reagendar'::text]))) -); - - -ALTER TABLE public.agendador_solicitacoes OWNER TO supabase_admin; - --- --- Name: billing_contracts; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.billing_contracts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - patient_id uuid NOT NULL, - type text NOT NULL, - total_sessions integer, - sessions_used integer DEFAULT 0, - package_price numeric(10,2), - amount numeric(10,2), - billing_interval text, - active_from timestamp with time zone DEFAULT now(), - active_to timestamp with time zone, - status text DEFAULT 'active'::text NOT NULL, - created_at timestamp with time zone DEFAULT now(), - CONSTRAINT billing_contracts_interval_chk CHECK (((billing_interval IS NULL) OR (billing_interval = ANY (ARRAY['monthly'::text, 'weekly'::text])))), - CONSTRAINT billing_contracts_sess_used_chk CHECK (((sessions_used IS NULL) OR (sessions_used >= 0))), - CONSTRAINT billing_contracts_status_chk CHECK ((status = ANY (ARRAY['active'::text, 'completed'::text, 'cancelled'::text]))), - CONSTRAINT billing_contracts_total_sess_chk CHECK (((total_sessions IS NULL) OR (total_sessions > 0))), - CONSTRAINT billing_contracts_type_chk CHECK ((type = ANY (ARRAY['per_session'::text, 'package'::text, 'subscription'::text]))) -); - - -ALTER TABLE public.billing_contracts OWNER TO supabase_admin; - --- --- Name: commitment_services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.commitment_services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - commitment_id uuid NOT NULL, - service_id uuid NOT NULL, - quantity integer DEFAULT 1 NOT NULL, - unit_price numeric(10,2) NOT NULL, - discount_pct numeric(5,2) DEFAULT 0, - discount_flat numeric(10,2) DEFAULT 0, - final_price numeric(10,2) NOT NULL, - created_at timestamp with time zone DEFAULT now(), - CONSTRAINT commitment_services_disc_flat_chk CHECK ((discount_flat >= (0)::numeric)), - CONSTRAINT commitment_services_disc_pct_chk CHECK (((discount_pct >= (0)::numeric) AND (discount_pct <= (100)::numeric))), - CONSTRAINT commitment_services_final_price_chk CHECK ((final_price >= (0)::numeric)), - CONSTRAINT commitment_services_quantity_chk CHECK ((quantity > 0)) -); - - -ALTER TABLE public.commitment_services OWNER TO supabase_admin; - --- --- Name: commitment_time_logs; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.commitment_time_logs ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - commitment_id uuid NOT NULL, - calendar_event_id uuid, - source public.commitment_log_source DEFAULT 'manual'::public.commitment_log_source NOT NULL, - started_at timestamp with time zone NOT NULL, - ended_at timestamp with time zone NOT NULL, - minutes integer NOT NULL, - created_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.commitment_time_logs OWNER TO supabase_admin; - --- --- Name: current_tenant_id; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.current_tenant_id AS - SELECT current_setting('request.jwt.claim.tenant_id'::text, true) AS current_setting; - - -ALTER VIEW public.current_tenant_id OWNER TO supabase_admin; - --- --- Name: determined_commitment_fields; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.determined_commitment_fields ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - commitment_id uuid NOT NULL, - key text NOT NULL, - label text NOT NULL, - field_type public.determined_field_type DEFAULT 'text'::public.determined_field_type NOT NULL, - required boolean DEFAULT false NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.determined_commitment_fields OWNER TO supabase_admin; - --- --- Name: determined_commitments; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.determined_commitments ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - created_by uuid, - is_native boolean DEFAULT false NOT NULL, - native_key text, - is_locked boolean DEFAULT false NOT NULL, - active boolean DEFAULT true NOT NULL, - name text NOT NULL, - description text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - bg_color text, - text_color text -); - - -ALTER TABLE public.determined_commitments OWNER TO supabase_admin; - --- --- Name: dev_user_credentials; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.dev_user_credentials ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - email text NOT NULL, - password_dev text NOT NULL, - kind text DEFAULT 'custom'::text NOT NULL, - note text, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.dev_user_credentials OWNER TO supabase_admin; - --- --- Name: entitlements_invalidation; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.entitlements_invalidation ( - owner_id uuid NOT NULL, - changed_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.entitlements_invalidation OWNER TO supabase_admin; - --- --- Name: features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.features ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - description text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - descricao text DEFAULT ''::text NOT NULL, - name text DEFAULT ''::text NOT NULL -); - - -ALTER TABLE public.features OWNER TO supabase_admin; - --- --- Name: COLUMN features.descricao; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.features.descricao IS 'Descrição humana da feature (exibição no admin e documentação).'; - - --- --- Name: feriados; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.feriados ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid, - owner_id uuid, - tipo text DEFAULT 'municipal'::text NOT NULL, - nome text NOT NULL, - data date NOT NULL, - cidade text, - estado text, - observacao text, - bloqueia_sessoes boolean DEFAULT false NOT NULL, - criado_em timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT feriados_tipo_check CHECK ((tipo = ANY (ARRAY['municipal'::text, 'personalizado'::text]))) -); - - -ALTER TABLE public.feriados OWNER TO supabase_admin; - --- --- Name: financial_exceptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.financial_exceptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid, - tenant_id uuid NOT NULL, - exception_type text NOT NULL, - charge_mode text NOT NULL, - charge_value numeric(10,2), - charge_pct numeric(5,2), - min_hours_notice integer, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - CONSTRAINT financial_exceptions_charge_chk CHECK ((charge_mode = ANY (ARRAY['none'::text, 'full'::text, 'fixed_fee'::text, 'percentage'::text]))), - CONSTRAINT financial_exceptions_type_chk CHECK ((exception_type = ANY (ARRAY['patient_no_show'::text, 'patient_cancellation'::text, 'professional_cancellation'::text]))) -); - - -ALTER TABLE public.financial_exceptions OWNER TO supabase_admin; - --- --- Name: insurance_plan_services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.insurance_plan_services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - insurance_plan_id uuid NOT NULL, - name text NOT NULL, - value numeric(10,2) NOT NULL, - active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.insurance_plan_services OWNER TO supabase_admin; - --- --- Name: insurance_plans; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.insurance_plans ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - name text NOT NULL, - notes text, - default_value numeric(10,2), - active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.insurance_plans OWNER TO supabase_admin; - --- --- Name: module_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.module_features ( - module_id uuid NOT NULL, - feature_id uuid NOT NULL, - enabled boolean DEFAULT true NOT NULL, - limits jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.module_features OWNER TO supabase_admin; - --- --- Name: modules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.modules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - name text NOT NULL, - description text, - is_active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.modules OWNER TO supabase_admin; - --- --- Name: plan_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_features ( - plan_id uuid NOT NULL, - feature_id uuid NOT NULL, - enabled boolean DEFAULT true NOT NULL, - limits jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_features OWNER TO supabase_admin; - --- --- Name: tenant_modules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_modules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - module_id uuid NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - settings jsonb, - provider text DEFAULT 'manual'::text NOT NULL, - provider_item_id text, - installed_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_modules OWNER TO supabase_admin; - --- --- Name: owner_feature_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.owner_feature_entitlements AS - WITH base AS ( - SELECT s.user_id AS owner_id, - f.key AS feature_key, - pf.limits, - 'plan'::text AS source - FROM ((public.subscriptions s - JOIN public.plan_features pf ON (((pf.plan_id = s.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))) - WHERE ((s.status = 'active'::text) AND (s.user_id IS NOT NULL)) - UNION ALL - SELECT tm.owner_id, - f.key AS feature_key, - mf.limits, - 'module'::text AS source - FROM (((public.tenant_modules tm - JOIN public.modules m ON (((m.id = tm.module_id) AND (m.is_active = true)))) - JOIN public.module_features mf ON (((mf.module_id = m.id) AND (mf.enabled = true)))) - JOIN public.features f ON ((f.id = mf.feature_id))) - WHERE ((tm.status = 'active'::text) AND (tm.owner_id IS NOT NULL)) - ) - SELECT owner_id, - feature_key, - array_agg(DISTINCT source) AS sources, - jsonb_agg(limits) FILTER (WHERE (limits IS NOT NULL)) AS limits_list - FROM base - GROUP BY owner_id, feature_key; - - -ALTER VIEW public.owner_feature_entitlements OWNER TO supabase_admin; - --- --- Name: owner_users; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.owner_users ( - owner_id uuid NOT NULL, - user_id uuid NOT NULL, - role text DEFAULT 'admin'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.owner_users OWNER TO supabase_admin; - --- --- Name: patient_discounts; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_discounts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - patient_id uuid NOT NULL, - discount_pct numeric(5,2) DEFAULT 0, - discount_flat numeric(10,2) DEFAULT 0, - reason text, - active boolean DEFAULT true NOT NULL, - active_from timestamp with time zone DEFAULT now(), - active_to timestamp with time zone, - created_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.patient_discounts OWNER TO supabase_admin; - --- --- Name: patient_group_patient; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_group_patient ( - patient_group_id uuid NOT NULL, - patient_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now(), - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_group_patient OWNER TO supabase_admin; - --- --- Name: patient_groups; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_groups ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - nome text NOT NULL, - descricao text, - cor text, - is_active boolean DEFAULT true NOT NULL, - is_system boolean DEFAULT false NOT NULL, - owner_id uuid DEFAULT auth.uid() NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - therapist_id uuid, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_groups OWNER TO supabase_admin; - --- --- Name: patient_intake_requests; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_intake_requests ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - token text NOT NULL, - consent boolean DEFAULT false NOT NULL, - status text DEFAULT 'new'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - converted_patient_id uuid, - rejected_reason text, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - cpf text, - rg text, - cep text, - nome_completo text, - email_principal text, - telefone text, - pais text, - cidade text, - estado text, - endereco text, - numero text, - bairro text, - complemento text, - data_nascimento date, - naturalidade text, - genero text, - estado_civil text, - onde_nos_conheceu text, - encaminhado_por text, - observacoes text, - notas_internas text, - email_alternativo text, - telefone_alternativo text, - profissao text, - escolaridade text, - nacionalidade text, - avatar_url text, - tenant_id uuid, - CONSTRAINT chk_intakes_status CHECK ((status = ANY (ARRAY['new'::text, 'converted'::text, 'rejected'::text]))) -); - - -ALTER TABLE public.patient_intake_requests OWNER TO supabase_admin; - --- --- Name: patient_invites; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_invites ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - token text NOT NULL, - active boolean DEFAULT true NOT NULL, - expires_at timestamp with time zone, - max_uses integer, - uses integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid -); - - -ALTER TABLE public.patient_invites OWNER TO supabase_admin; - --- --- Name: patient_patient_tag; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_patient_tag ( - owner_id uuid NOT NULL, - patient_id uuid NOT NULL, - tag_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_patient_tag OWNER TO supabase_admin; - --- --- Name: patient_tags; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_tags ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - nome text NOT NULL, - cor text, - is_padrao boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_tags OWNER TO supabase_admin; - --- --- Name: patients; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patients ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - nome_completo text NOT NULL, - email_principal text, - telefone text, - created_at timestamp with time zone DEFAULT now(), - owner_id uuid, - avatar_url text, - status text DEFAULT 'Ativo'::text, - last_attended_at timestamp with time zone, - is_native boolean DEFAULT false, - naturalidade text, - data_nascimento date, - rg text, - cpf text, - identification_color text, - genero text, - estado_civil text, - email_alternativo text, - pais text DEFAULT 'Brasil'::text, - cep text, - cidade text, - estado text, - endereco text, - numero text, - bairro text, - complemento text, - escolaridade text, - profissao text, - nome_parente text, - grau_parentesco text, - telefone_alternativo text, - onde_nos_conheceu text, - encaminhado_por text, - nome_responsavel text, - telefone_responsavel text, - cpf_responsavel text, - observacao_responsavel text, - cobranca_no_responsavel boolean DEFAULT false, - observacoes text, - notas_internas text, - updated_at timestamp with time zone DEFAULT now(), - telefone_parente text, - tenant_id uuid NOT NULL, - responsible_member_id uuid NOT NULL, - user_id uuid, - patient_scope text DEFAULT 'clinic'::text NOT NULL, - therapist_member_id uuid, - CONSTRAINT cpf_responsavel_format_check CHECK (((cpf_responsavel IS NULL) OR (cpf_responsavel ~ '^\d{11}$'::text))), - CONSTRAINT patients_cpf_format_check CHECK (((cpf IS NULL) OR (cpf ~ '^\d{11}$'::text))), - CONSTRAINT patients_patient_scope_check CHECK ((patient_scope = ANY (ARRAY['clinic'::text, 'therapist'::text]))), - CONSTRAINT patients_status_check CHECK ((status = ANY (ARRAY['Ativo'::text, 'Inativo'::text, 'Alta'::text, 'Encaminhado'::text]))), - CONSTRAINT patients_therapist_scope_consistency CHECK ((((patient_scope = 'clinic'::text) AND (therapist_member_id IS NULL)) OR ((patient_scope = 'therapist'::text) AND (therapist_member_id IS NOT NULL)))) -); - - -ALTER TABLE public.patients OWNER TO supabase_admin; - --- --- Name: COLUMN patients.avatar_url; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.patients.avatar_url IS 'URL pública da imagem de avatar armazenada no Supabase Storage'; - - --- --- Name: payment_settings; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.payment_settings ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - pix_ativo boolean DEFAULT false NOT NULL, - pix_tipo text DEFAULT 'cpf'::text NOT NULL, - pix_chave text DEFAULT ''::text NOT NULL, - pix_nome_titular text DEFAULT ''::text NOT NULL, - deposito_ativo boolean DEFAULT false NOT NULL, - deposito_banco text DEFAULT ''::text NOT NULL, - deposito_agencia text DEFAULT ''::text NOT NULL, - deposito_conta text DEFAULT ''::text NOT NULL, - deposito_tipo_conta text DEFAULT 'corrente'::text NOT NULL, - deposito_titular text DEFAULT ''::text NOT NULL, - deposito_cpf_cnpj text DEFAULT ''::text NOT NULL, - dinheiro_ativo boolean DEFAULT false NOT NULL, - cartao_ativo boolean DEFAULT false NOT NULL, - cartao_instrucao text DEFAULT ''::text NOT NULL, - convenio_ativo boolean DEFAULT false NOT NULL, - convenio_lista text DEFAULT ''::text NOT NULL, - observacoes_pagamento text DEFAULT ''::text NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.payment_settings OWNER TO supabase_admin; - --- --- Name: plan_prices; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_prices ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - plan_id uuid NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - "interval" text NOT NULL, - amount_cents integer NOT NULL, - is_active boolean DEFAULT true NOT NULL, - active_from timestamp with time zone DEFAULT now() NOT NULL, - active_to timestamp with time zone, - source text DEFAULT 'manual'::text NOT NULL, - provider text, - provider_price_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT plan_prices_amount_cents_check CHECK ((amount_cents >= 0)), - CONSTRAINT plan_prices_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))) -); - - -ALTER TABLE public.plan_prices OWNER TO supabase_admin; - --- --- Name: TABLE plan_prices; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.plan_prices IS 'Histórico de preços por plano (fonte: manual/gateway).'; - - --- --- Name: plan_public; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_public ( - plan_id uuid NOT NULL, - public_name text DEFAULT ''::text NOT NULL, - public_description text DEFAULT ''::text NOT NULL, - badge text, - is_featured boolean DEFAULT false NOT NULL, - is_visible boolean DEFAULT true NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_public OWNER TO supabase_admin; - --- --- Name: TABLE plan_public; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.plan_public IS 'Configuração de vitrine (página pública) dos planos.'; - - --- --- Name: plan_public_bullets; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_public_bullets ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - plan_id uuid NOT NULL, - text text NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - highlight boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_public_bullets OWNER TO supabase_admin; - --- --- Name: plans; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plans ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - name text NOT NULL, - description text, - is_active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - price_cents integer DEFAULT 0 NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - billing_interval text DEFAULT 'month'::text NOT NULL, - target text, - max_supervisees integer, - CONSTRAINT plans_target_check CHECK ((target = ANY (ARRAY['patient'::text, 'therapist'::text, 'clinic'::text, 'supervisor'::text]))) -); - - -ALTER TABLE public.plans OWNER TO supabase_admin; - --- --- Name: COLUMN plans.name; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.name IS 'Nome interno do plano (admin). A key é técnica/imutável.'; - - --- --- Name: COLUMN plans.target; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.target IS 'Público-alvo do plano: patient, therapist ou clinic.'; - - --- --- Name: COLUMN plans.max_supervisees; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.max_supervisees IS 'Limite de terapeutas que podem ser supervisionados. Apenas para planos target=supervisor. NULL = sem limite.'; - - --- --- Name: professional_pricing; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.professional_pricing ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - determined_commitment_id uuid, - price numeric(10,2) NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.professional_pricing OWNER TO supabase_admin; - --- --- Name: TABLE professional_pricing; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.professional_pricing IS 'DEPRECATED: substituída por public.services. Manter até próxima release de limpeza.'; - - --- --- Name: profiles; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.profiles ( - id uuid NOT NULL, - role text DEFAULT 'tenant_member'::text NOT NULL, - full_name text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - avatar_url text, - phone text, - bio text, - language text DEFAULT 'pt-BR'::text NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - notify_system_email boolean DEFAULT true NOT NULL, - notify_reminders boolean DEFAULT true NOT NULL, - notify_news boolean DEFAULT false NOT NULL, - account_type text DEFAULT 'free'::text NOT NULL, - platform_roles text[] DEFAULT '{}'::text[] NOT NULL, - CONSTRAINT profiles_account_type_check CHECK ((account_type = ANY (ARRAY['free'::text, 'patient'::text, 'therapist'::text, 'clinic'::text]))), - CONSTRAINT profiles_role_check CHECK ((role = ANY (ARRAY['saas_admin'::text, 'tenant_member'::text, 'portal_user'::text, 'patient'::text]))) -); - - -ALTER TABLE public.profiles OWNER TO supabase_admin; - --- --- Name: COLUMN profiles.account_type; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.account_type IS 'Tipo de conta: free=sem perfil ainda, patient=paciente (imutável), therapist=terapeuta (imutável), clinic=clínica (imutável).'; - - --- --- Name: COLUMN profiles.platform_roles; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.platform_roles IS 'Papéis globais de plataforma, independentes de tenant. Ex: editor de microlearning. Atribuído pelo saas_admin.'; - - --- --- Name: recurrence_exceptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_exceptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - recurrence_id uuid NOT NULL, - tenant_id uuid NOT NULL, - original_date date NOT NULL, - type public.recurrence_exception_type NOT NULL, - new_date date, - new_start_time time without time zone, - new_end_time time without time zone, - modalidade text, - observacoes text, - titulo_custom text, - extra_fields jsonb, - reason text, - agenda_evento_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.recurrence_exceptions OWNER TO supabase_admin; - --- --- Name: recurrence_rule_services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_rule_services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - rule_id uuid NOT NULL, - service_id uuid NOT NULL, - quantity integer DEFAULT 1 NOT NULL, - unit_price numeric(10,2) NOT NULL, - discount_pct numeric(5,2) DEFAULT 0, - discount_flat numeric(10,2) DEFAULT 0, - final_price numeric(10,2) NOT NULL, - created_at timestamp with time zone DEFAULT now(), - CONSTRAINT recurrence_rule_services_disc_flat_chk CHECK ((discount_flat >= (0)::numeric)), - CONSTRAINT recurrence_rule_services_disc_pct_chk CHECK (((discount_pct >= (0)::numeric) AND (discount_pct <= (100)::numeric))), - CONSTRAINT recurrence_rule_services_final_price_chk CHECK ((final_price >= (0)::numeric)), - CONSTRAINT recurrence_rule_services_quantity_chk CHECK ((quantity > 0)) -); - - -ALTER TABLE public.recurrence_rule_services OWNER TO supabase_admin; - --- --- Name: recurrence_rules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_rules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - owner_id uuid NOT NULL, - therapist_id uuid, - patient_id uuid, - determined_commitment_id uuid, - type public.recurrence_type DEFAULT 'weekly'::public.recurrence_type NOT NULL, - "interval" smallint DEFAULT 1 NOT NULL, - weekdays smallint[] DEFAULT '{}'::smallint[] NOT NULL, - start_time time without time zone NOT NULL, - end_time time without time zone NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - duration_min smallint DEFAULT 50 NOT NULL, - start_date date NOT NULL, - end_date date, - max_occurrences integer, - open_ended boolean DEFAULT true NOT NULL, - modalidade text DEFAULT 'presencial'::text, - titulo_custom text, - observacoes text, - extra_fields jsonb, - status text DEFAULT 'ativo'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - price numeric(10,2), - insurance_plan_id uuid, - insurance_guide_number text, - insurance_value numeric(10,2), - insurance_plan_service_id uuid, - CONSTRAINT recurrence_rules_dates_chk CHECK (((end_date IS NULL) OR (end_date >= start_date))), - CONSTRAINT recurrence_rules_interval_chk CHECK (("interval" >= 1)), - CONSTRAINT recurrence_rules_status_check CHECK ((status = ANY (ARRAY['ativo'::text, 'pausado'::text, 'cancelado'::text]))), - CONSTRAINT recurrence_rules_times_chk CHECK ((end_time > start_time)) -); - - -ALTER TABLE public.recurrence_rules OWNER TO supabase_admin; - --- --- Name: saas_admins; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_admins ( - user_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_admins OWNER TO supabase_admin; - --- --- Name: saas_doc_votos; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_doc_votos ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - doc_id uuid NOT NULL, - user_id uuid NOT NULL, - util boolean NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_doc_votos OWNER TO supabase_admin; - --- --- Name: saas_docs; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_docs ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - titulo text NOT NULL, - conteudo text DEFAULT ''::text NOT NULL, - medias jsonb DEFAULT '[]'::jsonb NOT NULL, - tipo_acesso text DEFAULT 'usuario'::text NOT NULL, - pagina_path text NOT NULL, - docs_relacionados uuid[] DEFAULT '{}'::uuid[] NOT NULL, - ativo boolean DEFAULT true NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - categoria text, - exibir_no_faq boolean DEFAULT false NOT NULL, - votos_util integer DEFAULT 0 NOT NULL, - votos_nao_util integer DEFAULT 0 NOT NULL, - CONSTRAINT saas_docs_tipo_acesso_check CHECK ((tipo_acesso = ANY (ARRAY['admin'::text, 'usuario'::text]))) -); - - -ALTER TABLE public.saas_docs OWNER TO supabase_admin; - --- --- Name: COLUMN saas_docs.categoria; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.saas_docs.categoria IS 'Agrupa docs no portal FAQ (ex: Conta, Agenda, Pagamentos)'; - - --- --- Name: COLUMN saas_docs.exibir_no_faq; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.saas_docs.exibir_no_faq IS 'Se true, a doc e seus itens FAQ aparecem no portal de FAQ'; - - --- --- Name: saas_faq; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_faq ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - pergunta text NOT NULL, - categoria text, - publico boolean DEFAULT false NOT NULL, - votos integer DEFAULT 0 NOT NULL, - titulo text, - conteudo text, - tipo_acesso text DEFAULT 'usuario'::text NOT NULL, - pagina_path text NOT NULL, - pagina_label text, - medias jsonb DEFAULT '[]'::jsonb NOT NULL, - faqs_relacionados uuid[] DEFAULT '{}'::uuid[] NOT NULL, - ativo boolean DEFAULT true NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_faq OWNER TO supabase_admin; - --- --- Name: saas_faq_itens; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_faq_itens ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - doc_id uuid NOT NULL, - pergunta text NOT NULL, - resposta text, - ordem integer DEFAULT 0 NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_faq_itens OWNER TO supabase_admin; - --- --- Name: TABLE saas_faq_itens; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.saas_faq_itens IS 'Pares pergunta/resposta vinculados a um documento de ajuda'; - - --- --- Name: services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - name text NOT NULL, - description text, - price numeric(10,2) NOT NULL, - duration_min integer, - active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.services OWNER TO supabase_admin; - --- --- Name: subscription_events; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_events ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - subscription_id uuid NOT NULL, - owner_id uuid NOT NULL, - event_type text NOT NULL, - old_plan_id uuid, - new_plan_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - created_by uuid, - source text DEFAULT 'admin_ui'::text, - reason text, - metadata jsonb, - owner_type text NOT NULL, - owner_ref uuid NOT NULL, - CONSTRAINT subscription_events_owner_ref_consistency_chk CHECK ((owner_id = owner_ref)), - CONSTRAINT subscription_events_owner_type_chk CHECK (((owner_type IS NULL) OR (owner_type = ANY (ARRAY['clinic'::text, 'therapist'::text])))) -); - - -ALTER TABLE public.subscription_events OWNER TO supabase_admin; - --- --- Name: subscription_intents_personal; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_personal ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid NOT NULL, - created_by_user_id uuid, - email text NOT NULL, - plan_id uuid NOT NULL, - plan_key text, - "interval" text, - amount_cents integer, - currency text, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'manual'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - subscription_id uuid, - CONSTRAINT sint_personal_interval_check CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::text, 'year'::text])))), - CONSTRAINT sint_personal_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_personal OWNER TO supabase_admin; - --- --- Name: subscription_intents_tenant; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_tenant ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid NOT NULL, - created_by_user_id uuid, - email text NOT NULL, - plan_id uuid NOT NULL, - plan_key text, - "interval" text, - amount_cents integer, - currency text, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'manual'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - tenant_id uuid NOT NULL, - subscription_id uuid, - CONSTRAINT sint_tenant_interval_check CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::text, 'year'::text])))), - CONSTRAINT sint_tenant_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_tenant OWNER TO supabase_admin; - --- --- Name: subscription_intents; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.subscription_intents AS - SELECT t.id, - t.user_id, - t.created_by_user_id, - t.email, - t.plan_id, - t.plan_key, - t."interval", - t.amount_cents, - t.currency, - t.status, - t.source, - t.notes, - t.created_at, - t.paid_at, - t.tenant_id, - t.subscription_id, - 'clinic'::text AS plan_target - FROM public.subscription_intents_tenant t -UNION ALL - SELECT p.id, - p.user_id, - p.created_by_user_id, - p.email, - p.plan_id, - p.plan_key, - p."interval", - p.amount_cents, - p.currency, - p.status, - p.source, - p.notes, - p.created_at, - p.paid_at, - NULL::uuid AS tenant_id, - p.subscription_id, - 'therapist'::text AS plan_target - FROM public.subscription_intents_personal p; - - -ALTER VIEW public.subscription_intents OWNER TO supabase_admin; - --- --- Name: subscription_intents_legacy; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_legacy ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - email text, - plan_key text NOT NULL, - "interval" text NOT NULL, - amount_cents integer NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'landing'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - tenant_id uuid NOT NULL, - created_by_user_id uuid, - CONSTRAINT subscription_intents_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))), - CONSTRAINT subscription_intents_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_legacy OWNER TO supabase_admin; - --- --- Name: support_sessions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.support_sessions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - admin_id uuid NOT NULL, - token text DEFAULT encode(extensions.gen_random_bytes(32), 'hex'::text) NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '01:00:00'::interval) NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.support_sessions OWNER TO supabase_admin; - --- --- Name: tenant_feature_exceptions_log; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_feature_exceptions_log ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - feature_key text NOT NULL, - enabled boolean NOT NULL, - reason text, - created_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_feature_exceptions_log OWNER TO supabase_admin; - --- --- Name: tenant_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_features ( - tenant_id uuid NOT NULL, - feature_key text NOT NULL, - enabled boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_features OWNER TO supabase_admin; - --- --- Name: tenant_invites; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_invites ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - email text NOT NULL, - role text NOT NULL, - token uuid DEFAULT gen_random_uuid() NOT NULL, - invited_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '7 days'::interval) NOT NULL, - accepted_at timestamp with time zone, - accepted_by uuid, - revoked_at timestamp with time zone, - revoked_by uuid, - CONSTRAINT tenant_invites_role_check CHECK ((role = ANY (ARRAY['therapist'::text, 'secretary'::text]))) -); - - -ALTER TABLE public.tenant_invites OWNER TO supabase_admin; - --- --- Name: tenants; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenants ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - name text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - kind text DEFAULT 'saas'::text NOT NULL, - CONSTRAINT tenants_kind_check CHECK ((kind = ANY (ARRAY['therapist'::text, 'clinic_coworking'::text, 'clinic_reception'::text, 'clinic_full'::text, 'clinic'::text, 'saas'::text, 'supervisor'::text]))) -); - - -ALTER TABLE public.tenants OWNER TO supabase_admin; - --- --- Name: COLUMN tenants.kind; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.tenants.kind IS 'Tipo do tenant. Imutável após criação. therapist=terapeuta solo. clinic_coworking/clinic_reception/clinic_full=clínicas. clinic e saas são legados.'; - - --- --- Name: user_settings; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.user_settings ( - user_id uuid NOT NULL, - theme_mode text DEFAULT 'dark'::text NOT NULL, - preset text DEFAULT 'Aura'::text NOT NULL, - primary_color text DEFAULT 'noir'::text NOT NULL, - surface_color text DEFAULT 'slate'::text NOT NULL, - menu_mode text DEFAULT 'static'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.user_settings OWNER TO supabase_admin; - --- --- Name: v_auth_users_public; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_auth_users_public AS - SELECT id AS user_id, - email, - created_at, - last_sign_in_at - FROM auth.users u; - - -ALTER VIEW public.v_auth_users_public OWNER TO supabase_admin; - --- --- Name: v_commitment_totals; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_commitment_totals AS - SELECT c.tenant_id, - c.id AS commitment_id, - (COALESCE(sum(l.minutes), (0)::bigint))::integer AS total_minutes - FROM (public.determined_commitments c - LEFT JOIN public.commitment_time_logs l ON ((l.commitment_id = c.id))) - GROUP BY c.tenant_id, c.id; - - -ALTER VIEW public.v_commitment_totals OWNER TO supabase_admin; - --- --- Name: v_patient_groups_with_counts; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_patient_groups_with_counts AS - SELECT pg.id, - pg.nome, - pg.cor, - pg.owner_id, - pg.is_system, - pg.is_active, - pg.created_at, - pg.updated_at, - (COALESCE(count(pgp.patient_id), (0)::bigint))::integer AS patients_count - FROM (public.patient_groups pg - LEFT JOIN public.patient_group_patient pgp ON ((pgp.patient_group_id = pg.id))) - GROUP BY pg.id, pg.nome, pg.cor, pg.owner_id, pg.is_system, pg.is_active, pg.created_at, pg.updated_at; - - -ALTER VIEW public.v_patient_groups_with_counts OWNER TO supabase_admin; - --- --- Name: v_plan_active_prices; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_plan_active_prices AS - SELECT plan_id, - max( - CASE - WHEN (("interval" = 'month'::text) AND is_active) THEN amount_cents - ELSE NULL::integer - END) AS monthly_cents, - max( - CASE - WHEN (("interval" = 'year'::text) AND is_active) THEN amount_cents - ELSE NULL::integer - END) AS yearly_cents, - max( - CASE - WHEN (("interval" = 'month'::text) AND is_active) THEN currency - ELSE NULL::text - END) AS monthly_currency, - max( - CASE - WHEN (("interval" = 'year'::text) AND is_active) THEN currency - ELSE NULL::text - END) AS yearly_currency - FROM public.plan_prices - GROUP BY plan_id; - - -ALTER VIEW public.v_plan_active_prices OWNER TO supabase_admin; - --- --- Name: v_public_pricing; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_public_pricing AS - SELECT p.id AS plan_id, - p.key AS plan_key, - p.name AS plan_name, - COALESCE(pp.public_name, ''::text) AS public_name, - COALESCE(pp.public_description, ''::text) AS public_description, - pp.badge, - COALESCE(pp.is_featured, false) AS is_featured, - COALESCE(pp.is_visible, true) AS is_visible, - COALESCE(pp.sort_order, 0) AS sort_order, - ap.monthly_cents, - ap.yearly_cents, - ap.monthly_currency, - ap.yearly_currency, - COALESCE(( SELECT jsonb_agg(jsonb_build_object('id', b.id, 'text', b.text, 'highlight', b.highlight, 'sort_order', b.sort_order) ORDER BY b.sort_order, b.created_at) AS jsonb_agg - FROM public.plan_public_bullets b - WHERE (b.plan_id = p.id)), '[]'::jsonb) AS bullets, - p.target AS plan_target - FROM ((public.plans p - LEFT JOIN public.plan_public pp ON ((pp.plan_id = p.id))) - LEFT JOIN public.v_plan_active_prices ap ON ((ap.plan_id = p.id))) - ORDER BY COALESCE(pp.sort_order, 0), p.key; - - -ALTER VIEW public.v_public_pricing OWNER TO supabase_admin; - --- --- Name: v_subscription_feature_mismatch; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_feature_mismatch AS - WITH expected AS ( - SELECT s.user_id AS owner_id, - f.key AS feature_key - FROM ((public.subscriptions s - JOIN public.plan_features pf ON (((pf.plan_id = s.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))) - WHERE ((s.status = 'active'::text) AND (s.tenant_id IS NULL) AND (s.user_id IS NOT NULL)) - ), actual AS ( - SELECT e.owner_id, - e.feature_key - FROM public.owner_feature_entitlements e - ) - SELECT COALESCE(expected.owner_id, actual.owner_id) AS owner_id, - COALESCE(expected.feature_key, actual.feature_key) AS feature_key, - CASE - WHEN ((expected.feature_key IS NOT NULL) AND (actual.feature_key IS NULL)) THEN 'missing_entitlement'::text - WHEN ((expected.feature_key IS NULL) AND (actual.feature_key IS NOT NULL)) THEN 'unexpected_entitlement'::text - ELSE NULL::text - END AS mismatch_type - FROM (expected - FULL JOIN actual ON (((expected.owner_id = actual.owner_id) AND (expected.feature_key = actual.feature_key)))) - WHERE ((expected.feature_key IS NULL) OR (actual.feature_key IS NULL)); - - -ALTER VIEW public.v_subscription_feature_mismatch OWNER TO supabase_admin; - --- --- Name: v_subscription_health; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_health AS - SELECT s.id AS subscription_id, - s.user_id AS owner_id, - s.status, - s.plan_id, - p.key AS plan_key, - s.current_period_start, - s.current_period_end, - s.updated_at, - CASE - WHEN (s.plan_id IS NULL) THEN 'missing_plan'::text - WHEN (p.id IS NULL) THEN 'invalid_plan'::text - WHEN ((s.status = 'active'::text) AND (s.current_period_end IS NOT NULL) AND (s.current_period_end < now())) THEN 'expired_but_active'::text - WHEN ((s.status = 'canceled'::text) AND (s.current_period_end > now())) THEN 'canceled_but_still_in_period'::text - ELSE 'ok'::text - END AS health_status, - CASE - WHEN (s.tenant_id IS NOT NULL) THEN 'clinic'::text - ELSE 'therapist'::text - END AS owner_type, - COALESCE(s.tenant_id, s.user_id) AS owner_ref - FROM (public.subscriptions s - LEFT JOIN public.plans p ON ((p.id = s.plan_id))); - - -ALTER VIEW public.v_subscription_health OWNER TO supabase_admin; - --- --- Name: v_subscription_health_v2; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_health_v2 AS - SELECT s.id AS subscription_id, - s.user_id AS owner_id, - CASE - WHEN (s.tenant_id IS NOT NULL) THEN 'clinic'::text - ELSE 'therapist'::text - END AS owner_type, - COALESCE(s.tenant_id, s.user_id) AS owner_ref, - s.status, - s.plan_id, - p.key AS plan_key, - s.current_period_start, - s.current_period_end, - s.updated_at, - CASE - WHEN (s.plan_id IS NULL) THEN 'missing_plan'::text - WHEN (p.id IS NULL) THEN 'invalid_plan'::text - WHEN ((s.status = 'active'::text) AND (s.current_period_end IS NOT NULL) AND (s.current_period_end < now())) THEN 'expired_but_active'::text - WHEN ((s.status = 'canceled'::text) AND (s.current_period_end > now())) THEN 'canceled_but_still_in_period'::text - ELSE 'ok'::text - END AS health_status - FROM (public.subscriptions s - LEFT JOIN public.plans p ON ((p.id = s.plan_id))); - - -ALTER VIEW public.v_subscription_health_v2 OWNER TO supabase_admin; - --- --- Name: v_tag_patient_counts; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tag_patient_counts AS - SELECT t.id, - t.owner_id, - t.nome, - t.cor, - t.is_padrao, - t.created_at, - t.updated_at, - (COALESCE(count(ppt.patient_id), (0)::bigint))::integer AS pacientes_count, - (COALESCE(count(ppt.patient_id), (0)::bigint))::integer AS patient_count - FROM (public.patient_tags t - LEFT JOIN public.patient_patient_tag ppt ON (((ppt.tag_id = t.id) AND (ppt.owner_id = t.owner_id)))) - GROUP BY t.id, t.owner_id, t.nome, t.cor, t.is_padrao, t.created_at, t.updated_at; - - -ALTER VIEW public.v_tag_patient_counts OWNER TO supabase_admin; - --- --- Name: v_tenant_active_subscription; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_active_subscription AS - SELECT DISTINCT ON (tenant_id) tenant_id, - plan_id, - plan_key, - "interval", - status, - current_period_start, - current_period_end, - created_at - FROM public.subscriptions s - WHERE ((tenant_id IS NOT NULL) AND (status = 'active'::text) AND ((current_period_end IS NULL) OR (current_period_end > now()))) - ORDER BY tenant_id, created_at DESC; - - -ALTER VIEW public.v_tenant_active_subscription OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements AS - SELECT a.tenant_id, - f.key AS feature_key, - true AS allowed - FROM ((public.v_tenant_active_subscription a - JOIN public.plan_features pf ON (((pf.plan_id = a.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))); - - -ALTER VIEW public.v_tenant_entitlements OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements_full; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements_full AS - SELECT a.tenant_id, - f.key AS feature_key, - (pf.enabled = true) AS allowed, - pf.limits, - a.plan_id, - p.key AS plan_key - FROM (((public.v_tenant_active_subscription a - JOIN public.plan_features pf ON ((pf.plan_id = a.plan_id))) - JOIN public.features f ON ((f.id = pf.feature_id))) - JOIN public.plans p ON ((p.id = a.plan_id))); - - -ALTER VIEW public.v_tenant_entitlements_full OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements_json; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements_json AS - SELECT tenant_id, - max(plan_key) AS plan_key, - jsonb_object_agg(feature_key, jsonb_build_object('allowed', allowed, 'limits', COALESCE(limits, '{}'::jsonb)) ORDER BY feature_key) AS entitlements - FROM public.v_tenant_entitlements_full - GROUP BY tenant_id; - - -ALTER VIEW public.v_tenant_entitlements_json OWNER TO supabase_admin; - --- --- Name: v_tenant_feature_exceptions; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_feature_exceptions AS - SELECT tf.tenant_id, - a.plan_key, - tf.feature_key, - 'commercial_exception'::text AS exception_type - FROM ((public.tenant_features tf - JOIN public.v_tenant_active_subscription a ON ((a.tenant_id = tf.tenant_id))) - LEFT JOIN public.v_tenant_entitlements_full v ON (((v.tenant_id = tf.tenant_id) AND (v.feature_key = tf.feature_key)))) - WHERE ((tf.enabled = true) AND (COALESCE(v.allowed, false) = false)); - - -ALTER VIEW public.v_tenant_feature_exceptions OWNER TO supabase_admin; - --- --- Name: v_tenant_feature_mismatch; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_feature_mismatch AS - WITH plan_allowed AS ( - SELECT v.tenant_id, - v.feature_key, - v.allowed - FROM public.v_tenant_entitlements_full v - ), overrides AS ( - SELECT tf.tenant_id, - tf.feature_key, - tf.enabled - FROM public.tenant_features tf - ) - SELECT o.tenant_id, - o.feature_key, - CASE - WHEN ((o.enabled = true) AND (COALESCE(p.allowed, false) = false)) THEN 'unexpected_override'::text - ELSE NULL::text - END AS mismatch_type - FROM (overrides o - LEFT JOIN plan_allowed p ON (((p.tenant_id = o.tenant_id) AND (p.feature_key = o.feature_key)))) - WHERE ((o.enabled = true) AND (COALESCE(p.allowed, false) = false)); - - -ALTER VIEW public.v_tenant_feature_mismatch OWNER TO supabase_admin; - --- --- Name: v_tenant_members_with_profiles; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_members_with_profiles AS - SELECT tm.id AS tenant_member_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at, - p.full_name, - au.email - FROM ((public.tenant_members tm - LEFT JOIN public.profiles p ON ((p.id = tm.user_id))) - LEFT JOIN auth.users au ON ((au.id = tm.user_id))); - - -ALTER VIEW public.v_tenant_members_with_profiles OWNER TO supabase_admin; - --- --- Name: v_tenant_people; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_people AS - SELECT 'member'::text AS type, - m.tenant_id, - m.user_id, - u.email, - m.role, - m.status, - NULL::uuid AS invite_token, - NULL::timestamp with time zone AS expires_at - FROM (public.tenant_members m - JOIN auth.users u ON ((u.id = m.user_id))) -UNION ALL - SELECT 'invite'::text AS type, - i.tenant_id, - NULL::uuid AS user_id, - i.email, - i.role, - 'invited'::text AS status, - i.token AS invite_token, - i.expires_at - FROM public.tenant_invites i - WHERE ((i.accepted_at IS NULL) AND (i.revoked_at IS NULL)); - - -ALTER VIEW public.v_tenant_people OWNER TO supabase_admin; - --- --- Name: v_tenant_staff; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_staff AS - SELECT ('m_'::text || (tm.id)::text) AS row_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at, - p.full_name, - au.email, - NULL::uuid AS invite_token - FROM ((public.tenant_members tm - LEFT JOIN public.profiles p ON ((p.id = tm.user_id))) - LEFT JOIN auth.users au ON ((au.id = tm.user_id))) -UNION ALL - SELECT ('i_'::text || (ti.id)::text) AS row_id, - ti.tenant_id, - NULL::uuid AS user_id, - ti.role, - 'invited'::text AS status, - ti.created_at, - NULL::text AS full_name, - ti.email, - ti.token AS invite_token - FROM public.tenant_invites ti - WHERE ((ti.accepted_at IS NULL) AND (ti.revoked_at IS NULL) AND (ti.expires_at > now())); - - -ALTER VIEW public.v_tenant_staff OWNER TO supabase_admin; - --- --- Name: v_user_active_subscription; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_user_active_subscription AS - SELECT DISTINCT ON (user_id) user_id, - plan_id, - plan_key, - "interval", - status, - current_period_start, - current_period_end, - created_at - FROM public.subscriptions s - WHERE ((tenant_id IS NULL) AND (user_id IS NOT NULL) AND (status = 'active'::text) AND ((current_period_end IS NULL) OR (current_period_end > now()))) - ORDER BY user_id, created_at DESC; - - -ALTER VIEW public.v_user_active_subscription OWNER TO supabase_admin; - --- --- Name: v_user_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_user_entitlements AS - SELECT a.user_id, - f.key AS feature_key, - true AS allowed - FROM ((public.v_user_active_subscription a - JOIN public.plan_features pf ON (((pf.plan_id = a.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))); - - -ALTER VIEW public.v_user_entitlements OWNER TO supabase_admin; - --- --- Name: messages; Type: TABLE; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE TABLE realtime.messages ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -) -PARTITION BY RANGE (inserted_at); - - -ALTER TABLE realtime.messages OWNER TO supabase_realtime_admin; - --- --- Name: messages_2026_03_11; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_11 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_11 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_12; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_12 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_12 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_13; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_13 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_13 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_14; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_14 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_14 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_15; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_15 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_15 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_16; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_16 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_16 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_17; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_17 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_17 OWNER TO supabase_admin; - --- --- Name: schema_migrations; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.schema_migrations ( - version bigint NOT NULL, - inserted_at timestamp(0) without time zone -); - - -ALTER TABLE realtime.schema_migrations OWNER TO supabase_admin; - --- --- Name: subscription; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.subscription ( - id bigint NOT NULL, - subscription_id uuid NOT NULL, - entity regclass NOT NULL, - filters realtime.user_defined_filter[] DEFAULT '{}'::realtime.user_defined_filter[] NOT NULL, - claims jsonb NOT NULL, - claims_role regrole GENERATED ALWAYS AS (realtime.to_regrole((claims ->> 'role'::text))) STORED NOT NULL, - created_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL -); - - -ALTER TABLE realtime.subscription OWNER TO supabase_admin; - --- --- Name: subscription_id_seq; Type: SEQUENCE; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE realtime.subscription ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( - SEQUENCE NAME realtime.subscription_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: buckets; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets ( - id text NOT NULL, - name text NOT NULL, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - public boolean DEFAULT false, - avif_autodetection boolean DEFAULT false, - file_size_limit bigint, - allowed_mime_types text[], - owner_id text, - type storage.buckettype DEFAULT 'STANDARD'::storage.buckettype NOT NULL -); - - -ALTER TABLE storage.buckets OWNER TO supabase_storage_admin; - --- --- Name: COLUMN buckets.owner; Type: COMMENT; Schema: storage; Owner: supabase_storage_admin --- - -COMMENT ON COLUMN storage.buckets.owner IS 'Field is deprecated, use owner_id instead'; - - --- --- Name: buckets_analytics; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets_analytics ( - name text NOT NULL, - type storage.buckettype DEFAULT 'ANALYTICS'::storage.buckettype NOT NULL, - format text DEFAULT 'ICEBERG'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL, - deleted_at timestamp with time zone -); - - -ALTER TABLE storage.buckets_analytics OWNER TO supabase_storage_admin; - --- --- Name: buckets_vectors; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets_vectors ( - id text NOT NULL, - type storage.buckettype DEFAULT 'VECTOR'::storage.buckettype NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.buckets_vectors OWNER TO supabase_storage_admin; - --- --- Name: iceberg_namespaces; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.iceberg_namespaces ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - bucket_name text NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - metadata jsonb DEFAULT '{}'::jsonb NOT NULL, - catalog_id uuid NOT NULL -); - - -ALTER TABLE storage.iceberg_namespaces OWNER TO supabase_storage_admin; - --- --- Name: iceberg_tables; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.iceberg_tables ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - namespace_id uuid NOT NULL, - bucket_name text NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - location text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - remote_table_id text, - shard_key text, - shard_id text, - catalog_id uuid NOT NULL -); - - -ALTER TABLE storage.iceberg_tables OWNER TO supabase_storage_admin; - --- --- Name: migrations; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.migrations ( - id integer NOT NULL, - name character varying(100) NOT NULL, - hash character varying(40) NOT NULL, - executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP -); - - -ALTER TABLE storage.migrations OWNER TO supabase_storage_admin; - --- --- Name: objects; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.objects ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - bucket_id text, - name text, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - last_accessed_at timestamp with time zone DEFAULT now(), - metadata jsonb, - path_tokens text[] GENERATED ALWAYS AS (string_to_array(name, '/'::text)) STORED, - version text, - owner_id text, - user_metadata jsonb -); - - -ALTER TABLE storage.objects OWNER TO supabase_storage_admin; - --- --- Name: COLUMN objects.owner; Type: COMMENT; Schema: storage; Owner: supabase_storage_admin --- - -COMMENT ON COLUMN storage.objects.owner IS 'Field is deprecated, use owner_id instead'; - - --- --- Name: s3_multipart_uploads; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.s3_multipart_uploads ( - id text NOT NULL, - in_progress_size bigint DEFAULT 0 NOT NULL, - upload_signature text NOT NULL, - bucket_id text NOT NULL, - key text NOT NULL COLLATE pg_catalog."C", - version text NOT NULL, - owner_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - user_metadata jsonb -); - - -ALTER TABLE storage.s3_multipart_uploads OWNER TO supabase_storage_admin; - --- --- Name: s3_multipart_uploads_parts; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.s3_multipart_uploads_parts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - upload_id text NOT NULL, - size bigint DEFAULT 0 NOT NULL, - part_number integer NOT NULL, - bucket_id text NOT NULL, - key text NOT NULL COLLATE pg_catalog."C", - etag text NOT NULL, - owner_id text, - version text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.s3_multipart_uploads_parts OWNER TO supabase_storage_admin; - --- --- Name: vector_indexes; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.vector_indexes ( - id text DEFAULT gen_random_uuid() NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - bucket_id text NOT NULL, - data_type text NOT NULL, - dimension integer NOT NULL, - distance_metric text NOT NULL, - metadata_configuration jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.vector_indexes OWNER TO supabase_storage_admin; - --- --- Name: hooks; Type: TABLE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE TABLE supabase_functions.hooks ( - id bigint NOT NULL, - hook_table_id integer NOT NULL, - hook_name text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - request_id bigint -); - - -ALTER TABLE supabase_functions.hooks OWNER TO supabase_functions_admin; - --- --- Name: TABLE hooks; Type: COMMENT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -COMMENT ON TABLE supabase_functions.hooks IS 'Supabase Functions Hooks: Audit trail for triggered hooks.'; - - --- --- Name: hooks_id_seq; Type: SEQUENCE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE SEQUENCE supabase_functions.hooks_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE supabase_functions.hooks_id_seq OWNER TO supabase_functions_admin; - --- --- Name: hooks_id_seq; Type: SEQUENCE OWNED BY; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER SEQUENCE supabase_functions.hooks_id_seq OWNED BY supabase_functions.hooks.id; - - --- --- Name: migrations; Type: TABLE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE TABLE supabase_functions.migrations ( - version text NOT NULL, - inserted_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE supabase_functions.migrations OWNER TO supabase_functions_admin; - --- --- Name: messages_2026_03_11; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_11 FOR VALUES FROM ('2026-03-11 00:00:00') TO ('2026-03-12 00:00:00'); - - --- --- Name: messages_2026_03_12; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_12 FOR VALUES FROM ('2026-03-12 00:00:00') TO ('2026-03-13 00:00:00'); - - --- --- Name: messages_2026_03_13; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_13 FOR VALUES FROM ('2026-03-13 00:00:00') TO ('2026-03-14 00:00:00'); - - --- --- Name: messages_2026_03_14; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_14 FOR VALUES FROM ('2026-03-14 00:00:00') TO ('2026-03-15 00:00:00'); - - --- --- Name: messages_2026_03_15; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_15 FOR VALUES FROM ('2026-03-15 00:00:00') TO ('2026-03-16 00:00:00'); - - --- --- Name: messages_2026_03_16; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_16 FOR VALUES FROM ('2026-03-16 00:00:00') TO ('2026-03-17 00:00:00'); - - --- --- Name: messages_2026_03_17; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_17 FOR VALUES FROM ('2026-03-17 00:00:00') TO ('2026-03-18 00:00:00'); - - --- --- Name: refresh_tokens id; Type: DEFAULT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens ALTER COLUMN id SET DEFAULT nextval('auth.refresh_tokens_id_seq'::regclass); - - --- --- Name: agenda_online_slots id; Type: DEFAULT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots ALTER COLUMN id SET DEFAULT nextval('public.agenda_online_slots_id_seq'::regclass); - - --- --- Name: hooks id; Type: DEFAULT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.hooks ALTER COLUMN id SET DEFAULT nextval('supabase_functions.hooks_id_seq'::regclass); - - --- --- Name: extensions extensions_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.extensions - ADD CONSTRAINT extensions_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.tenants - ADD CONSTRAINT tenants_pkey PRIMARY KEY (id); - - --- --- Name: mfa_amr_claims amr_id_pk; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT amr_id_pk PRIMARY KEY (id); - - --- --- Name: audit_log_entries audit_log_entries_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.audit_log_entries - ADD CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id); - - --- --- Name: flow_state flow_state_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.flow_state - ADD CONSTRAINT flow_state_pkey PRIMARY KEY (id); - - --- --- Name: identities identities_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_pkey PRIMARY KEY (id); - - --- --- Name: identities identities_provider_id_provider_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_provider_id_provider_unique UNIQUE (provider_id, provider); - - --- --- Name: instances instances_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.instances - ADD CONSTRAINT instances_pkey PRIMARY KEY (id); - - --- --- Name: mfa_amr_claims mfa_amr_claims_session_id_authentication_method_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT mfa_amr_claims_session_id_authentication_method_pkey UNIQUE (session_id, authentication_method); - - --- --- Name: mfa_challenges mfa_challenges_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_challenges - ADD CONSTRAINT mfa_challenges_pkey PRIMARY KEY (id); - - --- --- Name: mfa_factors mfa_factors_last_challenged_at_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_last_challenged_at_key UNIQUE (last_challenged_at); - - --- --- Name: mfa_factors mfa_factors_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_pkey PRIMARY KEY (id); - - --- --- Name: oauth_authorizations oauth_authorizations_authorization_code_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_authorization_code_key UNIQUE (authorization_code); - - --- --- Name: oauth_authorizations oauth_authorizations_authorization_id_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_authorization_id_key UNIQUE (authorization_id); - - --- --- Name: oauth_authorizations oauth_authorizations_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_pkey PRIMARY KEY (id); - - --- --- Name: oauth_client_states oauth_client_states_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_client_states - ADD CONSTRAINT oauth_client_states_pkey PRIMARY KEY (id); - - --- --- Name: oauth_clients oauth_clients_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_clients - ADD CONSTRAINT oauth_clients_pkey PRIMARY KEY (id); - - --- --- Name: oauth_consents oauth_consents_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_pkey PRIMARY KEY (id); - - --- --- Name: oauth_consents oauth_consents_user_client_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_user_client_unique UNIQUE (user_id, client_id); - - --- --- Name: one_time_tokens one_time_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.one_time_tokens - ADD CONSTRAINT one_time_tokens_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_token_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_token_unique UNIQUE (token); - - --- --- Name: saml_providers saml_providers_entity_id_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_entity_id_key UNIQUE (entity_id); - - --- --- Name: saml_providers saml_providers_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_pkey PRIMARY KEY (id); - - --- --- Name: saml_relay_states saml_relay_states_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_pkey PRIMARY KEY (id); - - --- --- Name: sso_domains sso_domains_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_domains - ADD CONSTRAINT sso_domains_pkey PRIMARY KEY (id); - - --- --- Name: sso_providers sso_providers_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_providers - ADD CONSTRAINT sso_providers_pkey PRIMARY KEY (id); - - --- --- Name: users users_phone_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_phone_key UNIQUE (phone); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: agenda_bloqueios agenda_bloqueios_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_pkey PRIMARY KEY (id); - - --- --- Name: agenda_configuracoes agenda_configuracoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_configuracoes - ADD CONSTRAINT agenda_configuracoes_pkey PRIMARY KEY (owner_id); - - --- --- Name: agenda_eventos agenda_eventos_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_pkey PRIMARY KEY (id); - - --- --- Name: agenda_eventos agenda_eventos_sem_sobreposicao; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_sem_sobreposicao EXCLUDE USING gist (owner_id WITH =, tstzrange(inicio_em, fim_em, '[)'::text) WITH &&); - - --- --- Name: agenda_excecoes agenda_excecoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_excecoes - ADD CONSTRAINT agenda_excecoes_pkey PRIMARY KEY (id); - - --- --- Name: agenda_online_slots agenda_online_slots_owner_id_weekday_time_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_owner_id_weekday_time_key UNIQUE (owner_id, weekday, "time"); - - --- --- Name: agenda_online_slots agenda_online_slots_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_pkey PRIMARY KEY (id); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_pkey PRIMARY KEY (id); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_unique UNIQUE (owner_id, dia_semana, hora_inicio, hora_fim, modalidade); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key UNIQUE (owner_id, dia_semana, hora_inicio); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_semanais_pkey PRIMARY KEY (id); - - --- --- Name: agenda_slots_regras agenda_slots_regras_owner_id_dia_semana_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_owner_id_dia_semana_key UNIQUE (owner_id, dia_semana); - - --- --- Name: agenda_slots_regras agenda_slots_regras_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_pkey PRIMARY KEY (id); - - --- --- Name: agendador_configuracoes agendador_configuracoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_pkey PRIMARY KEY (owner_id); - - --- --- Name: agendador_solicitacoes agendador_solicitacoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_solicitacoes_pkey PRIMARY KEY (id); - - --- --- Name: billing_contracts billing_contracts_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.billing_contracts - ADD CONSTRAINT billing_contracts_pkey PRIMARY KEY (id); - - --- --- Name: commitment_services commitment_services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_services - ADD CONSTRAINT commitment_services_pkey PRIMARY KEY (id); - - --- --- Name: commitment_time_logs commitment_time_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitment_fields determined_commitment_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitments determined_commitments_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitments determined_commitments_tenant_native_key_uq; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_tenant_native_key_uq UNIQUE (tenant_id, native_key); - - --- --- Name: dev_user_credentials dev_user_credentials_email_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.dev_user_credentials - ADD CONSTRAINT dev_user_credentials_email_key UNIQUE (email); - - --- --- Name: dev_user_credentials dev_user_credentials_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.dev_user_credentials - ADD CONSTRAINT dev_user_credentials_pkey PRIMARY KEY (id); - - --- --- Name: entitlements_invalidation entitlements_invalidation_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.entitlements_invalidation - ADD CONSTRAINT entitlements_invalidation_pkey PRIMARY KEY (owner_id); - - --- --- Name: features features_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.features - ADD CONSTRAINT features_key_key UNIQUE (key); - - --- --- Name: features features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.features - ADD CONSTRAINT features_pkey PRIMARY KEY (id); - - --- --- Name: feriados feriados_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_pkey PRIMARY KEY (id); - - --- --- Name: feriados feriados_tenant_id_data_nome_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_tenant_id_data_nome_key UNIQUE (tenant_id, data, nome); - - --- --- Name: financial_exceptions financial_exceptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.financial_exceptions - ADD CONSTRAINT financial_exceptions_pkey PRIMARY KEY (id); - - --- --- Name: insurance_plan_services insurance_plan_services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plan_services - ADD CONSTRAINT insurance_plan_services_pkey PRIMARY KEY (id); - - --- --- Name: insurance_plans insurance_plans_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plans - ADD CONSTRAINT insurance_plans_pkey PRIMARY KEY (id); - - --- --- Name: module_features module_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_pkey PRIMARY KEY (module_id, feature_id); - - --- --- Name: modules modules_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.modules - ADD CONSTRAINT modules_key_key UNIQUE (key); - - --- --- Name: modules modules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.modules - ADD CONSTRAINT modules_pkey PRIMARY KEY (id); - - --- --- Name: owner_users owner_users_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.owner_users - ADD CONSTRAINT owner_users_pkey PRIMARY KEY (owner_id, user_id); - - --- --- Name: patient_discounts patient_discounts_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_discounts - ADD CONSTRAINT patient_discounts_pkey PRIMARY KEY (id); - - --- --- Name: patient_group_patient patient_group_patient_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_pkey PRIMARY KEY (patient_group_id, patient_id); - - --- --- Name: patient_groups patient_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_groups - ADD CONSTRAINT patient_groups_pkey PRIMARY KEY (id); - - --- --- Name: patient_intake_requests patient_intake_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_intake_requests - ADD CONSTRAINT patient_intake_requests_pkey PRIMARY KEY (id); - - --- --- Name: patient_invites patient_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_pkey PRIMARY KEY (id); - - --- --- Name: patient_invites patient_invites_token_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_token_key UNIQUE (token); - - --- --- Name: patient_patient_tag patient_patient_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_pkey PRIMARY KEY (patient_id, tag_id); - - --- --- Name: patient_tags patient_tags_owner_name_uniq; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_owner_name_uniq UNIQUE (owner_id, nome); - - --- --- Name: patient_tags patient_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_pkey PRIMARY KEY (id); - - --- --- Name: patients patients_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_pkey PRIMARY KEY (id); - - --- --- Name: payment_settings payment_settings_owner_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_owner_id_key UNIQUE (owner_id); - - --- --- Name: payment_settings payment_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_pkey PRIMARY KEY (id); - - --- --- Name: plan_features plan_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_pkey PRIMARY KEY (plan_id, feature_id); - - --- --- Name: plan_prices plan_prices_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_prices - ADD CONSTRAINT plan_prices_pkey PRIMARY KEY (id); - - --- --- Name: plan_public_bullets plan_public_bullets_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public_bullets - ADD CONSTRAINT plan_public_bullets_pkey PRIMARY KEY (id); - - --- --- Name: plan_public plan_public_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public - ADD CONSTRAINT plan_public_pkey PRIMARY KEY (plan_id); - - --- --- Name: plans plans_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plans - ADD CONSTRAINT plans_key_key UNIQUE (key); - - --- --- Name: plans plans_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plans - ADD CONSTRAINT plans_pkey PRIMARY KEY (id); - - --- --- Name: professional_pricing professional_pricing_owner_commitment_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_owner_commitment_key UNIQUE (owner_id, determined_commitment_id); - - --- --- Name: professional_pricing professional_pricing_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_pkey PRIMARY KEY (id); - - --- --- Name: profiles profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.profiles - ADD CONSTRAINT profiles_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_exceptions recurrence_exceptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_exceptions recurrence_exceptions_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_unique UNIQUE (recurrence_id, original_date); - - --- --- Name: recurrence_rule_services recurrence_rule_services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rule_services - ADD CONSTRAINT recurrence_rule_services_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_rules recurrence_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_pkey PRIMARY KEY (id); - - --- --- Name: saas_admins saas_admins_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_admins - ADD CONSTRAINT saas_admins_pkey PRIMARY KEY (user_id); - - --- --- Name: saas_doc_votos saas_doc_votos_doc_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_doc_id_user_id_key UNIQUE (doc_id, user_id); - - --- --- Name: saas_doc_votos saas_doc_votos_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_pkey PRIMARY KEY (id); - - --- --- Name: saas_docs saas_docs_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_docs - ADD CONSTRAINT saas_docs_pkey PRIMARY KEY (id); - - --- --- Name: saas_faq_itens saas_faq_itens_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq_itens - ADD CONSTRAINT saas_faq_itens_pkey PRIMARY KEY (id); - - --- --- Name: saas_faq saas_faq_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq - ADD CONSTRAINT saas_faq_pkey PRIMARY KEY (id); - - --- --- Name: services services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.services - ADD CONSTRAINT services_pkey PRIMARY KEY (id); - - --- --- Name: subscription_events subscription_events_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_events - ADD CONSTRAINT subscription_events_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_personal subscription_intents_personal_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT subscription_intents_personal_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_legacy subscription_intents_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_legacy - ADD CONSTRAINT subscription_intents_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_tenant subscription_intents_tenant_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT subscription_intents_tenant_pkey PRIMARY KEY (id); - - --- --- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id); - - --- --- Name: support_sessions support_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_pkey PRIMARY KEY (id); - - --- --- Name: support_sessions support_sessions_token_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_token_unique UNIQUE (token); - - --- --- Name: tenant_feature_exceptions_log tenant_feature_exceptions_log_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_feature_exceptions_log - ADD CONSTRAINT tenant_feature_exceptions_log_pkey PRIMARY KEY (id); - - --- --- Name: tenant_features tenant_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_features - ADD CONSTRAINT tenant_features_pkey PRIMARY KEY (tenant_id, feature_key); - - --- --- Name: tenant_invites tenant_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_pkey PRIMARY KEY (id); - - --- --- Name: tenant_members tenant_members_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_pkey PRIMARY KEY (id); - - --- --- Name: tenant_members tenant_members_tenant_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_tenant_id_user_id_key UNIQUE (tenant_id, user_id); - - --- --- Name: tenant_modules tenant_modules_owner_id_module_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_owner_id_module_id_key UNIQUE (owner_id, module_id); - - --- --- Name: tenant_modules tenant_modules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_pkey PRIMARY KEY (id); - - --- --- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenants - ADD CONSTRAINT tenants_pkey PRIMARY KEY (id); - - --- --- Name: user_settings user_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.user_settings - ADD CONSTRAINT user_settings_pkey PRIMARY KEY (user_id); - - --- --- Name: messages messages_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER TABLE ONLY realtime.messages - ADD CONSTRAINT messages_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_11 messages_2026_03_11_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_11 - ADD CONSTRAINT messages_2026_03_11_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_12 messages_2026_03_12_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_12 - ADD CONSTRAINT messages_2026_03_12_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_13 messages_2026_03_13_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_13 - ADD CONSTRAINT messages_2026_03_13_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_14 messages_2026_03_14_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_14 - ADD CONSTRAINT messages_2026_03_14_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_15 messages_2026_03_15_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_15 - ADD CONSTRAINT messages_2026_03_15_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_16 messages_2026_03_16_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_16 - ADD CONSTRAINT messages_2026_03_16_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_17 messages_2026_03_17_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_17 - ADD CONSTRAINT messages_2026_03_17_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: subscription pk_subscription; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.subscription - ADD CONSTRAINT pk_subscription PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: buckets_analytics buckets_analytics_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets_analytics - ADD CONSTRAINT buckets_analytics_pkey PRIMARY KEY (id); - - --- --- Name: buckets buckets_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets - ADD CONSTRAINT buckets_pkey PRIMARY KEY (id); - - --- --- Name: buckets_vectors buckets_vectors_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets_vectors - ADD CONSTRAINT buckets_vectors_pkey PRIMARY KEY (id); - - --- --- Name: iceberg_namespaces iceberg_namespaces_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_namespaces - ADD CONSTRAINT iceberg_namespaces_pkey PRIMARY KEY (id); - - --- --- Name: iceberg_tables iceberg_tables_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_name_key; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_name_key UNIQUE (name); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); - - --- --- Name: objects objects_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT objects_pkey PRIMARY KEY (id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_pkey PRIMARY KEY (id); - - --- --- Name: s3_multipart_uploads s3_multipart_uploads_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads - ADD CONSTRAINT s3_multipart_uploads_pkey PRIMARY KEY (id); - - --- --- Name: vector_indexes vector_indexes_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.vector_indexes - ADD CONSTRAINT vector_indexes_pkey PRIMARY KEY (id); - - --- --- Name: hooks hooks_pkey; Type: CONSTRAINT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.hooks - ADD CONSTRAINT hooks_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (version); - - --- --- Name: extensions_tenant_external_id_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE INDEX extensions_tenant_external_id_index ON _realtime.extensions USING btree (tenant_external_id); - - --- --- Name: extensions_tenant_external_id_type_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX extensions_tenant_external_id_type_index ON _realtime.extensions USING btree (tenant_external_id, type); - - --- --- Name: tenants_external_id_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX tenants_external_id_index ON _realtime.tenants USING btree (external_id); - - --- --- Name: audit_logs_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id); - - --- --- Name: confirmation_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX confirmation_token_idx ON auth.users USING btree (confirmation_token) WHERE ((confirmation_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: email_change_token_current_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX email_change_token_current_idx ON auth.users USING btree (email_change_token_current) WHERE ((email_change_token_current)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: email_change_token_new_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX email_change_token_new_idx ON auth.users USING btree (email_change_token_new) WHERE ((email_change_token_new)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: factor_id_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX factor_id_created_at_idx ON auth.mfa_factors USING btree (user_id, created_at); - - --- --- Name: flow_state_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX flow_state_created_at_idx ON auth.flow_state USING btree (created_at DESC); - - --- --- Name: identities_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX identities_email_idx ON auth.identities USING btree (email text_pattern_ops); - - --- --- Name: INDEX identities_email_idx; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON INDEX auth.identities_email_idx IS 'Auth: Ensures indexed queries on the email column'; - - --- --- Name: identities_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX identities_user_id_idx ON auth.identities USING btree (user_id); - - --- --- Name: idx_auth_code; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_auth_code ON auth.flow_state USING btree (auth_code); - - --- --- Name: idx_oauth_client_states_created_at; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_oauth_client_states_created_at ON auth.oauth_client_states USING btree (created_at); - - --- --- Name: idx_user_id_auth_method; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_user_id_auth_method ON auth.flow_state USING btree (user_id, authentication_method); - - --- --- Name: mfa_challenge_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX mfa_challenge_created_at_idx ON auth.mfa_challenges USING btree (created_at DESC); - - --- --- Name: mfa_factors_user_friendly_name_unique; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX mfa_factors_user_friendly_name_unique ON auth.mfa_factors USING btree (friendly_name, user_id) WHERE (TRIM(BOTH FROM friendly_name) <> ''::text); - - --- --- Name: mfa_factors_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX mfa_factors_user_id_idx ON auth.mfa_factors USING btree (user_id); - - --- --- Name: oauth_auth_pending_exp_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_auth_pending_exp_idx ON auth.oauth_authorizations USING btree (expires_at) WHERE (status = 'pending'::auth.oauth_authorization_status); - - --- --- Name: oauth_clients_deleted_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_clients_deleted_at_idx ON auth.oauth_clients USING btree (deleted_at); - - --- --- Name: oauth_consents_active_client_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_active_client_idx ON auth.oauth_consents USING btree (client_id) WHERE (revoked_at IS NULL); - - --- --- Name: oauth_consents_active_user_client_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_active_user_client_idx ON auth.oauth_consents USING btree (user_id, client_id) WHERE (revoked_at IS NULL); - - --- --- Name: oauth_consents_user_order_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_user_order_idx ON auth.oauth_consents USING btree (user_id, granted_at DESC); - - --- --- Name: one_time_tokens_relates_to_hash_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX one_time_tokens_relates_to_hash_idx ON auth.one_time_tokens USING hash (relates_to); - - --- --- Name: one_time_tokens_token_hash_hash_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX one_time_tokens_token_hash_hash_idx ON auth.one_time_tokens USING hash (token_hash); - - --- --- Name: one_time_tokens_user_id_token_type_key; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX one_time_tokens_user_id_token_type_key ON auth.one_time_tokens USING btree (user_id, token_type); - - --- --- Name: reauthentication_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX reauthentication_token_idx ON auth.users USING btree (reauthentication_token) WHERE ((reauthentication_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: recovery_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX recovery_token_idx ON auth.users USING btree (recovery_token) WHERE ((recovery_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: refresh_tokens_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id); - - --- --- Name: refresh_tokens_instance_id_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id); - - --- --- Name: refresh_tokens_parent_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_parent_idx ON auth.refresh_tokens USING btree (parent); - - --- --- Name: refresh_tokens_session_id_revoked_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_session_id_revoked_idx ON auth.refresh_tokens USING btree (session_id, revoked); - - --- --- Name: refresh_tokens_updated_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_updated_at_idx ON auth.refresh_tokens USING btree (updated_at DESC); - - --- --- Name: saml_providers_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_providers_sso_provider_id_idx ON auth.saml_providers USING btree (sso_provider_id); - - --- --- Name: saml_relay_states_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_created_at_idx ON auth.saml_relay_states USING btree (created_at DESC); - - --- --- Name: saml_relay_states_for_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_for_email_idx ON auth.saml_relay_states USING btree (for_email); - - --- --- Name: saml_relay_states_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_sso_provider_id_idx ON auth.saml_relay_states USING btree (sso_provider_id); - - --- --- Name: sessions_not_after_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_not_after_idx ON auth.sessions USING btree (not_after DESC); - - --- --- Name: sessions_oauth_client_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_oauth_client_id_idx ON auth.sessions USING btree (oauth_client_id); - - --- --- Name: sessions_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_user_id_idx ON auth.sessions USING btree (user_id); - - --- --- Name: sso_domains_domain_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX sso_domains_domain_idx ON auth.sso_domains USING btree (lower(domain)); - - --- --- Name: sso_domains_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sso_domains_sso_provider_id_idx ON auth.sso_domains USING btree (sso_provider_id); - - --- --- Name: sso_providers_resource_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX sso_providers_resource_id_idx ON auth.sso_providers USING btree (lower(resource_id)); - - --- --- Name: sso_providers_resource_id_pattern_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sso_providers_resource_id_pattern_idx ON auth.sso_providers USING btree (resource_id text_pattern_ops); - - --- --- Name: unique_phone_factor_per_user; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX unique_phone_factor_per_user ON auth.mfa_factors USING btree (user_id, phone); - - --- --- Name: user_id_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX user_id_created_at_idx ON auth.sessions USING btree (user_id, created_at); - - --- --- Name: users_email_partial_key; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX users_email_partial_key ON auth.users USING btree (email) WHERE (is_sso_user = false); - - --- --- Name: INDEX users_email_partial_key; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON INDEX auth.users_email_partial_key IS 'Auth: A partial unique index that applies only when is_sso_user is false'; - - --- --- Name: users_instance_id_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, lower((email)::text)); - - --- --- Name: users_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id); - - --- --- Name: users_is_anonymous_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_is_anonymous_idx ON auth.users USING btree (is_anonymous); - - --- --- Name: agenda_bloqueios_owner_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_owner_data_idx ON public.agenda_bloqueios USING btree (owner_id, data_inicio, data_fim); - - --- --- Name: agenda_bloqueios_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_owner_id_idx ON public.agenda_bloqueios USING btree (owner_id); - - --- --- Name: agenda_bloqueios_recorrente_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_recorrente_idx ON public.agenda_bloqueios USING btree (owner_id, dia_semana) WHERE (recorrente = true); - - --- --- Name: agenda_bloqueios_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_tenant_id_idx ON public.agenda_bloqueios USING btree (tenant_id); - - --- --- Name: agenda_configuracoes_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_configuracoes_tenant_idx ON public.agenda_configuracoes USING btree (tenant_id); - - --- --- Name: agenda_configuracoes_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_configuracoes_tenant_owner_idx ON public.agenda_configuracoes USING btree (tenant_id, owner_id); - - --- --- Name: agenda_eventos_billing_contract_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_billing_contract_idx ON public.agenda_eventos USING btree (billing_contract_id) WHERE (billing_contract_id IS NOT NULL); - - --- --- Name: agenda_eventos_insurance_plan_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_insurance_plan_idx ON public.agenda_eventos USING btree (insurance_plan_id); - - --- --- Name: agenda_eventos_owner_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_owner_inicio_idx ON public.agenda_eventos USING btree (owner_id, inicio_em); - - --- --- Name: agenda_eventos_owner_terapeuta_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_owner_terapeuta_inicio_idx ON public.agenda_eventos USING btree (owner_id, terapeuta_id, inicio_em); - - --- --- Name: agenda_eventos_recurrence_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_recurrence_idx ON public.agenda_eventos USING btree (recurrence_id) WHERE (recurrence_id IS NOT NULL); - - --- --- Name: agenda_eventos_tenant_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_tenant_inicio_idx ON public.agenda_eventos USING btree (tenant_id, inicio_em); - - --- --- Name: agenda_eventos_tenant_owner_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_tenant_owner_inicio_idx ON public.agenda_eventos USING btree (tenant_id, owner_id, inicio_em); - - --- --- Name: agenda_excecoes_owner_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_owner_data_idx ON public.agenda_excecoes USING btree (owner_id, data); - - --- --- Name: agenda_excecoes_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_tenant_idx ON public.agenda_excecoes USING btree (tenant_id); - - --- --- Name: agenda_excecoes_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_tenant_owner_idx ON public.agenda_excecoes USING btree (tenant_id, owner_id); - - --- --- Name: agenda_online_slots_owner_weekday_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_owner_weekday_idx ON public.agenda_online_slots USING btree (owner_id, weekday); - - --- --- Name: agenda_online_slots_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_tenant_idx ON public.agenda_online_slots USING btree (tenant_id); - - --- --- Name: agenda_online_slots_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_tenant_owner_idx ON public.agenda_online_slots USING btree (tenant_id, owner_id); - - --- --- Name: agenda_regras_semanais_owner_dia_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_owner_dia_idx ON public.agenda_regras_semanais USING btree (owner_id, dia_semana); - - --- --- Name: agenda_regras_semanais_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_tenant_idx ON public.agenda_regras_semanais USING btree (tenant_id); - - --- --- Name: agenda_regras_semanais_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_tenant_owner_idx ON public.agenda_regras_semanais USING btree (tenant_id, owner_id); - - --- --- Name: agenda_slots_bloqueados_semanais_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_bloqueados_semanais_tenant_idx ON public.agenda_slots_bloqueados_semanais USING btree (tenant_id); - - --- --- Name: agenda_slots_bloqueados_semanais_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_bloqueados_semanais_tenant_owner_idx ON public.agenda_slots_bloqueados_semanais USING btree (tenant_id, owner_id); - - --- --- Name: agenda_slots_regras_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_regras_tenant_idx ON public.agenda_slots_regras USING btree (tenant_id); - - --- --- Name: agenda_slots_regras_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_regras_tenant_owner_idx ON public.agenda_slots_regras USING btree (tenant_id, owner_id); - - --- --- Name: agendador_cfg_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_cfg_tenant_idx ON public.agendador_configuracoes USING btree (tenant_id); - - --- --- Name: agendador_sol_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_data_idx ON public.agendador_solicitacoes USING btree (data_solicitada, hora_solicitada); - - --- --- Name: agendador_sol_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_owner_idx ON public.agendador_solicitacoes USING btree (owner_id, status); - - --- --- Name: agendador_sol_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_tenant_idx ON public.agendador_solicitacoes USING btree (tenant_id); - - --- --- Name: billing_contracts_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX billing_contracts_owner_idx ON public.billing_contracts USING btree (owner_id); - - --- --- Name: billing_contracts_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX billing_contracts_patient_idx ON public.billing_contracts USING btree (patient_id); - - --- --- Name: billing_contracts_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX billing_contracts_tenant_idx ON public.billing_contracts USING btree (tenant_id); - - --- --- Name: commitment_services_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_services_commitment_idx ON public.commitment_services USING btree (commitment_id); - - --- --- Name: commitment_services_service_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_services_service_idx ON public.commitment_services USING btree (service_id); - - --- --- Name: commitment_time_logs_calendar_event_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_calendar_event_idx ON public.commitment_time_logs USING btree (calendar_event_id); - - --- --- Name: commitment_time_logs_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_commitment_idx ON public.commitment_time_logs USING btree (commitment_id, created_at DESC); - - --- --- Name: commitment_time_logs_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_tenant_idx ON public.commitment_time_logs USING btree (tenant_id, created_at DESC); - - --- --- Name: determined_commitment_fields_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitment_fields_commitment_idx ON public.determined_commitment_fields USING btree (commitment_id, sort_order); - - --- --- Name: determined_commitment_fields_key_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX determined_commitment_fields_key_uniq ON public.determined_commitment_fields USING btree (commitment_id, key); - - --- --- Name: determined_commitment_fields_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitment_fields_tenant_idx ON public.determined_commitment_fields USING btree (tenant_id); - - --- --- Name: determined_commitments_active_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitments_active_idx ON public.determined_commitments USING btree (tenant_id, active); - - --- --- Name: determined_commitments_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitments_tenant_idx ON public.determined_commitments USING btree (tenant_id); - - --- --- Name: determined_commitments_tenant_name_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX determined_commitments_tenant_name_uniq ON public.determined_commitments USING btree (tenant_id, lower(name)); - - --- --- Name: feriados_global_unique; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX feriados_global_unique ON public.feriados USING btree (data, nome) WHERE (tenant_id IS NULL); - - --- --- Name: financial_exceptions_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX financial_exceptions_owner_idx ON public.financial_exceptions USING btree (owner_id); - - --- --- Name: financial_exceptions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX financial_exceptions_tenant_idx ON public.financial_exceptions USING btree (tenant_id); - - --- --- Name: idx_agenda_eventos_determined_commitment_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_eventos_determined_commitment_id ON public.agenda_eventos USING btree (determined_commitment_id); - - --- --- Name: idx_agenda_excecoes_owner_data; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_excecoes_owner_data ON public.agenda_excecoes USING btree (owner_id, data); - - --- --- Name: idx_agenda_slots_regras_owner_dia; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_slots_regras_owner_dia ON public.agenda_slots_regras USING btree (owner_id, dia_semana); - - --- --- Name: idx_intakes_converted_patient_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_converted_patient_id ON public.patient_intake_requests USING btree (converted_patient_id); - - --- --- Name: idx_intakes_owner_cpf; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_cpf ON public.patient_intake_requests USING btree (owner_id, cpf); - - --- --- Name: idx_intakes_owner_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_created ON public.patient_intake_requests USING btree (owner_id, created_at DESC); - - --- --- Name: idx_intakes_owner_status_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_status_created ON public.patient_intake_requests USING btree (owner_id, status, created_at DESC); - - --- --- Name: idx_intakes_status_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_status_created ON public.patient_intake_requests USING btree (status, created_at DESC); - - --- --- Name: idx_patient_group_patient_group_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_group_patient_group_id ON public.patient_group_patient USING btree (patient_group_id); - - --- --- Name: idx_patient_groups_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_groups_owner ON public.patient_groups USING btree (owner_id); - - --- --- Name: idx_patient_groups_owner_system_nome; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_groups_owner_system_nome ON public.patient_groups USING btree (owner_id, is_system, nome); - - --- --- Name: idx_patient_tags_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_tags_owner ON public.patient_tags USING btree (owner_id); - - --- --- Name: idx_patients_created_at; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_created_at ON public.patients USING btree (created_at DESC); - - --- --- Name: idx_patients_last_attended; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_last_attended ON public.patients USING btree (last_attended_at DESC); - - --- --- Name: idx_patients_owner_email_principal; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_email_principal ON public.patients USING btree (owner_id, email_principal); - - --- --- Name: idx_patients_owner_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_id ON public.patients USING btree (owner_id); - - --- --- Name: idx_patients_owner_nome; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_nome ON public.patients USING btree (owner_id, nome_completo); - - --- --- Name: idx_patients_responsible_member; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_responsible_member ON public.patients USING btree (responsible_member_id); - - --- --- Name: idx_patients_status; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_status ON public.patients USING btree (status); - - --- --- Name: idx_patients_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_tenant ON public.patients USING btree (tenant_id); - - --- --- Name: idx_patients_tenant_email_norm; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_tenant_email_norm ON public.patients USING btree (tenant_id, lower(TRIM(BOTH FROM email_principal))); - - --- --- Name: idx_pgp_group; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_pgp_group ON public.patient_group_patient USING btree (patient_group_id); - - --- --- Name: idx_pgp_patient; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_pgp_patient ON public.patient_group_patient USING btree (patient_id); - - --- --- Name: idx_ppt_patient; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_ppt_patient ON public.patient_patient_tag USING btree (patient_id); - - --- --- Name: idx_ppt_tag; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_ppt_tag ON public.patient_patient_tag USING btree (tag_id); - - --- --- Name: idx_slots_bloq_owner_dia; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_slots_bloq_owner_dia ON public.agenda_slots_bloqueados_semanais USING btree (owner_id, dia_semana); - - --- --- Name: idx_subscription_intents_plan_interval; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_plan_interval ON public.subscription_intents_legacy USING btree (plan_key, "interval"); - - --- --- Name: idx_subscription_intents_status; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_status ON public.subscription_intents_legacy USING btree (status); - - --- --- Name: idx_subscription_intents_user_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_user_id ON public.subscription_intents_legacy USING btree (user_id); - - --- --- Name: idx_tenant_features_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_features_tenant ON public.tenant_features USING btree (tenant_id); - - --- --- Name: idx_tenant_invites_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_invites_tenant ON public.tenant_invites USING btree (tenant_id); - - --- --- Name: idx_tenant_invites_token; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_invites_token ON public.tenant_invites USING btree (token); - - --- --- Name: insurance_plans_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX insurance_plans_owner_idx ON public.insurance_plans USING btree (owner_id); - - --- --- Name: insurance_plans_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX insurance_plans_tenant_idx ON public.insurance_plans USING btree (tenant_id); - - --- --- Name: ix_plan_prices_plan; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_prices_plan ON public.plan_prices USING btree (plan_id); - - --- --- Name: ix_plan_public_bullets_plan; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_public_bullets_plan ON public.plan_public_bullets USING btree (plan_id); - - --- --- Name: ix_plan_public_sort; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_public_sort ON public.plan_public USING btree (sort_order); - - --- --- Name: patient_discounts_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_discounts_owner_idx ON public.patient_discounts USING btree (owner_id); - - --- --- Name: patient_discounts_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_discounts_patient_idx ON public.patient_discounts USING btree (patient_id); - - --- --- Name: patient_discounts_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_discounts_tenant_idx ON public.patient_discounts USING btree (tenant_id); - - --- --- Name: patient_group_patient_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_group_patient_tenant_idx ON public.patient_group_patient USING btree (tenant_id); - - --- --- Name: patient_groups_owner_nome_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_groups_owner_nome_uniq ON public.patient_groups USING btree (owner_id, nome); - - --- --- Name: patient_groups_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_groups_tenant_idx ON public.patient_groups USING btree (tenant_id); - - --- --- Name: patient_intake_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_owner_id_idx ON public.patient_intake_requests USING btree (owner_id); - - --- --- Name: patient_intake_requests_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_requests_tenant_idx ON public.patient_intake_requests USING btree (tenant_id); - - --- --- Name: patient_intake_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_status_idx ON public.patient_intake_requests USING btree (status); - - --- --- Name: patient_intake_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_token_idx ON public.patient_intake_requests USING btree (token); - - --- --- Name: patient_invites_one_active_per_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_invites_one_active_per_owner ON public.patient_invites USING btree (owner_id) WHERE (active = true); - - --- --- Name: patient_invites_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_owner_id_idx ON public.patient_invites USING btree (owner_id); - - --- --- Name: patient_invites_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_tenant_idx ON public.patient_invites USING btree (tenant_id); - - --- --- Name: patient_invites_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_token_idx ON public.patient_invites USING btree (token); - - --- --- Name: patient_patient_tag_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_patient_tag_tenant_idx ON public.patient_patient_tag USING btree (tenant_id); - - --- --- Name: patient_tags_owner_name_uq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_tags_owner_name_uq ON public.patient_tags USING btree (owner_id, lower(nome)); - - --- --- Name: patient_tags_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_tags_tenant_idx ON public.patient_tags USING btree (tenant_id); - - --- --- Name: payment_settings_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX payment_settings_tenant_id_idx ON public.payment_settings USING btree (tenant_id); - - --- --- Name: ppt_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_owner_idx ON public.patient_patient_tag USING btree (owner_id); - - --- --- Name: ppt_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_patient_idx ON public.patient_patient_tag USING btree (patient_id); - - --- --- Name: ppt_tag_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_tag_idx ON public.patient_patient_tag USING btree (tag_id); - - --- --- Name: professional_pricing_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX professional_pricing_tenant_idx ON public.professional_pricing USING btree (tenant_id); - - --- --- Name: recurrence_exceptions_rule_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_exceptions_rule_idx ON public.recurrence_exceptions USING btree (recurrence_id); - - --- --- Name: recurrence_exceptions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_exceptions_tenant_idx ON public.recurrence_exceptions USING btree (tenant_id); - - --- --- Name: recurrence_rule_services_rule_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rule_services_rule_idx ON public.recurrence_rule_services USING btree (rule_id); - - --- --- Name: recurrence_rule_services_service_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rule_services_service_idx ON public.recurrence_rule_services USING btree (service_id); - - --- --- Name: recurrence_rules_active_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_active_idx ON public.recurrence_rules USING btree (owner_id, status) WHERE (status = 'ativo'::text); - - --- --- Name: recurrence_rules_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_owner_idx ON public.recurrence_rules USING btree (owner_id); - - --- --- Name: recurrence_rules_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_patient_idx ON public.recurrence_rules USING btree (patient_id); - - --- --- Name: recurrence_rules_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_tenant_idx ON public.recurrence_rules USING btree (tenant_id); - - --- --- Name: saas_doc_votos_doc_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_doc_votos_doc_id_idx ON public.saas_doc_votos USING btree (doc_id); - - --- --- Name: saas_doc_votos_user_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_doc_votos_user_id_idx ON public.saas_doc_votos USING btree (user_id); - - --- --- Name: saas_docs_categoria_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_categoria_idx ON public.saas_docs USING btree (categoria); - - --- --- Name: saas_docs_exibir_no_faq_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_exibir_no_faq_idx ON public.saas_docs USING btree (exibir_no_faq) WHERE (exibir_no_faq = true); - - --- --- Name: saas_docs_path_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_path_ativo_idx ON public.saas_docs USING btree (pagina_path, ativo); - - --- --- Name: saas_faq_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_ativo_idx ON public.saas_faq USING btree (ativo); - - --- --- Name: saas_faq_categoria_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_categoria_idx ON public.saas_faq USING btree (categoria); - - --- --- Name: saas_faq_fts_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_fts_idx ON public.saas_faq USING gin (to_tsvector('portuguese'::regconfig, ((COALESCE(pergunta, ''::text) || ' '::text) || COALESCE(conteudo, ''::text)))); - - --- --- Name: saas_faq_itens_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_itens_ativo_idx ON public.saas_faq_itens USING btree (ativo); - - --- --- Name: saas_faq_itens_doc_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_itens_doc_id_idx ON public.saas_faq_itens USING btree (doc_id); - - --- --- Name: saas_faq_pagina_path_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_pagina_path_idx ON public.saas_faq USING btree (pagina_path); - - --- --- Name: saas_faq_publico_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_publico_idx ON public.saas_faq USING btree (publico); - - --- --- Name: saas_faq_votos_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_votos_idx ON public.saas_faq USING btree (votos DESC); - - --- --- Name: services_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX services_owner_idx ON public.services USING btree (owner_id); - - --- --- Name: services_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX services_tenant_idx ON public.services USING btree (tenant_id); - - --- --- Name: sint_personal_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_personal_created_idx ON public.subscription_intents_personal USING btree (created_at DESC); - - --- --- Name: sint_personal_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_personal_status_idx ON public.subscription_intents_personal USING btree (status); - - --- --- Name: sint_tenant_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_created_idx ON public.subscription_intents_tenant USING btree (created_at DESC); - - --- --- Name: sint_tenant_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_status_idx ON public.subscription_intents_tenant USING btree (status); - - --- --- Name: sint_tenant_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_tenant_idx ON public.subscription_intents_tenant USING btree (tenant_id); - - --- --- Name: subscription_events_created_at_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_created_at_idx ON public.subscription_events USING btree (created_at DESC); - - --- --- Name: subscription_events_owner_ref_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_owner_ref_idx ON public.subscription_events USING btree (owner_type, owner_ref); - - --- --- Name: subscription_events_sub_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_sub_created_idx ON public.subscription_events USING btree (subscription_id, created_at DESC); - - --- --- Name: subscription_events_subscription_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_subscription_id_idx ON public.subscription_events USING btree (subscription_id); - - --- --- Name: subscriptions_one_active_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_tenant ON public.subscriptions USING btree (tenant_id) WHERE (status = 'active'::text); - - --- --- Name: subscriptions_one_active_per_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_user ON public.subscriptions USING btree (user_id) WHERE (status = 'active'::text); - - --- --- Name: subscriptions_one_active_per_user_personal; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_user_personal ON public.subscriptions USING btree (user_id) WHERE ((tenant_id IS NULL) AND (status = 'active'::text)); - - --- --- Name: subscriptions_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_owner_idx ON public.subscriptions USING btree (user_id); - - --- --- Name: subscriptions_plan_key_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_plan_key_idx ON public.subscriptions USING btree (plan_key); - - --- --- Name: subscriptions_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_status_idx ON public.subscriptions USING btree (status); - - --- --- Name: subscriptions_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_id_idx ON public.subscriptions USING btree (tenant_id); - - --- --- Name: subscriptions_tenant_period_end_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_period_end_idx ON public.subscriptions USING btree (tenant_id, current_period_end); - - --- --- Name: subscriptions_tenant_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_status_idx ON public.subscriptions USING btree (tenant_id, status); - - --- --- Name: subscriptions_user_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_user_status_idx ON public.subscriptions USING btree (user_id, status, created_at DESC); - - --- --- Name: support_sessions_expires_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_expires_idx ON public.support_sessions USING btree (expires_at); - - --- --- Name: support_sessions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_tenant_idx ON public.support_sessions USING btree (tenant_id); - - --- --- Name: support_sessions_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_token_idx ON public.support_sessions USING btree (token); - - --- --- Name: tenant_members_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_members_tenant_idx ON public.tenant_members USING btree (tenant_id); - - --- --- Name: tenant_members_user_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_members_user_idx ON public.tenant_members USING btree (user_id); - - --- --- Name: tenant_modules_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_modules_owner_idx ON public.tenant_modules USING btree (owner_id); - - --- --- Name: unique_member_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX unique_member_per_tenant ON public.tenant_members USING btree (tenant_id, user_id); - - --- --- Name: uq_patients_tenant_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_patients_tenant_user ON public.patients USING btree (tenant_id, user_id) WHERE (user_id IS NOT NULL); - - --- --- Name: uq_plan_price_active; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_plan_price_active ON public.plan_prices USING btree (plan_id, "interval", currency) WHERE ((is_active = true) AND (active_to IS NULL)); - - --- --- Name: uq_plan_prices_active; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_plan_prices_active ON public.plan_prices USING btree (plan_id, "interval") WHERE (is_active = true); - - --- --- Name: uq_subscriptions_active_by_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_subscriptions_active_by_tenant ON public.subscriptions USING btree (tenant_id) WHERE ((tenant_id IS NOT NULL) AND (status = 'active'::text)); - - --- --- Name: uq_subscriptions_active_personal_by_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_subscriptions_active_personal_by_user ON public.subscriptions USING btree (user_id) WHERE ((tenant_id IS NULL) AND (status = 'active'::text)); - - --- --- Name: uq_tenant_invites_pending; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_tenant_invites_pending ON public.tenant_invites USING btree (tenant_id, lower(email), role) WHERE ((accepted_at IS NULL) AND (revoked_at IS NULL)); - - --- --- Name: uq_tenant_members_tenant_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_tenant_members_tenant_user ON public.tenant_members USING btree (tenant_id, user_id); - - --- --- Name: ux_subscriptions_active_per_personal_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX ux_subscriptions_active_per_personal_user ON public.subscriptions USING btree (user_id) WHERE ((status = 'active'::text) AND (tenant_id IS NULL)); - - --- --- Name: ux_subscriptions_active_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX ux_subscriptions_active_per_tenant ON public.subscriptions USING btree (tenant_id) WHERE ((status = 'active'::text) AND (tenant_id IS NOT NULL)); - - --- --- Name: ix_realtime_subscription_entity; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX ix_realtime_subscription_entity ON realtime.subscription USING btree (entity); - - --- --- Name: messages_inserted_at_topic_index; Type: INDEX; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE INDEX messages_inserted_at_topic_index ON ONLY realtime.messages USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_11_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_11_inserted_at_topic_idx ON realtime.messages_2026_03_11 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_12_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_12_inserted_at_topic_idx ON realtime.messages_2026_03_12 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_13_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_13_inserted_at_topic_idx ON realtime.messages_2026_03_13 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_14_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_14_inserted_at_topic_idx ON realtime.messages_2026_03_14 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_15_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_15_inserted_at_topic_idx ON realtime.messages_2026_03_15 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_16_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_16_inserted_at_topic_idx ON realtime.messages_2026_03_16 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_17_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_17_inserted_at_topic_idx ON realtime.messages_2026_03_17 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: subscription_subscription_id_entity_filters_key; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscription_subscription_id_entity_filters_key ON realtime.subscription USING btree (subscription_id, entity, filters); - - --- --- Name: bname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bname ON storage.buckets USING btree (name); - - --- --- Name: bucketid_objname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bucketid_objname ON storage.objects USING btree (bucket_id, name); - - --- --- Name: buckets_analytics_unique_name_idx; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX buckets_analytics_unique_name_idx ON storage.buckets_analytics USING btree (name) WHERE (deleted_at IS NULL); - - --- --- Name: idx_iceberg_namespaces_bucket_id; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_namespaces_bucket_id ON storage.iceberg_namespaces USING btree (catalog_id, name); - - --- --- Name: idx_iceberg_tables_location; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_tables_location ON storage.iceberg_tables USING btree (location); - - --- --- Name: idx_iceberg_tables_namespace_id; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_tables_namespace_id ON storage.iceberg_tables USING btree (catalog_id, namespace_id, name); - - --- --- Name: idx_multipart_uploads_list; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_multipart_uploads_list ON storage.s3_multipart_uploads USING btree (bucket_id, key, created_at); - - --- --- Name: idx_objects_bucket_id_name; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_objects_bucket_id_name ON storage.objects USING btree (bucket_id, name COLLATE "C"); - - --- --- Name: idx_objects_bucket_id_name_lower; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_objects_bucket_id_name_lower ON storage.objects USING btree (bucket_id, lower(name) COLLATE "C"); - - --- --- Name: name_prefix_search; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX name_prefix_search ON storage.objects USING btree (name text_pattern_ops); - - --- --- Name: vector_indexes_name_bucket_id_idx; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX vector_indexes_name_bucket_id_idx ON storage.vector_indexes USING btree (name, bucket_id); - - --- --- Name: supabase_functions_hooks_h_table_id_h_name_idx; Type: INDEX; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE INDEX supabase_functions_hooks_h_table_id_h_name_idx ON supabase_functions.hooks USING btree (hook_table_id, hook_name); - - --- --- Name: supabase_functions_hooks_request_id_idx; Type: INDEX; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE INDEX supabase_functions_hooks_request_id_idx ON supabase_functions.hooks USING btree (request_id); - - --- --- Name: messages_2026_03_11_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_11_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_11_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_11_pkey; - - --- --- Name: messages_2026_03_12_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_12_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_12_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_12_pkey; - - --- --- Name: messages_2026_03_13_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_13_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_13_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_13_pkey; - - --- --- Name: messages_2026_03_14_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_14_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_14_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_14_pkey; - - --- --- Name: messages_2026_03_15_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_15_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_15_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_15_pkey; - - --- --- Name: messages_2026_03_16_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_16_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_16_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_16_pkey; - - --- --- Name: messages_2026_03_17_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_17_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_17_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_17_pkey; - - --- --- Name: users on_auth_user_created; Type: TRIGGER; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.handle_new_user(); - - --- --- Name: users trg_seed_patient_groups; Type: TRIGGER; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TRIGGER trg_seed_patient_groups AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.on_new_user_seed_patient_groups(); - - --- --- Name: agenda_bloqueios agenda_bloqueios_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER agenda_bloqueios_updated_at BEFORE UPDATE ON public.agenda_bloqueios FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agendador_configuracoes agendador_slug_trigger; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER agendador_slug_trigger BEFORE INSERT OR UPDATE ON public.agendador_configuracoes FOR EACH ROW EXECUTE FUNCTION public.agendador_gerar_slug(); - - --- --- Name: tenant_members prevent_saas_membership_trigger; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER prevent_saas_membership_trigger BEFORE INSERT ON public.tenant_members FOR EACH ROW EXECUTE FUNCTION public.prevent_saas_membership(); - - --- --- Name: insurance_plan_services set_insurance_plan_services_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER set_insurance_plan_services_updated_at BEFORE UPDATE ON public.insurance_plan_services FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_configuracoes tg_agenda_configuracoes_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_configuracoes_updated_at BEFORE UPDATE ON public.agenda_configuracoes FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_eventos tg_agenda_eventos_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_eventos_updated_at BEFORE UPDATE ON public.agenda_eventos FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_excecoes tg_agenda_excecoes_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_excecoes_updated_at BEFORE UPDATE ON public.agenda_excecoes FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_regras_semanais tg_agenda_regras_semanais_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_regras_semanais_updated_at BEFORE UPDATE ON public.agenda_regras_semanais FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: recurrence_rules tg_recurrence_rules_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_recurrence_rules_updated_at BEFORE UPDATE ON public.recurrence_rules FOR EACH ROW EXECUTE FUNCTION public.set_updated_at_recurrence(); - - --- --- Name: plan_public tr_plan_public_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tr_plan_public_updated_at BEFORE UPDATE ON public.plan_public FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: profiles trg_account_type_immutable; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_account_type_immutable BEFORE UPDATE OF account_type ON public.profiles FOR EACH ROW EXECUTE FUNCTION public.guard_account_type_immutable(); - - --- --- Name: agenda_configuracoes trg_agenda_cfg_sync; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_cfg_sync BEFORE INSERT OR UPDATE ON public.agenda_configuracoes FOR EACH ROW EXECUTE FUNCTION public.agenda_cfg_sync(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_del; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_del AFTER DELETE ON public.agenda_eventos FOR EACH ROW WHEN (((old.mirror_of_event_id IS NULL) AND (old.tenant_id = old.owner_id))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_ins; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_ins AFTER INSERT ON public.agenda_eventos FOR EACH ROW WHEN (((new.mirror_of_event_id IS NULL) AND (new.tenant_id = new.owner_id) AND (new.visibility_scope = ANY (ARRAY['busy_only'::text, 'private'::text])))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_upd; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_upd AFTER UPDATE ON public.agenda_eventos FOR EACH ROW WHEN (((new.mirror_of_event_id IS NULL) AND (new.tenant_id = new.owner_id) AND ((new.visibility_scope IS DISTINCT FROM old.visibility_scope) OR (new.inicio_em IS DISTINCT FROM old.inicio_em) OR (new.fim_em IS DISTINCT FROM old.fim_em) OR (new.owner_id IS DISTINCT FROM old.owner_id) OR (new.tenant_id IS DISTINCT FROM old.tenant_id)))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_regras_semanais trg_agenda_regras_semanais_no_overlap; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_regras_semanais_no_overlap BEFORE INSERT OR UPDATE ON public.agenda_regras_semanais FOR EACH ROW EXECUTE FUNCTION public.fn_agenda_regras_semanais_no_overlap(); - - --- --- Name: determined_commitment_fields trg_determined_commitment_fields_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_determined_commitment_fields_updated_at BEFORE UPDATE ON public.determined_commitment_fields FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: determined_commitments trg_determined_commitments_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_determined_commitments_updated_at BEFORE UPDATE ON public.determined_commitments FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: financial_exceptions trg_financial_exceptions_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_financial_exceptions_updated_at BEFORE UPDATE ON public.financial_exceptions FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: insurance_plans trg_insurance_plans_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_insurance_plans_updated_at BEFORE UPDATE ON public.insurance_plans FOR EACH ROW EXECUTE FUNCTION public.set_insurance_plans_updated_at(); - - --- --- Name: plans trg_no_change_core_plan_key; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_change_core_plan_key BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_change_core_plan_key(); - - --- --- Name: plans trg_no_change_plan_target; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_change_plan_target BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_change_plan_target(); - - --- --- Name: plans trg_no_delete_core_plans; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_delete_core_plans BEFORE DELETE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_delete_core_plans(); - - --- --- Name: tenant_members trg_patient_cannot_own_tenant; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_cannot_own_tenant BEFORE INSERT OR UPDATE ON public.tenant_members FOR EACH ROW EXECUTE FUNCTION public.guard_patient_cannot_own_tenant(); - - --- --- Name: patient_groups trg_patient_groups_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_groups_set_updated_at BEFORE UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patient_intake_requests trg_patient_intake_requests_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_intake_requests_updated_at BEFORE UPDATE ON public.patient_intake_requests FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patient_tags trg_patient_tags_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_tags_set_updated_at BEFORE UPDATE ON public.patient_tags FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patients trg_patients_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patients_updated_at BEFORE UPDATE ON public.patients FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patients trg_patients_validate_members; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patients_validate_members BEFORE INSERT OR UPDATE OF tenant_id, responsible_member_id, patient_scope, therapist_member_id ON public.patients FOR EACH ROW EXECUTE FUNCTION public.patients_validate_member_consistency(); - - --- --- Name: payment_settings trg_payment_settings_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_payment_settings_updated_at BEFORE UPDATE ON public.payment_settings FOR EACH ROW EXECUTE FUNCTION public.update_payment_settings_updated_at(); - - --- --- Name: patient_groups trg_prevent_promoting_to_system; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_prevent_promoting_to_system BEFORE UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.prevent_promoting_to_system(); - - --- --- Name: patient_groups trg_prevent_system_group_changes; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_prevent_system_group_changes BEFORE DELETE OR UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.prevent_system_group_changes(); - - --- --- Name: professional_pricing trg_professional_pricing_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_professional_pricing_updated_at BEFORE UPDATE ON public.professional_pricing FOR EACH ROW EXECUTE FUNCTION public.update_professional_pricing_updated_at(); - - --- --- Name: profiles trg_profiles_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_profiles_updated_at BEFORE UPDATE ON public.profiles FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: services trg_services_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_services_updated_at BEFORE UPDATE ON public.services FOR EACH ROW EXECUTE FUNCTION public.set_services_updated_at(); - - --- --- Name: subscription_intents trg_subscription_intents_view_insert; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_subscription_intents_view_insert INSTEAD OF INSERT ON public.subscription_intents FOR EACH ROW EXECUTE FUNCTION public.subscription_intents_view_insert(); - - --- --- Name: subscriptions trg_subscriptions_validate_scope; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_subscriptions_validate_scope BEFORE INSERT OR UPDATE ON public.subscriptions FOR EACH ROW EXECUTE FUNCTION public.subscriptions_validate_scope(); - - --- --- Name: tenant_features trg_tenant_features_guard_with_plan; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_features_guard_with_plan BEFORE INSERT OR UPDATE ON public.tenant_features FOR EACH ROW EXECUTE FUNCTION public.tenant_features_guard_with_plan(); - - --- --- Name: tenant_features trg_tenant_features_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_features_updated_at BEFORE UPDATE ON public.tenant_features FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: tenants trg_tenant_kind_immutable; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_kind_immutable BEFORE UPDATE OF kind ON public.tenants FOR EACH ROW EXECUTE FUNCTION public.guard_tenant_kind_immutable(); - - --- --- Name: user_settings trg_user_settings_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_user_settings_updated_at BEFORE UPDATE ON public.user_settings FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: subscription tr_check_filters; Type: TRIGGER; Schema: realtime; Owner: supabase_admin --- - -CREATE TRIGGER tr_check_filters BEFORE INSERT OR UPDATE ON realtime.subscription FOR EACH ROW EXECUTE FUNCTION realtime.subscription_check_filters(); - - --- --- Name: buckets enforce_bucket_name_length_trigger; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER enforce_bucket_name_length_trigger BEFORE INSERT OR UPDATE OF name ON storage.buckets FOR EACH ROW EXECUTE FUNCTION storage.enforce_bucket_name_length(); - - --- --- Name: buckets protect_buckets_delete; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER protect_buckets_delete BEFORE DELETE ON storage.buckets FOR EACH STATEMENT EXECUTE FUNCTION storage.protect_delete(); - - --- --- Name: objects protect_objects_delete; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER protect_objects_delete BEFORE DELETE ON storage.objects FOR EACH STATEMENT EXECUTE FUNCTION storage.protect_delete(); - - --- --- Name: objects update_objects_updated_at; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER update_objects_updated_at BEFORE UPDATE ON storage.objects FOR EACH ROW EXECUTE FUNCTION storage.update_updated_at_column(); - - --- --- Name: extensions extensions_tenant_external_id_fkey; Type: FK CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.extensions - ADD CONSTRAINT extensions_tenant_external_id_fkey FOREIGN KEY (tenant_external_id) REFERENCES _realtime.tenants(external_id) ON DELETE CASCADE; - - --- --- Name: identities identities_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: mfa_amr_claims mfa_amr_claims_session_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT mfa_amr_claims_session_id_fkey FOREIGN KEY (session_id) REFERENCES auth.sessions(id) ON DELETE CASCADE; - - --- --- Name: mfa_challenges mfa_challenges_auth_factor_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_challenges - ADD CONSTRAINT mfa_challenges_auth_factor_id_fkey FOREIGN KEY (factor_id) REFERENCES auth.mfa_factors(id) ON DELETE CASCADE; - - --- --- Name: mfa_factors mfa_factors_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: oauth_authorizations oauth_authorizations_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_client_id_fkey FOREIGN KEY (client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: oauth_authorizations oauth_authorizations_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: oauth_consents oauth_consents_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_client_id_fkey FOREIGN KEY (client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: oauth_consents oauth_consents_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: one_time_tokens one_time_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.one_time_tokens - ADD CONSTRAINT one_time_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: refresh_tokens refresh_tokens_session_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_session_id_fkey FOREIGN KEY (session_id) REFERENCES auth.sessions(id) ON DELETE CASCADE; - - --- --- Name: saml_providers saml_providers_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: saml_relay_states saml_relay_states_flow_state_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_flow_state_id_fkey FOREIGN KEY (flow_state_id) REFERENCES auth.flow_state(id) ON DELETE CASCADE; - - --- --- Name: saml_relay_states saml_relay_states_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: sessions sessions_oauth_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_oauth_client_id_fkey FOREIGN KEY (oauth_client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: sessions sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: sso_domains sso_domains_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_domains - ADD CONSTRAINT sso_domains_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: agenda_bloqueios agenda_bloqueios_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agenda_bloqueios agenda_bloqueios_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE SET NULL; - - --- --- Name: agenda_configuracoes agenda_configuracoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_configuracoes - ADD CONSTRAINT agenda_configuracoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_eventos agenda_eventos_billing_contract_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_billing_contract_id_fkey FOREIGN KEY (billing_contract_id) REFERENCES public.billing_contracts(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_determined_commitment_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_determined_commitment_fk FOREIGN KEY (determined_commitment_id) REFERENCES public.determined_commitments(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_insurance_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_insurance_plan_id_fkey FOREIGN KEY (insurance_plan_id) REFERENCES public.insurance_plans(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_insurance_plan_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_insurance_plan_service_id_fkey FOREIGN KEY (insurance_plan_service_id) REFERENCES public.insurance_plan_services(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.recurrence_rules(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_terapeuta_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_terapeuta_fk FOREIGN KEY (terapeuta_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: agenda_excecoes agenda_excecoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_excecoes - ADD CONSTRAINT agenda_excecoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_online_slots agenda_online_slots_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agenda_online_slots agenda_online_slots_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_semanais_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_slots_regras agenda_slots_regras_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agendador_configuracoes agendador_configuracoes_owner_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_owner_fk FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agendador_configuracoes agendador_configuracoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agendador_solicitacoes agendador_sol_owner_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_sol_owner_fk FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agendador_solicitacoes agendador_sol_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_sol_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: billing_contracts billing_contracts_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.billing_contracts - ADD CONSTRAINT billing_contracts_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: billing_contracts billing_contracts_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.billing_contracts - ADD CONSTRAINT billing_contracts_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: commitment_services commitment_services_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_services - ADD CONSTRAINT commitment_services_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.agenda_eventos(id) ON DELETE CASCADE; - - --- --- Name: commitment_services commitment_services_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_services - ADD CONSTRAINT commitment_services_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE RESTRICT; - - --- --- Name: commitment_time_logs commitment_time_logs_calendar_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_calendar_event_id_fkey FOREIGN KEY (calendar_event_id) REFERENCES public.agenda_eventos(id) ON DELETE SET NULL; - - --- --- Name: commitment_time_logs commitment_time_logs_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.determined_commitments(id) ON DELETE CASCADE; - - --- --- Name: commitment_time_logs commitment_time_logs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: determined_commitment_fields determined_commitment_fields_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.determined_commitments(id) ON DELETE CASCADE; - - --- --- Name: determined_commitment_fields determined_commitment_fields_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: determined_commitments determined_commitments_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: feriados feriados_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: feriados feriados_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: financial_exceptions financial_exceptions_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.financial_exceptions - ADD CONSTRAINT financial_exceptions_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: insurance_plan_services insurance_plan_services_plan_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plan_services - ADD CONSTRAINT insurance_plan_services_plan_fkey FOREIGN KEY (insurance_plan_id) REFERENCES public.insurance_plans(id) ON DELETE CASCADE; - - --- --- Name: insurance_plans insurance_plans_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plans - ADD CONSTRAINT insurance_plans_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: module_features module_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.features(id) ON DELETE CASCADE; - - --- --- Name: module_features module_features_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.modules(id) ON DELETE CASCADE; - - --- --- Name: patient_discounts patient_discounts_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_discounts - ADD CONSTRAINT patient_discounts_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: patient_discounts patient_discounts_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_discounts - ADD CONSTRAINT patient_discounts_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_group_patient patient_group_patient_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_group_patient patient_group_patient_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_groups patient_groups_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_groups - ADD CONSTRAINT patient_groups_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_intake_requests patient_intake_requests_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_intake_requests - ADD CONSTRAINT patient_intake_requests_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_invites patient_invites_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag patient_patient_tag_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.patient_tags(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag patient_patient_tag_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_tags patient_tags_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patients patients_responsible_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_responsible_member_id_fkey FOREIGN KEY (responsible_member_id) REFERENCES public.tenant_members(id) ON DELETE RESTRICT; - - --- --- Name: patients patients_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patients patients_therapist_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_therapist_member_id_fkey FOREIGN KEY (therapist_member_id) REFERENCES public.tenant_members(id); - - --- --- Name: patients patients_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: payment_settings payment_settings_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: payment_settings payment_settings_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: plan_features plan_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.features(id) ON DELETE CASCADE; - - --- --- Name: plan_features plan_features_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_prices plan_prices_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_prices - ADD CONSTRAINT plan_prices_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_public_bullets plan_public_bullets_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public_bullets - ADD CONSTRAINT plan_public_bullets_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_public plan_public_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public - ADD CONSTRAINT plan_public_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag ppt_patient_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT ppt_patient_fk FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag ppt_tag_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT ppt_tag_fk FOREIGN KEY (tag_id) REFERENCES public.patient_tags(id) ON DELETE CASCADE; - - --- --- Name: professional_pricing professional_pricing_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: profiles profiles_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.profiles - ADD CONSTRAINT profiles_id_fkey FOREIGN KEY (id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: recurrence_exceptions recurrence_exceptions_agenda_evento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_agenda_evento_id_fkey FOREIGN KEY (agenda_evento_id) REFERENCES public.agenda_eventos(id) ON DELETE SET NULL; - - --- --- Name: recurrence_exceptions recurrence_exceptions_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.recurrence_rules(id) ON DELETE CASCADE; - - --- --- Name: recurrence_rule_services recurrence_rule_services_rule_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rule_services - ADD CONSTRAINT recurrence_rule_services_rule_id_fkey FOREIGN KEY (rule_id) REFERENCES public.recurrence_rules(id) ON DELETE CASCADE; - - --- --- Name: recurrence_rule_services recurrence_rule_services_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rule_services - ADD CONSTRAINT recurrence_rule_services_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE RESTRICT; - - --- --- Name: recurrence_rules recurrence_rules_insurance_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_insurance_plan_id_fkey FOREIGN KEY (insurance_plan_id) REFERENCES public.insurance_plans(id) ON DELETE SET NULL; - - --- --- Name: recurrence_rules recurrence_rules_insurance_plan_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_insurance_plan_service_id_fkey FOREIGN KEY (insurance_plan_service_id) REFERENCES public.insurance_plan_services(id) ON DELETE SET NULL; - - --- --- Name: saas_admins saas_admins_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_admins - ADD CONSTRAINT saas_admins_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: saas_doc_votos saas_doc_votos_doc_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_doc_id_fkey FOREIGN KEY (doc_id) REFERENCES public.saas_docs(id) ON DELETE CASCADE; - - --- --- Name: saas_doc_votos saas_doc_votos_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: saas_faq_itens saas_faq_itens_doc_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq_itens - ADD CONSTRAINT saas_faq_itens_doc_id_fkey FOREIGN KEY (doc_id) REFERENCES public.saas_docs(id) ON DELETE CASCADE; - - --- --- Name: services services_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.services - ADD CONSTRAINT services_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: subscription_intents_personal sint_personal_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT sint_personal_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE SET NULL; - - --- --- Name: subscription_intents_tenant sint_tenant_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT sint_tenant_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE SET NULL; - - --- --- Name: subscription_events subscription_events_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_events - ADD CONSTRAINT subscription_events_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE CASCADE; - - --- --- Name: subscription_intents_personal subscription_intents_personal_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT subscription_intents_personal_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: subscription_intents_tenant subscription_intents_tenant_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT subscription_intents_tenant_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: subscription_intents_legacy subscription_intents_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_legacy - ADD CONSTRAINT subscription_intents_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: subscriptions subscriptions_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_owner_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: subscriptions subscriptions_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: support_sessions support_sessions_admin_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_admin_fk FOREIGN KEY (admin_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: support_sessions support_sessions_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_features tenant_features_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_features - ADD CONSTRAINT tenant_features_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_invites tenant_invites_accepted_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_accepted_by_fkey FOREIGN KEY (accepted_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_invited_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_invited_by_fkey FOREIGN KEY (invited_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_revoked_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_revoked_by_fkey FOREIGN KEY (revoked_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_members tenant_members_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_members tenant_members_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: tenant_modules tenant_modules_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.modules(id) ON DELETE CASCADE; - - --- --- Name: tenant_modules tenant_modules_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: user_settings user_settings_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.user_settings - ADD CONSTRAINT user_settings_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: iceberg_namespaces iceberg_namespaces_catalog_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_namespaces - ADD CONSTRAINT iceberg_namespaces_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES storage.buckets_analytics(id) ON DELETE CASCADE; - - --- --- Name: iceberg_tables iceberg_tables_catalog_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES storage.buckets_analytics(id) ON DELETE CASCADE; - - --- --- Name: iceberg_tables iceberg_tables_namespace_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_namespace_id_fkey FOREIGN KEY (namespace_id) REFERENCES storage.iceberg_namespaces(id) ON DELETE CASCADE; - - --- --- Name: objects objects_bucketId_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT "objects_bucketId_fkey" FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads s3_multipart_uploads_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads - ADD CONSTRAINT s3_multipart_uploads_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_upload_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_upload_id_fkey FOREIGN KEY (upload_id) REFERENCES storage.s3_multipart_uploads(id) ON DELETE CASCADE; - - --- --- Name: vector_indexes vector_indexes_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.vector_indexes - ADD CONSTRAINT vector_indexes_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets_vectors(id); - - --- --- Name: audit_log_entries; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.audit_log_entries ENABLE ROW LEVEL SECURITY; - --- --- Name: flow_state; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.flow_state ENABLE ROW LEVEL SECURITY; - --- --- Name: identities; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.identities ENABLE ROW LEVEL SECURITY; - --- --- Name: instances; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.instances ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_amr_claims; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_amr_claims ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_challenges; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_challenges ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_factors; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_factors ENABLE ROW LEVEL SECURITY; - --- --- Name: one_time_tokens; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.one_time_tokens ENABLE ROW LEVEL SECURITY; - --- --- Name: refresh_tokens; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.refresh_tokens ENABLE ROW LEVEL SECURITY; - --- --- Name: saml_providers; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.saml_providers ENABLE ROW LEVEL SECURITY; - --- --- Name: saml_relay_states; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.saml_relay_states ENABLE ROW LEVEL SECURITY; - --- --- Name: schema_migrations; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.schema_migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: sessions; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sessions ENABLE ROW LEVEL SECURITY; - --- --- Name: sso_domains; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sso_domains ENABLE ROW LEVEL SECURITY; - --- --- Name: sso_providers; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sso_providers ENABLE ROW LEVEL SECURITY; - --- --- Name: users; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.users ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_bloqueios ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_configuracoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_configuracoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_configuracoes agenda_configuracoes_clinic_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_clinic_read ON public.agenda_configuracoes FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_configuracoes agenda_configuracoes_clinic_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_clinic_write ON public.agenda_configuracoes USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_configuracoes agenda_configuracoes_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_owner ON public.agenda_configuracoes USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_eventos; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_eventos ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_eventos agenda_eventos_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_delete ON public.agenda_eventos FOR DELETE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.delete'::text))); - - --- --- Name: agenda_eventos agenda_eventos_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_insert ON public.agenda_eventos FOR INSERT WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.create'::text))); - - --- --- Name: agenda_eventos agenda_eventos_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_owner_all ON public.agenda_eventos TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_eventos agenda_eventos_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_select ON public.agenda_eventos FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_eventos agenda_eventos_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_update ON public.agenda_eventos FOR UPDATE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_excecoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_excecoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_excecoes agenda_excecoes_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_owner ON public.agenda_excecoes USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_excecoes agenda_excecoes_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_select ON public.agenda_excecoes FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_excecoes agenda_excecoes_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_write ON public.agenda_excecoes USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_online_slots; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_online_slots ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_online_slots agenda_online_slots_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_owner ON public.agenda_online_slots USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_online_slots agenda_online_slots_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_select ON public.agenda_online_slots FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_online_slots agenda_online_slots_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_write ON public.agenda_online_slots USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_regras_semanais; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_regras_semanais ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_regras_semanais agenda_regras_semanais_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_owner ON public.agenda_regras_semanais USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_select ON public.agenda_regras_semanais FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_write ON public.agenda_regras_semanais USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_slots_bloqueados_semanais; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_slots_bloqueados_semanais ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_bloqueados_semanais_select ON public.agenda_slots_bloqueados_semanais FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_bloqueados_semanais_write ON public.agenda_slots_bloqueados_semanais USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_slots_regras; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_slots_regras ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_slots_regras agenda_slots_regras_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_regras_select ON public.agenda_slots_regras FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_slots_regras agenda_slots_regras_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_regras_write ON public.agenda_slots_regras USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agendador_configuracoes agendador_cfg_public_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_public_read ON public.agendador_configuracoes FOR SELECT TO anon USING (((ativo = true) AND (link_slug IS NOT NULL))); - - --- --- Name: agendador_configuracoes agendador_cfg_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_select ON public.agendador_configuracoes FOR SELECT USING ((auth.uid() = owner_id)); - - --- --- Name: agendador_configuracoes agendador_cfg_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_write ON public.agendador_configuracoes USING ((auth.uid() = owner_id)) WITH CHECK ((auth.uid() = owner_id)); - - --- --- Name: agendador_configuracoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agendador_configuracoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agendador_solicitacoes agendador_sol_owner_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_owner_select ON public.agendador_solicitacoes FOR SELECT USING ((auth.uid() = owner_id)); - - --- --- Name: agendador_solicitacoes agendador_sol_owner_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_owner_write ON public.agendador_solicitacoes USING ((auth.uid() = owner_id)) WITH CHECK ((auth.uid() = owner_id)); - - --- --- Name: agendador_solicitacoes agendador_sol_patient_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_patient_read ON public.agendador_solicitacoes FOR SELECT TO authenticated USING (((auth.uid() = user_id) OR (auth.uid() = owner_id))); - - --- --- Name: agendador_solicitacoes agendador_sol_public_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_public_insert ON public.agendador_solicitacoes FOR INSERT TO anon WITH CHECK (true); - - --- --- Name: agendador_solicitacoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agendador_solicitacoes ENABLE ROW LEVEL SECURITY; - --- --- Name: billing_contracts; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.billing_contracts ENABLE ROW LEVEL SECURITY; - --- --- Name: billing_contracts billing_contracts: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "billing_contracts: owner full access" ON public.billing_contracts USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_delete ON public.agenda_bloqueios FOR DELETE TO authenticated USING ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_insert ON public.agenda_bloqueios FOR INSERT TO authenticated WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_select_clinic; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_select_clinic ON public.agenda_bloqueios FOR SELECT TO authenticated USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE ((tenant_members.user_id = auth.uid()) AND (tenant_members.role = ANY (ARRAY['admin'::text, 'clinic_admin'::text, 'tenant_admin'::text, 'secretary'::text])))))); - - --- --- Name: agenda_bloqueios bloqueios_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_select_own ON public.agenda_bloqueios FOR SELECT TO authenticated USING ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_update ON public.agenda_bloqueios FOR UPDATE TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: saas_docs clinic_admin_read_all_docs; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY clinic_admin_read_all_docs ON public.saas_docs FOR SELECT TO authenticated USING (((ativo = true) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['clinic_admin'::text, 'tenant_admin'::text]))))))); - - --- --- Name: commitment_services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.commitment_services ENABLE ROW LEVEL SECURITY; - --- --- Name: commitment_services commitment_services: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "commitment_services: owner full access" ON public.commitment_services USING ((EXISTS ( SELECT 1 - FROM public.services s - WHERE ((s.id = commitment_services.service_id) AND (s.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.services s - WHERE ((s.id = commitment_services.service_id) AND (s.owner_id = auth.uid()))))); - - --- --- Name: commitment_time_logs; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.commitment_time_logs ENABLE ROW LEVEL SECURITY; - --- --- Name: commitment_time_logs ctl_delete_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_delete_for_active_member ON public.commitment_time_logs FOR DELETE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_insert_for_active_member ON public.commitment_time_logs FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_select_for_active_member ON public.commitment_time_logs FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_update_for_active_member ON public.commitment_time_logs FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_delete_custom_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_delete_custom_for_active_member ON public.determined_commitments FOR DELETE TO authenticated USING (((is_native = false) AND (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: determined_commitments dc_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_insert_for_active_member ON public.determined_commitments FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_select_for_active_member ON public.determined_commitments FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_update_for_active_member ON public.determined_commitments FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_delete_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_delete_for_active_member ON public.determined_commitment_fields FOR DELETE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_insert_for_active_member ON public.determined_commitment_fields FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_select_for_active_member ON public.determined_commitment_fields FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_update_for_active_member ON public.determined_commitment_fields FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: agenda_bloqueios delete own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "delete own" ON public.agenda_bloqueios FOR DELETE USING ((owner_id = auth.uid())); - - --- --- Name: determined_commitment_fields; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.determined_commitment_fields ENABLE ROW LEVEL SECURITY; - --- --- Name: determined_commitments; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.determined_commitments ENABLE ROW LEVEL SECURITY; - --- --- Name: dev_user_credentials dev_creds_select_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dev_creds_select_saas_admin ON public.dev_user_credentials FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))); - - --- --- Name: dev_user_credentials dev_creds_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dev_creds_write_saas_admin ON public.dev_user_credentials TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))); - - --- --- Name: dev_user_credentials; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.dev_user_credentials ENABLE ROW LEVEL SECURITY; - --- --- Name: entitlements_invalidation ent_inv_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_select_own ON public.entitlements_invalidation FOR SELECT USING (((owner_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: entitlements_invalidation ent_inv_update_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_update_saas ON public.entitlements_invalidation FOR UPDATE USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: entitlements_invalidation ent_inv_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_write_saas ON public.entitlements_invalidation FOR INSERT WITH CHECK (public.is_saas_admin()); - - --- --- Name: entitlements_invalidation; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.entitlements_invalidation ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq faq_admin_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_admin_write ON public.saas_faq TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['saas_admin'::text, 'tenant_admin'::text, 'clinic_admin'::text])))))); - - --- --- Name: saas_faq faq_auth_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_auth_read ON public.saas_faq FOR SELECT TO authenticated USING ((ativo = true)); - - --- --- Name: saas_faq_itens faq_itens_admin_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_itens_admin_write ON public.saas_faq_itens TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['saas_admin'::text, 'tenant_admin'::text, 'clinic_admin'::text])))))); - - --- --- Name: saas_faq_itens faq_itens_auth_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_itens_auth_read ON public.saas_faq_itens FOR SELECT TO authenticated USING (((ativo = true) AND (EXISTS ( SELECT 1 - FROM public.saas_docs d - WHERE ((d.id = saas_faq_itens.doc_id) AND (d.ativo = true)))))); - - --- --- Name: saas_faq faq_public_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_public_read ON public.saas_faq FOR SELECT USING (((publico = true) AND (ativo = true))); - - --- --- Name: features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.features ENABLE ROW LEVEL SECURITY; - --- --- Name: features features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY features_read_authenticated ON public.features FOR SELECT TO authenticated USING (true); - - --- --- Name: features features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY features_write_saas_admin ON public.features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: feriados; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.feriados ENABLE ROW LEVEL SECURITY; - --- --- Name: feriados feriados_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_delete ON public.feriados FOR DELETE USING ((owner_id = auth.uid())); - - --- --- Name: feriados feriados_global_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_global_select ON public.feriados FOR SELECT USING ((tenant_id IS NULL)); - - --- --- Name: feriados feriados_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_insert ON public.feriados FOR INSERT WITH CHECK ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_delete ON public.feriados FOR DELETE USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_insert ON public.feriados FOR INSERT WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_select ON public.feriados FOR SELECT USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_select ON public.feriados FOR SELECT USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: financial_exceptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.financial_exceptions ENABLE ROW LEVEL SECURITY; - --- --- Name: financial_exceptions financial_exceptions: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "financial_exceptions: owner full access" ON public.financial_exceptions USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: financial_exceptions financial_exceptions: tenant members read clinic rules; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "financial_exceptions: tenant members read clinic rules" ON public.financial_exceptions FOR SELECT USING (((owner_id IS NULL) AND (EXISTS ( SELECT 1 - FROM public.owner_users ou - WHERE ((ou.owner_id = financial_exceptions.tenant_id) AND (ou.user_id = auth.uid())))))); - - --- --- Name: agenda_bloqueios insert own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "insert own" ON public.agenda_bloqueios FOR INSERT WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: insurance_plan_services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.insurance_plan_services ENABLE ROW LEVEL SECURITY; - --- --- Name: insurance_plan_services insurance_plan_services_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY insurance_plan_services_owner ON public.insurance_plan_services USING ((EXISTS ( SELECT 1 - FROM public.insurance_plans ip - WHERE ((ip.id = insurance_plan_services.insurance_plan_id) AND (ip.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.insurance_plans ip - WHERE ((ip.id = insurance_plan_services.insurance_plan_id) AND (ip.owner_id = auth.uid()))))); - - --- --- Name: insurance_plans; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.insurance_plans ENABLE ROW LEVEL SECURITY; - --- --- Name: insurance_plans insurance_plans: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "insurance_plans: owner full access" ON public.insurance_plans USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: module_features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.module_features ENABLE ROW LEVEL SECURITY; - --- --- Name: module_features module_features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY module_features_read_authenticated ON public.module_features FOR SELECT TO authenticated USING (true); - - --- --- Name: module_features module_features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY module_features_write_saas_admin ON public.module_features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: modules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.modules ENABLE ROW LEVEL SECURITY; - --- --- Name: modules modules_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY modules_read_authenticated ON public.modules FOR SELECT TO authenticated USING (true); - - --- --- Name: modules modules_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY modules_write_saas_admin ON public.modules TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: owner_users; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.owner_users ENABLE ROW LEVEL SECURITY; - --- --- Name: owner_users owner_users: user can read own links; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "owner_users: user can read own links" ON public.owner_users FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: patient_discounts; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_discounts ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_discounts patient_discounts: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "patient_discounts: owner full access" ON public.patient_discounts USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_group_patient; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_group_patient ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_group_patient patient_group_patient_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_owner_all ON public.patient_group_patient TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.patients p - WHERE ((p.id = patient_group_patient.patient_id) AND (p.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.patients p - WHERE ((p.id = patient_group_patient.patient_id) AND (p.owner_id = auth.uid()))))); - - --- --- Name: patient_group_patient patient_group_patient_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_select ON public.patient_group_patient FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_group_patient patient_group_patient_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_write ON public.patient_group_patient USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_groups; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_groups ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_groups patient_groups_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_owner_all ON public.patient_groups TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_groups patient_groups_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_select ON public.patient_groups FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_groups patient_groups_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_write ON public.patient_groups USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_intake_requests; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_intake_requests ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_intake_requests patient_intake_requests_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_owner_all ON public.patient_intake_requests TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_intake_requests patient_intake_requests_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_select ON public.patient_intake_requests FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_intake_requests patient_intake_requests_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_write ON public.patient_intake_requests USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_invites; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_invites ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_invites patient_invites_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_owner_all ON public.patient_invites TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_invites patient_invites_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_select ON public.patient_invites FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_invites patient_invites_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_write ON public.patient_invites USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_patient_tag; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_patient_tag ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_patient_tag patient_patient_tag_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_owner_all ON public.patient_patient_tag TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_patient_tag patient_patient_tag_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_select ON public.patient_patient_tag FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_patient_tag patient_patient_tag_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_write ON public.patient_patient_tag USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_tags; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_tags ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_tags patient_tags_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_owner_all ON public.patient_tags TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_tags patient_tags_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_select ON public.patient_tags FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_tags patient_tags_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_write ON public.patient_tags USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patients; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patients ENABLE ROW LEVEL SECURITY; - --- --- Name: patients patients_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_delete ON public.patients FOR DELETE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.delete'::text))); - - --- --- Name: patients patients_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_insert ON public.patients FOR INSERT WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.create'::text))); - - --- --- Name: patients patients_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_owner_all ON public.patients TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patients patients_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_select ON public.patients FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patients patients_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_update ON public.patients FOR UPDATE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: payment_settings; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.payment_settings ENABLE ROW LEVEL SECURITY; - --- --- Name: payment_settings payment_settings: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "payment_settings: owner full access" ON public.payment_settings USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: plan_features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.plan_features ENABLE ROW LEVEL SECURITY; - --- --- Name: plan_features plan_features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plan_features_read_authenticated ON public.plan_features FOR SELECT TO authenticated USING (true); - - --- --- Name: plan_features plan_features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plan_features_write_saas_admin ON public.plan_features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: plans; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.plans ENABLE ROW LEVEL SECURITY; - --- --- Name: plans plans_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plans_read_authenticated ON public.plans FOR SELECT TO authenticated USING (true); - - --- --- Name: plans plans_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plans_write_saas_admin ON public.plans TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: professional_pricing; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.professional_pricing ENABLE ROW LEVEL SECURITY; - --- --- Name: professional_pricing professional_pricing: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "professional_pricing: owner full access" ON public.professional_pricing USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: profiles; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY; - --- --- Name: profiles profiles_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_insert_own ON public.profiles FOR INSERT WITH CHECK ((id = auth.uid())); - - --- --- Name: profiles profiles_read_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_read_saas_admin ON public.profiles FOR SELECT USING (public.is_saas_admin()); - - --- --- Name: profiles profiles_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_select_own ON public.profiles FOR SELECT USING ((id = auth.uid())); - - --- --- Name: profiles profiles_update_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_update_own ON public.profiles FOR UPDATE USING ((id = auth.uid())) WITH CHECK ((id = auth.uid())); - - --- --- Name: features read features (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read features (auth)" ON public.features FOR SELECT TO authenticated USING (true); - - --- --- Name: plan_features read plan_features (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read plan_features (auth)" ON public.plan_features FOR SELECT TO authenticated USING (true); - - --- --- Name: plans read plans (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read plans (auth)" ON public.plans FOR SELECT TO authenticated USING (true); - - --- --- Name: recurrence_exceptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_exceptions ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_exceptions recurrence_exceptions_tenant; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_exceptions_tenant ON public.recurrence_exceptions TO authenticated USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))) WITH CHECK ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: recurrence_rule_services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_rule_services ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_rule_services recurrence_rule_services: clinic read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "recurrence_rule_services: clinic read" ON public.recurrence_rule_services FOR SELECT USING ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND public.is_clinic_tenant(r.tenant_id) AND public.is_tenant_member(r.tenant_id) AND public.tenant_has_feature(r.tenant_id, 'agenda.view'::text))))); - - --- --- Name: recurrence_rule_services recurrence_rule_services: clinic write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "recurrence_rule_services: clinic write" ON public.recurrence_rule_services USING ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND public.is_clinic_tenant(r.tenant_id) AND public.is_tenant_member(r.tenant_id) AND public.tenant_has_feature(r.tenant_id, 'agenda.edit'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND public.is_clinic_tenant(r.tenant_id) AND public.is_tenant_member(r.tenant_id) AND public.tenant_has_feature(r.tenant_id, 'agenda.edit'::text))))); - - --- --- Name: recurrence_rule_services recurrence_rule_services: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "recurrence_rule_services: owner full access" ON public.recurrence_rule_services TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND (r.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND (r.owner_id = auth.uid()))))); - - --- --- Name: recurrence_rules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_rules ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_rules recurrence_rules_clinic_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_clinic_read ON public.recurrence_rules FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: recurrence_rules recurrence_rules_clinic_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_clinic_write ON public.recurrence_rules USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: recurrence_rules recurrence_rules_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_owner ON public.recurrence_rules TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: subscription_intents_legacy saas_admin can read subscription_intents; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "saas_admin can read subscription_intents" ON public.subscription_intents_legacy FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))); - - --- --- Name: subscription_intents_legacy saas_admin can update subscription_intents; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "saas_admin can update subscription_intents" ON public.subscription_intents_legacy FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))); - - --- --- Name: saas_docs saas_admin_full_access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY saas_admin_full_access ON public.saas_docs TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: saas_admins; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_admins ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_admins saas_admins_select_self; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY saas_admins_select_self ON public.saas_admins FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: saas_doc_votos; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_doc_votos ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_docs; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_docs ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_faq ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq_itens; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_faq_itens ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios select own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "select own" ON public.agenda_bloqueios FOR SELECT USING ((owner_id = auth.uid())); - - --- --- Name: services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.services ENABLE ROW LEVEL SECURITY; - --- --- Name: services services: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "services: owner full access" ON public.services USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: subscription_events; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscription_events ENABLE ROW LEVEL SECURITY; - --- --- Name: subscription_events subscription_events_read_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_events_read_saas ON public.subscription_events FOR SELECT USING (public.is_saas_admin()); - - --- --- Name: subscription_events subscription_events_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_events_write_saas ON public.subscription_events FOR INSERT WITH CHECK (public.is_saas_admin()); - - --- --- Name: subscription_intents_legacy subscription_intents_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_intents_insert_own ON public.subscription_intents_legacy FOR INSERT TO authenticated WITH CHECK ((user_id = auth.uid())); - - --- --- Name: subscription_intents_legacy; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscription_intents_legacy ENABLE ROW LEVEL SECURITY; - --- --- Name: subscription_intents_legacy subscription_intents_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_intents_select_own ON public.subscription_intents_legacy FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: subscriptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscriptions ENABLE ROW LEVEL SECURITY; - --- --- Name: subscriptions subscriptions read own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "subscriptions read own" ON public.subscriptions FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: subscriptions subscriptions: read if linked owner_users; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "subscriptions: read if linked owner_users" ON public.subscriptions FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.owner_users ou - WHERE ((ou.owner_id = subscriptions.user_id) AND (ou.user_id = auth.uid()))))); - - --- --- Name: subscriptions subscriptions_insert_own_personal; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_insert_own_personal ON public.subscriptions FOR INSERT TO authenticated WITH CHECK (((user_id = auth.uid()) AND (tenant_id IS NULL))); - - --- --- Name: subscriptions subscriptions_no_direct_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_no_direct_update ON public.subscriptions FOR UPDATE TO authenticated USING (false) WITH CHECK (false); - - --- --- Name: subscriptions subscriptions_read_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_read_own ON public.subscriptions FOR SELECT TO authenticated USING (((user_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: subscriptions subscriptions_select_for_tenant_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_select_for_tenant_members ON public.subscriptions FOR SELECT TO authenticated USING (((tenant_id IS NOT NULL) AND (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = subscriptions.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: subscriptions subscriptions_select_own_personal; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_select_own_personal ON public.subscriptions FOR SELECT TO authenticated USING (((user_id = auth.uid()) AND (tenant_id IS NULL))); - - --- --- Name: subscriptions subscriptions_update_only_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_update_only_saas_admin ON public.subscriptions FOR UPDATE TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: support_sessions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.support_sessions ENABLE ROW LEVEL SECURITY; - --- --- Name: support_sessions support_sessions_saas_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_delete ON public.support_sessions FOR DELETE USING (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: support_sessions support_sessions_saas_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_insert ON public.support_sessions FOR INSERT WITH CHECK (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: support_sessions support_sessions_saas_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_select ON public.support_sessions FOR SELECT USING (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: tenant_members; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenant_members ENABLE ROW LEVEL SECURITY; - --- --- Name: tenant_members tenant_members_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_members_write_saas ON public.tenant_members TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenant_modules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenant_modules ENABLE ROW LEVEL SECURITY; - --- --- Name: tenant_modules tenant_modules_read_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_modules_read_own ON public.tenant_modules FOR SELECT TO authenticated USING (((owner_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: tenant_modules tenant_modules_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_modules_write_saas ON public.tenant_modules TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenants; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenants ENABLE ROW LEVEL SECURITY; - --- --- Name: tenants tenants_read_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenants_read_members ON public.tenants FOR SELECT TO authenticated USING ((public.is_saas_admin() OR (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = tenants.id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: tenants tenants_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenants_write_saas ON public.tenants TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenant_members tm_select_admin_all_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tm_select_admin_all_members ON public.tenant_members FOR SELECT TO authenticated USING (public.is_tenant_admin(tenant_id)); - - --- --- Name: tenant_members tm_select_own_membership; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tm_select_own_membership ON public.tenant_members FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: agenda_bloqueios update own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "update own" ON public.agenda_bloqueios FOR UPDATE USING ((owner_id = auth.uid())); - - --- --- Name: user_settings; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.user_settings ENABLE ROW LEVEL SECURITY; - --- --- Name: user_settings user_settings_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_insert_own ON public.user_settings FOR INSERT WITH CHECK ((user_id = auth.uid())); - - --- --- Name: user_settings user_settings_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_select_own ON public.user_settings FOR SELECT USING ((user_id = auth.uid())); - - --- --- Name: user_settings user_settings_update_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_update_own ON public.user_settings FOR UPDATE USING ((user_id = auth.uid())) WITH CHECK ((user_id = auth.uid())); - - --- --- Name: saas_docs users_read_usuario_docs; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY users_read_usuario_docs ON public.saas_docs FOR SELECT TO authenticated USING (((ativo = true) AND (tipo_acesso = 'usuario'::text))); - - --- --- Name: saas_doc_votos votos_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY votos_select_own ON public.saas_doc_votos FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: saas_doc_votos votos_upsert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY votos_upsert_own ON public.saas_doc_votos TO authenticated USING ((user_id = auth.uid())) WITH CHECK ((user_id = auth.uid())); - - --- --- Name: messages; Type: ROW SECURITY; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY; - --- --- Name: objects agendador_storage_owner_delete; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_delete ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_owner_insert; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_insert ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_owner_update; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_update ON storage.objects FOR UPDATE TO authenticated USING (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_public_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_public_read ON storage.objects FOR SELECT USING ((bucket_id = 'agendador'::text)); - - --- --- Name: objects avatars_delete_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_delete_own ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_delete_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_delete_own_folder ON storage.objects FOR DELETE USING (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: objects avatars_insert_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_insert_own ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_insert_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_insert_own_folder ON storage.objects FOR INSERT WITH CHECK (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: objects avatars_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_read ON storage.objects FOR SELECT USING ((bucket_id = 'avatars'::text)); - - --- --- Name: objects avatars_select_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_select_own ON storage.objects FOR SELECT TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_update_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_update_own ON storage.objects FOR UPDATE TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))) WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_update_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_update_own_folder ON storage.objects FOR UPDATE USING (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))) WITH CHECK (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: buckets; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets ENABLE ROW LEVEL SECURITY; - --- --- Name: buckets_analytics; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets_analytics ENABLE ROW LEVEL SECURITY; - --- --- Name: buckets_vectors; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets_vectors ENABLE ROW LEVEL SECURITY; - --- --- Name: iceberg_namespaces; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.iceberg_namespaces ENABLE ROW LEVEL SECURITY; - --- --- Name: iceberg_tables; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.iceberg_tables ENABLE ROW LEVEL SECURITY; - --- --- Name: objects intake_read_anon; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_read_anon ON storage.objects FOR SELECT TO anon USING (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_read_public; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_read_public ON storage.objects FOR SELECT USING (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_upload_anon; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_upload_anon ON storage.objects FOR INSERT TO anon WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_upload_public; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_upload_public ON storage.objects FOR INSERT WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: migrations; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: objects; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY; - --- --- Name: objects public_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY public_read ON storage.objects FOR SELECT USING ((bucket_id = 'saas-docs'::text)); - - --- --- Name: s3_multipart_uploads; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.s3_multipart_uploads ENABLE ROW LEVEL SECURITY; - --- --- Name: s3_multipart_uploads_parts; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.s3_multipart_uploads_parts ENABLE ROW LEVEL SECURITY; - --- --- Name: objects saas_admin_delete; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY saas_admin_delete ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'saas-docs'::text) AND (EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid()))))); - - --- --- Name: objects saas_admin_upload; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY saas_admin_upload ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'saas-docs'::text) AND (EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid()))))); - - --- --- Name: vector_indexes; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.vector_indexes ENABLE ROW LEVEL SECURITY; - --- --- Name: supabase_realtime; Type: PUBLICATION; Schema: -; Owner: postgres --- - -CREATE PUBLICATION supabase_realtime WITH (publish = 'insert, update, delete, truncate'); - - -ALTER PUBLICATION supabase_realtime OWNER TO postgres; - --- --- Name: SCHEMA auth; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA auth TO anon; -GRANT USAGE ON SCHEMA auth TO authenticated; -GRANT USAGE ON SCHEMA auth TO service_role; -GRANT ALL ON SCHEMA auth TO supabase_auth_admin; -GRANT ALL ON SCHEMA auth TO dashboard_user; -GRANT USAGE ON SCHEMA auth TO postgres; - - --- --- Name: SCHEMA extensions; Type: ACL; Schema: -; Owner: postgres --- - -GRANT USAGE ON SCHEMA extensions TO anon; -GRANT USAGE ON SCHEMA extensions TO authenticated; -GRANT USAGE ON SCHEMA extensions TO service_role; -GRANT ALL ON SCHEMA extensions TO dashboard_user; - - --- --- Name: SCHEMA net; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA net TO supabase_functions_admin; -GRANT USAGE ON SCHEMA net TO postgres; -GRANT USAGE ON SCHEMA net TO anon; -GRANT USAGE ON SCHEMA net TO authenticated; -GRANT USAGE ON SCHEMA net TO service_role; - - --- --- Name: SCHEMA public; Type: ACL; Schema: -; Owner: pg_database_owner --- - -GRANT USAGE ON SCHEMA public TO postgres; -GRANT USAGE ON SCHEMA public TO anon; -GRANT USAGE ON SCHEMA public TO authenticated; -GRANT USAGE ON SCHEMA public TO service_role; - - --- --- Name: SCHEMA realtime; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA realtime TO postgres; -GRANT USAGE ON SCHEMA realtime TO anon; -GRANT USAGE ON SCHEMA realtime TO authenticated; -GRANT USAGE ON SCHEMA realtime TO service_role; -GRANT ALL ON SCHEMA realtime TO supabase_realtime_admin; - - --- --- Name: SCHEMA storage; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA storage TO postgres WITH GRANT OPTION; -GRANT USAGE ON SCHEMA storage TO anon; -GRANT USAGE ON SCHEMA storage TO authenticated; -GRANT USAGE ON SCHEMA storage TO service_role; -GRANT ALL ON SCHEMA storage TO supabase_storage_admin WITH GRANT OPTION; -GRANT ALL ON SCHEMA storage TO dashboard_user; - - --- --- Name: SCHEMA supabase_functions; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA supabase_functions TO postgres; -GRANT USAGE ON SCHEMA supabase_functions TO anon; -GRANT USAGE ON SCHEMA supabase_functions TO authenticated; -GRANT USAGE ON SCHEMA supabase_functions TO service_role; -GRANT ALL ON SCHEMA supabase_functions TO supabase_functions_admin; - - --- --- Name: SCHEMA vault; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA vault TO postgres WITH GRANT OPTION; -GRANT USAGE ON SCHEMA vault TO service_role; - - --- --- Name: FUNCTION citextin(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextin(cstring) TO postgres; -GRANT ALL ON FUNCTION public.citextin(cstring) TO anon; -GRANT ALL ON FUNCTION public.citextin(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.citextin(cstring) TO service_role; - - --- --- Name: FUNCTION citextout(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextout(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO service_role; - - --- --- Name: FUNCTION citextrecv(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextrecv(internal) TO postgres; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO anon; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO authenticated; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO service_role; - - --- --- Name: FUNCTION citextsend(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO service_role; - - --- --- Name: FUNCTION gbtreekey16_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey16_out(public.gbtreekey16); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO service_role; - - --- --- Name: FUNCTION gbtreekey2_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey2_out(public.gbtreekey2); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO service_role; - - --- --- Name: FUNCTION gbtreekey32_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey32_out(public.gbtreekey32); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO service_role; - - --- --- Name: FUNCTION gbtreekey4_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey4_out(public.gbtreekey4); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO service_role; - - --- --- Name: FUNCTION gbtreekey8_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey8_out(public.gbtreekey8); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO service_role; - - --- --- Name: FUNCTION gbtreekey_var_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey_var_out(public.gbtreekey_var); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO service_role; - - --- --- Name: FUNCTION gtrgm_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO service_role; - - --- --- Name: FUNCTION gtrgm_out(public.gtrgm); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO service_role; - - --- --- Name: FUNCTION citext(boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(boolean) TO postgres; -GRANT ALL ON FUNCTION public.citext(boolean) TO anon; -GRANT ALL ON FUNCTION public.citext(boolean) TO authenticated; -GRANT ALL ON FUNCTION public.citext(boolean) TO service_role; - - --- --- Name: FUNCTION citext(character); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(character) TO postgres; -GRANT ALL ON FUNCTION public.citext(character) TO anon; -GRANT ALL ON FUNCTION public.citext(character) TO authenticated; -GRANT ALL ON FUNCTION public.citext(character) TO service_role; - - --- --- Name: FUNCTION citext(inet); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(inet) TO postgres; -GRANT ALL ON FUNCTION public.citext(inet) TO anon; -GRANT ALL ON FUNCTION public.citext(inet) TO authenticated; -GRANT ALL ON FUNCTION public.citext(inet) TO service_role; - - --- --- Name: FUNCTION email(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.email() TO dashboard_user; - - --- --- Name: FUNCTION jwt(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.jwt() TO postgres; -GRANT ALL ON FUNCTION auth.jwt() TO dashboard_user; - - --- --- Name: FUNCTION role(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.role() TO dashboard_user; - - --- --- Name: FUNCTION uid(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.uid() TO dashboard_user; - - --- --- Name: FUNCTION armor(bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.armor(bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.armor(bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION armor(bytea, text[], text[]); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.armor(bytea, text[], text[]) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.armor(bytea, text[], text[]) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION crypt(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.crypt(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.crypt(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION dearmor(text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.dearmor(text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.dearmor(text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION decrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.decrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.decrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION decrypt_iv(bytea, bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.decrypt_iv(bytea, bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.decrypt_iv(bytea, bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION digest(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.digest(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.digest(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION digest(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.digest(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.digest(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION encrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.encrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.encrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION encrypt_iv(bytea, bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.encrypt_iv(bytea, bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.encrypt_iv(bytea, bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_random_bytes(integer); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_random_bytes(integer) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_random_bytes(integer) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_random_uuid(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_random_uuid() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_random_uuid() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_salt(text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_salt(text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_salt(text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_salt(text, integer); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_salt(text, integer) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_salt(text, integer) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION grant_pg_cron_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION extensions.grant_pg_cron_access() FROM supabase_admin; -GRANT ALL ON FUNCTION extensions.grant_pg_cron_access() TO supabase_admin WITH GRANT OPTION; -GRANT ALL ON FUNCTION extensions.grant_pg_cron_access() TO dashboard_user; - - --- --- Name: FUNCTION grant_pg_graphql_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.grant_pg_graphql_access() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION grant_pg_net_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION extensions.grant_pg_net_access() FROM supabase_admin; -GRANT ALL ON FUNCTION extensions.grant_pg_net_access() TO supabase_admin WITH GRANT OPTION; -GRANT ALL ON FUNCTION extensions.grant_pg_net_access() TO dashboard_user; - - --- --- Name: FUNCTION hmac(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.hmac(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.hmac(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION hmac(text, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.hmac(text, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.hmac(text, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT shared_blk_read_time double precision, OUT shared_blk_write_time double precision, OUT local_blk_read_time double precision, OUT local_blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision, OUT jit_deform_count bigint, OUT jit_deform_time double precision, OUT stats_since timestamp with time zone, OUT minmax_stats_since timestamp with time zone); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT shared_blk_read_time double precision, OUT shared_blk_write_time double precision, OUT local_blk_read_time double precision, OUT local_blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision, OUT jit_deform_count bigint, OUT jit_deform_time double precision, OUT stats_since timestamp with time zone, OUT minmax_stats_since timestamp with time zone) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements_reset(userid oid, dbid oid, queryid bigint, minmax_only boolean); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements_reset(userid oid, dbid oid, queryid bigint, minmax_only boolean) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_armor_headers(text, OUT key text, OUT value text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_armor_headers(text, OUT key text, OUT value text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_armor_headers(text, OUT key text, OUT value text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_key_id(bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_key_id(bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_key_id(bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt(text, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt(text, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt_bytea(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt_bytea(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt_bytea(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt_bytea(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt(text, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt_bytea(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt_bytea(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgrst_ddl_watch(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgrst_ddl_watch() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgrst_drop_watch(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgrst_drop_watch() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION set_graphql_placeholder(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.set_graphql_placeholder() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v1(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v1() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v1() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v1mc(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v1mc() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v1mc() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v3(namespace uuid, name text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v3(namespace uuid, name text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v3(namespace uuid, name text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v4(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v4() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v4() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v5(namespace uuid, name text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v5(namespace uuid, name text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v5(namespace uuid, name text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_nil(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_nil() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_nil() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_dns(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_dns() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_dns() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_oid(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_oid() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_oid() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_url(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_url() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_url() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_x500(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_x500() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_x500() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION graphql("operationName" text, query text, variables jsonb, extensions jsonb); Type: ACL; Schema: graphql_public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO postgres; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO anon; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO authenticated; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO service_role; - - --- --- Name: FUNCTION http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer); Type: ACL; Schema: net; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO anon; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO authenticated; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO service_role; - - --- --- Name: FUNCTION http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer); Type: ACL; Schema: net; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO anon; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO authenticated; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO service_role; - - --- --- Name: FUNCTION pg_reload_conf(); Type: ACL; Schema: pg_catalog; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION pg_catalog.pg_reload_conf() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION get_auth(p_usename text); Type: ACL; Schema: pgbouncer; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION pgbouncer.get_auth(p_usename text) FROM PUBLIC; -GRANT ALL ON FUNCTION pgbouncer.get_auth(p_usename text) TO pgbouncer; - - --- --- Name: FUNCTION __rls_ping(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.__rls_ping() TO postgres; -GRANT ALL ON FUNCTION public.__rls_ping() TO anon; -GRANT ALL ON FUNCTION public.__rls_ping() TO authenticated; -GRANT ALL ON FUNCTION public.__rls_ping() TO service_role; - - --- --- Name: TABLE subscriptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscriptions TO postgres; -GRANT ALL ON TABLE public.subscriptions TO anon; -GRANT ALL ON TABLE public.subscriptions TO authenticated; -GRANT ALL ON TABLE public.subscriptions TO service_role; - - --- --- Name: FUNCTION activate_subscription_from_intent(p_intent_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO anon; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO service_role; - - --- --- Name: FUNCTION admin_fix_plan_target(p_plan_key text, p_new_target text); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) FROM PUBLIC; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO postgres; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO anon; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO authenticated; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO service_role; - - --- --- Name: FUNCTION agenda_cfg_sync(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO postgres; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO anon; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO authenticated; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO service_role; - - --- --- Name: FUNCTION agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO postgres; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO anon; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO authenticated; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO service_role; - - --- --- Name: FUNCTION agendador_gerar_slug(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO postgres; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO anon; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO authenticated; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO service_role; - - --- --- Name: FUNCTION agendador_slots_disponiveis(p_slug text, p_data date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO postgres; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO anon; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO authenticated; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO service_role; - - --- --- Name: FUNCTION cancel_recurrence_from(p_recurrence_id uuid, p_from_date date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO postgres; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO anon; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO authenticated; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO service_role; - - --- --- Name: FUNCTION cancel_subscription(p_subscription_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO anon; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO service_role; - - --- --- Name: FUNCTION cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO postgres; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO anon; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO authenticated; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO service_role; - - --- --- Name: FUNCTION cash_dist(money, money); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO postgres; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO anon; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO authenticated; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO service_role; - - --- --- Name: FUNCTION change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO anon; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO service_role; - - --- --- Name: FUNCTION citext_cmp(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_eq(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_ge(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_gt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_hash(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO service_role; - - --- --- Name: FUNCTION citext_hash_extended(public.citext, bigint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO postgres; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO anon; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO authenticated; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO service_role; - - --- --- Name: FUNCTION citext_larger(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_le(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_lt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_ne(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_cmp(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_ge(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_gt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_le(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_lt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_smaller(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION create_clinic_tenant(p_name text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO postgres; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO anon; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO authenticated; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO service_role; - - --- --- Name: FUNCTION create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO postgres; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO anon; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO authenticated; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO service_role; - - --- --- Name: FUNCTION create_patient_intake_request_v2(p_token text, p_payload jsonb); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) FROM PUBLIC; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO postgres; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO anon; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO authenticated; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO service_role; - - --- --- Name: FUNCTION create_support_session(p_tenant_id uuid, p_ttl_minutes integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO postgres; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO anon; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO authenticated; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO service_role; - - --- --- Name: FUNCTION current_member_id(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION current_member_role(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION date_dist(date, date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.date_dist(date, date) TO postgres; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO anon; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO authenticated; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO service_role; - - --- --- Name: FUNCTION delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid); Type: ACL; Schema: public; Owner: postgres --- - -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO anon; -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO service_role; - - --- --- Name: FUNCTION delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO anon; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO service_role; - - --- --- Name: FUNCTION dev_list_auth_users(p_limit integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO postgres; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO anon; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO service_role; - - --- --- Name: FUNCTION dev_list_custom_users(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.dev_list_custom_users() FROM PUBLIC; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO postgres; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO anon; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO service_role; - - --- --- Name: FUNCTION dev_list_intent_leads(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.dev_list_intent_leads() FROM PUBLIC; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO postgres; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO anon; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO service_role; - - --- --- Name: FUNCTION dev_public_debug_snapshot(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO postgres; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO anon; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO authenticated; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO service_role; - - --- --- Name: FUNCTION ensure_personal_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO postgres; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO anon; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO service_role; - - --- --- Name: FUNCTION ensure_personal_tenant_for_user(p_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO service_role; - - --- --- Name: FUNCTION faq_votar(faq_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO anon; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO service_role; - - --- --- Name: FUNCTION fix_all_subscription_mismatches(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO postgres; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO anon; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO authenticated; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO service_role; - - --- --- Name: FUNCTION float4_dist(real, real); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO postgres; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO anon; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO authenticated; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO service_role; - - --- --- Name: FUNCTION float8_dist(double precision, double precision); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO postgres; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO anon; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO authenticated; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO service_role; - - --- --- Name: FUNCTION fn_agenda_regras_semanais_no_overlap(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO postgres; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO anon; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO authenticated; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO service_role; - - --- --- Name: FUNCTION gbt_bit_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_consistent(internal, bit, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_consistent(internal, boolean, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bpchar_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bpchar_consistent(internal, character, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_consistent(internal, bytea, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_consistent(internal, money, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_distance(internal, money, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_consistent(internal, date, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_distance(internal, date, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_consistent(internal, anyenum, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_consistent(internal, real, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_distance(internal, real, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_consistent(internal, double precision, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_distance(internal, double precision, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_consistent(internal, inet, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_consistent(internal, smallint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_distance(internal, smallint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_consistent(internal, integer, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_distance(internal, integer, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_consistent(internal, bigint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_distance(internal, bigint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_consistent(internal, interval, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_distance(internal, interval, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_consistent(internal, macaddr, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_consistent(internal, numeric, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_consistent(internal, oid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_distance(internal, oid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_consistent(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_distance(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_timetz_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_consistent(internal, uuid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_var_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_var_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO service_role; - - --- --- Name: FUNCTION get_my_email(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.get_my_email() FROM PUBLIC; -GRANT ALL ON FUNCTION public.get_my_email() TO postgres; -GRANT ALL ON FUNCTION public.get_my_email() TO anon; -GRANT ALL ON FUNCTION public.get_my_email() TO authenticated; -GRANT ALL ON FUNCTION public.get_my_email() TO service_role; - - --- --- Name: FUNCTION gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gin_extract_value_trgm(text, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO service_role; - - --- --- Name: FUNCTION gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_distance(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_options(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_same(public.gtrgm, public.gtrgm, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION guard_account_type_immutable(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO postgres; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO anon; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO authenticated; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO service_role; - - --- --- Name: FUNCTION guard_locked_commitment(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO postgres; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO anon; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO authenticated; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO service_role; - - --- --- Name: FUNCTION guard_no_change_core_plan_key(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO anon; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO service_role; - - --- --- Name: FUNCTION guard_no_change_plan_target(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO anon; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO service_role; - - --- --- Name: FUNCTION guard_no_delete_core_plans(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO anon; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO service_role; - - --- --- Name: FUNCTION guard_patient_cannot_own_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO postgres; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO anon; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO service_role; - - --- --- Name: FUNCTION guard_tenant_kind_immutable(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO postgres; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO anon; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO authenticated; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO service_role; - - --- --- Name: FUNCTION handle_new_user(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.handle_new_user() TO postgres; -GRANT ALL ON FUNCTION public.handle_new_user() TO anon; -GRANT ALL ON FUNCTION public.handle_new_user() TO authenticated; -GRANT ALL ON FUNCTION public.handle_new_user() TO service_role; - - --- --- Name: FUNCTION handle_new_user_create_personal_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO postgres; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO anon; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO service_role; - - --- --- Name: FUNCTION has_feature(p_owner_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION int2_dist(smallint, smallint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO postgres; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO anon; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO authenticated; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO service_role; - - --- --- Name: FUNCTION int4_dist(integer, integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO postgres; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO anon; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO authenticated; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO service_role; - - --- --- Name: FUNCTION int8_dist(bigint, bigint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO postgres; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO anon; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO authenticated; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO service_role; - - --- --- Name: FUNCTION interval_dist(interval, interval); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO postgres; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO anon; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO authenticated; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO service_role; - - --- --- Name: FUNCTION is_clinic_tenant(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_saas_admin(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_saas_admin() TO postgres; -GRANT ALL ON FUNCTION public.is_saas_admin() TO anon; -GRANT ALL ON FUNCTION public.is_saas_admin() TO authenticated; -GRANT ALL ON FUNCTION public.is_saas_admin() TO service_role; - - --- --- Name: FUNCTION is_tenant_admin(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_tenant_member(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_therapist_tenant(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION jwt_email(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.jwt_email() TO postgres; -GRANT ALL ON FUNCTION public.jwt_email() TO anon; -GRANT ALL ON FUNCTION public.jwt_email() TO authenticated; -GRANT ALL ON FUNCTION public.jwt_email() TO service_role; - - --- --- Name: FUNCTION my_tenants(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.my_tenants() TO postgres; -GRANT ALL ON FUNCTION public.my_tenants() TO anon; -GRANT ALL ON FUNCTION public.my_tenants() TO authenticated; -GRANT ALL ON FUNCTION public.my_tenants() TO service_role; - - --- --- Name: FUNCTION oid_dist(oid, oid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO postgres; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO anon; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO authenticated; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO service_role; - - --- --- Name: FUNCTION on_new_user_seed_patient_groups(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO postgres; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO anon; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO authenticated; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO service_role; - - --- --- Name: FUNCTION patients_validate_member_consistency(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO postgres; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO anon; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO authenticated; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO service_role; - - --- --- Name: FUNCTION patients_validate_responsible_member_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO postgres; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO anon; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO service_role; - - --- --- Name: FUNCTION prevent_promoting_to_system(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO postgres; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO anon; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO service_role; - - --- --- Name: FUNCTION prevent_saas_membership(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO postgres; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO anon; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO service_role; - - --- --- Name: FUNCTION prevent_system_group_changes(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO postgres; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO anon; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO service_role; - - --- --- Name: FUNCTION provision_account_tenant(p_user_id uuid, p_kind text, p_name text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO postgres; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO anon; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO authenticated; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO service_role; - - --- --- Name: FUNCTION reactivate_subscription(p_subscription_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO anon; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO service_role; - - --- --- Name: FUNCTION rebuild_owner_entitlements(p_owner_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO anon; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO service_role; - - --- --- Name: FUNCTION regexp_match(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_match(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_matches(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_matches(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_replace(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_replace(public.citext, public.citext, text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_array(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_array(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_table(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_table(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION replace(public.citext, public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION revoke_support_session(p_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO postgres; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO anon; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO authenticated; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO service_role; - - --- --- Name: FUNCTION rotate_patient_invite_token(p_new_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO postgres; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO anon; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO authenticated; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO service_role; - - --- --- Name: FUNCTION saas_votar_doc(p_doc_id uuid, p_util boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO postgres; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO anon; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO authenticated; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO service_role; - - --- --- Name: FUNCTION seed_determined_commitments(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION set_insurance_plans_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO service_role; - - --- --- Name: FUNCTION set_limit(real); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_limit(real) TO postgres; -GRANT ALL ON FUNCTION public.set_limit(real) TO anon; -GRANT ALL ON FUNCTION public.set_limit(real) TO authenticated; -GRANT ALL ON FUNCTION public.set_limit(real) TO service_role; - - --- --- Name: FUNCTION set_owner_id(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_owner_id() TO postgres; -GRANT ALL ON FUNCTION public.set_owner_id() TO anon; -GRANT ALL ON FUNCTION public.set_owner_id() TO authenticated; -GRANT ALL ON FUNCTION public.set_owner_id() TO service_role; - - --- --- Name: FUNCTION set_services_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_services_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_services_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_services_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_services_updated_at() TO service_role; - - --- --- Name: FUNCTION set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO postgres; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO anon; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO authenticated; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO service_role; - - --- --- Name: FUNCTION set_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_updated_at() TO service_role; - - --- --- Name: FUNCTION set_updated_at_recurrence(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO postgres; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO anon; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO authenticated; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO service_role; - - --- --- Name: FUNCTION show_limit(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.show_limit() TO postgres; -GRANT ALL ON FUNCTION public.show_limit() TO anon; -GRANT ALL ON FUNCTION public.show_limit() TO authenticated; -GRANT ALL ON FUNCTION public.show_limit() TO service_role; - - --- --- Name: FUNCTION show_trgm(text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.show_trgm(text) TO postgres; -GRANT ALL ON FUNCTION public.show_trgm(text) TO anon; -GRANT ALL ON FUNCTION public.show_trgm(text) TO authenticated; -GRANT ALL ON FUNCTION public.show_trgm(text) TO service_role; - - --- --- Name: FUNCTION similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity(text, text) TO service_role; - - --- --- Name: FUNCTION similarity_dist(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO service_role; - - --- --- Name: FUNCTION similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION split_part(public.citext, public.citext, integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO postgres; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO anon; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO authenticated; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO service_role; - - --- --- Name: FUNCTION split_recurrence_at(p_recurrence_id uuid, p_from_date date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO postgres; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO anon; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO authenticated; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_dist_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_dist_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION strpos(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION subscription_intents_view_insert(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO postgres; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO anon; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO authenticated; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO service_role; - - --- --- Name: FUNCTION subscriptions_validate_scope(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO postgres; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO anon; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO authenticated; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO service_role; - - --- --- Name: FUNCTION sync_busy_mirror_agenda_eventos(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO postgres; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO anon; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO authenticated; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO service_role; - - --- --- Name: FUNCTION tenant_accept_invite(p_token uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO service_role; - - --- --- Name: TABLE tenant_members; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_members TO postgres; -GRANT SELECT,REFERENCES,TRIGGER,TRUNCATE,MAINTAIN ON TABLE public.tenant_members TO authenticated; -GRANT ALL ON TABLE public.tenant_members TO service_role; - - --- --- Name: FUNCTION tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_feature_allowed(p_tenant_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION tenant_feature_enabled(p_tenant_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION tenant_features_guard_with_plan(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO postgres; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO anon; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO authenticated; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO service_role; - - --- --- Name: FUNCTION tenant_has_feature(_tenant_id uuid, _feature text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO anon; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO service_role; - - --- --- Name: FUNCTION tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) FROM PUBLIC; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO anon; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO service_role; - - --- --- Name: FUNCTION tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO service_role; - - --- --- Name: FUNCTION texticlike(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticlike(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticnlike(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticnlike(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticregexeq(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticregexeq(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticregexne(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticregexne(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION time_dist(time without time zone, time without time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO postgres; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO anon; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO authenticated; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO service_role; - - --- --- Name: FUNCTION toggle_plan(owner uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO postgres; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO anon; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO authenticated; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO service_role; - - --- --- Name: FUNCTION transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO postgres; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO anon; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO authenticated; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO service_role; - - --- --- Name: FUNCTION translate(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION ts_dist(timestamp without time zone, timestamp without time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO postgres; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO anon; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO authenticated; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO service_role; - - --- --- Name: FUNCTION tstz_dist(timestamp with time zone, timestamp with time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO postgres; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO anon; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO authenticated; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO service_role; - - --- --- Name: FUNCTION update_payment_settings_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO anon; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO service_role; - - --- --- Name: FUNCTION update_professional_pricing_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO anon; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO service_role; - - --- --- Name: FUNCTION user_has_feature(_user_id uuid, _feature text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO postgres; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO anon; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO authenticated; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO service_role; - - --- --- Name: FUNCTION validate_support_session(p_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO postgres; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO anon; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO authenticated; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO service_role; - - --- --- Name: FUNCTION whoami(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.whoami() TO postgres; -GRANT ALL ON FUNCTION public.whoami() TO anon; -GRANT ALL ON FUNCTION public.whoami() TO authenticated; -GRANT ALL ON FUNCTION public.whoami() TO service_role; - - --- --- Name: FUNCTION word_similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_dist_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_dist_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION apply_rls(wal jsonb, max_record_bytes integer); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO postgres; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO anon; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO authenticated; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO service_role; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO supabase_realtime_admin; - - --- --- Name: FUNCTION broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) TO postgres; -GRANT ALL ON FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) TO dashboard_user; - - --- --- Name: FUNCTION build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO postgres; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO anon; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO authenticated; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO service_role; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO supabase_realtime_admin; - - --- --- Name: FUNCTION "cast"(val text, type_ regtype); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO postgres; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO dashboard_user; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO anon; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO authenticated; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO service_role; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO supabase_realtime_admin; - - --- --- Name: FUNCTION check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO postgres; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO anon; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO authenticated; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO service_role; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO supabase_realtime_admin; - - --- --- Name: FUNCTION is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO postgres; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO anon; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO authenticated; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO service_role; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO supabase_realtime_admin; - - --- --- Name: FUNCTION list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO postgres; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO anon; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO authenticated; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO service_role; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO supabase_realtime_admin; - - --- --- Name: FUNCTION quote_wal2json(entity regclass); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO postgres; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO anon; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO authenticated; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO service_role; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO supabase_realtime_admin; - - --- --- Name: FUNCTION send(payload jsonb, event text, topic text, private boolean); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) TO postgres; -GRANT ALL ON FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) TO dashboard_user; - - --- --- Name: FUNCTION subscription_check_filters(); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO postgres; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO dashboard_user; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO anon; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO authenticated; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO service_role; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO supabase_realtime_admin; - - --- --- Name: FUNCTION to_regrole(role_name text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO postgres; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO anon; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO authenticated; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO service_role; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO supabase_realtime_admin; - - --- --- Name: FUNCTION topic(); Type: ACL; Schema: realtime; Owner: supabase_realtime_admin --- - -GRANT ALL ON FUNCTION realtime.topic() TO postgres; -GRANT ALL ON FUNCTION realtime.topic() TO dashboard_user; - - --- --- Name: FUNCTION http_request(); Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -REVOKE ALL ON FUNCTION supabase_functions.http_request() FROM PUBLIC; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO postgres; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO anon; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO authenticated; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO service_role; - - --- --- Name: FUNCTION _crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault._crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault._crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea) TO service_role; - - --- --- Name: FUNCTION create_secret(new_secret text, new_name text, new_description text, new_key_id uuid); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault.create_secret(new_secret text, new_name text, new_description text, new_key_id uuid) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault.create_secret(new_secret text, new_name text, new_description text, new_key_id uuid) TO service_role; - - --- --- Name: FUNCTION update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault.update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault.update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid) TO service_role; - - --- --- Name: FUNCTION max(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.max(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.max(public.citext) TO anon; -GRANT ALL ON FUNCTION public.max(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.max(public.citext) TO service_role; - - --- --- Name: FUNCTION min(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.min(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.min(public.citext) TO anon; -GRANT ALL ON FUNCTION public.min(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.min(public.citext) TO service_role; - - --- --- Name: TABLE audit_log_entries; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.audit_log_entries TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.audit_log_entries TO postgres; -GRANT SELECT ON TABLE auth.audit_log_entries TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE flow_state; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.flow_state TO postgres; -GRANT SELECT ON TABLE auth.flow_state TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.flow_state TO dashboard_user; - - --- --- Name: TABLE identities; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.identities TO postgres; -GRANT SELECT ON TABLE auth.identities TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.identities TO dashboard_user; - - --- --- Name: TABLE instances; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.instances TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.instances TO postgres; -GRANT SELECT ON TABLE auth.instances TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE mfa_amr_claims; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_amr_claims TO postgres; -GRANT SELECT ON TABLE auth.mfa_amr_claims TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_amr_claims TO dashboard_user; - - --- --- Name: TABLE mfa_challenges; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_challenges TO postgres; -GRANT SELECT ON TABLE auth.mfa_challenges TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_challenges TO dashboard_user; - - --- --- Name: TABLE mfa_factors; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_factors TO postgres; -GRANT SELECT ON TABLE auth.mfa_factors TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_factors TO dashboard_user; - - --- --- Name: TABLE oauth_authorizations; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_authorizations TO postgres; -GRANT ALL ON TABLE auth.oauth_authorizations TO dashboard_user; - - --- --- Name: TABLE oauth_client_states; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_client_states TO postgres; -GRANT ALL ON TABLE auth.oauth_client_states TO dashboard_user; - - --- --- Name: TABLE oauth_clients; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_clients TO postgres; -GRANT ALL ON TABLE auth.oauth_clients TO dashboard_user; - - --- --- Name: TABLE oauth_consents; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_consents TO postgres; -GRANT ALL ON TABLE auth.oauth_consents TO dashboard_user; - - --- --- Name: TABLE one_time_tokens; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.one_time_tokens TO postgres; -GRANT SELECT ON TABLE auth.one_time_tokens TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.one_time_tokens TO dashboard_user; - - --- --- Name: TABLE refresh_tokens; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.refresh_tokens TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.refresh_tokens TO postgres; -GRANT SELECT ON TABLE auth.refresh_tokens TO postgres WITH GRANT OPTION; - - --- --- Name: SEQUENCE refresh_tokens_id_seq; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO dashboard_user; -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO postgres; - - --- --- Name: TABLE saml_providers; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.saml_providers TO postgres; -GRANT SELECT ON TABLE auth.saml_providers TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.saml_providers TO dashboard_user; - - --- --- Name: TABLE saml_relay_states; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.saml_relay_states TO postgres; -GRANT SELECT ON TABLE auth.saml_relay_states TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.saml_relay_states TO dashboard_user; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT SELECT ON TABLE auth.schema_migrations TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE sessions; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sessions TO postgres; -GRANT SELECT ON TABLE auth.sessions TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sessions TO dashboard_user; - - --- --- Name: TABLE sso_domains; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sso_domains TO postgres; -GRANT SELECT ON TABLE auth.sso_domains TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sso_domains TO dashboard_user; - - --- --- Name: TABLE sso_providers; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sso_providers TO postgres; -GRANT SELECT ON TABLE auth.sso_providers TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sso_providers TO dashboard_user; - - --- --- Name: TABLE users; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.users TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.users TO postgres; -GRANT SELECT ON TABLE auth.users TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE pg_stat_statements; Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON TABLE extensions.pg_stat_statements TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE pg_stat_statements_info; Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON TABLE extensions.pg_stat_statements_info TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE agenda_bloqueios; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_bloqueios TO postgres; -GRANT ALL ON TABLE public.agenda_bloqueios TO anon; -GRANT ALL ON TABLE public.agenda_bloqueios TO authenticated; -GRANT ALL ON TABLE public.agenda_bloqueios TO service_role; - - --- --- Name: TABLE agenda_configuracoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_configuracoes TO postgres; -GRANT ALL ON TABLE public.agenda_configuracoes TO anon; -GRANT ALL ON TABLE public.agenda_configuracoes TO authenticated; -GRANT ALL ON TABLE public.agenda_configuracoes TO service_role; - - --- --- Name: TABLE agenda_eventos; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_eventos TO postgres; -GRANT ALL ON TABLE public.agenda_eventos TO anon; -GRANT ALL ON TABLE public.agenda_eventos TO authenticated; -GRANT ALL ON TABLE public.agenda_eventos TO service_role; - - --- --- Name: TABLE agenda_excecoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_excecoes TO postgres; -GRANT ALL ON TABLE public.agenda_excecoes TO anon; -GRANT ALL ON TABLE public.agenda_excecoes TO authenticated; -GRANT ALL ON TABLE public.agenda_excecoes TO service_role; - - --- --- Name: TABLE agenda_online_slots; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_online_slots TO postgres; -GRANT ALL ON TABLE public.agenda_online_slots TO anon; -GRANT ALL ON TABLE public.agenda_online_slots TO authenticated; -GRANT ALL ON TABLE public.agenda_online_slots TO service_role; - - --- --- Name: SEQUENCE agenda_online_slots_id_seq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO postgres; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO anon; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO authenticated; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO service_role; - - --- --- Name: TABLE agenda_regras_semanais; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_regras_semanais TO postgres; -GRANT ALL ON TABLE public.agenda_regras_semanais TO anon; -GRANT ALL ON TABLE public.agenda_regras_semanais TO authenticated; -GRANT ALL ON TABLE public.agenda_regras_semanais TO service_role; - - --- --- Name: TABLE agenda_slots_bloqueados_semanais; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO postgres; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO anon; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO authenticated; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO service_role; - - --- --- Name: TABLE agenda_slots_regras; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_slots_regras TO postgres; -GRANT ALL ON TABLE public.agenda_slots_regras TO anon; -GRANT ALL ON TABLE public.agenda_slots_regras TO authenticated; -GRANT ALL ON TABLE public.agenda_slots_regras TO service_role; - - --- --- Name: TABLE agendador_configuracoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agendador_configuracoes TO postgres; -GRANT ALL ON TABLE public.agendador_configuracoes TO anon; -GRANT ALL ON TABLE public.agendador_configuracoes TO authenticated; -GRANT ALL ON TABLE public.agendador_configuracoes TO service_role; - - --- --- Name: TABLE agendador_solicitacoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agendador_solicitacoes TO postgres; -GRANT ALL ON TABLE public.agendador_solicitacoes TO anon; -GRANT ALL ON TABLE public.agendador_solicitacoes TO authenticated; -GRANT ALL ON TABLE public.agendador_solicitacoes TO service_role; - - --- --- Name: TABLE billing_contracts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.billing_contracts TO postgres; -GRANT ALL ON TABLE public.billing_contracts TO anon; -GRANT ALL ON TABLE public.billing_contracts TO authenticated; -GRANT ALL ON TABLE public.billing_contracts TO service_role; - - --- --- Name: TABLE commitment_services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.commitment_services TO postgres; -GRANT ALL ON TABLE public.commitment_services TO anon; -GRANT ALL ON TABLE public.commitment_services TO authenticated; -GRANT ALL ON TABLE public.commitment_services TO service_role; - - --- --- Name: TABLE commitment_time_logs; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.commitment_time_logs TO postgres; -GRANT ALL ON TABLE public.commitment_time_logs TO anon; -GRANT ALL ON TABLE public.commitment_time_logs TO authenticated; -GRANT ALL ON TABLE public.commitment_time_logs TO service_role; - - --- --- Name: TABLE current_tenant_id; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.current_tenant_id TO postgres; -GRANT ALL ON TABLE public.current_tenant_id TO anon; -GRANT ALL ON TABLE public.current_tenant_id TO authenticated; -GRANT ALL ON TABLE public.current_tenant_id TO service_role; - - --- --- Name: TABLE determined_commitment_fields; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.determined_commitment_fields TO postgres; -GRANT ALL ON TABLE public.determined_commitment_fields TO anon; -GRANT ALL ON TABLE public.determined_commitment_fields TO authenticated; -GRANT ALL ON TABLE public.determined_commitment_fields TO service_role; - - --- --- Name: TABLE determined_commitments; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.determined_commitments TO postgres; -GRANT ALL ON TABLE public.determined_commitments TO anon; -GRANT ALL ON TABLE public.determined_commitments TO authenticated; -GRANT ALL ON TABLE public.determined_commitments TO service_role; - - --- --- Name: TABLE dev_user_credentials; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.dev_user_credentials TO postgres; -GRANT ALL ON TABLE public.dev_user_credentials TO anon; -GRANT ALL ON TABLE public.dev_user_credentials TO authenticated; -GRANT ALL ON TABLE public.dev_user_credentials TO service_role; - - --- --- Name: TABLE entitlements_invalidation; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.entitlements_invalidation TO postgres; -GRANT ALL ON TABLE public.entitlements_invalidation TO anon; -GRANT ALL ON TABLE public.entitlements_invalidation TO authenticated; -GRANT ALL ON TABLE public.entitlements_invalidation TO service_role; - - --- --- Name: TABLE features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.features TO postgres; -GRANT ALL ON TABLE public.features TO anon; -GRANT ALL ON TABLE public.features TO authenticated; -GRANT ALL ON TABLE public.features TO service_role; - - --- --- Name: TABLE feriados; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.feriados TO postgres; -GRANT ALL ON TABLE public.feriados TO anon; -GRANT ALL ON TABLE public.feriados TO authenticated; -GRANT ALL ON TABLE public.feriados TO service_role; - - --- --- Name: TABLE financial_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.financial_exceptions TO postgres; -GRANT ALL ON TABLE public.financial_exceptions TO anon; -GRANT ALL ON TABLE public.financial_exceptions TO authenticated; -GRANT ALL ON TABLE public.financial_exceptions TO service_role; - - --- --- Name: TABLE insurance_plan_services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.insurance_plan_services TO postgres; -GRANT ALL ON TABLE public.insurance_plan_services TO anon; -GRANT ALL ON TABLE public.insurance_plan_services TO authenticated; -GRANT ALL ON TABLE public.insurance_plan_services TO service_role; - - --- --- Name: TABLE insurance_plans; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.insurance_plans TO postgres; -GRANT ALL ON TABLE public.insurance_plans TO anon; -GRANT ALL ON TABLE public.insurance_plans TO authenticated; -GRANT ALL ON TABLE public.insurance_plans TO service_role; - - --- --- Name: TABLE module_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.module_features TO postgres; -GRANT ALL ON TABLE public.module_features TO anon; -GRANT ALL ON TABLE public.module_features TO authenticated; -GRANT ALL ON TABLE public.module_features TO service_role; - - --- --- Name: TABLE modules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.modules TO postgres; -GRANT ALL ON TABLE public.modules TO anon; -GRANT ALL ON TABLE public.modules TO authenticated; -GRANT ALL ON TABLE public.modules TO service_role; - - --- --- Name: TABLE plan_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_features TO postgres; -GRANT ALL ON TABLE public.plan_features TO anon; -GRANT ALL ON TABLE public.plan_features TO authenticated; -GRANT ALL ON TABLE public.plan_features TO service_role; - - --- --- Name: TABLE tenant_modules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_modules TO postgres; -GRANT ALL ON TABLE public.tenant_modules TO anon; -GRANT ALL ON TABLE public.tenant_modules TO authenticated; -GRANT ALL ON TABLE public.tenant_modules TO service_role; - - --- --- Name: TABLE owner_feature_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.owner_feature_entitlements TO postgres; -GRANT ALL ON TABLE public.owner_feature_entitlements TO anon; -GRANT ALL ON TABLE public.owner_feature_entitlements TO authenticated; -GRANT ALL ON TABLE public.owner_feature_entitlements TO service_role; - - --- --- Name: TABLE owner_users; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.owner_users TO postgres; -GRANT ALL ON TABLE public.owner_users TO anon; -GRANT ALL ON TABLE public.owner_users TO authenticated; -GRANT ALL ON TABLE public.owner_users TO service_role; - - --- --- Name: TABLE patient_discounts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_discounts TO postgres; -GRANT ALL ON TABLE public.patient_discounts TO anon; -GRANT ALL ON TABLE public.patient_discounts TO authenticated; -GRANT ALL ON TABLE public.patient_discounts TO service_role; - - --- --- Name: TABLE patient_group_patient; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_group_patient TO postgres; -GRANT ALL ON TABLE public.patient_group_patient TO anon; -GRANT ALL ON TABLE public.patient_group_patient TO authenticated; -GRANT ALL ON TABLE public.patient_group_patient TO service_role; - - --- --- Name: TABLE patient_groups; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_groups TO postgres; -GRANT ALL ON TABLE public.patient_groups TO anon; -GRANT ALL ON TABLE public.patient_groups TO authenticated; -GRANT ALL ON TABLE public.patient_groups TO service_role; - - --- --- Name: TABLE patient_intake_requests; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_intake_requests TO postgres; -GRANT ALL ON TABLE public.patient_intake_requests TO authenticated; -GRANT ALL ON TABLE public.patient_intake_requests TO service_role; - - --- --- Name: TABLE patient_invites; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_invites TO postgres; -GRANT ALL ON TABLE public.patient_invites TO authenticated; -GRANT ALL ON TABLE public.patient_invites TO service_role; - - --- --- Name: TABLE patient_patient_tag; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_patient_tag TO postgres; -GRANT ALL ON TABLE public.patient_patient_tag TO anon; -GRANT ALL ON TABLE public.patient_patient_tag TO authenticated; -GRANT ALL ON TABLE public.patient_patient_tag TO service_role; - - --- --- Name: TABLE patient_tags; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_tags TO postgres; -GRANT ALL ON TABLE public.patient_tags TO anon; -GRANT ALL ON TABLE public.patient_tags TO authenticated; -GRANT ALL ON TABLE public.patient_tags TO service_role; - - --- --- Name: TABLE patients; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patients TO postgres; -GRANT ALL ON TABLE public.patients TO anon; -GRANT ALL ON TABLE public.patients TO authenticated; -GRANT ALL ON TABLE public.patients TO service_role; - - --- --- Name: TABLE payment_settings; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.payment_settings TO postgres; -GRANT ALL ON TABLE public.payment_settings TO anon; -GRANT ALL ON TABLE public.payment_settings TO authenticated; -GRANT ALL ON TABLE public.payment_settings TO service_role; - - --- --- Name: TABLE plan_prices; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_prices TO postgres; -GRANT ALL ON TABLE public.plan_prices TO anon; -GRANT ALL ON TABLE public.plan_prices TO authenticated; -GRANT ALL ON TABLE public.plan_prices TO service_role; - - --- --- Name: TABLE plan_public; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_public TO postgres; -GRANT ALL ON TABLE public.plan_public TO anon; -GRANT ALL ON TABLE public.plan_public TO authenticated; -GRANT ALL ON TABLE public.plan_public TO service_role; - - --- --- Name: TABLE plan_public_bullets; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_public_bullets TO postgres; -GRANT ALL ON TABLE public.plan_public_bullets TO anon; -GRANT ALL ON TABLE public.plan_public_bullets TO authenticated; -GRANT ALL ON TABLE public.plan_public_bullets TO service_role; - - --- --- Name: TABLE plans; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plans TO postgres; -GRANT ALL ON TABLE public.plans TO anon; -GRANT ALL ON TABLE public.plans TO authenticated; -GRANT ALL ON TABLE public.plans TO service_role; - - --- --- Name: TABLE professional_pricing; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.professional_pricing TO postgres; -GRANT ALL ON TABLE public.professional_pricing TO anon; -GRANT ALL ON TABLE public.professional_pricing TO authenticated; -GRANT ALL ON TABLE public.professional_pricing TO service_role; - - --- --- Name: TABLE profiles; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.profiles TO postgres; -GRANT ALL ON TABLE public.profiles TO anon; -GRANT ALL ON TABLE public.profiles TO authenticated; -GRANT ALL ON TABLE public.profiles TO service_role; - - --- --- Name: TABLE recurrence_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_exceptions TO postgres; -GRANT ALL ON TABLE public.recurrence_exceptions TO anon; -GRANT ALL ON TABLE public.recurrence_exceptions TO authenticated; -GRANT ALL ON TABLE public.recurrence_exceptions TO service_role; - - --- --- Name: TABLE recurrence_rule_services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_rule_services TO postgres; -GRANT ALL ON TABLE public.recurrence_rule_services TO anon; -GRANT ALL ON TABLE public.recurrence_rule_services TO authenticated; -GRANT ALL ON TABLE public.recurrence_rule_services TO service_role; - - --- --- Name: TABLE recurrence_rules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_rules TO postgres; -GRANT ALL ON TABLE public.recurrence_rules TO anon; -GRANT ALL ON TABLE public.recurrence_rules TO authenticated; -GRANT ALL ON TABLE public.recurrence_rules TO service_role; - - --- --- Name: TABLE saas_admins; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_admins TO postgres; -GRANT ALL ON TABLE public.saas_admins TO anon; -GRANT ALL ON TABLE public.saas_admins TO authenticated; -GRANT ALL ON TABLE public.saas_admins TO service_role; - - --- --- Name: TABLE saas_doc_votos; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_doc_votos TO postgres; -GRANT ALL ON TABLE public.saas_doc_votos TO anon; -GRANT ALL ON TABLE public.saas_doc_votos TO authenticated; -GRANT ALL ON TABLE public.saas_doc_votos TO service_role; - - --- --- Name: TABLE saas_docs; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_docs TO postgres; -GRANT ALL ON TABLE public.saas_docs TO anon; -GRANT ALL ON TABLE public.saas_docs TO authenticated; -GRANT ALL ON TABLE public.saas_docs TO service_role; - - --- --- Name: TABLE saas_faq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_faq TO postgres; -GRANT ALL ON TABLE public.saas_faq TO anon; -GRANT ALL ON TABLE public.saas_faq TO authenticated; -GRANT ALL ON TABLE public.saas_faq TO service_role; - - --- --- Name: TABLE saas_faq_itens; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_faq_itens TO postgres; -GRANT ALL ON TABLE public.saas_faq_itens TO anon; -GRANT ALL ON TABLE public.saas_faq_itens TO authenticated; -GRANT ALL ON TABLE public.saas_faq_itens TO service_role; - - --- --- Name: TABLE services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.services TO postgres; -GRANT ALL ON TABLE public.services TO anon; -GRANT ALL ON TABLE public.services TO authenticated; -GRANT ALL ON TABLE public.services TO service_role; - - --- --- Name: TABLE subscription_events; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_events TO postgres; -GRANT ALL ON TABLE public.subscription_events TO anon; -GRANT ALL ON TABLE public.subscription_events TO authenticated; -GRANT ALL ON TABLE public.subscription_events TO service_role; - - --- --- Name: TABLE subscription_intents_personal; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_personal TO postgres; -GRANT ALL ON TABLE public.subscription_intents_personal TO anon; -GRANT ALL ON TABLE public.subscription_intents_personal TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_personal TO service_role; - - --- --- Name: TABLE subscription_intents_tenant; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_tenant TO postgres; -GRANT ALL ON TABLE public.subscription_intents_tenant TO anon; -GRANT ALL ON TABLE public.subscription_intents_tenant TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_tenant TO service_role; - - --- --- Name: TABLE subscription_intents; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents TO postgres; -GRANT ALL ON TABLE public.subscription_intents TO anon; -GRANT ALL ON TABLE public.subscription_intents TO authenticated; -GRANT ALL ON TABLE public.subscription_intents TO service_role; - - --- --- Name: TABLE subscription_intents_legacy; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_legacy TO postgres; -GRANT ALL ON TABLE public.subscription_intents_legacy TO anon; -GRANT ALL ON TABLE public.subscription_intents_legacy TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_legacy TO service_role; - - --- --- Name: TABLE support_sessions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.support_sessions TO postgres; -GRANT ALL ON TABLE public.support_sessions TO anon; -GRANT ALL ON TABLE public.support_sessions TO authenticated; -GRANT ALL ON TABLE public.support_sessions TO service_role; - - --- --- Name: TABLE tenant_feature_exceptions_log; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO postgres; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO anon; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO authenticated; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO service_role; - - --- --- Name: TABLE tenant_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_features TO postgres; -GRANT ALL ON TABLE public.tenant_features TO anon; -GRANT ALL ON TABLE public.tenant_features TO authenticated; -GRANT ALL ON TABLE public.tenant_features TO service_role; - - --- --- Name: TABLE tenant_invites; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_invites TO postgres; -GRANT ALL ON TABLE public.tenant_invites TO authenticated; -GRANT ALL ON TABLE public.tenant_invites TO service_role; - - --- --- Name: TABLE tenants; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenants TO postgres; -GRANT ALL ON TABLE public.tenants TO anon; -GRANT ALL ON TABLE public.tenants TO authenticated; -GRANT ALL ON TABLE public.tenants TO service_role; - - --- --- Name: TABLE user_settings; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.user_settings TO postgres; -GRANT ALL ON TABLE public.user_settings TO anon; -GRANT ALL ON TABLE public.user_settings TO authenticated; -GRANT ALL ON TABLE public.user_settings TO service_role; - - --- --- Name: TABLE v_auth_users_public; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_auth_users_public TO postgres; -GRANT ALL ON TABLE public.v_auth_users_public TO anon; -GRANT ALL ON TABLE public.v_auth_users_public TO authenticated; -GRANT ALL ON TABLE public.v_auth_users_public TO service_role; - - --- --- Name: TABLE v_commitment_totals; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_commitment_totals TO postgres; -GRANT ALL ON TABLE public.v_commitment_totals TO anon; -GRANT ALL ON TABLE public.v_commitment_totals TO authenticated; -GRANT ALL ON TABLE public.v_commitment_totals TO service_role; - - --- --- Name: TABLE v_patient_groups_with_counts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO postgres; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO anon; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO authenticated; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO service_role; - - --- --- Name: TABLE v_plan_active_prices; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_plan_active_prices TO postgres; -GRANT ALL ON TABLE public.v_plan_active_prices TO anon; -GRANT ALL ON TABLE public.v_plan_active_prices TO authenticated; -GRANT ALL ON TABLE public.v_plan_active_prices TO service_role; - - --- --- Name: TABLE v_public_pricing; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_public_pricing TO postgres; -GRANT ALL ON TABLE public.v_public_pricing TO anon; -GRANT ALL ON TABLE public.v_public_pricing TO authenticated; -GRANT ALL ON TABLE public.v_public_pricing TO service_role; - - --- --- Name: TABLE v_subscription_feature_mismatch; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO postgres; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO anon; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO authenticated; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO service_role; - - --- --- Name: TABLE v_subscription_health; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_health TO postgres; -GRANT ALL ON TABLE public.v_subscription_health TO anon; -GRANT ALL ON TABLE public.v_subscription_health TO authenticated; -GRANT ALL ON TABLE public.v_subscription_health TO service_role; - - --- --- Name: TABLE v_subscription_health_v2; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_health_v2 TO postgres; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO anon; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO authenticated; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO service_role; - - --- --- Name: TABLE v_tag_patient_counts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tag_patient_counts TO postgres; -GRANT ALL ON TABLE public.v_tag_patient_counts TO anon; -GRANT ALL ON TABLE public.v_tag_patient_counts TO authenticated; -GRANT ALL ON TABLE public.v_tag_patient_counts TO service_role; - - --- --- Name: TABLE v_tenant_active_subscription; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_active_subscription TO postgres; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO anon; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO authenticated; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO service_role; - - --- --- Name: TABLE v_tenant_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements TO service_role; - - --- --- Name: TABLE v_tenant_entitlements_full; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO service_role; - - --- --- Name: TABLE v_tenant_entitlements_json; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO service_role; - - --- --- Name: TABLE v_tenant_feature_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO postgres; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO anon; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO authenticated; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO service_role; - - --- --- Name: TABLE v_tenant_feature_mismatch; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO postgres; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO anon; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO authenticated; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO service_role; - - --- --- Name: TABLE v_tenant_members_with_profiles; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO postgres; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO anon; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO authenticated; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO service_role; - - --- --- Name: TABLE v_tenant_people; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_people TO postgres; -GRANT ALL ON TABLE public.v_tenant_people TO anon; -GRANT ALL ON TABLE public.v_tenant_people TO authenticated; -GRANT ALL ON TABLE public.v_tenant_people TO service_role; - - --- --- Name: TABLE v_tenant_staff; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_staff TO postgres; -GRANT ALL ON TABLE public.v_tenant_staff TO anon; -GRANT ALL ON TABLE public.v_tenant_staff TO authenticated; -GRANT ALL ON TABLE public.v_tenant_staff TO service_role; - - --- --- Name: TABLE v_user_active_subscription; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_user_active_subscription TO postgres; -GRANT ALL ON TABLE public.v_user_active_subscription TO anon; -GRANT ALL ON TABLE public.v_user_active_subscription TO authenticated; -GRANT ALL ON TABLE public.v_user_active_subscription TO service_role; - - --- --- Name: TABLE v_user_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_user_entitlements TO postgres; -GRANT ALL ON TABLE public.v_user_entitlements TO anon; -GRANT ALL ON TABLE public.v_user_entitlements TO authenticated; -GRANT ALL ON TABLE public.v_user_entitlements TO service_role; - - --- --- Name: TABLE messages; Type: ACL; Schema: realtime; Owner: supabase_realtime_admin --- - -GRANT ALL ON TABLE realtime.messages TO postgres; -GRANT ALL ON TABLE realtime.messages TO dashboard_user; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO anon; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO authenticated; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO service_role; - - --- --- Name: TABLE messages_2026_03_11; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_11 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_11 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_12; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_12 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_12 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_13; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_13 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_13 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_14; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_14 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_14 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_15; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_15 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_15 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_16; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_16 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_16 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_17; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_17 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_17 TO dashboard_user; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.schema_migrations TO postgres; -GRANT ALL ON TABLE realtime.schema_migrations TO dashboard_user; -GRANT SELECT ON TABLE realtime.schema_migrations TO anon; -GRANT SELECT ON TABLE realtime.schema_migrations TO authenticated; -GRANT SELECT ON TABLE realtime.schema_migrations TO service_role; -GRANT ALL ON TABLE realtime.schema_migrations TO supabase_realtime_admin; - - --- --- Name: TABLE subscription; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.subscription TO postgres; -GRANT ALL ON TABLE realtime.subscription TO dashboard_user; -GRANT SELECT ON TABLE realtime.subscription TO anon; -GRANT SELECT ON TABLE realtime.subscription TO authenticated; -GRANT SELECT ON TABLE realtime.subscription TO service_role; -GRANT ALL ON TABLE realtime.subscription TO supabase_realtime_admin; - - --- --- Name: SEQUENCE subscription_id_seq; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO postgres; -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO dashboard_user; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO anon; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO authenticated; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO service_role; -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO supabase_realtime_admin; - - --- --- Name: TABLE buckets; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE storage.buckets TO service_role; -GRANT ALL ON TABLE storage.buckets TO authenticated; -GRANT ALL ON TABLE storage.buckets TO anon; - - --- --- Name: TABLE buckets_analytics; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets_analytics TO service_role; -GRANT ALL ON TABLE storage.buckets_analytics TO authenticated; -GRANT ALL ON TABLE storage.buckets_analytics TO anon; - - --- --- Name: TABLE buckets_vectors; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT SELECT ON TABLE storage.buckets_vectors TO service_role; -GRANT SELECT ON TABLE storage.buckets_vectors TO authenticated; -GRANT SELECT ON TABLE storage.buckets_vectors TO anon; - - --- --- Name: TABLE iceberg_namespaces; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.iceberg_namespaces TO service_role; -GRANT SELECT ON TABLE storage.iceberg_namespaces TO authenticated; -GRANT SELECT ON TABLE storage.iceberg_namespaces TO anon; - - --- --- Name: TABLE iceberg_tables; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.iceberg_tables TO service_role; -GRANT SELECT ON TABLE storage.iceberg_tables TO authenticated; -GRANT SELECT ON TABLE storage.iceberg_tables TO anon; - - --- --- Name: TABLE objects; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.objects TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE storage.objects TO service_role; -GRANT ALL ON TABLE storage.objects TO authenticated; -GRANT ALL ON TABLE storage.objects TO anon; - - --- --- Name: TABLE s3_multipart_uploads; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.s3_multipart_uploads TO service_role; -GRANT SELECT ON TABLE storage.s3_multipart_uploads TO authenticated; -GRANT SELECT ON TABLE storage.s3_multipart_uploads TO anon; - - --- --- Name: TABLE s3_multipart_uploads_parts; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.s3_multipart_uploads_parts TO service_role; -GRANT SELECT ON TABLE storage.s3_multipart_uploads_parts TO authenticated; -GRANT SELECT ON TABLE storage.s3_multipart_uploads_parts TO anon; - - --- --- Name: TABLE vector_indexes; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT SELECT ON TABLE storage.vector_indexes TO service_role; -GRANT SELECT ON TABLE storage.vector_indexes TO authenticated; -GRANT SELECT ON TABLE storage.vector_indexes TO anon; - - --- --- Name: TABLE hooks; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON TABLE supabase_functions.hooks TO postgres; -GRANT ALL ON TABLE supabase_functions.hooks TO anon; -GRANT ALL ON TABLE supabase_functions.hooks TO authenticated; -GRANT ALL ON TABLE supabase_functions.hooks TO service_role; - - --- --- Name: SEQUENCE hooks_id_seq; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO postgres; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO anon; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO authenticated; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO service_role; - - --- --- Name: TABLE migrations; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON TABLE supabase_functions.migrations TO postgres; -GRANT ALL ON TABLE supabase_functions.migrations TO anon; -GRANT ALL ON TABLE supabase_functions.migrations TO authenticated; -GRANT ALL ON TABLE supabase_functions.migrations TO service_role; - - --- --- Name: TABLE secrets; Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT SELECT,REFERENCES,DELETE,TRUNCATE ON TABLE vault.secrets TO postgres WITH GRANT OPTION; -GRANT SELECT,DELETE ON TABLE vault.secrets TO service_role; - - --- --- Name: TABLE decrypted_secrets; Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT SELECT,REFERENCES,DELETE,TRUNCATE ON TABLE vault.decrypted_secrets TO postgres WITH GRANT OPTION; -GRANT SELECT,DELETE ON TABLE vault.decrypted_secrets TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON SEQUENCES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON FUNCTIONS TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON TABLES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON SEQUENCES TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON FUNCTIONS TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON TABLES TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON SEQUENCES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON FUNCTIONS TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON TABLES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO service_role; - - --- --- Name: issue_graphql_placeholder; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_graphql_placeholder ON sql_drop - WHEN TAG IN ('DROP EXTENSION') - EXECUTE FUNCTION extensions.set_graphql_placeholder(); - - -ALTER EVENT TRIGGER issue_graphql_placeholder OWNER TO supabase_admin; - --- --- Name: issue_pg_cron_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_cron_access ON ddl_command_end - WHEN TAG IN ('CREATE EXTENSION') - EXECUTE FUNCTION extensions.grant_pg_cron_access(); - - -ALTER EVENT TRIGGER issue_pg_cron_access OWNER TO supabase_admin; - --- --- Name: issue_pg_graphql_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_graphql_access ON ddl_command_end - WHEN TAG IN ('CREATE FUNCTION') - EXECUTE FUNCTION extensions.grant_pg_graphql_access(); - - -ALTER EVENT TRIGGER issue_pg_graphql_access OWNER TO supabase_admin; - --- --- Name: issue_pg_net_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_net_access ON ddl_command_end - WHEN TAG IN ('CREATE EXTENSION') - EXECUTE FUNCTION extensions.grant_pg_net_access(); - - -ALTER EVENT TRIGGER issue_pg_net_access OWNER TO supabase_admin; - --- --- Name: pgrst_ddl_watch; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER pgrst_ddl_watch ON ddl_command_end - EXECUTE FUNCTION extensions.pgrst_ddl_watch(); - - -ALTER EVENT TRIGGER pgrst_ddl_watch OWNER TO supabase_admin; - --- --- Name: pgrst_drop_watch; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop - EXECUTE FUNCTION extensions.pgrst_drop_watch(); - - -ALTER EVENT TRIGGER pgrst_drop_watch OWNER TO supabase_admin; - --- --- PostgreSQL database dump complete --- - -\unrestrict yeY9H8V42lbJiLOWXgm32d7gqvrbttAXIQpuhmJAUW6CcywchAbLQWIAldNEVsZ - diff --git a/DBS/2026-03-15/schema.sql b/DBS/2026-03-15/schema.sql deleted file mode 100644 index f8dd56d..0000000 --- a/DBS/2026-03-15/schema.sql +++ /dev/null @@ -1,21933 +0,0 @@ --- --- PostgreSQL database dump --- - -\restrict jIaZyygk9Cg9Z4ELczVcfs8ceh7EIWutd6NCBTzG3dunNfjBgnAm5uGtlm0D4Zf - --- Dumped from database version 17.6 --- Dumped by pg_dump version 17.6 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET transaction_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- Name: _realtime; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA _realtime; - - -ALTER SCHEMA _realtime OWNER TO postgres; - --- --- Name: auth; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA auth; - - -ALTER SCHEMA auth OWNER TO supabase_admin; - --- --- Name: extensions; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA extensions; - - -ALTER SCHEMA extensions OWNER TO postgres; - --- --- Name: graphql; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA graphql; - - -ALTER SCHEMA graphql OWNER TO supabase_admin; - --- --- Name: graphql_public; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA graphql_public; - - -ALTER SCHEMA graphql_public OWNER TO supabase_admin; - --- --- Name: pg_net; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions; - - --- --- Name: EXTENSION pg_net; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_net IS 'Async HTTP'; - - --- --- Name: pgbouncer; Type: SCHEMA; Schema: -; Owner: pgbouncer --- - -CREATE SCHEMA pgbouncer; - - -ALTER SCHEMA pgbouncer OWNER TO pgbouncer; - --- --- Name: realtime; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA realtime; - - -ALTER SCHEMA realtime OWNER TO supabase_admin; - --- --- Name: storage; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA storage; - - -ALTER SCHEMA storage OWNER TO supabase_admin; - --- --- Name: supabase_functions; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA supabase_functions; - - -ALTER SCHEMA supabase_functions OWNER TO supabase_admin; - --- --- Name: vault; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA vault; - - -ALTER SCHEMA vault OWNER TO supabase_admin; - --- --- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public; - - --- --- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST'; - - --- --- Name: citext; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; - - --- --- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings'; - - --- --- Name: pg_graphql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; - - --- --- Name: EXTENSION pg_graphql; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; - - --- --- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA extensions; - - --- --- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed'; - - --- --- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; - - --- --- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; - - --- --- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions; - - --- --- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; - - --- --- Name: supabase_vault; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS supabase_vault WITH SCHEMA vault; - - --- --- Name: EXTENSION supabase_vault; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION supabase_vault IS 'Supabase Vault Extension'; - - --- --- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions; - - --- --- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; - - --- --- Name: aal_level; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.aal_level AS ENUM ( - 'aal1', - 'aal2', - 'aal3' -); - - -ALTER TYPE auth.aal_level OWNER TO supabase_auth_admin; - --- --- Name: code_challenge_method; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.code_challenge_method AS ENUM ( - 's256', - 'plain' -); - - -ALTER TYPE auth.code_challenge_method OWNER TO supabase_auth_admin; - --- --- Name: factor_status; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.factor_status AS ENUM ( - 'unverified', - 'verified' -); - - -ALTER TYPE auth.factor_status OWNER TO supabase_auth_admin; - --- --- Name: factor_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.factor_type AS ENUM ( - 'totp', - 'webauthn', - 'phone' -); - - -ALTER TYPE auth.factor_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_authorization_status; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_authorization_status AS ENUM ( - 'pending', - 'approved', - 'denied', - 'expired' -); - - -ALTER TYPE auth.oauth_authorization_status OWNER TO supabase_auth_admin; - --- --- Name: oauth_client_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_client_type AS ENUM ( - 'public', - 'confidential' -); - - -ALTER TYPE auth.oauth_client_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_registration_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_registration_type AS ENUM ( - 'dynamic', - 'manual' -); - - -ALTER TYPE auth.oauth_registration_type OWNER TO supabase_auth_admin; - --- --- Name: oauth_response_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.oauth_response_type AS ENUM ( - 'code' -); - - -ALTER TYPE auth.oauth_response_type OWNER TO supabase_auth_admin; - --- --- Name: one_time_token_type; Type: TYPE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TYPE auth.one_time_token_type AS ENUM ( - 'confirmation_token', - 'reauthentication_token', - 'recovery_token', - 'email_change_token_new', - 'email_change_token_current', - 'phone_change_token' -); - - -ALTER TYPE auth.one_time_token_type OWNER TO supabase_auth_admin; - --- --- Name: commitment_log_source; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.commitment_log_source AS ENUM ( - 'manual', - 'auto' -); - - -ALTER TYPE public.commitment_log_source OWNER TO supabase_admin; - --- --- Name: determined_field_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.determined_field_type AS ENUM ( - 'text', - 'textarea', - 'number', - 'date', - 'select', - 'boolean' -); - - -ALTER TYPE public.determined_field_type OWNER TO supabase_admin; - --- --- Name: recurrence_exception_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.recurrence_exception_type AS ENUM ( - 'cancel_session', - 'reschedule_session', - 'patient_missed', - 'therapist_canceled', - 'holiday_block' -); - - -ALTER TYPE public.recurrence_exception_type OWNER TO supabase_admin; - --- --- Name: recurrence_type; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.recurrence_type AS ENUM ( - 'weekly', - 'biweekly', - 'monthly', - 'yearly', - 'custom_weekdays' -); - - -ALTER TYPE public.recurrence_type OWNER TO supabase_admin; - --- --- Name: status_agenda_serie; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_agenda_serie AS ENUM ( - 'ativo', - 'pausado', - 'cancelado' -); - - -ALTER TYPE public.status_agenda_serie OWNER TO supabase_admin; - --- --- Name: status_evento_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_evento_agenda AS ENUM ( - 'agendado', - 'realizado', - 'faltou', - 'cancelado', - 'remarcar' -); - - -ALTER TYPE public.status_evento_agenda OWNER TO supabase_admin; - --- --- Name: status_excecao_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.status_excecao_agenda AS ENUM ( - 'pendente', - 'ativo', - 'arquivado' -); - - -ALTER TYPE public.status_excecao_agenda OWNER TO supabase_admin; - --- --- Name: tipo_evento_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.tipo_evento_agenda AS ENUM ( - 'sessao', - 'bloqueio' -); - - -ALTER TYPE public.tipo_evento_agenda OWNER TO supabase_admin; - --- --- Name: tipo_excecao_agenda; Type: TYPE; Schema: public; Owner: supabase_admin --- - -CREATE TYPE public.tipo_excecao_agenda AS ENUM ( - 'bloqueio', - 'horario_extra' -); - - -ALTER TYPE public.tipo_excecao_agenda OWNER TO supabase_admin; - --- --- Name: action; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.action AS ENUM ( - 'INSERT', - 'UPDATE', - 'DELETE', - 'TRUNCATE', - 'ERROR' -); - - -ALTER TYPE realtime.action OWNER TO supabase_admin; - --- --- Name: equality_op; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.equality_op AS ENUM ( - 'eq', - 'neq', - 'lt', - 'lte', - 'gt', - 'gte', - 'in' -); - - -ALTER TYPE realtime.equality_op OWNER TO supabase_admin; - --- --- Name: user_defined_filter; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.user_defined_filter AS ( - column_name text, - op realtime.equality_op, - value text -); - - -ALTER TYPE realtime.user_defined_filter OWNER TO supabase_admin; - --- --- Name: wal_column; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.wal_column AS ( - name text, - type_name text, - type_oid oid, - value jsonb, - is_pkey boolean, - is_selectable boolean -); - - -ALTER TYPE realtime.wal_column OWNER TO supabase_admin; - --- --- Name: wal_rls; Type: TYPE; Schema: realtime; Owner: supabase_admin --- - -CREATE TYPE realtime.wal_rls AS ( - wal jsonb, - is_rls_enabled boolean, - subscription_ids uuid[], - errors text[] -); - - -ALTER TYPE realtime.wal_rls OWNER TO supabase_admin; - --- --- Name: buckettype; Type: TYPE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TYPE storage.buckettype AS ENUM ( - 'STANDARD', - 'ANALYTICS', - 'VECTOR' -); - - -ALTER TYPE storage.buckettype OWNER TO supabase_storage_admin; - --- --- Name: email(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.email() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION email(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.email() IS 'Deprecated. Use auth.jwt() -> ''email'' instead.'; - - --- --- Name: jwt(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.jwt() OWNER TO supabase_auth_admin; - --- --- Name: role(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.role() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION role(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.role() IS 'Deprecated. Use auth.jwt() -> ''role'' instead.'; - - --- --- Name: uid(); Type: FUNCTION; Schema: auth; Owner: supabase_auth_admin --- - -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 -$$; - - -ALTER FUNCTION auth.uid() OWNER TO supabase_auth_admin; - --- --- Name: FUNCTION uid(); Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON FUNCTION auth.uid() IS 'Deprecated. Use auth.jwt() -> ''sub'' instead.'; - - --- --- Name: grant_pg_cron_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_cron_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT - FROM pg_event_trigger_ddl_commands() AS ev - JOIN pg_extension AS ext - ON ev.objid = ext.oid - WHERE ext.extname = 'pg_cron' - ) - THEN - grant usage on schema cron to postgres with grant option; - - alter default privileges in schema cron grant all on tables to postgres with grant option; - alter default privileges in schema cron grant all on functions to postgres with grant option; - alter default privileges in schema cron grant all on sequences to postgres with grant option; - - alter default privileges for user supabase_admin in schema cron grant all - on sequences to postgres with grant option; - alter default privileges for user supabase_admin in schema cron grant all - on tables to postgres with grant option; - alter default privileges for user supabase_admin in schema cron grant all - on functions to postgres with grant option; - - grant all privileges on all tables in schema cron to postgres with grant option; - revoke all on table cron.job from postgres; - grant select on table cron.job to postgres with grant option; - END IF; -END; -$$; - - -ALTER FUNCTION extensions.grant_pg_cron_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_cron_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_cron_access() IS 'Grants access to pg_cron'; - - --- --- Name: grant_pg_graphql_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_graphql_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $_$ -DECLARE - func_is_graphql_resolve bool; -BEGIN - func_is_graphql_resolve = ( - SELECT n.proname = 'resolve' - FROM pg_event_trigger_ddl_commands() AS ev - LEFT JOIN pg_catalog.pg_proc AS n - ON ev.objid = n.oid - ); - - IF func_is_graphql_resolve - THEN - -- Update public wrapper to pass all arguments through to the pg_graphql resolve func - DROP FUNCTION IF EXISTS graphql_public.graphql; - create or replace function graphql_public.graphql( - "operationName" text default null, - query text default null, - variables jsonb default null, - extensions jsonb default null - ) - returns jsonb - language sql - as $$ - select graphql.resolve( - query := query, - variables := coalesce(variables, '{}'), - "operationName" := "operationName", - extensions := extensions - ); - $$; - - -- This hook executes when `graphql.resolve` is created. That is not necessarily the last - -- function in the extension so we need to grant permissions on existing entities AND - -- update default permissions to any others that are created after `graphql.resolve` - grant usage on schema graphql to postgres, anon, authenticated, service_role; - grant select on all tables in schema graphql to postgres, anon, authenticated, service_role; - grant execute on all functions in schema graphql to postgres, anon, authenticated, service_role; - grant all on all sequences in schema graphql to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on tables to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on functions to postgres, anon, authenticated, service_role; - alter default privileges in schema graphql grant all on sequences to postgres, anon, authenticated, service_role; - - -- Allow postgres role to allow granting usage on graphql and graphql_public schemas to custom roles - grant usage on schema graphql_public to postgres with grant option; - grant usage on schema graphql to postgres with grant option; - END IF; - -END; -$_$; - - -ALTER FUNCTION extensions.grant_pg_graphql_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_graphql_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_graphql_access() IS 'Grants access to pg_graphql'; - - --- --- Name: grant_pg_net_access(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.grant_pg_net_access() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM pg_event_trigger_ddl_commands() AS ev - JOIN pg_extension AS ext - ON ev.objid = ext.oid - WHERE ext.extname = 'pg_net' - ) - THEN - GRANT USAGE ON SCHEMA net TO supabase_functions_admin, postgres, anon, authenticated, service_role; - - ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER; - ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER; - - ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; - ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; - - REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; - REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; - - GRANT EXECUTE ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role; - GRANT EXECUTE ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role; - END IF; -END; -$$; - - -ALTER FUNCTION extensions.grant_pg_net_access() OWNER TO supabase_admin; - --- --- Name: FUNCTION grant_pg_net_access(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.grant_pg_net_access() IS 'Grants access to pg_net'; - - --- --- Name: pgrst_ddl_watch(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.pgrst_ddl_watch() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -DECLARE - cmd record; -BEGIN - FOR cmd IN SELECT * FROM pg_event_trigger_ddl_commands() - LOOP - IF cmd.command_tag IN ( - 'CREATE SCHEMA', 'ALTER SCHEMA' - , 'CREATE TABLE', 'CREATE TABLE AS', 'SELECT INTO', 'ALTER TABLE' - , 'CREATE FOREIGN TABLE', 'ALTER FOREIGN TABLE' - , 'CREATE VIEW', 'ALTER VIEW' - , 'CREATE MATERIALIZED VIEW', 'ALTER MATERIALIZED VIEW' - , 'CREATE FUNCTION', 'ALTER FUNCTION' - , 'CREATE TRIGGER' - , 'CREATE TYPE', 'ALTER TYPE' - , 'CREATE RULE' - , 'COMMENT' - ) - -- don't notify in case of CREATE TEMP table or other objects created on pg_temp - AND cmd.schema_name is distinct from 'pg_temp' - THEN - NOTIFY pgrst, 'reload schema'; - END IF; - END LOOP; -END; $$; - - -ALTER FUNCTION extensions.pgrst_ddl_watch() OWNER TO supabase_admin; - --- --- Name: pgrst_drop_watch(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.pgrst_drop_watch() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ -DECLARE - obj record; -BEGIN - FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects() - LOOP - IF obj.object_type IN ( - 'schema' - , 'table' - , 'foreign table' - , 'view' - , 'materialized view' - , 'function' - , 'trigger' - , 'type' - , 'rule' - ) - AND obj.is_temporary IS false -- no pg_temp objects - THEN - NOTIFY pgrst, 'reload schema'; - END IF; - END LOOP; -END; $$; - - -ALTER FUNCTION extensions.pgrst_drop_watch() OWNER TO supabase_admin; - --- --- Name: set_graphql_placeholder(); Type: FUNCTION; Schema: extensions; Owner: supabase_admin --- - -CREATE FUNCTION extensions.set_graphql_placeholder() RETURNS event_trigger - LANGUAGE plpgsql - AS $_$ - DECLARE - graphql_is_dropped bool; - BEGIN - graphql_is_dropped = ( - SELECT ev.schema_name = 'graphql_public' - FROM pg_event_trigger_dropped_objects() AS ev - WHERE ev.schema_name = 'graphql_public' - ); - - IF graphql_is_dropped - THEN - create or replace function graphql_public.graphql( - "operationName" text default null, - query text default null, - variables jsonb default null, - extensions jsonb default null - ) - returns jsonb - language plpgsql - as $$ - DECLARE - server_version float; - BEGIN - server_version = (SELECT (SPLIT_PART((select version()), ' ', 2))::float); - - IF server_version >= 14 THEN - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql extension is not enabled.' - ) - ) - ); - ELSE - RETURN jsonb_build_object( - 'errors', jsonb_build_array( - jsonb_build_object( - 'message', 'pg_graphql is only available on projects running Postgres 14 onwards.' - ) - ) - ); - END IF; - END; - $$; - END IF; - - END; -$_$; - - -ALTER FUNCTION extensions.set_graphql_placeholder() OWNER TO supabase_admin; - --- --- Name: FUNCTION set_graphql_placeholder(); Type: COMMENT; Schema: extensions; Owner: supabase_admin --- - -COMMENT ON FUNCTION extensions.set_graphql_placeholder() IS 'Reintroduces placeholder function for graphql_public.graphql'; - - --- --- Name: get_auth(text); Type: FUNCTION; Schema: pgbouncer; Owner: supabase_admin --- - -CREATE FUNCTION pgbouncer.get_auth(p_usename text) RETURNS TABLE(username text, password text) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO '' - AS $_$ -begin - raise debug 'PgBouncer auth request: %', p_usename; - - return query - select - rolname::text, - case when rolvaliduntil < now() - then null - else rolpassword::text - end - from pg_authid - where rolname=$1 and rolcanlogin; -end; -$_$; - - -ALTER FUNCTION pgbouncer.get_auth(p_usename text) OWNER TO supabase_admin; - --- --- Name: __rls_ping(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.__rls_ping() RETURNS text - LANGUAGE sql STABLE - AS $$ - select 'ok'::text; -$$; - - -ALTER FUNCTION public.__rls_ping() OWNER TO supabase_admin; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- Name: subscriptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscriptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - plan_id uuid NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - current_period_start timestamp with time zone, - current_period_end timestamp with time zone, - cancel_at_period_end boolean DEFAULT false NOT NULL, - provider text DEFAULT 'manual'::text NOT NULL, - provider_customer_id text, - provider_subscription_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid, - plan_key text, - "interval" text, - source text DEFAULT 'manual'::text NOT NULL, - started_at timestamp with time zone DEFAULT now() NOT NULL, - canceled_at timestamp with time zone, - activated_at timestamp with time zone, - past_due_since timestamp with time zone, - suspended_at timestamp with time zone, - suspended_reason text, - cancelled_at timestamp with time zone, - cancel_reason text, - expired_at timestamp with time zone, - CONSTRAINT subscriptions_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))), - CONSTRAINT subscriptions_owner_xor CHECK ((((tenant_id IS NOT NULL) AND (user_id IS NULL)) OR ((tenant_id IS NULL) AND (user_id IS NOT NULL)))), - CONSTRAINT subscriptions_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'active'::text, 'past_due'::text, 'suspended'::text, 'cancelled'::text, 'expired'::text]))) -); - - -ALTER TABLE public.subscriptions OWNER TO supabase_admin; - --- --- Name: activate_subscription_from_intent(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_intent record; - v_sub public.subscriptions; - v_days int; - v_user_id uuid; - v_plan_id uuid; - v_target text; -begin - -- lê pela VIEW unificada - select * into v_intent - from public.subscription_intents - where id = p_intent_id; - - if not found then - raise exception 'Intent não encontrado: %', p_intent_id; - end if; - - if v_intent.status <> 'paid' then - raise exception 'Intent precisa estar paid para ativar assinatura'; - end if; - - -- resolve target e plan_id via plans.key - select p.id, p.target - into v_plan_id, v_target - from public.plans p - where p.key = v_intent.plan_key - limit 1; - - if v_plan_id is null then - raise exception 'Plano não encontrado em plans.key = %', v_intent.plan_key; - end if; - - v_target := lower(coalesce(v_target, '')); - - -- ✅ supervisor adicionado - if v_target not in ('clinic', 'therapist', 'supervisor') then - raise exception 'Target inválido em plans.target: %', v_target; - end if; - - -- regra por target - if v_target = 'clinic' then - if v_intent.tenant_id is null then - raise exception 'Intent sem tenant_id'; - end if; - else - -- therapist ou supervisor: vinculado ao user - v_user_id := v_intent.user_id; - if v_user_id is null then - v_user_id := v_intent.created_by_user_id; - end if; - end if; - - if v_target in ('therapist', 'supervisor') and v_user_id is null then - raise exception 'Não foi possível determinar user_id para assinatura %.', v_target; - end if; - - -- cancela assinatura ativa anterior - if v_target = 'clinic' then - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where tenant_id = v_intent.tenant_id - and plan_id = v_plan_id - and status = 'active'; - else - -- therapist ou supervisor - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where user_id = v_user_id - and plan_id = v_plan_id - and status = 'active' - and tenant_id is null; - end if; - - -- duração do plano (30 dias para mensal) - v_days := case - when lower(coalesce(v_intent.interval, 'month')) = 'year' then 365 - else 30 - end; - - -- cria nova assinatura - insert into public.subscriptions ( - user_id, - plan_id, - status, - started_at, - expires_at, - cancelled_at, - activated_at, - tenant_id, - plan_key, - interval, - source, - created_at, - updated_at - ) - values ( - case when v_target = 'clinic' then null else v_user_id end, - v_plan_id, - 'active', - now(), - now() + make_interval(days => v_days), - null, - now(), - case when v_target = 'clinic' then v_intent.tenant_id else null end, - v_intent.plan_key, - v_intent.interval, - 'manual', - now(), - now() - ) - returning * into v_sub; - - -- grava vínculo intent → subscription - if v_target = 'clinic' then - update public.subscription_intents_tenant - set subscription_id = v_sub.id - where id = p_intent_id; - else - update public.subscription_intents_personal - set subscription_id = v_sub.id - where id = p_intent_id; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) OWNER TO supabase_admin; - --- --- Name: admin_fix_plan_target(text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- (opcional) restringe targets válidos - if p_new_target not in ('clinic','therapist') then - raise exception 'Target inválido: %', p_new_target using errcode='P0001'; - end if; - - -- trava o plano - select id into v_plan_id - from public.plans - where key = p_plan_key - for update; - - if v_plan_id is null then - raise exception 'Plano não encontrado: %', p_plan_key using errcode='P0001'; - end if; - - -- segurança: não mexer se existe subscription - if exists (select 1 from public.subscriptions s where s.plan_id = v_plan_id) then - raise exception 'Plano % possui subscriptions. Migração bloqueada.', p_plan_key using errcode='P0001'; - end if; - - -- liga bypass SOMENTE nesta transação - perform set_config('app.plan_migration_bypass', '1', true); - - update public.plans - set target = p_new_target - where id = v_plan_id; - -end -$$; - - -ALTER FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) OWNER TO supabase_admin; - --- --- Name: agenda_cfg_sync(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agenda_cfg_sync() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.agenda_view_mode = 'custom' then - new.usar_horario_admin_custom := true; - new.admin_inicio_visualizacao := new.agenda_custom_start; - new.admin_fim_visualizacao := new.agenda_custom_end; - else - new.usar_horario_admin_custom := false; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.agenda_cfg_sync() OWNER TO supabase_admin; - --- --- Name: agendador_dias_disponiveis(text, integer, integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) RETURNS TABLE(data date, tem_slots boolean) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_agora timestamptz; - v_data date; - v_data_inicio date; - v_data_fim date; - v_db_dow int; - v_tem_slot boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - AND (v_data::text || ' ' || s.time::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo' - >= v_agora + (v_antecedencia || ' hours')::interval - ) INTO v_tem_slot; - - IF v_tem_slot THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - - -ALTER FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) OWNER TO supabase_admin; - --- --- Name: agendador_gerar_slug(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_gerar_slug() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_slug text; - v_exists boolean; -BEGIN - -- só gera se ativou e não tem slug ainda - IF NEW.ativo = true AND (NEW.link_slug IS NULL OR NEW.link_slug = '') THEN - LOOP - v_slug := lower(substring(replace(gen_random_uuid()::text, '-', ''), 1, 8)); - SELECT EXISTS ( - SELECT 1 FROM public.agendador_configuracoes - WHERE link_slug = v_slug AND owner_id <> NEW.owner_id - ) INTO v_exists; - EXIT WHEN NOT v_exists; - END LOOP; - NEW.link_slug := v_slug; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.agendador_gerar_slug() OWNER TO supabase_admin; - --- --- Name: agendador_slots_disponiveis(text, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) RETURNS TABLE(hora time without time zone, disponivel boolean) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_antecedencia int; - v_agora timestamptz; - v_db_dow int; - v_slot time; - v_slot_fim time; - v_slot_ts timestamptz; - v_ocupado boolean; - -- loop de recorrências - v_rule RECORD; - v_rule_start_dow int; - v_first_occ date; - v_day_diff int; - v_ex_type text; -BEGIN - SELECT c.owner_id, c.duracao_sessao_min, c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; - - FOR v_slot IN - SELECT s.time - FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - ORDER BY s.time - LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - v_ocupado := false; - - -- ── Antecedência mínima ────────────────────────────────────────────────── - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo'; - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- ── Eventos avulsos internos (agenda_eventos) ──────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos e - WHERE e.owner_id = v_owner_id - AND e.status::text NOT IN ('cancelado', 'faltou') - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::date = p_data - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (e.fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Recorrências ativas (recurrence_rules) ─────────────────────────────── - -- Loop explícito para evitar erros de tipo no cálculo do ciclo semanal - IF NOT v_ocupado THEN - FOR v_rule IN - SELECT - r.id, - r.start_date::date AS start_date, - r.end_date::date AS end_date, - r.start_time::time AS start_time, - r.end_time::time AS end_time, - COALESCE(r.interval, 1)::int AS interval - FROM public.recurrence_rules r - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND p_data >= r.start_date::date - AND (r.end_date IS NULL OR p_data <= r.end_date::date) - AND v_db_dow = ANY(r.weekdays) - AND r.start_time::time < v_slot_fim - AND r.end_time::time > v_slot - LOOP - -- Calcula a primeira ocorrência do dia-da-semana a partir do start_date - v_rule_start_dow := extract(dow from v_rule.start_date)::int; - v_first_occ := v_rule.start_date - + (((v_db_dow - v_rule_start_dow + 7) % 7))::int; - v_day_diff := (p_data - v_first_occ)::int; - - -- Ocorrência válida: diff >= 0 e divisível pelo ciclo semanal - IF v_day_diff >= 0 AND v_day_diff % (7 * v_rule.interval) = 0 THEN - - -- Verifica se há exceção para esta data - v_ex_type := NULL; - SELECT ex.type INTO v_ex_type - FROM public.recurrence_exceptions ex - WHERE ex.recurrence_id = v_rule.id - AND ex.original_date = p_data - LIMIT 1; - - -- Sem exceção, ou exceção que não cancela → bloqueia o slot - IF v_ex_type IS NULL OR v_ex_type NOT IN ( - 'cancel_session', 'patient_missed', - 'therapist_canceled', 'holiday_block', - 'reschedule_session' - ) THEN - v_ocupado := true; - EXIT; -- já basta uma regra que conflite - END IF; - - END IF; - END LOOP; - END IF; - - -- ── Recorrências remarcadas para este dia (reschedule → new_date = p_data) ─ - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 - FROM public.recurrence_exceptions ex - JOIN public.recurrence_rules r ON r.id = ex.recurrence_id - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND ex.type = 'reschedule_session' - AND ex.new_date = p_data - AND COALESCE(ex.new_start_time, r.start_time)::time < v_slot_fim - AND COALESCE(ex.new_end_time, r.end_time)::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Solicitações públicas pendentes ────────────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes sol - WHERE sol.owner_id = v_owner_id - AND sol.status = 'pendente' - AND sol.data_solicitada = p_data - AND sol.hora_solicitada = v_slot - AND (sol.reservado_ate IS NULL OR sol.reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END LOOP; -END; -$$; - - -ALTER FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) OWNER TO supabase_admin; - --- --- Name: cancel_recurrence_from(uuid, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -BEGIN - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - status = CASE - WHEN p_from_date <= start_date THEN 'cancelado' - ELSE status - END, - updated_at = now() - WHERE id = p_recurrence_id; -END; -$$; - - -ALTER FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) OWNER TO supabase_admin; - --- --- Name: cancel_subscription(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancel_subscription(p_subscription_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'canceled' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'canceled', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'canceled', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Cancelamento manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'active') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION public.cancel_subscription(p_subscription_id uuid) OWNER TO supabase_admin; - --- --- Name: cancelar_eventos_serie(uuid, timestamp with time zone); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone DEFAULT now()) RETURNS integer - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_count integer; -BEGIN - UPDATE public.agenda_eventos - SET status = 'cancelado', - updated_at = now() - WHERE serie_id = p_serie_id - AND inicio_em >= p_a_partir_de - AND status NOT IN ('realizado', 'cancelado'); - - GET DIAGNOSTICS v_count = ROW_COUNT; - RETURN v_count; -END; -$$; - - -ALTER FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) OWNER TO supabase_admin; - --- --- Name: FUNCTION cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone); Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) IS 'Cancela todos os eventos futuros de uma série a partir de p_a_partir_de (inclusive). - Não cancela eventos já realizados.'; - - --- --- Name: change_subscription_plan(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_old_plan uuid; - v_new_key text; - - v_owner_type text; - v_owner_ref uuid; - - v_new_target text; - v_sub_target text; -begin - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - v_old_plan := v_sub.plan_id; - - if v_old_plan = p_new_plan_id then - return v_sub; - end if; - - select key, target - into v_new_key, v_new_target - from public.plans - where id = p_new_plan_id; - - if v_new_key is null then - raise exception 'Plano não encontrado'; - end if; - - v_new_target := lower(coalesce(v_new_target, '')); - - v_sub_target := case - when v_sub.tenant_id is not null then 'clinic' - else 'therapist' - end; - - if v_new_target <> v_sub_target then - raise exception 'Plano inválido para este tipo de assinatura. Assinatura é % e o plano é %.', - v_sub_target, v_new_target - using errcode = 'P0001'; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set plan_id = p_new_plan_id, - plan_key = v_new_key, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'plan_changed', - v_old_plan, - p_new_plan_id, - auth.uid(), - 'Plan change via DEV menu', - 'dev_menu', - jsonb_build_object( - 'previous_plan', v_old_plan, - 'new_plan', p_new_plan_id, - 'new_plan_key', v_new_key, - 'new_plan_target', v_new_target - ) - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation (owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) OWNER TO supabase_admin; - --- --- Name: create_clinic_tenant(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_clinic_tenant(p_name text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_tenant uuid; - v_name text; -begin - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Not authenticated'; - end if; - - v_name := nullif(trim(coalesce(p_name, '')), ''); - if v_name is null then - v_name := 'Clínica'; - end if; - - insert into public.tenants (name, kind, created_at) - values (v_name, 'clinic', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION public.create_clinic_tenant(p_name text) OWNER TO supabase_admin; - --- --- Name: create_patient_intake_request(text, text, text, text, text, boolean); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text DEFAULT NULL::text, p_phone text DEFAULT NULL::text, p_notes text DEFAULT NULL::text, p_consent boolean DEFAULT false) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_owner uuid; - v_active boolean; - v_expires timestamptz; - v_max_uses int; - v_uses int; - v_id uuid; -begin - select owner_id, active, expires_at, max_uses, uses - into v_owner, v_active, v_expires, v_max_uses, v_uses - from public.patient_invites - where token = p_token - limit 1; - - if v_owner is null then - raise exception 'Token inválido'; - end if; - - if v_active is not true then - raise exception 'Link desativado'; - end if; - - if v_expires is not null and now() > v_expires then - raise exception 'Link expirado'; - end if; - - if v_max_uses is not null and v_uses >= v_max_uses then - raise exception 'Limite de uso atingido'; - end if; - - if p_name is null or length(trim(p_name)) = 0 then - raise exception 'Nome é obrigatório'; - end if; - - insert into public.patient_intake_requests - (owner_id, token, name, email, phone, notes, consent, status) - values - (v_owner, p_token, trim(p_name), - nullif(lower(trim(p_email)), ''), - nullif(trim(p_phone), ''), - nullif(trim(p_notes), ''), - coalesce(p_consent, false), - 'new') - returning id into v_id; - - update public.patient_invites - set uses = uses + 1 - where token = p_token; - - return v_id; -end; -$$; - - -ALTER FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) OWNER TO supabase_admin; - --- --- Name: create_patient_intake_request_v2(text, jsonb); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $_$ -declare - v_owner_id uuid; - v_intake_id uuid; - v_birth_raw text; - v_birth date; -begin - select owner_id - into v_owner_id - from public.patient_invites - where token = p_token; - - if v_owner_id is null then - raise exception 'Token inválido ou expirado'; - end if; - - v_birth_raw := nullif(trim(coalesce( - p_payload->>'data_nascimento', - '' - )), ''); - - v_birth := case - when v_birth_raw is null then null - when v_birth_raw ~ '^\d{4}-\d{2}-\d{2}$' then v_birth_raw::date - when v_birth_raw ~ '^\d{2}-\d{2}-\d{4}$' then to_date(v_birth_raw, 'DD-MM-YYYY') - else null - end; - - insert into public.patient_intake_requests ( - owner_id, - token, - status, - consent, - - nome_completo, - email_principal, - telefone, - - avatar_url, -- 🔥 AQUI - - data_nascimento, - cpf, - rg, - genero, - estado_civil, - profissao, - escolaridade, - nacionalidade, - naturalidade, - - cep, - pais, - cidade, - estado, - endereco, - numero, - complemento, - bairro, - - observacoes, - notas_internas, - - encaminhado_por, - onde_nos_conheceu - ) - values ( - v_owner_id, - p_token, - 'new', - coalesce((p_payload->>'consent')::boolean, false), - - nullif(trim(p_payload->>'nome_completo'), ''), - nullif(trim(p_payload->>'email_principal'), ''), - nullif(regexp_replace(coalesce(p_payload->>'telefone',''), '\D', '', 'g'), ''), - - nullif(trim(p_payload->>'avatar_url'), ''), -- 🔥 AQUI - - v_birth, - nullif(regexp_replace(coalesce(p_payload->>'cpf',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'rg'), ''), - nullif(trim(p_payload->>'genero'), ''), - nullif(trim(p_payload->>'estado_civil'), ''), - nullif(trim(p_payload->>'profissao'), ''), - nullif(trim(p_payload->>'escolaridade'), ''), - nullif(trim(p_payload->>'nacionalidade'), ''), - nullif(trim(p_payload->>'naturalidade'), ''), - - nullif(regexp_replace(coalesce(p_payload->>'cep',''), '\D', '', 'g'), ''), - nullif(trim(p_payload->>'pais'), ''), - nullif(trim(p_payload->>'cidade'), ''), - nullif(trim(p_payload->>'estado'), ''), - nullif(trim(p_payload->>'endereco'), ''), - nullif(trim(p_payload->>'numero'), ''), - nullif(trim(p_payload->>'complemento'), ''), - nullif(trim(p_payload->>'bairro'), ''), - - nullif(trim(p_payload->>'observacoes'), ''), - nullif(trim(p_payload->>'notas_internas'), ''), - - nullif(trim(p_payload->>'encaminhado_por'), ''), - nullif(trim(p_payload->>'onde_nos_conheceu'), '') - ) - returning id into v_intake_id; - - return v_intake_id; -end; -$_$; - - -ALTER FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) OWNER TO supabase_admin; - --- --- Name: create_support_session(uuid, integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer DEFAULT 60) RETURNS json - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_admin_id uuid; - v_role text; - v_token text; - v_expires timestamp with time zone; - v_session support_sessions; -BEGIN - -- Verifica autenticação - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - -- Verifica role saas_admin - SELECT role INTO v_role - FROM public.profiles - WHERE id = v_admin_id; - - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado. Somente saas_admin pode criar sessões de suporte.' - USING ERRCODE = 'P0002'; - END IF; - - -- Valida TTL (1 a 120 minutos) - IF p_ttl_minutes < 1 OR p_ttl_minutes > 120 THEN - RAISE EXCEPTION 'TTL inválido. Use entre 1 e 120 minutos.' - USING ERRCODE = 'P0003'; - END IF; - - -- Valida tenant - IF NOT EXISTS (SELECT 1 FROM public.tenants WHERE id = p_tenant_id) THEN - RAISE EXCEPTION 'Tenant não encontrado.' - USING ERRCODE = 'P0004'; - END IF; - - -- Gera token único (64 chars hex, sem pgcrypto) - v_token := replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', ''); - v_expires := now() + (p_ttl_minutes || ' minutes')::interval; - - -- Insere sessão - INSERT INTO public.support_sessions (tenant_id, admin_id, token, expires_at) - VALUES (p_tenant_id, v_admin_id, v_token, v_expires) - RETURNING * INTO v_session; - - RETURN json_build_object( - 'token', v_session.token, - 'expires_at', v_session.expires_at, - 'session_id', v_session.id - ); -END; -$$; - - -ALTER FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) OWNER TO supabase_admin; - --- --- Name: current_member_id(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.current_member_id(p_tenant_id uuid) RETURNS uuid - LANGUAGE sql STABLE - AS $$ - select tm.id - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION public.current_member_id(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: current_member_role(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.current_member_role(p_tenant_id uuid) RETURNS text - LANGUAGE sql STABLE - AS $$ - select tm.role - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - limit 1 -$$; - - -ALTER FUNCTION public.current_member_role(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: delete_commitment_full(uuid, uuid); Type: FUNCTION; Schema: public; Owner: postgres --- - -CREATE FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields int := 0; - v_logs int := 0; - v_parent int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_fields = row_count; - - delete from public.commitment_time_logs - where tenant_id = p_tenant_id - and commitment_id = p_commitment_id; - get diagnostics v_logs = row_count; - - delete from public.determined_commitments - where tenant_id = p_tenant_id - and id = p_commitment_id; - get diagnostics v_parent = row_count; - - if v_parent <> 1 then - raise exception 'Parent not deleted (RLS/owner issue).'; - end if; - - return jsonb_build_object( - 'ok', true, - 'deleted', jsonb_build_object( - 'fields', v_fields, - 'logs', v_logs, - 'commitment', v_parent - ) - ); -end; -$$; - - -ALTER FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) OWNER TO postgres; - --- --- Name: delete_determined_commitment(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_is_native boolean; - v_fields_deleted int := 0; - v_logs_deleted int := 0; - v_commitment_deleted int := 0; -begin - if auth.uid() is null then - raise exception 'Not authenticated'; - end if; - - if not exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.status = 'active' - ) then - raise exception 'Not allowed'; - end if; - - select dc.is_native - into v_is_native - from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - - if v_is_native is null then - raise exception 'Commitment not found for tenant'; - end if; - - if v_is_native = true then - raise exception 'Cannot delete native commitment'; - end if; - - delete from public.determined_commitment_fields f - where f.tenant_id = p_tenant_id - and f.commitment_id = p_commitment_id; - get diagnostics v_fields_deleted = row_count; - - delete from public.commitment_time_logs l - where l.tenant_id = p_tenant_id - and l.commitment_id = p_commitment_id; - get diagnostics v_logs_deleted = row_count; - - delete from public.determined_commitments dc - where dc.tenant_id = p_tenant_id - and dc.id = p_commitment_id; - get diagnostics v_commitment_deleted = row_count; - - if v_commitment_deleted <> 1 then - raise exception 'Delete did not remove the commitment (tenant mismatch?)'; - end if; - - return jsonb_build_object( - 'ok', true, - 'tenant_id', p_tenant_id, - 'commitment_id', p_commitment_id, - 'deleted', jsonb_build_object( - 'fields', v_fields_deleted, - 'logs', v_logs_deleted, - 'commitment', v_commitment_deleted - ) - ); -end; -$$; - - -ALTER FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) OWNER TO supabase_admin; - --- --- Name: dev_list_auth_users(integer); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_auth_users(p_limit integer DEFAULT 50) RETURNS TABLE(id uuid, email text, created_at timestamp with time zone) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -begin - -- só saas_admin pode ver - if not exists ( - select 1 - from public.profiles p - where p.id = auth.uid() - and p.role = 'saas_admin' - ) then - return; - end if; - - return query - select - u.id, - u.email, - u.created_at - from auth.users u - order by u.created_at desc - limit greatest(1, least(coalesce(p_limit, 50), 500)); -end; -$$; - - -ALTER FUNCTION public.dev_list_auth_users(p_limit integer) OWNER TO supabase_admin; - --- --- Name: dev_list_custom_users(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_custom_users() RETURNS TABLE(user_id uuid, email text, created_at timestamp with time zone, global_role text, tenant_role text, tenant_id uuid, password_dev text, kind text) - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - with base as ( - select - u.id as user_id, - lower(u.email) as email, - u.created_at - from auth.users u - where lower(u.email) not in ( - 'clinic@agenciapsi.com.br', - 'therapist@agenciapsi.com.br', - 'patient@agenciapsi.com.br', - 'saas@agenciapsi.com.br' - ) - ), - prof as ( - select p.id, p.role as global_role - from public.profiles p - ), - last_membership as ( - select distinct on (tm.user_id) - tm.user_id, - tm.tenant_id, - tm.role as tenant_role, - tm.created_at - from public.tenant_members tm - where tm.status = 'active' - order by tm.user_id, tm.created_at desc - ) - select - b.user_id, - b.email, - b.created_at, - pr.global_role, - lm.tenant_role, - lm.tenant_id, - dc.password_dev, - dc.kind - from base b - left join prof pr on pr.id = b.user_id - left join last_membership lm on lm.user_id = b.user_id - left join public.dev_user_credentials dc on lower(dc.email) = b.email - order by b.created_at desc; -$$; - - -ALTER FUNCTION public.dev_list_custom_users() OWNER TO supabase_admin; - --- --- Name: dev_list_intent_leads(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_list_intent_leads() RETURNS TABLE(email text, last_intent_at timestamp with time zone, plan_key text, billing_interval text, status text, tenant_id uuid) - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - select - lower(si.email) as email, - max(si.created_at) as last_intent_at, - (array_agg(si.plan_key order by si.created_at desc))[1] as plan_key, - (array_agg(si.interval order by si.created_at desc))[1] as billing_interval, - (array_agg(si.status order by si.created_at desc))[1] as status, - (array_agg(si.tenant_id order by si.created_at desc))[1] as tenant_id - from public.subscription_intents si - where si.email is not null - and not exists ( - select 1 - from auth.users au - where lower(au.email) = lower(si.email) - ) - group by lower(si.email) - order by max(si.created_at) desc; -$$; - - -ALTER FUNCTION public.dev_list_intent_leads() OWNER TO supabase_admin; - --- --- Name: dev_public_debug_snapshot(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.dev_public_debug_snapshot() RETURNS TABLE(users_total integer, tenants_total integer, intents_new_total integer, latest_intents jsonb) - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $_$ -declare - v_latest jsonb; -begin - select jsonb_agg( - jsonb_build_object( - 'created_at', si.created_at, - 'email_masked', - regexp_replace(lower(si.email), '(^.).*(@.*$)', '\1***\2'), - 'plan_key', si.plan_key, - 'status', si.status - ) - order by si.created_at desc - ) - into v_latest - from ( - select si.* - from public.subscription_intents si - where si.email is not null - order by si.created_at desc - limit 5 - ) si; - - return query - select - (select count(*)::int from auth.users) as users_total, - (select count(*)::int from public.tenants) as tenants_total, - (select count(*)::int from public.subscription_intents where status = 'new') as intents_new_total, - coalesce(v_latest, '[]'::jsonb) as latest_intents; -end; -$_$; - - -ALTER FUNCTION public.dev_public_debug_snapshot() OWNER TO supabase_admin; - --- --- Name: ensure_personal_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.ensure_personal_tenant() RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_uid uuid; - v_existing uuid; -BEGIN - v_uid := auth.uid(); - IF v_uid IS NULL THEN - RAISE EXCEPTION 'Not authenticated'; - END IF; - - SELECT tm.tenant_id INTO v_existing - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = v_uid - AND tm.status = 'active' - AND t.kind IN ('therapist', 'saas') - ORDER BY tm.created_at DESC - LIMIT 1; - - IF v_existing IS NOT NULL THEN - RETURN v_existing; - END IF; - - RETURN public.provision_account_tenant(v_uid, 'therapist'); -END; -$$; - - -ALTER FUNCTION public.ensure_personal_tenant() OWNER TO supabase_admin; - --- --- Name: ensure_personal_tenant_for_user(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid; - v_existing uuid; - v_tenant uuid; - v_email text; - v_name text; -begin - v_uid := p_user_id; - if v_uid is null then - raise exception 'Missing user id'; - end if; - - -- só considera tenant pessoal (kind='saas') - select tm.tenant_id - into v_existing - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = v_uid - and tm.status = 'active' - and t.kind = 'saas' - order by tm.created_at desc - limit 1; - - if v_existing is not null then - return v_existing; - end if; - - select email into v_email - from auth.users - where id = v_uid; - - v_name := coalesce(split_part(v_email, '@', 1), 'Conta'); - - insert into public.tenants (name, kind, created_at) - values (v_name || ' (Pessoal)', 'saas', now()) - returning id into v_tenant; - - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_tenant, v_uid, 'tenant_admin', 'active', now()); - - return v_tenant; -end; -$$; - - -ALTER FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) OWNER TO supabase_admin; - --- --- Name: faq_votar(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.faq_votar(faq_id uuid) RETURNS void - LANGUAGE sql SECURITY DEFINER - AS $$ - update public.saas_faq - set votos = votos + 1, - updated_at = now() - where id = faq_id - and ativo = true; -$$; - - -ALTER FUNCTION public.faq_votar(faq_id uuid) OWNER TO supabase_admin; - --- --- Name: fix_all_subscription_mismatches(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.fix_all_subscription_mismatches() RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - r record; -begin - for r in - select distinct s.user_id as owner_id - from public.subscriptions s - where s.status = 'active' - and s.user_id is not null - loop - perform public.rebuild_owner_entitlements(r.owner_id); - end loop; -end; -$$; - - -ALTER FUNCTION public.fix_all_subscription_mismatches() OWNER TO supabase_admin; - --- --- Name: fn_agenda_regras_semanais_no_overlap(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.fn_agenda_regras_semanais_no_overlap() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_count int; -begin - if new.ativo is false then - return new; - end if; - - select count(*) into v_count - from public.agenda_regras_semanais r - where r.owner_id = new.owner_id - and r.dia_semana = new.dia_semana - and r.ativo is true - and (tg_op = 'INSERT' or r.id <> new.id) - and (new.hora_inicio < r.hora_fim and new.hora_fim > r.hora_inicio); - - if v_count > 0 then - raise exception 'Janela sobreposta: já existe uma regra ativa nesse intervalo.'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.fn_agenda_regras_semanais_no_overlap() OWNER TO supabase_admin; - --- --- Name: get_my_email(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.get_my_email() RETURNS text - LANGUAGE sql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ - select lower(email) - from auth.users - where id = auth.uid(); -$$; - - -ALTER FUNCTION public.get_my_email() OWNER TO supabase_admin; - --- --- Name: guard_account_type_immutable(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_account_type_immutable() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF OLD.account_type <> 'free' AND NEW.account_type IS DISTINCT FROM OLD.account_type THEN - RAISE EXCEPTION 'account_type é imutável após escolha (atual: "%" para tentativa: "%"). Para mudar de perfil, crie uma nova conta.', OLD.account_type, NEW.account_type - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_account_type_immutable() OWNER TO supabase_admin; - --- --- Name: guard_locked_commitment(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_locked_commitment() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if (old.is_locked = true) then - if (tg_op = 'DELETE') then - raise exception 'Compromisso bloqueado não pode ser excluído.'; - end if; - - if (tg_op = 'UPDATE') then - if (new.active = false) then - raise exception 'Compromisso bloqueado não pode ser desativado.'; - end if; - - -- trava renomear (mantém o "Sessão" sempre igual) - if (new.name is distinct from old.name) then - raise exception 'Compromisso bloqueado não pode ser renomeado.'; - end if; - - -- se quiser travar descrição também, descomente: - -- if (new.description is distinct from old.description) then - -- raise exception 'Compromisso bloqueado não pode alterar descrição.'; - -- end if; - end if; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.guard_locked_commitment() OWNER TO supabase_admin; - --- --- Name: guard_no_change_core_plan_key(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_change_core_plan_key() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') - and new.key is distinct from old.key then - raise exception 'Não é permitido alterar a key do plano padrão (%).', old.key - using errcode = 'P0001'; - end if; - - return new; -end $$; - - -ALTER FUNCTION public.guard_no_change_core_plan_key() OWNER TO supabase_admin; - --- --- Name: guard_no_change_plan_target(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_change_plan_target() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_bypass text; -begin - -- bypass controlado por sessão/transação: - -- só passa se app.plan_migration_bypass = '1' - v_bypass := current_setting('app.plan_migration_bypass', true); - - if v_bypass = '1' then - return new; - end if; - - -- comportamento original (bloqueia qualquer mudança) - if new.target is distinct from old.target then - raise exception 'Não é permitido alterar target do plano (%) de % para %.', - old.key, old.target, new.target - using errcode = 'P0001'; - end if; - - return new; -end -$$; - - -ALTER FUNCTION public.guard_no_change_plan_target() OWNER TO supabase_admin; - --- --- Name: guard_no_delete_core_plans(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_no_delete_core_plans() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if old.key in ('clinic_free','clinic_pro','therapist_free','therapist_pro') then - raise exception 'Plano padrão (%) não pode ser removido.', old.key - using errcode = 'P0001'; - end if; - - return old; -end $$; - - -ALTER FUNCTION public.guard_no_delete_core_plans() OWNER TO supabase_admin; - --- --- Name: guard_patient_cannot_own_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_patient_cannot_own_tenant() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_account_type text; -BEGIN - SELECT account_type INTO v_account_type - FROM public.profiles - WHERE id = NEW.user_id; - - IF v_account_type = 'patient' AND NEW.role IN ('tenant_admin', 'therapist') THEN - RAISE EXCEPTION 'Usuário com perfil "patient" não pode ser proprietário ou terapeuta de um tenant. Se tornou profissional? Crie uma nova conta.' - USING ERRCODE = 'P0001'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_patient_cannot_own_tenant() OWNER TO supabase_admin; - --- --- Name: guard_tenant_kind_immutable(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.guard_tenant_kind_immutable() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF NEW.kind IS DISTINCT FROM OLD.kind THEN - RAISE EXCEPTION 'tenants.kind é imutável após criação. Tentativa de alterar "%" para "%".', OLD.kind, NEW.kind - USING ERRCODE = 'P0001'; - END IF; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.guard_tenant_kind_immutable() OWNER TO supabase_admin; - --- --- Name: handle_new_user(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.handle_new_user() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -BEGIN - INSERT INTO public.profiles (id, role, account_type) - VALUES (NEW.id, 'portal_user', 'free') - ON CONFLICT (id) DO NOTHING; - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.handle_new_user() OWNER TO supabase_admin; - --- --- Name: handle_new_user_create_personal_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.handle_new_user_create_personal_tenant() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -BEGIN - -- Desabilitado. Tenant criado no onboarding via provision_account_tenant(). - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.handle_new_user_create_personal_tenant() OWNER TO supabase_admin; - --- --- Name: has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.owner_feature_entitlements e - where e.owner_id = p_owner_id - and e.feature_key = p_feature_key - ); -$$; - - -ALTER FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: is_clinic_tenant(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_clinic_tenant(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id - AND t.kind IN ('clinic', 'clinic_coworking', 'clinic_reception', 'clinic_full') - ); -$$; - - -ALTER FUNCTION public.is_clinic_tenant(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_saas_admin(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_saas_admin() RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 from public.saas_admins sa - where sa.user_id = auth.uid() - ); -$$; - - -ALTER FUNCTION public.is_saas_admin() OWNER TO supabase_admin; - --- --- Name: is_tenant_admin(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_tenant_admin(p_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and tm.status = 'active' - ); -$$; - - -ALTER FUNCTION public.is_tenant_admin(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_tenant_member(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_tenant_member(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.tenant_members m - where m.tenant_id = _tenant_id - and m.user_id = auth.uid() - and m.status = 'active' - ); -$$; - - -ALTER FUNCTION public.is_tenant_member(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: is_therapist_tenant(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.is_therapist_tenant(_tenant_id uuid) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - SELECT EXISTS ( - SELECT 1 FROM public.tenants t - WHERE t.id = _tenant_id AND t.kind = 'therapist' - ); -$$; - - -ALTER FUNCTION public.is_therapist_tenant(_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: jwt_email(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.jwt_email() RETURNS text - LANGUAGE sql STABLE - AS $$ - select nullif(lower(current_setting('request.jwt.claim.email', true)), ''); -$$; - - -ALTER FUNCTION public.jwt_email() OWNER TO supabase_admin; - --- --- Name: my_tenants(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.my_tenants() RETURNS TABLE(tenant_id uuid, role text, status text, kind text) - LANGUAGE sql STABLE - AS $$ - select - tm.tenant_id, - tm.role, - tm.status, - t.kind - from public.tenant_members tm - join public.tenants t on t.id = tm.tenant_id - where tm.user_id = auth.uid(); -$$; - - -ALTER FUNCTION public.my_tenants() OWNER TO supabase_admin; - --- --- Name: on_new_user_seed_patient_groups(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.on_new_user_seed_patient_groups() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ - BEGIN - PERFORM public.seed_default_patient_groups(NEW.id); - RETURN NEW; - END; - $$; - - -ALTER FUNCTION public.on_new_user_seed_patient_groups() OWNER TO supabase_admin; - --- --- Name: patients_validate_member_consistency(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.patients_validate_member_consistency() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_tenant_responsible uuid; - v_tenant_therapist uuid; -BEGIN - -- responsible_member sempre deve existir e ser do tenant - SELECT tenant_id INTO v_tenant_responsible - FROM public.tenant_members - WHERE id = NEW.responsible_member_id; - - IF v_tenant_responsible IS NULL THEN - RAISE EXCEPTION 'Responsible member not found'; - END IF; - - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'tenant_id is required'; - END IF; - - IF v_tenant_responsible <> NEW.tenant_id THEN - RAISE EXCEPTION 'Responsible member must belong to the same tenant'; - END IF; - - -- therapist scope: therapist_member_id deve existir e ser do mesmo tenant - IF NEW.patient_scope = 'therapist' THEN - IF NEW.therapist_member_id IS NULL THEN - RAISE EXCEPTION 'therapist_member_id is required when patient_scope=therapist'; - END IF; - - SELECT tenant_id INTO v_tenant_therapist - FROM public.tenant_members - WHERE id = NEW.therapist_member_id; - - IF v_tenant_therapist IS NULL THEN - RAISE EXCEPTION 'Therapist member not found'; - END IF; - - IF v_tenant_therapist <> NEW.tenant_id THEN - RAISE EXCEPTION 'Therapist member must belong to the same tenant'; - END IF; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.patients_validate_member_consistency() OWNER TO supabase_admin; - --- --- Name: patients_validate_responsible_member_tenant(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.patients_validate_responsible_member_tenant() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - m_tenant uuid; -begin - select tenant_id into m_tenant - from public.tenant_members - where id = new.responsible_member_id; - - if m_tenant is null then - raise exception 'Responsible member not found'; - end if; - - if new.tenant_id is null then - raise exception 'tenant_id is required'; - end if; - - if m_tenant <> new.tenant_id then - raise exception 'Responsible member must belong to the same tenant'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.patients_validate_responsible_member_tenant() OWNER TO supabase_admin; - --- --- Name: prevent_promoting_to_system(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_promoting_to_system() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.is_system = true and old.is_system is distinct from true then - raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.'; - end if; - return new; -end; -$$; - - -ALTER FUNCTION public.prevent_promoting_to_system() OWNER TO supabase_admin; - --- --- Name: prevent_saas_membership(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_saas_membership() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM public.profiles - WHERE id = NEW.user_id - AND role = 'saas_admin' - ) THEN - RAISE EXCEPTION 'SaaS admin cannot belong to tenant'; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.prevent_saas_membership() OWNER TO supabase_admin; - --- --- Name: prevent_system_group_changes(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.prevent_system_group_changes() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - -- Se for grupo do sistema, regras rígidas: - if old.is_system = true then - - -- nunca pode deletar - if tg_op = 'DELETE' then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - if tg_op = 'UPDATE' then - -- permite SOMENTE mudar tenant_id e/ou updated_at - -- qualquer mudança de conteúdo permanece proibida - if - new.nome is distinct from old.nome or - new.descricao is distinct from old.descricao or - new.cor is distinct from old.cor or - new.is_active is distinct from old.is_active or - new.is_system is distinct from old.is_system or - new.owner_id is distinct from old.owner_id or - new.therapist_id is distinct from old.therapist_id or - new.created_at is distinct from old.created_at - then - raise exception 'Grupos padrão do sistema não podem ser alterados ou excluídos.'; - end if; - - -- chegou aqui: só tenant_id/updated_at mudaram -> ok - return new; - end if; - - end if; - - -- não-system: deixa passar - if tg_op = 'DELETE' then - return old; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.prevent_system_group_changes() OWNER TO supabase_admin; - --- --- Name: provision_account_tenant(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text DEFAULT NULL::text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -DECLARE - v_tenant_id uuid; - v_account_type text; - v_name text; -BEGIN - IF p_kind NOT IN ('therapist', 'clinic_coworking', 'clinic_reception', 'clinic_full') THEN - RAISE EXCEPTION 'kind inválido: "%". Use: therapist, clinic_coworking, clinic_reception, clinic_full.', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_account_type := CASE WHEN p_kind = 'therapist' THEN 'therapist' ELSE 'clinic' END; - - IF EXISTS ( - SELECT 1 - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - WHERE tm.user_id = p_user_id - AND tm.role = 'tenant_admin' - AND tm.status = 'active' - AND t.kind = p_kind - ) THEN - RAISE EXCEPTION 'Usuário já possui um tenant do tipo "%".', p_kind - USING ERRCODE = 'P0001'; - END IF; - - v_name := COALESCE( - NULLIF(TRIM(p_name), ''), - ( - SELECT COALESCE(NULLIF(TRIM(pr.full_name), ''), SPLIT_PART(au.email, '@', 1)) - FROM public.profiles pr - JOIN auth.users au ON au.id = pr.id - WHERE pr.id = p_user_id - ), - 'Conta' - ); - - INSERT INTO public.tenants (name, kind, created_at) - VALUES (v_name, p_kind, now()) - RETURNING id INTO v_tenant_id; - - INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) - VALUES (v_tenant_id, p_user_id, 'tenant_admin', 'active', now()); - - UPDATE public.profiles - SET account_type = v_account_type - WHERE id = p_user_id; - - PERFORM public.seed_determined_commitments(v_tenant_id); - - RETURN v_tenant_id; -END; -$$; - - -ALTER FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) OWNER TO supabase_admin; - --- --- Name: FUNCTION provision_account_tenant(p_user_id uuid, p_kind text, p_name text); Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) IS 'Cria o tenant do tipo correto e atualiza account_type no profile. Chamar no onboarding após escolha/pagamento de plano therapist ou clinic. p_kind: therapist | clinic_coworking | clinic_reception | clinic_full'; - - --- --- Name: reactivate_subscription(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.reactivate_subscription(p_subscription_id uuid) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_owner_type text; - v_owner_ref uuid; -begin - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id - for update; - - if not found then - raise exception 'Subscription não encontrada'; - end if; - - if v_sub.status = 'active' then - return v_sub; - end if; - - if v_sub.tenant_id is not null then - v_owner_type := 'clinic'; - v_owner_ref := v_sub.tenant_id; - elsif v_sub.user_id is not null then - v_owner_type := 'therapist'; - v_owner_ref := v_sub.user_id; - else - v_owner_type := null; - v_owner_ref := null; - end if; - - update public.subscriptions - set status = 'active', - cancel_at_period_end = false, - updated_at = now() - where id = p_subscription_id - returning * into v_sub; - - insert into public.subscription_events( - subscription_id, - owner_id, - owner_type, - owner_ref, - event_type, - old_plan_id, - new_plan_id, - created_by, - reason, - source, - metadata - ) - values ( - v_sub.id, - v_owner_ref, - v_owner_type, - v_owner_ref, - 'reactivated', - v_sub.plan_id, - v_sub.plan_id, - auth.uid(), - 'Reativação manual via admin', - 'admin_panel', - jsonb_build_object('previous_status', 'canceled') - ); - - if v_owner_ref is not null then - insert into public.entitlements_invalidation(owner_id, changed_at) - values (v_owner_ref, now()) - on conflict (owner_id) - do update set changed_at = excluded.changed_at; - end if; - - return v_sub; - -end; -$$; - - -ALTER FUNCTION public.reactivate_subscription(p_subscription_id uuid) OWNER TO supabase_admin; - --- --- Name: rebuild_owner_entitlements(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_plan_id uuid; -begin - -- Plano ativo do owner (owner = subscriptions.user_id) - select s.plan_id - into v_plan_id - from public.subscriptions s - where s.user_id = p_owner_id - and s.status = 'active' - order by s.created_at desc - limit 1; - - -- Sempre zera entitlements do owner (rebuild) - delete from public.owner_feature_entitlements e - where e.owner_id = p_owner_id; - - -- Se não tem assinatura ativa, acabou - if v_plan_id is null then - return; - end if; - - -- Recria entitlements esperados pelo plano - insert into public.owner_feature_entitlements (owner_id, feature_key, sources, limits_list) - select - p_owner_id as owner_id, - f.key as feature_key, - array['plan'::text] as sources, - '{}'::jsonb as limits_list - from public.plan_features pf - join public.features f on f.id = pf.feature_id - where pf.plan_id = v_plan_id; - -end; -$$; - - -ALTER FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) OWNER TO supabase_admin; - --- --- Name: revoke_support_session(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.revoke_support_session(p_token text) RETURNS boolean - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_admin_id uuid; - v_role text; -BEGIN - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - SELECT role INTO v_role FROM public.profiles WHERE id = v_admin_id; - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado.' USING ERRCODE = 'P0002'; - END IF; - - DELETE FROM public.support_sessions - WHERE token = p_token - AND admin_id = v_admin_id; - - RETURN FOUND; -END; -$$; - - -ALTER FUNCTION public.revoke_support_session(p_token text) OWNER TO supabase_admin; - --- --- Name: rotate_patient_invite_token(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.rotate_patient_invite_token(p_new_token text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - v_uid uuid; - v_id uuid; -begin - -- pega o usuário logado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'Usuário não autenticado'; - end if; - - -- desativa tokens antigos ativos do usuário - update public.patient_invites - set active = false - where owner_id = v_uid - and active = true; - - -- cria novo token - insert into public.patient_invites (owner_id, token, active) - values (v_uid, p_new_token, true) - returning id into v_id; - - return v_id; -end; -$$; - - -ALTER FUNCTION public.rotate_patient_invite_token(p_new_token text) OWNER TO supabase_admin; - --- --- Name: saas_votar_doc(uuid, boolean); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_uid uuid := auth.uid(); - v_voto_antigo boolean; -begin - if v_uid is null then - raise exception 'Não autenticado'; - end if; - - -- Verifica se já votou - select util into v_voto_antigo - from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - if found then - -- Já votou igual → cancela o voto (toggle) - if v_voto_antigo = p_util then - delete from public.saas_doc_votos - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util - (case when p_util then 1 else 0 end)), - votos_nao_util = greatest(0, votos_nao_util - (case when not p_util then 1 else 0 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'removido', 'util', null); - else - -- Mudou de voto - update public.saas_doc_votos set util = p_util, updated_at = now() - where doc_id = p_doc_id and user_id = v_uid; - - update public.saas_docs set - votos_util = greatest(0, votos_util + (case when p_util then 1 else -1 end)), - votos_nao_util = greatest(0, votos_nao_util + (case when not p_util then 1 else -1 end)), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'atualizado', 'util', p_util); - end if; - else - -- Primeiro voto - insert into public.saas_doc_votos (doc_id, user_id, util) - values (p_doc_id, v_uid, p_util); - - update public.saas_docs set - votos_util = votos_util + (case when p_util then 1 else 0 end), - votos_nao_util = votos_nao_util + (case when not p_util then 1 else 0 end), - updated_at = now() - where id = p_doc_id; - - return jsonb_build_object('acao', 'registrado', 'util', p_util); - end if; -end; -$$; - - -ALTER FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) OWNER TO supabase_admin; - --- --- Name: seed_determined_commitments(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.seed_determined_commitments(p_tenant_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_id uuid; -begin - -- Sessão (locked + sempre ativa) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'session' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'session', true, true, 'Sessão', 'Sessão com paciente'); - end if; - - -- Leitura - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'reading', false, true, 'Leitura', 'Praticar leitura'); - end if; - - -- Supervisão - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'supervision', false, true, 'Supervisão', 'Supervisão'); - end if; - - -- Aula ✅ (corrigido) - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'class', false, false, 'Aula', 'Dar aula'); - end if; - - -- Análise pessoal - if not exists ( - select 1 from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - ) then - insert into public.determined_commitments - (tenant_id, is_native, native_key, is_locked, active, name, description) - values - (p_tenant_id, true, 'analysis', false, true, 'Análise Pessoal', 'Minha análise pessoal'); - end if; - - -- ------------------------------------------------------- - -- Campos padrão (idempotentes por (commitment_id, key)) - -- ------------------------------------------------------- - - -- Leitura - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'reading' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'book') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'book', 'Livro', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'author') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'author', 'Autor', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Supervisão - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'supervision' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'supervisor') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'supervisor', 'Supervisor', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'topic') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'topic', 'Assunto', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Aula - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'class' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'theme') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'theme', 'Tema', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'group') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'group', 'Turma', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; - - -- Análise - select id into v_id - from public.determined_commitments - where tenant_id = p_tenant_id and is_native = true and native_key = 'analysis' - limit 1; - - if v_id is not null then - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'analyst') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'analyst', 'Analista', 'text', false, 10); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'focus') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'focus', 'Foco', 'text', false, 20); - end if; - - if not exists (select 1 from public.determined_commitment_fields where commitment_id = v_id and key = 'notes') then - insert into public.determined_commitment_fields (tenant_id, commitment_id, key, label, field_type, required, sort_order) - values (p_tenant_id, v_id, 'notes', 'Observação', 'textarea', false, 30); - end if; - end if; -end; -$$; - - -ALTER FUNCTION public.seed_determined_commitments(p_tenant_id uuid) OWNER TO supabase_admin; - --- --- Name: set_insurance_plans_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_insurance_plans_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN NEW.updated_at = now(); RETURN NEW; END; $$; - - -ALTER FUNCTION public.set_insurance_plans_updated_at() OWNER TO supabase_admin; - --- --- Name: set_owner_id(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_owner_id() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if new.owner_id is null then - new.owner_id := auth.uid(); - end if; - return new; -end; -$$; - - -ALTER FUNCTION public.set_owner_id() OWNER TO supabase_admin; - --- --- Name: set_services_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_services_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.set_services_updated_at() OWNER TO supabase_admin; - --- --- Name: set_tenant_feature_exception(uuid, text, boolean, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text DEFAULT NULL::text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -begin - -- ✅ Só owner ou admin do tenant podem alterar features - if not exists ( - select 1 from public.tenant_members - where tenant_id = p_tenant_id - and user_id = auth.uid() - and role in ('owner', 'admin') - and status = 'active' - ) then - raise exception 'Acesso negado: apenas owner/admin pode alterar features do tenant.'; - end if; - - insert into public.tenant_features (tenant_id, feature_key, enabled) - values (p_tenant_id, p_feature_key, p_enabled) - on conflict (tenant_id, feature_key) - do update set enabled = excluded.enabled; - - insert into public.tenant_feature_exceptions_log ( - tenant_id, feature_key, enabled, reason, created_by - ) values ( - p_tenant_id, p_feature_key, p_enabled, p_reason, auth.uid() - ); -end; -$$; - - -ALTER FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) OWNER TO supabase_admin; - --- --- Name: set_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - new.updated_at = now(); - return new; -end; -$$; - - -ALTER FUNCTION public.set_updated_at() OWNER TO supabase_admin; - --- --- Name: set_updated_at_recurrence(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.set_updated_at_recurrence() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN NEW.updated_at = now(); RETURN NEW; END; -$$; - - -ALTER FUNCTION public.set_updated_at_recurrence() OWNER TO supabase_admin; - --- --- Name: split_recurrence_at(uuid, date); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_old public.recurrence_rules; - v_new_id uuid; -BEGIN - -- busca a regra original - SELECT * INTO v_old - FROM public.recurrence_rules - WHERE id = p_recurrence_id; - - IF NOT FOUND THEN - RAISE EXCEPTION 'recurrence_rule % não encontrada', p_recurrence_id; - END IF; - - -- encerra a regra antiga na data anterior - UPDATE public.recurrence_rules - SET - end_date = p_from_date - INTERVAL '1 day', - open_ended = false, - updated_at = now() - WHERE id = p_recurrence_id; - - -- cria nova regra a partir de p_from_date - INSERT INTO public.recurrence_rules ( - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - start_date, end_date, max_occurrences, open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - ) - SELECT - tenant_id, owner_id, therapist_id, patient_id, - determined_commitment_id, type, interval, weekdays, - start_time, end_time, timezone, duration_min, - p_from_date, v_old.end_date, v_old.max_occurrences, v_old.open_ended, - modalidade, titulo_custom, observacoes, extra_fields, status - FROM public.recurrence_rules - WHERE id = p_recurrence_id - RETURNING id INTO v_new_id; - - RETURN v_new_id; -END; -$$; - - -ALTER FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) OWNER TO supabase_admin; - --- --- Name: subscription_intents_view_insert(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.subscription_intents_view_insert() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_target text; - v_plan_id uuid; -begin - select p.id, p.target into v_plan_id, v_target - from public.plans p - where p.key = new.plan_key; - - if v_plan_id is null then - raise exception 'Plano inválido: plan_key=%', new.plan_key; - end if; - - if lower(v_target) = 'clinic' then - if new.tenant_id is null then - raise exception 'Intenção clinic exige tenant_id.'; - end if; - - insert into public.subscription_intents_tenant ( - id, tenant_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.tenant_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := 'clinic'; - return new; - end if; - - -- therapist ou supervisor → tabela personal - if lower(v_target) in ('therapist', 'supervisor') then - insert into public.subscription_intents_personal ( - id, user_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.user_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := lower(v_target); -- 'therapist' ou 'supervisor' - return new; - end if; - - raise exception 'Target de plano não suportado: %', v_target; -end; -$$; - - -ALTER FUNCTION public.subscription_intents_view_insert() OWNER TO supabase_admin; - --- --- Name: subscriptions_validate_scope(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.subscriptions_validate_scope() RETURNS trigger - LANGUAGE plpgsql - AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target IN ('therapist', 'supervisor') THEN - -- supervisor é pessoal como therapist - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura % não deve ter tenant_id.', v_target; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura % exige user_id.', v_target; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.subscriptions_validate_scope() OWNER TO supabase_admin; - --- --- Name: sync_busy_mirror_agenda_eventos(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.sync_busy_mirror_agenda_eventos() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -declare - clinic_tenant uuid; - is_personal boolean; - should_mirror boolean; -begin - -- Anti-recursão: espelho não espelha - if (tg_op <> 'DELETE') then - if new.mirror_of_event_id is not null then - return new; - end if; - else - if old.mirror_of_event_id is not null then - return old; - end if; - end if; - - -- Define se é pessoal e se deve espelhar - if (tg_op = 'DELETE') then - is_personal := (old.tenant_id = old.owner_id); - should_mirror := (old.visibility_scope in ('busy_only','private')); - else - is_personal := (new.tenant_id = new.owner_id); - should_mirror := (new.visibility_scope in ('busy_only','private')); - end if; - - -- Se não é pessoal, não faz nada - if not is_personal then - if (tg_op = 'DELETE') then - return old; - end if; - return new; - end if; - - -- DELETE: remove espelhos existentes - if (tg_op = 'DELETE') then - delete from public.agenda_eventos e - where e.mirror_of_event_id = old.id - and e.mirror_source = 'personal_busy_mirror'; - - return old; - end if; - - -- INSERT/UPDATE: - -- Se não deve espelhar, remove espelhos e sai - if not should_mirror then - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror'; - - return new; - end if; - - -- Para cada clínica onde o usuário é therapist active, cria/atualiza o "Ocupado" - for clinic_tenant in - select tm.tenant_id - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id <> new.owner_id - loop - insert into public.agenda_eventos ( - tenant_id, - owner_id, - terapeuta_id, - paciente_id, - tipo, - status, - titulo, - observacoes, - inicio_em, - fim_em, - mirror_of_event_id, - mirror_source, - visibility_scope, - created_at, - updated_at - ) values ( - clinic_tenant, - new.owner_id, - new.owner_id, - null, - 'bloqueio'::public.tipo_evento_agenda, - 'agendado'::public.status_evento_agenda, - 'Ocupado', - null, - new.inicio_em, - new.fim_em, - new.id, - 'personal_busy_mirror', - 'public', - now(), - now() - ) - on conflict (tenant_id, mirror_of_event_id) where mirror_of_event_id is not null - do update set - owner_id = excluded.owner_id, - terapeuta_id = excluded.terapeuta_id, - tipo = excluded.tipo, - status = excluded.status, - titulo = excluded.titulo, - observacoes = excluded.observacoes, - inicio_em = excluded.inicio_em, - fim_em = excluded.fim_em, - updated_at = now(); - end loop; - - -- Limpa espelhos de clínicas onde o vínculo therapist active não existe mais - delete from public.agenda_eventos e - where e.mirror_of_event_id = new.id - and e.mirror_source = 'personal_busy_mirror' - and not exists ( - select 1 - from public.tenant_members tm - where tm.user_id = new.owner_id - and tm.role = 'therapist' - and tm.status = 'active' - and tm.tenant_id = e.tenant_id - ); - - return new; -end; -$$; - - -ALTER FUNCTION public.sync_busy_mirror_agenda_eventos() OWNER TO supabase_admin; - --- --- Name: tenant_accept_invite(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_accept_invite(p_token uuid) RETURNS jsonb - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_uid uuid; - v_email text; - v_invite public.tenant_invites%rowtype; -begin - -- 1) precisa estar autenticado - v_uid := auth.uid(); - if v_uid is null then - raise exception 'not_authenticated' using errcode = 'P0001'; - end if; - - -- 2) pega email real do usuário logado sem depender do JWT claim - select u.email - into v_email - from auth.users u - where u.id = v_uid; - - if v_email is null or length(trim(v_email)) = 0 then - raise exception 'missing_user_email' using errcode = 'P0001'; - end if; - - -- 3) carrega o invite e trava linha (evita 2 aceites concorrentes) - select * - into v_invite - from public.tenant_invites i - where i.token = p_token - for update; - - if not found then - raise exception 'invite_not_found' using errcode = 'P0001'; - end if; - - -- 4) validações de estado - if v_invite.revoked_at is not null then - raise exception 'invite_revoked' using errcode = 'P0001'; - end if; - - if v_invite.accepted_at is not null then - raise exception 'invite_already_accepted' using errcode = 'P0001'; - end if; - - if v_invite.expires_at is not null and v_invite.expires_at <= now() then - raise exception 'invite_expired' using errcode = 'P0001'; - end if; - - -- 5) valida email (case-insensitive) - if lower(trim(v_invite.email)) <> lower(trim(v_email)) then - raise exception 'email_mismatch' using errcode = 'P0001'; - end if; - - -- 6) consome o invite - update public.tenant_invites - set accepted_at = now(), - accepted_by = v_uid - where id = v_invite.id; - - -- 7) cria ou reativa o membership - insert into public.tenant_members (tenant_id, user_id, role, status, created_at) - values (v_invite.tenant_id, v_uid, v_invite.role, 'active', now()) - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active'; - - -- 8) retorno útil pro front (você já tenta ler tenant_id no AcceptInvitePage) - return jsonb_build_object( - 'ok', true, - 'tenant_id', v_invite.tenant_id, - 'role', v_invite.role - ); -end; -$$; - - -ALTER FUNCTION public.tenant_accept_invite(p_token uuid) OWNER TO supabase_admin; - --- --- Name: tenant_members; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_members ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - user_id uuid NOT NULL, - role text NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_members OWNER TO supabase_admin; - --- --- Name: tenant_add_member_by_email(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text DEFAULT 'therapist'::text) RETURNS public.tenant_members - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_target_uid uuid; - v_member public.tenant_members%rowtype; - v_is_admin boolean; - v_email text; -begin - if p_tenant_id is null then - raise exception 'tenant_id é obrigatório'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'email é obrigatório'; - end if; - - -- valida role permitida - if p_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'role inválida: %', p_role; - end if; - - -- apenas admin do tenant (role real no banco) - select exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = p_tenant_id - and tm.user_id = auth.uid() - and tm.role = 'tenant_admin' - and coalesce(tm.status,'active') = 'active' - ) into v_is_admin; - - if not v_is_admin then - raise exception 'sem permissão: apenas admin da clínica pode adicionar membros'; - end if; - - -- acha usuário pelo e-mail no Supabase Auth - select u.id - into v_target_uid - from auth.users u - where lower(u.email) = v_email - limit 1; - - if v_target_uid is null then - raise exception 'nenhum usuário encontrado com este e-mail'; - end if; - - -- cria ou reativa membro - insert into public.tenant_members (tenant_id, user_id, role, status) - values (p_tenant_id, v_target_uid, p_role, 'active') - on conflict (tenant_id, user_id) - do update set - role = excluded.role, - status = 'active' - returning * into v_member; - - return v_member; -end; -$$; - - -ALTER FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_feature_allowed(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.v_tenant_entitlements v - where v.tenant_id = p_tenant_id - and v.feature_key = p_feature_key - and coalesce(v.allowed, false) = true - ); -$$; - - -ALTER FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: tenant_feature_enabled(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select coalesce( - (select tf.enabled - from public.tenant_features tf - where tf.tenant_id = p_tenant_id and tf.feature_key = p_feature_key), - false - ); -$$; - - -ALTER FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) OWNER TO supabase_admin; - --- --- Name: tenant_features_guard_with_plan(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_features_guard_with_plan() RETURNS trigger - LANGUAGE plpgsql - AS $$ -declare - v_allowed boolean; -begin - -- só valida quando está habilitando - if new.enabled is distinct from true then - return new; - end if; - - -- permitido pelo plano do tenant? - select exists ( - select 1 - from public.v_tenant_entitlements_full v - where v.tenant_id = new.tenant_id - and v.feature_key = new.feature_key - and v.allowed = true - ) - into v_allowed; - - if not v_allowed then - raise exception 'Feature % não permitida pelo plano atual do tenant %.', - new.feature_key, new.tenant_id - using errcode = 'P0001'; - end if; - - return new; -end; -$$; - - -ALTER FUNCTION public.tenant_features_guard_with_plan() OWNER TO supabase_admin; - --- --- Name: tenant_has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select - exists ( - select 1 - from public.v_tenant_entitlements e - where e.tenant_id = _tenant_id - and e.feature_key = _feature - and e.allowed = true - ) - or exists ( - select 1 - from public.tenant_features tf - where tf.tenant_id = _tenant_id - and tf.feature_key = _feature - and tf.enabled = true - ); -$$; - - -ALTER FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) OWNER TO supabase_admin; - --- --- Name: tenant_invite_member_by_email(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) RETURNS uuid - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public', 'auth' - AS $$ -declare - v_email text; - v_my_email text; - v_token uuid; - v_updated int; -begin - -- validações básicas - if p_tenant_id is null then - raise exception 'tenant_id inválido' using errcode = 'P0001'; - end if; - - v_email := lower(trim(coalesce(p_email, ''))); - if v_email = '' then - raise exception 'Informe um email' using errcode = 'P0001'; - end if; - - -- role permitido (ajuste se quiser) - if p_role is null or p_role not in ('therapist', 'secretary') then - raise exception 'Role inválido (use therapist/secretary)' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: auto-convite - v_my_email := public.get_my_email(); - if v_my_email is not null and v_email = v_my_email then - raise exception 'Você não pode convidar o seu próprio email.' using errcode = 'P0001'; - end if; - - -- ✅ bloqueio: já é membro ativo do tenant - if exists ( - select 1 - from tenant_members tm - join auth.users au on au.id = tm.user_id - where tm.tenant_id = p_tenant_id - and tm.status = 'active' - and lower(au.email) = v_email - ) then - raise exception 'Este email já está vinculado a esta clínica.' using errcode = 'P0001'; - end if; - - -- ✅ permissão: só admin do tenant pode convidar - if not exists ( - select 1 - from tenant_members me - where me.tenant_id = p_tenant_id - and me.user_id = auth.uid() - and me.status = 'active' - and me.role in ('tenant_admin','clinic_admin') - ) then - raise exception 'Sem permissão para convidar membros.' using errcode = 'P0001'; - end if; - - -- Gera token (reenvio simples / regeneração) - v_token := gen_random_uuid(); - - -- 1) tenta "regerar" um convite pendente existente (mesmo email) - update tenant_invites - set token = v_token, - role = p_role, - created_at = now(), - expires_at = now() + interval '7 days', - accepted_at = null, - revoked_at = null - where tenant_id = p_tenant_id - and lower(email) = v_email - and accepted_at is null - and revoked_at is null; - - get diagnostics v_updated = row_count; - - -- 2) se não atualizou nada, cria convite novo - if v_updated = 0 then - insert into tenant_invites (tenant_id, email, role, token, created_at, expires_at) - values (p_tenant_id, v_email, p_role, v_token, now(), now() + interval '7 days'); - end if; - - return v_token; -end; -$$; - - -ALTER FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_reactivate_member(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - update public.tenant_members - set status = 'active' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_remove_member(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -declare - v_role text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - -- pega role atual do membro (se não existir, erro) - select role into v_role - from public.tenant_members - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if v_role is null then - raise exception 'membership_not_found'; - end if; - - -- trava: se for therapist, não pode remover com eventos futuros - if v_role = 'therapist' then - if exists ( - select 1 - from public.agenda_eventos e - where e.owner_id = p_tenant_id - and e.terapeuta_id = p_member_user_id - and e.inicio_em >= now() - and e.status::text not in ('cancelado','cancelled','canceled') - limit 1 - ) then - raise exception 'cannot_remove_therapist_with_future_events'; - end if; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_remove_member_soft(uuid, uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - if p_member_user_id = auth.uid() then - raise exception 'cannot_remove_self'; - end if; - - update public.tenant_members - set status = 'inactive' - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) OWNER TO supabase_admin; - --- --- Name: tenant_revoke_invite(uuid, text, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -declare - v_email text; -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - v_email := lower(trim(p_email)); - - update public.tenant_invites - set revoked_at = now(), - revoked_by = auth.uid() - where tenant_id = p_tenant_id - and lower(email) = v_email - and role = p_role - and accepted_at is null - and revoked_at is null; - - if not found then - raise exception 'invite_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) OWNER TO supabase_admin; - --- --- Name: tenant_set_member_status(uuid, uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida status (adapte aos seus valores reais) - if p_new_status not in ('active','inactive','suspended','invited') then - raise exception 'invalid_status: %', p_new_status; - end if; - - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita desativar a si mesmo (opcional) - if p_member_user_id = auth.uid() and p_new_status <> 'active' then - raise exception 'cannot_disable_self'; - end if; - - update public.tenant_members - set status = p_new_status - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) OWNER TO supabase_admin; - --- --- Name: tenant_update_member_role(uuid, uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - SET row_security TO 'off' - AS $$ -begin - -- exige auth - if auth.uid() is null then - raise exception 'not_authenticated'; - end if; - - -- valida role - if p_new_role not in ('tenant_admin','therapist','secretary','patient') then - raise exception 'invalid_role: %', p_new_role; - end if; - - -- somente tenant_admin ativo pode alterar role - if not public.is_tenant_admin(p_tenant_id) then - raise exception 'not_allowed'; - end if; - - -- evita o admin remover o próprio admin sem querer (opcional mas recomendado) - if p_member_user_id = auth.uid() and p_new_role <> 'tenant_admin' then - raise exception 'cannot_demote_self'; - end if; - - update public.tenant_members - set role = p_new_role - where tenant_id = p_tenant_id - and user_id = p_member_user_id; - - if not found then - raise exception 'membership_not_found'; - end if; -end; -$$; - - -ALTER FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) OWNER TO supabase_admin; - --- --- Name: toggle_plan(uuid); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.toggle_plan(owner uuid) RETURNS void - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - current_key text; - new_key text; -begin - select p.key into current_key - from subscriptions s - join plans p on p.id = s.plan_id - where s.owner_id = owner - and s.status = 'active'; - - new_key := case - when current_key = 'pro' then 'free' - else 'pro' - end; - - update subscriptions s - set plan_id = p.id - from plans p - where p.key = new_key - and s.owner_id = owner - and s.status = 'active'; -end; -$$; - - -ALTER FUNCTION public.toggle_plan(owner uuid) OWNER TO supabase_admin; - --- --- Name: transition_subscription(uuid, text, text, jsonb); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text DEFAULT NULL::text, p_metadata jsonb DEFAULT NULL::jsonb) RETURNS public.subscriptions - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -declare - v_sub public.subscriptions; - v_uid uuid; - v_is_allowed boolean := false; -begin - v_uid := auth.uid(); - - select * - into v_sub - from public.subscriptions - where id = p_subscription_id; - - if not found then - raise exception 'Assinatura não encontrada'; - end if; - - -- ===================================================== - -- 🔐 BLOCO DE AUTORIZAÇÃO - -- ===================================================== - - -- 1) SaaS admin pode tudo - if is_saas_admin() then - v_is_allowed := true; - end if; - - -- 2) Assinatura pessoal (therapist) - if not v_is_allowed - and v_sub.tenant_id is null - and v_sub.user_id = v_uid then - v_is_allowed := true; - end if; - - -- 3) Assinatura de clinic (tenant) - if not v_is_allowed - and v_sub.tenant_id is not null then - - if exists ( - select 1 - from public.tenant_members tm - where tm.tenant_id = v_sub.tenant_id - and tm.user_id = v_uid - and tm.status = 'active' - and tm.role = 'tenant_admin' - ) then - v_is_allowed := true; - end if; - - end if; - - if not v_is_allowed then - raise exception 'Sem permissão para transicionar esta assinatura'; - end if; - - -- ===================================================== - -- 🧠 TRANSIÇÃO - -- ===================================================== - - update public.subscriptions - set status = p_to_status, - updated_at = now(), - cancelled_at = case when p_to_status = 'cancelled' then now() else cancelled_at end, - suspended_at = case when p_to_status = 'suspended' then now() else suspended_at end, - past_due_since = case when p_to_status = 'past_due' then now() else past_due_since end, - expired_at = case when p_to_status = 'expired' then now() else expired_at end, - activated_at = case when p_to_status = 'active' then now() else activated_at end - where id = p_subscription_id - returning * into v_sub; - - -- ===================================================== - -- 🧾 EVENT LOG - -- ===================================================== - - insert into public.subscription_events ( - subscription_id, - owner_id, - event_type, - created_at, - created_by, - source, - reason, - metadata, - owner_type, - owner_ref - ) - values ( - v_sub.id, - coalesce(v_sub.tenant_id, v_sub.user_id), - 'status_changed', - now(), - v_uid, - 'manual_transition', - p_reason, - p_metadata, - case when v_sub.tenant_id is not null then 'tenant' else 'personal' end, - coalesce(v_sub.tenant_id, v_sub.user_id) - ); - - return v_sub; -end; -$$; - - -ALTER FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) OWNER TO supabase_admin; - --- --- Name: update_payment_settings_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.update_payment_settings_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.update_payment_settings_updated_at() OWNER TO supabase_admin; - --- --- Name: update_professional_pricing_updated_at(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.update_professional_pricing_updated_at() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION public.update_professional_pricing_updated_at() OWNER TO supabase_admin; - --- --- Name: user_has_feature(uuid, text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.user_has_feature(_user_id uuid, _feature text) RETURNS boolean - LANGUAGE sql STABLE - AS $$ - select exists ( - select 1 - from public.v_user_entitlements e - where e.user_id = _user_id - and e.feature_key = _feature - and e.allowed = true - ); -$$; - - -ALTER FUNCTION public.user_has_feature(_user_id uuid, _feature text) OWNER TO supabase_admin; - --- --- Name: validate_support_session(text); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.validate_support_session(p_token text) RETURNS json - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'public' - AS $$ -DECLARE - v_session support_sessions; -BEGIN - IF p_token IS NULL OR length(trim(p_token)) < 32 THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - SELECT * INTO v_session - FROM public.support_sessions - WHERE token = p_token - AND expires_at > now() - LIMIT 1; - - IF NOT FOUND THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - RETURN json_build_object( - 'valid', true, - 'tenant_id', v_session.tenant_id - ); -END; -$$; - - -ALTER FUNCTION public.validate_support_session(p_token text) OWNER TO supabase_admin; - --- --- Name: whoami(); Type: FUNCTION; Schema: public; Owner: supabase_admin --- - -CREATE FUNCTION public.whoami() RETURNS TABLE(uid uuid, role text) - LANGUAGE sql STABLE - AS $$ - select auth.uid() as uid, auth.role() as role; -$$; - - -ALTER FUNCTION public.whoami() OWNER TO supabase_admin; - --- --- Name: apply_rls(jsonb, integer); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer DEFAULT (1024 * 1024)) RETURNS SETOF realtime.wal_rls - LANGUAGE plpgsql - AS $$ -declare --- Regclass of the table e.g. public.notes -entity_ regclass = (quote_ident(wal ->> 'schema') || '.' || quote_ident(wal ->> 'table'))::regclass; - --- I, U, D, T: insert, update ... -action realtime.action = ( - case wal ->> 'action' - when 'I' then 'INSERT' - when 'U' then 'UPDATE' - when 'D' then 'DELETE' - else 'ERROR' - end -); - --- Is row level security enabled for the table -is_rls_enabled bool = relrowsecurity from pg_class where oid = entity_; - -subscriptions realtime.subscription[] = array_agg(subs) - from - realtime.subscription subs - where - subs.entity = entity_; - --- Subscription vars -roles regrole[] = array_agg(distinct us.claims_role::text) - from - unnest(subscriptions) us; - -working_role regrole; -claimed_role regrole; -claims jsonb; - -subscription_id uuid; -subscription_has_access bool; -visible_to_subscription_ids uuid[] = '{}'; - --- structured info for wal's columns -columns realtime.wal_column[]; --- previous identity values for update/delete -old_columns realtime.wal_column[]; - -error_record_exceeds_max_size boolean = octet_length(wal::text) > max_record_bytes; - --- Primary jsonb output for record -output jsonb; - -begin -perform set_config('role', null, true); - -columns = - array_agg( - ( - x->>'name', - x->>'type', - x->>'typeoid', - realtime.cast( - (x->'value') #>> '{}', - coalesce( - (x->>'typeoid')::regtype, -- null when wal2json version <= 2.4 - (x->>'type')::regtype - ) - ), - (pks ->> 'name') is not null, - true - )::realtime.wal_column - ) - from - jsonb_array_elements(wal -> 'columns') x - left join jsonb_array_elements(wal -> 'pk') pks - on (x ->> 'name') = (pks ->> 'name'); - -old_columns = - array_agg( - ( - x->>'name', - x->>'type', - x->>'typeoid', - realtime.cast( - (x->'value') #>> '{}', - coalesce( - (x->>'typeoid')::regtype, -- null when wal2json version <= 2.4 - (x->>'type')::regtype - ) - ), - (pks ->> 'name') is not null, - true - )::realtime.wal_column - ) - from - jsonb_array_elements(wal -> 'identity') x - left join jsonb_array_elements(wal -> 'pk') pks - on (x ->> 'name') = (pks ->> 'name'); - -for working_role in select * from unnest(roles) loop - - -- Update `is_selectable` for columns and old_columns - columns = - array_agg( - ( - c.name, - c.type_name, - c.type_oid, - c.value, - c.is_pkey, - pg_catalog.has_column_privilege(working_role, entity_, c.name, 'SELECT') - )::realtime.wal_column - ) - from - unnest(columns) c; - - old_columns = - array_agg( - ( - c.name, - c.type_name, - c.type_oid, - c.value, - c.is_pkey, - pg_catalog.has_column_privilege(working_role, entity_, c.name, 'SELECT') - )::realtime.wal_column - ) - from - unnest(old_columns) c; - - if action <> 'DELETE' and count(1) = 0 from unnest(columns) c where c.is_pkey then - return next ( - jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action - ), - is_rls_enabled, - -- subscriptions is already filtered by entity - (select array_agg(s.subscription_id) from unnest(subscriptions) as s where claims_role = working_role), - array['Error 400: Bad Request, no primary key'] - )::realtime.wal_rls; - - -- The claims role does not have SELECT permission to the primary key of entity - elsif action <> 'DELETE' and sum(c.is_selectable::int) <> count(1) from unnest(columns) c where c.is_pkey then - return next ( - jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action - ), - is_rls_enabled, - (select array_agg(s.subscription_id) from unnest(subscriptions) as s where claims_role = working_role), - array['Error 401: Unauthorized'] - )::realtime.wal_rls; - - else - output = jsonb_build_object( - 'schema', wal ->> 'schema', - 'table', wal ->> 'table', - 'type', action, - 'commit_timestamp', to_char( - ((wal ->> 'timestamp')::timestamptz at time zone 'utc'), - 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"' - ), - 'columns', ( - select - jsonb_agg( - jsonb_build_object( - 'name', pa.attname, - 'type', pt.typname - ) - order by pa.attnum asc - ) - from - pg_attribute pa - join pg_type pt - on pa.atttypid = pt.oid - where - attrelid = entity_ - and attnum > 0 - and pg_catalog.has_column_privilege(working_role, entity_, pa.attname, 'SELECT') - ) - ) - -- Add "record" key for insert and update - || case - when action in ('INSERT', 'UPDATE') then - jsonb_build_object( - 'record', - ( - select - jsonb_object_agg( - -- if unchanged toast, get column name and value from old record - coalesce((c).name, (oc).name), - case - when (c).name is null then (oc).value - else (c).value - end - ) - from - unnest(columns) c - full outer join unnest(old_columns) oc - on (c).name = (oc).name - where - coalesce((c).is_selectable, (oc).is_selectable) - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - ) - ) - else '{}'::jsonb - end - -- Add "old_record" key for update and delete - || case - when action = 'UPDATE' then - jsonb_build_object( - 'old_record', - ( - select jsonb_object_agg((c).name, (c).value) - from unnest(old_columns) c - where - (c).is_selectable - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - ) - ) - when action = 'DELETE' then - jsonb_build_object( - 'old_record', - ( - select jsonb_object_agg((c).name, (c).value) - from unnest(old_columns) c - where - (c).is_selectable - and ( not error_record_exceeds_max_size or (octet_length((c).value::text) <= 64)) - and ( not is_rls_enabled or (c).is_pkey ) -- if RLS enabled, we can't secure deletes so filter to pkey - ) - ) - else '{}'::jsonb - end; - - -- Create the prepared statement - if is_rls_enabled and action <> 'DELETE' then - if (select 1 from pg_prepared_statements where name = 'walrus_rls_stmt' limit 1) > 0 then - deallocate walrus_rls_stmt; - end if; - execute realtime.build_prepared_statement_sql('walrus_rls_stmt', entity_, columns); - end if; - - visible_to_subscription_ids = '{}'; - - for subscription_id, claims in ( - select - subs.subscription_id, - subs.claims - from - unnest(subscriptions) subs - where - subs.entity = entity_ - and subs.claims_role = working_role - and ( - realtime.is_visible_through_filters(columns, subs.filters) - or ( - action = 'DELETE' - and realtime.is_visible_through_filters(old_columns, subs.filters) - ) - ) - ) loop - - if not is_rls_enabled or action = 'DELETE' then - visible_to_subscription_ids = visible_to_subscription_ids || subscription_id; - else - -- Check if RLS allows the role to see the record - perform - -- Trim leading and trailing quotes from working_role because set_config - -- doesn't recognize the role as valid if they are included - set_config('role', trim(both '"' from working_role::text), true), - set_config('request.jwt.claims', claims::text, true); - - execute 'execute walrus_rls_stmt' into subscription_has_access; - - if subscription_has_access then - visible_to_subscription_ids = visible_to_subscription_ids || subscription_id; - end if; - end if; - end loop; - - perform set_config('role', null, true); - - return next ( - output, - is_rls_enabled, - visible_to_subscription_ids, - case - when error_record_exceeds_max_size then array['Error 413: Payload Too Large'] - else '{}' - end - )::realtime.wal_rls; - - end if; -end loop; - -perform set_config('role', null, true); -end; -$$; - - -ALTER FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) OWNER TO supabase_admin; - --- --- Name: broadcast_changes(text, text, text, text, text, record, record, text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text DEFAULT 'ROW'::text) RETURNS void - LANGUAGE plpgsql - AS $$ -DECLARE - -- Declare a variable to hold the JSONB representation of the row - row_data jsonb := '{}'::jsonb; -BEGIN - IF level = 'STATEMENT' THEN - RAISE EXCEPTION 'function can only be triggered for each row, not for each statement'; - END IF; - -- Check the operation type and handle accordingly - IF operation = 'INSERT' OR operation = 'UPDATE' OR operation = 'DELETE' THEN - row_data := jsonb_build_object('old_record', OLD, 'record', NEW, 'operation', operation, 'table', table_name, 'schema', table_schema); - PERFORM realtime.send (row_data, event_name, topic_name); - ELSE - RAISE EXCEPTION 'Unexpected operation type: %', operation; - END IF; -EXCEPTION - WHEN OTHERS THEN - RAISE EXCEPTION 'Failed to process the row: %', SQLERRM; -END; - -$$; - - -ALTER FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) OWNER TO supabase_admin; - --- --- Name: build_prepared_statement_sql(text, regclass, realtime.wal_column[]); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) RETURNS text - LANGUAGE sql - AS $$ - /* - Builds a sql string that, if executed, creates a prepared statement to - tests retrive a row from *entity* by its primary key columns. - Example - select realtime.build_prepared_statement_sql('public.notes', '{"id"}'::text[], '{"bigint"}'::text[]) - */ - select - 'prepare ' || prepared_statement_name || ' as - select - exists( - select - 1 - from - ' || entity || ' - where - ' || string_agg(quote_ident(pkc.name) || '=' || quote_nullable(pkc.value #>> '{}') , ' and ') || ' - )' - from - unnest(columns) pkc - where - pkc.is_pkey - group by - entity - $$; - - -ALTER FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) OWNER TO supabase_admin; - --- --- Name: cast(text, regtype); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime."cast"(val text, type_ regtype) RETURNS jsonb - LANGUAGE plpgsql IMMUTABLE - AS $$ - declare - res jsonb; - begin - execute format('select to_jsonb(%L::'|| type_::text || ')', val) into res; - return res; - end - $$; - - -ALTER FUNCTION realtime."cast"(val text, type_ regtype) OWNER TO supabase_admin; - --- --- Name: check_equality_op(realtime.equality_op, regtype, text, text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) RETURNS boolean - LANGUAGE plpgsql IMMUTABLE - AS $$ - /* - Casts *val_1* and *val_2* as type *type_* and check the *op* condition for truthiness - */ - declare - op_symbol text = ( - case - when op = 'eq' then '=' - when op = 'neq' then '!=' - when op = 'lt' then '<' - when op = 'lte' then '<=' - when op = 'gt' then '>' - when op = 'gte' then '>=' - when op = 'in' then '= any' - else 'UNKNOWN OP' - end - ); - res boolean; - begin - execute format( - 'select %L::'|| type_::text || ' ' || op_symbol - || ' ( %L::' - || ( - case - when op = 'in' then type_::text || '[]' - else type_::text end - ) - || ')', val_1, val_2) into res; - return res; - end; - $$; - - -ALTER FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) OWNER TO supabase_admin; - --- --- Name: is_visible_through_filters(realtime.wal_column[], realtime.user_defined_filter[]); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) RETURNS boolean - LANGUAGE sql IMMUTABLE - AS $_$ - /* - Should the record be visible (true) or filtered out (false) after *filters* are applied - */ - select - -- Default to allowed when no filters present - $2 is null -- no filters. this should not happen because subscriptions has a default - or array_length($2, 1) is null -- array length of an empty array is null - or bool_and( - coalesce( - realtime.check_equality_op( - op:=f.op, - type_:=coalesce( - col.type_oid::regtype, -- null when wal2json version <= 2.4 - col.type_name::regtype - ), - -- cast jsonb to text - val_1:=col.value #>> '{}', - val_2:=f.value - ), - false -- if null, filter does not match - ) - ) - from - unnest(filters) f - join unnest(columns) col - on f.column_name = col.name; - $_$; - - -ALTER FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) OWNER TO supabase_admin; - --- --- Name: list_changes(name, name, integer, integer); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) RETURNS SETOF realtime.wal_rls - LANGUAGE sql - SET log_min_messages TO 'fatal' - AS $$ - with pub as ( - select - concat_ws( - ',', - case when bool_or(pubinsert) then 'insert' else null end, - case when bool_or(pubupdate) then 'update' else null end, - case when bool_or(pubdelete) then 'delete' else null end - ) as w2j_actions, - coalesce( - string_agg( - realtime.quote_wal2json(format('%I.%I', schemaname, tablename)::regclass), - ',' - ) filter (where ppt.tablename is not null and ppt.tablename not like '% %'), - '' - ) w2j_add_tables - from - pg_publication pp - left join pg_publication_tables ppt - on pp.pubname = ppt.pubname - where - pp.pubname = publication - group by - pp.pubname - limit 1 - ), - w2j as ( - select - x.*, pub.w2j_add_tables - from - pub, - pg_logical_slot_get_changes( - slot_name, null, max_changes, - 'include-pk', 'true', - 'include-transaction', 'false', - 'include-timestamp', 'true', - 'include-type-oids', 'true', - 'format-version', '2', - 'actions', pub.w2j_actions, - 'add-tables', pub.w2j_add_tables - ) x - ) - select - xyz.wal, - xyz.is_rls_enabled, - xyz.subscription_ids, - xyz.errors - from - w2j, - realtime.apply_rls( - wal := w2j.data::jsonb, - max_record_bytes := max_record_bytes - ) xyz(wal, is_rls_enabled, subscription_ids, errors) - where - w2j.w2j_add_tables <> '' - and xyz.subscription_ids[1] is not null - $$; - - -ALTER FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) OWNER TO supabase_admin; - --- --- Name: quote_wal2json(regclass); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.quote_wal2json(entity regclass) RETURNS text - LANGUAGE sql IMMUTABLE STRICT - AS $$ - select - ( - select string_agg('' || ch,'') - from unnest(string_to_array(nsp.nspname::text, null)) with ordinality x(ch, idx) - where - not (x.idx = 1 and x.ch = '"') - and not ( - x.idx = array_length(string_to_array(nsp.nspname::text, null), 1) - and x.ch = '"' - ) - ) - || '.' - || ( - select string_agg('' || ch,'') - from unnest(string_to_array(pc.relname::text, null)) with ordinality x(ch, idx) - where - not (x.idx = 1 and x.ch = '"') - and not ( - x.idx = array_length(string_to_array(nsp.nspname::text, null), 1) - and x.ch = '"' - ) - ) - from - pg_class pc - join pg_namespace nsp - on pc.relnamespace = nsp.oid - where - pc.oid = entity - $$; - - -ALTER FUNCTION realtime.quote_wal2json(entity regclass) OWNER TO supabase_admin; - --- --- Name: send(jsonb, text, text, boolean); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean DEFAULT true) RETURNS void - LANGUAGE plpgsql - AS $$ -DECLARE - generated_id uuid; - final_payload jsonb; -BEGIN - BEGIN - -- Generate a new UUID for the id - generated_id := gen_random_uuid(); - - -- Check if payload has an 'id' key, if not, add the generated UUID - IF payload ? 'id' THEN - final_payload := payload; - ELSE - final_payload := jsonb_set(payload, '{id}', to_jsonb(generated_id)); - END IF; - - -- Set the topic configuration - EXECUTE format('SET LOCAL realtime.topic TO %L', topic); - - -- Attempt to insert the message - INSERT INTO realtime.messages (id, payload, event, topic, private, extension) - VALUES (generated_id, final_payload, event, topic, private, 'broadcast'); - EXCEPTION - WHEN OTHERS THEN - -- Capture and notify the error - RAISE WARNING 'ErrorSendingBroadcastMessage: %', SQLERRM; - END; -END; -$$; - - -ALTER FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) OWNER TO supabase_admin; - --- --- Name: subscription_check_filters(); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.subscription_check_filters() RETURNS trigger - LANGUAGE plpgsql - AS $$ - /* - Validates that the user defined filters for a subscription: - - refer to valid columns that the claimed role may access - - values are coercable to the correct column type - */ - declare - col_names text[] = coalesce( - array_agg(c.column_name order by c.ordinal_position), - '{}'::text[] - ) - from - information_schema.columns c - where - format('%I.%I', c.table_schema, c.table_name)::regclass = new.entity - and pg_catalog.has_column_privilege( - (new.claims ->> 'role'), - format('%I.%I', c.table_schema, c.table_name)::regclass, - c.column_name, - 'SELECT' - ); - filter realtime.user_defined_filter; - col_type regtype; - - in_val jsonb; - begin - for filter in select * from unnest(new.filters) loop - -- Filtered column is valid - if not filter.column_name = any(col_names) then - raise exception 'invalid column for filter %', filter.column_name; - end if; - - -- Type is sanitized and safe for string interpolation - col_type = ( - select atttypid::regtype - from pg_catalog.pg_attribute - where attrelid = new.entity - and attname = filter.column_name - ); - if col_type is null then - raise exception 'failed to lookup type for column %', filter.column_name; - end if; - - -- Set maximum number of entries for in filter - if filter.op = 'in'::realtime.equality_op then - in_val = realtime.cast(filter.value, (col_type::text || '[]')::regtype); - if coalesce(jsonb_array_length(in_val), 0) > 100 then - raise exception 'too many values for `in` filter. Maximum 100'; - end if; - else - -- raises an exception if value is not coercable to type - perform realtime.cast(filter.value, col_type); - end if; - - end loop; - - -- Apply consistent order to filters so the unique constraint on - -- (subscription_id, entity, filters) can't be tricked by a different filter order - new.filters = coalesce( - array_agg(f order by f.column_name, f.op, f.value), - '{}' - ) from unnest(new.filters) f; - - return new; - end; - $$; - - -ALTER FUNCTION realtime.subscription_check_filters() OWNER TO supabase_admin; - --- --- Name: to_regrole(text); Type: FUNCTION; Schema: realtime; Owner: supabase_admin --- - -CREATE FUNCTION realtime.to_regrole(role_name text) RETURNS regrole - LANGUAGE sql IMMUTABLE - AS $$ select role_name::regrole $$; - - -ALTER FUNCTION realtime.to_regrole(role_name text) OWNER TO supabase_admin; - --- --- Name: topic(); Type: FUNCTION; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE FUNCTION realtime.topic() RETURNS text - LANGUAGE sql STABLE - AS $$ -select nullif(current_setting('realtime.topic', true), '')::text; -$$; - - -ALTER FUNCTION realtime.topic() OWNER TO supabase_realtime_admin; - --- --- Name: can_insert_object(text, text, uuid, jsonb); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb) RETURNS void - LANGUAGE plpgsql - AS $$ -BEGIN - INSERT INTO "storage"."objects" ("bucket_id", "name", "owner", "metadata") VALUES (bucketid, name, owner, metadata); - -- hack to rollback the successful insert - RAISE sqlstate 'PT200' using - message = 'ROLLBACK', - detail = 'rollback successful insert'; -END -$$; - - -ALTER FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb) OWNER TO supabase_storage_admin; - --- --- Name: enforce_bucket_name_length(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.enforce_bucket_name_length() RETURNS trigger - LANGUAGE plpgsql - AS $$ -begin - if length(new.name) > 100 then - raise exception 'bucket name "%" is too long (% characters). Max is 100.', new.name, length(new.name); - end if; - return new; -end; -$$; - - -ALTER FUNCTION storage.enforce_bucket_name_length() OWNER TO supabase_storage_admin; - --- --- Name: extension(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.extension(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -_filename text; -BEGIN - select string_to_array(name, '/') into _parts; - select _parts[array_length(_parts,1)] into _filename; - -- @todo return the last part instead of 2 - return reverse(split_part(reverse(_filename), '.', 1)); -END -$$; - - -ALTER FUNCTION storage.extension(name text) OWNER TO supabase_storage_admin; - --- --- Name: filename(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.filename(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[array_length(_parts,1)]; -END -$$; - - -ALTER FUNCTION storage.filename(name text) OWNER TO supabase_storage_admin; - --- --- Name: foldername(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.foldername(name text) RETURNS text[] - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[1:array_length(_parts,1)-1]; -END -$$; - - -ALTER FUNCTION storage.foldername(name text) OWNER TO supabase_storage_admin; - --- --- Name: get_common_prefix(text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_common_prefix(p_key text, p_prefix text, p_delimiter text) RETURNS text - LANGUAGE sql IMMUTABLE - AS $$ -SELECT CASE - WHEN position(p_delimiter IN substring(p_key FROM length(p_prefix) + 1)) > 0 - THEN left(p_key, length(p_prefix) + position(p_delimiter IN substring(p_key FROM length(p_prefix) + 1))) - ELSE NULL -END; -$$; - - -ALTER FUNCTION storage.get_common_prefix(p_key text, p_prefix text, p_delimiter text) OWNER TO supabase_storage_admin; - --- --- Name: get_size_by_bucket(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_size_by_bucket() RETURNS TABLE(size bigint, bucket_id text) - LANGUAGE plpgsql - AS $$ -BEGIN - return query - select sum((metadata->>'size')::int) as size, obj.bucket_id - from "storage".objects as obj - group by obj.bucket_id; -END -$$; - - -ALTER FUNCTION storage.get_size_by_bucket() OWNER TO supabase_storage_admin; - --- --- Name: list_multipart_uploads_with_delimiter(text, text, text, integer, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer DEFAULT 100, next_key_token text DEFAULT ''::text, next_upload_token text DEFAULT ''::text) RETURNS TABLE(key text, id text, created_at timestamp with time zone) - LANGUAGE plpgsql - AS $_$ -BEGIN - RETURN QUERY EXECUTE - 'SELECT DISTINCT ON(key COLLATE "C") * from ( - SELECT - CASE - WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN - substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) - ELSE - key - END AS key, id, created_at - FROM - storage.s3_multipart_uploads - WHERE - bucket_id = $5 AND - key ILIKE $1 || ''%'' AND - CASE - WHEN $4 != '''' AND $6 = '''' THEN - CASE - WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN - substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) COLLATE "C" > $4 - ELSE - key COLLATE "C" > $4 - END - ELSE - true - END AND - CASE - WHEN $6 != '''' THEN - id COLLATE "C" > $6 - ELSE - true - END - ORDER BY - key COLLATE "C" ASC, created_at ASC) as e order by key COLLATE "C" LIMIT $3' - USING prefix_param, delimiter_param, max_keys, next_key_token, bucket_id, next_upload_token; -END; -$_$; - - -ALTER FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer, next_key_token text, next_upload_token text) OWNER TO supabase_storage_admin; - --- --- Name: list_objects_with_delimiter(text, text, text, integer, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.list_objects_with_delimiter(_bucket_id text, prefix_param text, delimiter_param text, max_keys integer DEFAULT 100, start_after text DEFAULT ''::text, next_token text DEFAULT ''::text, sort_order text DEFAULT 'asc'::text) RETURNS TABLE(name text, id uuid, metadata jsonb, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_peek_name TEXT; - v_current RECORD; - v_common_prefix TEXT; - - -- Configuration - v_is_asc BOOLEAN; - v_prefix TEXT; - v_start TEXT; - v_upper_bound TEXT; - v_file_batch_size INT; - - -- Seek state - v_next_seek TEXT; - v_count INT := 0; - - -- Dynamic SQL for batch query only - v_batch_query TEXT; - -BEGIN - -- ======================================================================== - -- INITIALIZATION - -- ======================================================================== - v_is_asc := lower(coalesce(sort_order, 'asc')) = 'asc'; - v_prefix := coalesce(prefix_param, ''); - v_start := CASE WHEN coalesce(next_token, '') <> '' THEN next_token ELSE coalesce(start_after, '') END; - v_file_batch_size := LEAST(GREATEST(max_keys * 2, 100), 1000); - - -- Calculate upper bound for prefix filtering (bytewise, using COLLATE "C") - IF v_prefix = '' THEN - v_upper_bound := NULL; - ELSIF right(v_prefix, 1) = delimiter_param THEN - v_upper_bound := left(v_prefix, -1) || chr(ascii(delimiter_param) + 1); - ELSE - v_upper_bound := left(v_prefix, -1) || chr(ascii(right(v_prefix, 1)) + 1); - END IF; - - -- Build batch query (dynamic SQL - called infrequently, amortized over many rows) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" >= $2 ' || - 'AND o.name COLLATE "C" < $3 ORDER BY o.name COLLATE "C" ASC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" >= $2 ' || - 'ORDER BY o.name COLLATE "C" ASC LIMIT $4'; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" < $2 ' || - 'AND o.name COLLATE "C" >= $3 ORDER BY o.name COLLATE "C" DESC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND o.name COLLATE "C" < $2 ' || - 'ORDER BY o.name COLLATE "C" DESC LIMIT $4'; - END IF; - END IF; - - -- ======================================================================== - -- SEEK INITIALIZATION: Determine starting position - -- ======================================================================== - IF v_start = '' THEN - IF v_is_asc THEN - v_next_seek := v_prefix; - ELSE - -- DESC without cursor: find the last item in range - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_prefix AND o.name COLLATE "C" < v_upper_bound - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix <> '' THEN - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_next_seek FROM storage.objects o - WHERE o.bucket_id = _bucket_id - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - END IF; - - IF v_next_seek IS NOT NULL THEN - v_next_seek := v_next_seek || delimiter_param; - ELSE - RETURN; - END IF; - END IF; - ELSE - -- Cursor provided: determine if it refers to a folder or leaf - IF EXISTS ( - SELECT 1 FROM storage.objects o - WHERE o.bucket_id = _bucket_id - AND o.name COLLATE "C" LIKE v_start || delimiter_param || '%' - LIMIT 1 - ) THEN - -- Cursor refers to a folder - IF v_is_asc THEN - v_next_seek := v_start || chr(ascii(delimiter_param) + 1); - ELSE - v_next_seek := v_start || delimiter_param; - END IF; - ELSE - -- Cursor refers to a leaf object - IF v_is_asc THEN - v_next_seek := v_start || delimiter_param; - ELSE - v_next_seek := v_start; - END IF; - END IF; - END IF; - - -- ======================================================================== - -- MAIN LOOP: Hybrid peek-then-batch algorithm - -- Uses STATIC SQL for peek (hot path) and DYNAMIC SQL for batch - -- ======================================================================== - LOOP - EXIT WHEN v_count >= max_keys; - - -- STEP 1: PEEK using STATIC SQL (plan cached, very fast) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_next_seek AND o.name COLLATE "C" < v_upper_bound - ORDER BY o.name COLLATE "C" ASC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" >= v_next_seek - ORDER BY o.name COLLATE "C" ASC LIMIT 1; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek AND o.name COLLATE "C" >= v_prefix - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = _bucket_id AND o.name COLLATE "C" < v_next_seek - ORDER BY o.name COLLATE "C" DESC LIMIT 1; - END IF; - END IF; - - EXIT WHEN v_peek_name IS NULL; - - -- STEP 2: Check if this is a FOLDER or FILE - v_common_prefix := storage.get_common_prefix(v_peek_name, v_prefix, delimiter_param); - - IF v_common_prefix IS NOT NULL THEN - -- FOLDER: Emit and skip to next folder (no heap access needed) - name := rtrim(v_common_prefix, delimiter_param); - id := NULL; - updated_at := NULL; - created_at := NULL; - last_accessed_at := NULL; - metadata := NULL; - RETURN NEXT; - v_count := v_count + 1; - - -- Advance seek past the folder range - IF v_is_asc THEN - v_next_seek := left(v_common_prefix, -1) || chr(ascii(delimiter_param) + 1); - ELSE - v_next_seek := v_common_prefix; - END IF; - ELSE - -- FILE: Batch fetch using DYNAMIC SQL (overhead amortized over many rows) - -- For ASC: upper_bound is the exclusive upper limit (< condition) - -- For DESC: prefix is the inclusive lower limit (>= condition) - FOR v_current IN EXECUTE v_batch_query USING _bucket_id, v_next_seek, - CASE WHEN v_is_asc THEN COALESCE(v_upper_bound, v_prefix) ELSE v_prefix END, v_file_batch_size - LOOP - v_common_prefix := storage.get_common_prefix(v_current.name, v_prefix, delimiter_param); - - IF v_common_prefix IS NOT NULL THEN - -- Hit a folder: exit batch, let peek handle it - v_next_seek := v_current.name; - EXIT; - END IF; - - -- Emit file - name := v_current.name; - id := v_current.id; - updated_at := v_current.updated_at; - created_at := v_current.created_at; - last_accessed_at := v_current.last_accessed_at; - metadata := v_current.metadata; - RETURN NEXT; - v_count := v_count + 1; - - -- Advance seek past this file - IF v_is_asc THEN - v_next_seek := v_current.name || delimiter_param; - ELSE - v_next_seek := v_current.name; - END IF; - - EXIT WHEN v_count >= max_keys; - END LOOP; - END IF; - END LOOP; -END; -$_$; - - -ALTER FUNCTION storage.list_objects_with_delimiter(_bucket_id text, prefix_param text, delimiter_param text, max_keys integer, start_after text, next_token text, sort_order text) OWNER TO supabase_storage_admin; - --- --- Name: operation(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.operation() RETURNS text - LANGUAGE plpgsql STABLE - AS $$ -BEGIN - RETURN current_setting('storage.operation', true); -END; -$$; - - -ALTER FUNCTION storage.operation() OWNER TO supabase_storage_admin; - --- --- Name: protect_delete(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.protect_delete() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - -- Check if storage.allow_delete_query is set to 'true' - IF COALESCE(current_setting('storage.allow_delete_query', true), 'false') != 'true' THEN - RAISE EXCEPTION 'Direct deletion from storage tables is not allowed. Use the Storage API instead.' - USING HINT = 'This prevents accidental data loss from orphaned objects.', - ERRCODE = '42501'; - END IF; - RETURN NULL; -END; -$$; - - -ALTER FUNCTION storage.protect_delete() OWNER TO supabase_storage_admin; - --- --- Name: search(text, text, integer, integer, integer, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search(prefix text, bucketname text, limits integer DEFAULT 100, levels integer DEFAULT 1, offsets integer DEFAULT 0, search text DEFAULT ''::text, sortcolumn text DEFAULT 'name'::text, sortorder text DEFAULT 'asc'::text) RETURNS TABLE(name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_peek_name TEXT; - v_current RECORD; - v_common_prefix TEXT; - v_delimiter CONSTANT TEXT := '/'; - - -- Configuration - v_limit INT; - v_prefix TEXT; - v_prefix_lower TEXT; - v_is_asc BOOLEAN; - v_order_by TEXT; - v_sort_order TEXT; - v_upper_bound TEXT; - v_file_batch_size INT; - - -- Dynamic SQL for batch query only - v_batch_query TEXT; - - -- Seek state - v_next_seek TEXT; - v_count INT := 0; - v_skipped INT := 0; -BEGIN - -- ======================================================================== - -- INITIALIZATION - -- ======================================================================== - v_limit := LEAST(coalesce(limits, 100), 1500); - v_prefix := coalesce(prefix, '') || coalesce(search, ''); - v_prefix_lower := lower(v_prefix); - v_is_asc := lower(coalesce(sortorder, 'asc')) = 'asc'; - v_file_batch_size := LEAST(GREATEST(v_limit * 2, 100), 1000); - - -- Validate sort column - CASE lower(coalesce(sortcolumn, 'name')) - WHEN 'name' THEN v_order_by := 'name'; - WHEN 'updated_at' THEN v_order_by := 'updated_at'; - WHEN 'created_at' THEN v_order_by := 'created_at'; - WHEN 'last_accessed_at' THEN v_order_by := 'last_accessed_at'; - ELSE v_order_by := 'name'; - END CASE; - - v_sort_order := CASE WHEN v_is_asc THEN 'asc' ELSE 'desc' END; - - -- ======================================================================== - -- NON-NAME SORTING: Use path_tokens approach (unchanged) - -- ======================================================================== - IF v_order_by != 'name' THEN - RETURN QUERY EXECUTE format( - $sql$ - WITH folders AS ( - SELECT path_tokens[$1] AS folder - FROM storage.objects - WHERE objects.name ILIKE $2 || '%%' - AND bucket_id = $3 - AND array_length(objects.path_tokens, 1) <> $1 - GROUP BY folder - ORDER BY folder %s - ) - (SELECT folder AS "name", - NULL::uuid AS id, - NULL::timestamptz AS updated_at, - NULL::timestamptz AS created_at, - NULL::timestamptz AS last_accessed_at, - NULL::jsonb AS metadata FROM folders) - UNION ALL - (SELECT path_tokens[$1] AS "name", - id, updated_at, created_at, last_accessed_at, metadata - FROM storage.objects - WHERE objects.name ILIKE $2 || '%%' - AND bucket_id = $3 - AND array_length(objects.path_tokens, 1) = $1 - ORDER BY %I %s) - LIMIT $4 OFFSET $5 - $sql$, v_sort_order, v_order_by, v_sort_order - ) USING levels, v_prefix, bucketname, v_limit, offsets; - RETURN; - END IF; - - -- ======================================================================== - -- NAME SORTING: Hybrid skip-scan with batch optimization - -- ======================================================================== - - -- Calculate upper bound for prefix filtering - IF v_prefix_lower = '' THEN - v_upper_bound := NULL; - ELSIF right(v_prefix_lower, 1) = v_delimiter THEN - v_upper_bound := left(v_prefix_lower, -1) || chr(ascii(v_delimiter) + 1); - ELSE - v_upper_bound := left(v_prefix_lower, -1) || chr(ascii(right(v_prefix_lower, 1)) + 1); - END IF; - - -- Build batch query (dynamic SQL - called infrequently, amortized over many rows) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" >= $2 ' || - 'AND lower(o.name) COLLATE "C" < $3 ORDER BY lower(o.name) COLLATE "C" ASC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" >= $2 ' || - 'ORDER BY lower(o.name) COLLATE "C" ASC LIMIT $4'; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" < $2 ' || - 'AND lower(o.name) COLLATE "C" >= $3 ORDER BY lower(o.name) COLLATE "C" DESC LIMIT $4'; - ELSE - v_batch_query := 'SELECT o.name, o.id, o.updated_at, o.created_at, o.last_accessed_at, o.metadata ' || - 'FROM storage.objects o WHERE o.bucket_id = $1 AND lower(o.name) COLLATE "C" < $2 ' || - 'ORDER BY lower(o.name) COLLATE "C" DESC LIMIT $4'; - END IF; - END IF; - - -- Initialize seek position - IF v_is_asc THEN - v_next_seek := v_prefix_lower; - ELSE - -- DESC: find the last item in range first (static SQL) - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_prefix_lower AND lower(o.name) COLLATE "C" < v_upper_bound - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix_lower <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - END IF; - - IF v_peek_name IS NOT NULL THEN - v_next_seek := lower(v_peek_name) || v_delimiter; - ELSE - RETURN; - END IF; - END IF; - - -- ======================================================================== - -- MAIN LOOP: Hybrid peek-then-batch algorithm - -- Uses STATIC SQL for peek (hot path) and DYNAMIC SQL for batch - -- ======================================================================== - LOOP - EXIT WHEN v_count >= v_limit; - - -- STEP 1: PEEK using STATIC SQL (plan cached, very fast) - IF v_is_asc THEN - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_next_seek AND lower(o.name) COLLATE "C" < v_upper_bound - ORDER BY lower(o.name) COLLATE "C" ASC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" >= v_next_seek - ORDER BY lower(o.name) COLLATE "C" ASC LIMIT 1; - END IF; - ELSE - IF v_upper_bound IS NOT NULL THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSIF v_prefix_lower <> '' THEN - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek AND lower(o.name) COLLATE "C" >= v_prefix_lower - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - ELSE - SELECT o.name INTO v_peek_name FROM storage.objects o - WHERE o.bucket_id = bucketname AND lower(o.name) COLLATE "C" < v_next_seek - ORDER BY lower(o.name) COLLATE "C" DESC LIMIT 1; - END IF; - END IF; - - EXIT WHEN v_peek_name IS NULL; - - -- STEP 2: Check if this is a FOLDER or FILE - v_common_prefix := storage.get_common_prefix(lower(v_peek_name), v_prefix_lower, v_delimiter); - - IF v_common_prefix IS NOT NULL THEN - -- FOLDER: Handle offset, emit if needed, skip to next folder - IF v_skipped < offsets THEN - v_skipped := v_skipped + 1; - ELSE - name := split_part(rtrim(v_common_prefix, v_delimiter), v_delimiter, levels); - id := NULL; - updated_at := NULL; - created_at := NULL; - last_accessed_at := NULL; - metadata := NULL; - RETURN NEXT; - v_count := v_count + 1; - END IF; - - -- Advance seek past the folder range - IF v_is_asc THEN - v_next_seek := lower(left(v_common_prefix, -1)) || chr(ascii(v_delimiter) + 1); - ELSE - v_next_seek := lower(v_common_prefix); - END IF; - ELSE - -- FILE: Batch fetch using DYNAMIC SQL (overhead amortized over many rows) - -- For ASC: upper_bound is the exclusive upper limit (< condition) - -- For DESC: prefix_lower is the inclusive lower limit (>= condition) - FOR v_current IN EXECUTE v_batch_query - USING bucketname, v_next_seek, - CASE WHEN v_is_asc THEN COALESCE(v_upper_bound, v_prefix_lower) ELSE v_prefix_lower END, v_file_batch_size - LOOP - v_common_prefix := storage.get_common_prefix(lower(v_current.name), v_prefix_lower, v_delimiter); - - IF v_common_prefix IS NOT NULL THEN - -- Hit a folder: exit batch, let peek handle it - v_next_seek := lower(v_current.name); - EXIT; - END IF; - - -- Handle offset skipping - IF v_skipped < offsets THEN - v_skipped := v_skipped + 1; - ELSE - -- Emit file - name := split_part(v_current.name, v_delimiter, levels); - id := v_current.id; - updated_at := v_current.updated_at; - created_at := v_current.created_at; - last_accessed_at := v_current.last_accessed_at; - metadata := v_current.metadata; - RETURN NEXT; - v_count := v_count + 1; - END IF; - - -- Advance seek past this file - IF v_is_asc THEN - v_next_seek := lower(v_current.name) || v_delimiter; - ELSE - v_next_seek := lower(v_current.name); - END IF; - - EXIT WHEN v_count >= v_limit; - END LOOP; - END IF; - END LOOP; -END; -$_$; - - -ALTER FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer, search text, sortcolumn text, sortorder text) OWNER TO supabase_storage_admin; - --- --- Name: search_by_timestamp(text, text, integer, integer, text, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search_by_timestamp(p_prefix text, p_bucket_id text, p_limit integer, p_level integer, p_start_after text, p_sort_order text, p_sort_column text, p_sort_column_after text) RETURNS TABLE(key text, name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $_$ -DECLARE - v_cursor_op text; - v_query text; - v_prefix text; -BEGIN - v_prefix := coalesce(p_prefix, ''); - - IF p_sort_order = 'asc' THEN - v_cursor_op := '>'; - ELSE - v_cursor_op := '<'; - END IF; - - v_query := format($sql$ - WITH raw_objects AS ( - SELECT - o.name AS obj_name, - o.id AS obj_id, - o.updated_at AS obj_updated_at, - o.created_at AS obj_created_at, - o.last_accessed_at AS obj_last_accessed_at, - o.metadata AS obj_metadata, - storage.get_common_prefix(o.name, $1, '/') AS common_prefix - FROM storage.objects o - WHERE o.bucket_id = $2 - AND o.name COLLATE "C" LIKE $1 || '%%' - ), - -- Aggregate common prefixes (folders) - -- Both created_at and updated_at use MIN(obj_created_at) to match the old prefixes table behavior - aggregated_prefixes AS ( - SELECT - rtrim(common_prefix, '/') AS name, - NULL::uuid AS id, - MIN(obj_created_at) AS updated_at, - MIN(obj_created_at) AS created_at, - NULL::timestamptz AS last_accessed_at, - NULL::jsonb AS metadata, - TRUE AS is_prefix - FROM raw_objects - WHERE common_prefix IS NOT NULL - GROUP BY common_prefix - ), - leaf_objects AS ( - SELECT - obj_name AS name, - obj_id AS id, - obj_updated_at AS updated_at, - obj_created_at AS created_at, - obj_last_accessed_at AS last_accessed_at, - obj_metadata AS metadata, - FALSE AS is_prefix - FROM raw_objects - WHERE common_prefix IS NULL - ), - combined AS ( - SELECT * FROM aggregated_prefixes - UNION ALL - SELECT * FROM leaf_objects - ), - filtered AS ( - SELECT * - FROM combined - WHERE ( - $5 = '' - OR ROW( - date_trunc('milliseconds', %I), - name COLLATE "C" - ) %s ROW( - COALESCE(NULLIF($6, '')::timestamptz, 'epoch'::timestamptz), - $5 - ) - ) - ) - SELECT - split_part(name, '/', $3) AS key, - name, - id, - updated_at, - created_at, - last_accessed_at, - metadata - FROM filtered - ORDER BY - COALESCE(date_trunc('milliseconds', %I), 'epoch'::timestamptz) %s, - name COLLATE "C" %s - LIMIT $4 - $sql$, - p_sort_column, - v_cursor_op, - p_sort_column, - p_sort_order, - p_sort_order - ); - - RETURN QUERY EXECUTE v_query - USING v_prefix, p_bucket_id, p_level, p_limit, p_start_after, p_sort_column_after; -END; -$_$; - - -ALTER FUNCTION storage.search_by_timestamp(p_prefix text, p_bucket_id text, p_limit integer, p_level integer, p_start_after text, p_sort_order text, p_sort_column text, p_sort_column_after text) OWNER TO supabase_storage_admin; - --- --- Name: search_v2(text, text, integer, integer, text, text, text, text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search_v2(prefix text, bucket_name text, limits integer DEFAULT 100, levels integer DEFAULT 1, start_after text DEFAULT ''::text, sort_order text DEFAULT 'asc'::text, sort_column text DEFAULT 'name'::text, sort_column_after text DEFAULT ''::text) RETURNS TABLE(key text, name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql STABLE - AS $$ -DECLARE - v_sort_col text; - v_sort_ord text; - v_limit int; -BEGIN - -- Cap limit to maximum of 1500 records - v_limit := LEAST(coalesce(limits, 100), 1500); - - -- Validate and normalize sort_order - v_sort_ord := lower(coalesce(sort_order, 'asc')); - IF v_sort_ord NOT IN ('asc', 'desc') THEN - v_sort_ord := 'asc'; - END IF; - - -- Validate and normalize sort_column - v_sort_col := lower(coalesce(sort_column, 'name')); - IF v_sort_col NOT IN ('name', 'updated_at', 'created_at') THEN - v_sort_col := 'name'; - END IF; - - -- Route to appropriate implementation - IF v_sort_col = 'name' THEN - -- Use list_objects_with_delimiter for name sorting (most efficient: O(k * log n)) - RETURN QUERY - SELECT - split_part(l.name, '/', levels) AS key, - l.name AS name, - l.id, - l.updated_at, - l.created_at, - l.last_accessed_at, - l.metadata - FROM storage.list_objects_with_delimiter( - bucket_name, - coalesce(prefix, ''), - '/', - v_limit, - start_after, - '', - v_sort_ord - ) l; - ELSE - -- Use aggregation approach for timestamp sorting - -- Not efficient for large datasets but supports correct pagination - RETURN QUERY SELECT * FROM storage.search_by_timestamp( - prefix, bucket_name, v_limit, levels, start_after, - v_sort_ord, v_sort_col, sort_column_after - ); - END IF; -END; -$$; - - -ALTER FUNCTION storage.search_v2(prefix text, bucket_name text, limits integer, levels integer, start_after text, sort_order text, sort_column text, sort_column_after text) OWNER TO supabase_storage_admin; - --- --- Name: update_updated_at_column(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.update_updated_at_column() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - - -ALTER FUNCTION storage.update_updated_at_column() OWNER TO supabase_storage_admin; - --- --- Name: http_request(); Type: FUNCTION; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE FUNCTION supabase_functions.http_request() RETURNS trigger - LANGUAGE plpgsql SECURITY DEFINER - SET search_path TO 'supabase_functions' - AS $$ - DECLARE - request_id bigint; - payload jsonb; - url text := TG_ARGV[0]::text; - method text := TG_ARGV[1]::text; - headers jsonb DEFAULT '{}'::jsonb; - params jsonb DEFAULT '{}'::jsonb; - timeout_ms integer DEFAULT 1000; - BEGIN - IF url IS NULL OR url = 'null' THEN - RAISE EXCEPTION 'url argument is missing'; - END IF; - - IF method IS NULL OR method = 'null' THEN - RAISE EXCEPTION 'method argument is missing'; - END IF; - - IF TG_ARGV[2] IS NULL OR TG_ARGV[2] = 'null' THEN - headers = '{"Content-Type": "application/json"}'::jsonb; - ELSE - headers = TG_ARGV[2]::jsonb; - END IF; - - IF TG_ARGV[3] IS NULL OR TG_ARGV[3] = 'null' THEN - params = '{}'::jsonb; - ELSE - params = TG_ARGV[3]::jsonb; - END IF; - - IF TG_ARGV[4] IS NULL OR TG_ARGV[4] = 'null' THEN - timeout_ms = 1000; - ELSE - timeout_ms = TG_ARGV[4]::integer; - END IF; - - CASE - WHEN method = 'GET' THEN - SELECT http_get INTO request_id FROM net.http_get( - url, - params, - headers, - timeout_ms - ); - WHEN method = 'POST' THEN - payload = jsonb_build_object( - 'old_record', OLD, - 'record', NEW, - 'type', TG_OP, - 'table', TG_TABLE_NAME, - 'schema', TG_TABLE_SCHEMA - ); - - SELECT http_post INTO request_id FROM net.http_post( - url, - payload, - params, - headers, - timeout_ms - ); - ELSE - RAISE EXCEPTION 'method argument % is invalid', method; - END CASE; - - INSERT INTO supabase_functions.hooks - (hook_table_id, hook_name, request_id) - VALUES - (TG_RELID, TG_NAME, request_id); - - RETURN NEW; - END -$$; - - -ALTER FUNCTION supabase_functions.http_request() OWNER TO supabase_functions_admin; - --- --- Name: extensions; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.extensions ( - id uuid NOT NULL, - type text, - settings jsonb, - tenant_external_id text, - inserted_at timestamp(0) without time zone NOT NULL, - updated_at timestamp(0) without time zone NOT NULL -); - - -ALTER TABLE _realtime.extensions OWNER TO supabase_admin; - --- --- Name: schema_migrations; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.schema_migrations ( - version bigint NOT NULL, - inserted_at timestamp(0) without time zone -); - - -ALTER TABLE _realtime.schema_migrations OWNER TO supabase_admin; - --- --- Name: tenants; Type: TABLE; Schema: _realtime; Owner: supabase_admin --- - -CREATE TABLE _realtime.tenants ( - id uuid NOT NULL, - name text, - external_id text, - jwt_secret text, - max_concurrent_users integer DEFAULT 200 NOT NULL, - inserted_at timestamp(0) without time zone NOT NULL, - updated_at timestamp(0) without time zone NOT NULL, - max_events_per_second integer DEFAULT 100 NOT NULL, - postgres_cdc_default text DEFAULT 'postgres_cdc_rls'::text, - max_bytes_per_second integer DEFAULT 100000 NOT NULL, - max_channels_per_client integer DEFAULT 100 NOT NULL, - max_joins_per_second integer DEFAULT 500 NOT NULL, - suspend boolean DEFAULT false, - jwt_jwks jsonb, - notify_private_alpha boolean DEFAULT false, - private_only boolean DEFAULT false NOT NULL, - migrations_ran integer DEFAULT 0, - broadcast_adapter character varying(255) DEFAULT 'gen_rpc'::character varying, - max_presence_events_per_second integer DEFAULT 1000, - max_payload_size_in_kb integer DEFAULT 3000, - CONSTRAINT jwt_secret_or_jwt_jwks_required CHECK (((jwt_secret IS NOT NULL) OR (jwt_jwks IS NOT NULL))) -); - - -ALTER TABLE _realtime.tenants OWNER TO supabase_admin; - --- --- Name: audit_log_entries; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.audit_log_entries ( - instance_id uuid, - id uuid NOT NULL, - payload json, - created_at timestamp with time zone, - ip_address character varying(64) DEFAULT ''::character varying NOT NULL -); - - -ALTER TABLE auth.audit_log_entries OWNER TO supabase_auth_admin; - --- --- Name: TABLE audit_log_entries; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.audit_log_entries IS 'Auth: Audit trail for user actions.'; - - --- --- Name: flow_state; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.flow_state ( - id uuid NOT NULL, - user_id uuid, - auth_code text, - code_challenge_method auth.code_challenge_method, - code_challenge text, - provider_type text NOT NULL, - provider_access_token text, - provider_refresh_token text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - authentication_method text NOT NULL, - auth_code_issued_at timestamp with time zone, - invite_token text, - referrer text, - oauth_client_state_id uuid, - linking_target_id uuid, - email_optional boolean DEFAULT false NOT NULL -); - - -ALTER TABLE auth.flow_state OWNER TO supabase_auth_admin; - --- --- Name: TABLE flow_state; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.flow_state IS 'Stores metadata for all OAuth/SSO login flows'; - - --- --- Name: identities; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.identities ( - provider_id text NOT NULL, - user_id uuid NOT NULL, - identity_data jsonb NOT NULL, - provider text NOT NULL, - last_sign_in_at timestamp with time zone, - created_at timestamp with time zone, - updated_at timestamp with time zone, - email text GENERATED ALWAYS AS (lower((identity_data ->> 'email'::text))) STORED, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE auth.identities OWNER TO supabase_auth_admin; - --- --- Name: TABLE identities; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.identities IS 'Auth: Stores identities associated to a user.'; - - --- --- Name: COLUMN identities.email; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.identities.email IS 'Auth: Email is a generated column that references the optional email property in the identity_data'; - - --- --- Name: instances; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.instances ( - id uuid NOT NULL, - uuid uuid, - raw_base_config text, - created_at timestamp with time zone, - updated_at timestamp with time zone -); - - -ALTER TABLE auth.instances OWNER TO supabase_auth_admin; - --- --- Name: TABLE instances; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.instances IS 'Auth: Manages users across multiple sites.'; - - --- --- Name: mfa_amr_claims; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_amr_claims ( - session_id uuid NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - authentication_method text NOT NULL, - id uuid NOT NULL -); - - -ALTER TABLE auth.mfa_amr_claims OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_amr_claims; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_amr_claims IS 'auth: stores authenticator method reference claims for multi factor authentication'; - - --- --- Name: mfa_challenges; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_challenges ( - id uuid NOT NULL, - factor_id uuid NOT NULL, - created_at timestamp with time zone NOT NULL, - verified_at timestamp with time zone, - ip_address inet NOT NULL, - otp_code text, - web_authn_session_data jsonb -); - - -ALTER TABLE auth.mfa_challenges OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_challenges; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_challenges IS 'auth: stores metadata about challenge requests made'; - - --- --- Name: mfa_factors; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.mfa_factors ( - id uuid NOT NULL, - user_id uuid NOT NULL, - friendly_name text, - factor_type auth.factor_type NOT NULL, - status auth.factor_status NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - secret text, - phone text, - last_challenged_at timestamp with time zone, - web_authn_credential jsonb, - web_authn_aaguid uuid, - last_webauthn_challenge_data jsonb -); - - -ALTER TABLE auth.mfa_factors OWNER TO supabase_auth_admin; - --- --- Name: TABLE mfa_factors; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.mfa_factors IS 'auth: stores metadata about factors'; - - --- --- Name: COLUMN mfa_factors.last_webauthn_challenge_data; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.mfa_factors.last_webauthn_challenge_data IS 'Stores the latest WebAuthn challenge data including attestation/assertion for customer verification'; - - --- --- Name: oauth_authorizations; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_authorizations ( - id uuid NOT NULL, - authorization_id text NOT NULL, - client_id uuid NOT NULL, - user_id uuid, - redirect_uri text NOT NULL, - scope text NOT NULL, - state text, - resource text, - code_challenge text, - code_challenge_method auth.code_challenge_method, - response_type auth.oauth_response_type DEFAULT 'code'::auth.oauth_response_type NOT NULL, - status auth.oauth_authorization_status DEFAULT 'pending'::auth.oauth_authorization_status NOT NULL, - authorization_code text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '00:03:00'::interval) NOT NULL, - approved_at timestamp with time zone, - nonce text, - CONSTRAINT oauth_authorizations_authorization_code_length CHECK ((char_length(authorization_code) <= 255)), - CONSTRAINT oauth_authorizations_code_challenge_length CHECK ((char_length(code_challenge) <= 128)), - CONSTRAINT oauth_authorizations_expires_at_future CHECK ((expires_at > created_at)), - CONSTRAINT oauth_authorizations_nonce_length CHECK ((char_length(nonce) <= 255)), - CONSTRAINT oauth_authorizations_redirect_uri_length CHECK ((char_length(redirect_uri) <= 2048)), - CONSTRAINT oauth_authorizations_resource_length CHECK ((char_length(resource) <= 2048)), - CONSTRAINT oauth_authorizations_scope_length CHECK ((char_length(scope) <= 4096)), - CONSTRAINT oauth_authorizations_state_length CHECK ((char_length(state) <= 4096)) -); - - -ALTER TABLE auth.oauth_authorizations OWNER TO supabase_auth_admin; - --- --- Name: oauth_client_states; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_client_states ( - id uuid NOT NULL, - provider_type text NOT NULL, - code_verifier text, - created_at timestamp with time zone NOT NULL -); - - -ALTER TABLE auth.oauth_client_states OWNER TO supabase_auth_admin; - --- --- Name: TABLE oauth_client_states; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.oauth_client_states IS 'Stores OAuth states for third-party provider authentication flows where Supabase acts as the OAuth client.'; - - --- --- Name: oauth_clients; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_clients ( - id uuid NOT NULL, - client_secret_hash text, - registration_type auth.oauth_registration_type NOT NULL, - redirect_uris text NOT NULL, - grant_types text NOT NULL, - client_name text, - client_uri text, - logo_uri text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - deleted_at timestamp with time zone, - client_type auth.oauth_client_type DEFAULT 'confidential'::auth.oauth_client_type NOT NULL, - token_endpoint_auth_method text NOT NULL, - CONSTRAINT oauth_clients_client_name_length CHECK ((char_length(client_name) <= 1024)), - CONSTRAINT oauth_clients_client_uri_length CHECK ((char_length(client_uri) <= 2048)), - CONSTRAINT oauth_clients_logo_uri_length CHECK ((char_length(logo_uri) <= 2048)), - CONSTRAINT oauth_clients_token_endpoint_auth_method_check CHECK ((token_endpoint_auth_method = ANY (ARRAY['client_secret_basic'::text, 'client_secret_post'::text, 'none'::text]))) -); - - -ALTER TABLE auth.oauth_clients OWNER TO supabase_auth_admin; - --- --- Name: oauth_consents; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.oauth_consents ( - id uuid NOT NULL, - user_id uuid NOT NULL, - client_id uuid NOT NULL, - scopes text NOT NULL, - granted_at timestamp with time zone DEFAULT now() NOT NULL, - revoked_at timestamp with time zone, - CONSTRAINT oauth_consents_revoked_after_granted CHECK (((revoked_at IS NULL) OR (revoked_at >= granted_at))), - CONSTRAINT oauth_consents_scopes_length CHECK ((char_length(scopes) <= 2048)), - CONSTRAINT oauth_consents_scopes_not_empty CHECK ((char_length(TRIM(BOTH FROM scopes)) > 0)) -); - - -ALTER TABLE auth.oauth_consents OWNER TO supabase_auth_admin; - --- --- Name: one_time_tokens; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.one_time_tokens ( - id uuid NOT NULL, - user_id uuid NOT NULL, - token_type auth.one_time_token_type NOT NULL, - token_hash text NOT NULL, - relates_to text NOT NULL, - created_at timestamp without time zone DEFAULT now() NOT NULL, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - CONSTRAINT one_time_tokens_token_hash_check CHECK ((char_length(token_hash) > 0)) -); - - -ALTER TABLE auth.one_time_tokens OWNER TO supabase_auth_admin; - --- --- Name: refresh_tokens; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.refresh_tokens ( - instance_id uuid, - id bigint NOT NULL, - token character varying(255), - user_id character varying(255), - revoked boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone, - parent character varying(255), - session_id uuid -); - - -ALTER TABLE auth.refresh_tokens OWNER TO supabase_auth_admin; - --- --- Name: TABLE refresh_tokens; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.refresh_tokens IS 'Auth: Store of tokens used to refresh JWT tokens once they expire.'; - - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE SEQUENCE auth.refresh_tokens_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNER TO supabase_auth_admin; - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNED BY auth.refresh_tokens.id; - - --- --- Name: saml_providers; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.saml_providers ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - entity_id text NOT NULL, - metadata_xml text NOT NULL, - metadata_url text, - attribute_mapping jsonb, - created_at timestamp with time zone, - updated_at timestamp with time zone, - name_id_format text, - CONSTRAINT "entity_id not empty" CHECK ((char_length(entity_id) > 0)), - CONSTRAINT "metadata_url not empty" CHECK (((metadata_url = NULL::text) OR (char_length(metadata_url) > 0))), - CONSTRAINT "metadata_xml not empty" CHECK ((char_length(metadata_xml) > 0)) -); - - -ALTER TABLE auth.saml_providers OWNER TO supabase_auth_admin; - --- --- Name: TABLE saml_providers; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.saml_providers IS 'Auth: Manages SAML Identity Provider connections.'; - - --- --- Name: saml_relay_states; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.saml_relay_states ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - request_id text NOT NULL, - for_email text, - redirect_to text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - flow_state_id uuid, - CONSTRAINT "request_id not empty" CHECK ((char_length(request_id) > 0)) -); - - -ALTER TABLE auth.saml_relay_states OWNER TO supabase_auth_admin; - --- --- Name: TABLE saml_relay_states; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.saml_relay_states IS 'Auth: Contains SAML Relay State information for each Service Provider initiated login.'; - - --- --- Name: schema_migrations; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.schema_migrations ( - version character varying(255) NOT NULL -); - - -ALTER TABLE auth.schema_migrations OWNER TO supabase_auth_admin; - --- --- Name: TABLE schema_migrations; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.schema_migrations IS 'Auth: Manages updates to the auth system.'; - - --- --- Name: sessions; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sessions ( - id uuid NOT NULL, - user_id uuid NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - factor_id uuid, - aal auth.aal_level, - not_after timestamp with time zone, - refreshed_at timestamp without time zone, - user_agent text, - ip inet, - tag text, - oauth_client_id uuid, - refresh_token_hmac_key text, - refresh_token_counter bigint, - scopes text, - CONSTRAINT sessions_scopes_length CHECK ((char_length(scopes) <= 4096)) -); - - -ALTER TABLE auth.sessions OWNER TO supabase_auth_admin; - --- --- Name: TABLE sessions; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sessions IS 'Auth: Stores session data associated to a user.'; - - --- --- Name: COLUMN sessions.not_after; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.not_after IS 'Auth: Not after is a nullable column that contains a timestamp after which the session should be regarded as expired.'; - - --- --- Name: COLUMN sessions.refresh_token_hmac_key; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.refresh_token_hmac_key IS 'Holds a HMAC-SHA256 key used to sign refresh tokens for this session.'; - - --- --- Name: COLUMN sessions.refresh_token_counter; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sessions.refresh_token_counter IS 'Holds the ID (counter) of the last issued refresh token.'; - - --- --- Name: sso_domains; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sso_domains ( - id uuid NOT NULL, - sso_provider_id uuid NOT NULL, - domain text NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - CONSTRAINT "domain not empty" CHECK ((char_length(domain) > 0)) -); - - -ALTER TABLE auth.sso_domains OWNER TO supabase_auth_admin; - --- --- Name: TABLE sso_domains; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sso_domains IS 'Auth: Manages SSO email address domain mapping to an SSO Identity Provider.'; - - --- --- Name: sso_providers; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.sso_providers ( - id uuid NOT NULL, - resource_id text, - created_at timestamp with time zone, - updated_at timestamp with time zone, - disabled boolean, - CONSTRAINT "resource_id not empty" CHECK (((resource_id = NULL::text) OR (char_length(resource_id) > 0))) -); - - -ALTER TABLE auth.sso_providers OWNER TO supabase_auth_admin; - --- --- Name: TABLE sso_providers; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.sso_providers IS 'Auth: Manages SSO identity provider information; see saml_providers for SAML.'; - - --- --- Name: COLUMN sso_providers.resource_id; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.sso_providers.resource_id IS 'Auth: Uniquely identifies a SSO provider according to a user-chosen resource ID (case insensitive), useful in infrastructure as code.'; - - --- --- Name: users; Type: TABLE; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TABLE auth.users ( - instance_id uuid, - id uuid NOT NULL, - aud character varying(255), - role character varying(255), - email character varying(255), - encrypted_password character varying(255), - email_confirmed_at timestamp with time zone, - invited_at timestamp with time zone, - confirmation_token character varying(255), - confirmation_sent_at timestamp with time zone, - recovery_token character varying(255), - recovery_sent_at timestamp with time zone, - email_change_token_new character varying(255), - email_change character varying(255), - email_change_sent_at timestamp with time zone, - last_sign_in_at timestamp with time zone, - raw_app_meta_data jsonb, - raw_user_meta_data jsonb, - is_super_admin boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone, - phone text DEFAULT NULL::character varying, - phone_confirmed_at timestamp with time zone, - phone_change text DEFAULT ''::character varying, - phone_change_token character varying(255) DEFAULT ''::character varying, - phone_change_sent_at timestamp with time zone, - confirmed_at timestamp with time zone GENERATED ALWAYS AS (LEAST(email_confirmed_at, phone_confirmed_at)) STORED, - email_change_token_current character varying(255) DEFAULT ''::character varying, - email_change_confirm_status smallint DEFAULT 0, - banned_until timestamp with time zone, - reauthentication_token character varying(255) DEFAULT ''::character varying, - reauthentication_sent_at timestamp with time zone, - is_sso_user boolean DEFAULT false NOT NULL, - deleted_at timestamp with time zone, - is_anonymous boolean DEFAULT false NOT NULL, - CONSTRAINT users_email_change_confirm_status_check CHECK (((email_change_confirm_status >= 0) AND (email_change_confirm_status <= 2))) -); - - -ALTER TABLE auth.users OWNER TO supabase_auth_admin; - --- --- Name: TABLE users; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure schema.'; - - --- --- Name: COLUMN users.is_sso_user; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON COLUMN auth.users.is_sso_user IS 'Auth: Set this column to true when the account comes from SSO. These accounts can have duplicate emails.'; - - --- --- Name: agenda_bloqueios; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_bloqueios ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - tipo text NOT NULL, - titulo text NOT NULL, - data_inicio date NOT NULL, - data_fim date, - hora_inicio time without time zone, - hora_fim time without time zone, - recorrente boolean DEFAULT false NOT NULL, - dia_semana smallint, - observacao text, - origem text DEFAULT 'manual'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT agenda_bloqueios_tipo_check CHECK ((tipo = ANY (ARRAY['feriado_nacional'::text, 'feriado_municipal'::text, 'bloqueio'::text]))) -); - - -ALTER TABLE public.agenda_bloqueios OWNER TO supabase_admin; - --- --- Name: agenda_configuracoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_configuracoes ( - owner_id uuid NOT NULL, - duracao_padrao_minutos integer DEFAULT 50 NOT NULL, - intervalo_padrao_minutos integer DEFAULT 0 NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - usar_horario_admin_custom boolean DEFAULT false NOT NULL, - admin_inicio_visualizacao time without time zone, - admin_fim_visualizacao time without time zone, - admin_slot_visual_minutos integer DEFAULT 30 NOT NULL, - online_ativo boolean DEFAULT false NOT NULL, - online_min_antecedencia_horas integer DEFAULT 24 NOT NULL, - online_max_dias_futuro integer DEFAULT 60 NOT NULL, - online_cancelar_ate_horas integer DEFAULT 12 NOT NULL, - online_reagendar_ate_horas integer DEFAULT 12 NOT NULL, - online_limite_agendamentos_futuros integer DEFAULT 1 NOT NULL, - online_modo text DEFAULT 'automatico'::text NOT NULL, - online_buffer_antes_min integer DEFAULT 0 NOT NULL, - online_buffer_depois_min integer DEFAULT 0 NOT NULL, - online_modalidade text DEFAULT 'ambos'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - usar_granularidade_custom boolean DEFAULT false NOT NULL, - granularidade_min integer, - setup_concluido boolean DEFAULT false NOT NULL, - setup_concluido_em timestamp with time zone, - agenda_view_mode text DEFAULT 'full_24h'::text NOT NULL, - agenda_custom_start time without time zone, - agenda_custom_end time without time zone, - session_duration_min integer DEFAULT 50 NOT NULL, - session_break_min integer DEFAULT 10 NOT NULL, - pausas_semanais jsonb DEFAULT '[]'::jsonb NOT NULL, - setup_clinica_concluido boolean DEFAULT false NOT NULL, - setup_clinica_concluido_em timestamp with time zone, - tenant_id uuid, - jornada_igual_todos boolean DEFAULT true, - slot_mode text DEFAULT 'fixed'::text NOT NULL, - CONSTRAINT agenda_configuracoes_admin_slot_visual_minutos_check CHECK ((admin_slot_visual_minutos = ANY (ARRAY[5, 10, 15, 20, 30, 60]))), - CONSTRAINT agenda_configuracoes_check CHECK (((usar_horario_admin_custom = false) OR ((admin_inicio_visualizacao IS NOT NULL) AND (admin_fim_visualizacao IS NOT NULL) AND (admin_fim_visualizacao > admin_inicio_visualizacao)))), - CONSTRAINT agenda_configuracoes_duracao_padrao_minutos_check CHECK (((duracao_padrao_minutos >= 10) AND (duracao_padrao_minutos <= 240))), - CONSTRAINT agenda_configuracoes_granularidade_min_check CHECK (((granularidade_min IS NULL) OR (granularidade_min = ANY (ARRAY[5, 10, 15, 20, 30, 45, 50, 60])))), - CONSTRAINT agenda_configuracoes_intervalo_padrao_minutos_check CHECK (((intervalo_padrao_minutos >= 0) AND (intervalo_padrao_minutos <= 120))), - CONSTRAINT agenda_configuracoes_online_buffer_antes_min_check CHECK (((online_buffer_antes_min >= 0) AND (online_buffer_antes_min <= 120))), - CONSTRAINT agenda_configuracoes_online_buffer_depois_min_check CHECK (((online_buffer_depois_min >= 0) AND (online_buffer_depois_min <= 120))), - CONSTRAINT agenda_configuracoes_online_cancelar_ate_horas_check CHECK (((online_cancelar_ate_horas >= 0) AND (online_cancelar_ate_horas <= 720))), - CONSTRAINT agenda_configuracoes_online_limite_agendamentos_futuros_check CHECK (((online_limite_agendamentos_futuros >= 1) AND (online_limite_agendamentos_futuros <= 10))), - CONSTRAINT agenda_configuracoes_online_max_dias_futuro_check CHECK (((online_max_dias_futuro >= 1) AND (online_max_dias_futuro <= 365))), - CONSTRAINT agenda_configuracoes_online_min_antecedencia_horas_check CHECK (((online_min_antecedencia_horas >= 0) AND (online_min_antecedencia_horas <= 720))), - CONSTRAINT agenda_configuracoes_online_modalidade_check CHECK ((online_modalidade = ANY (ARRAY['online'::text, 'presencial'::text, 'ambos'::text]))), - CONSTRAINT agenda_configuracoes_online_modo_check CHECK ((online_modo = ANY (ARRAY['automatico'::text, 'aprovacao'::text]))), - CONSTRAINT agenda_configuracoes_online_reagendar_ate_horas_check CHECK (((online_reagendar_ate_horas >= 0) AND (online_reagendar_ate_horas <= 720))), - CONSTRAINT agenda_configuracoes_slot_mode_chk CHECK ((slot_mode = ANY (ARRAY['fixed'::text, 'dynamic'::text]))), - CONSTRAINT session_break_min_chk CHECK (((session_break_min >= 0) AND (session_break_min <= 60))), - CONSTRAINT session_duration_min_chk CHECK (((session_duration_min >= 10) AND (session_duration_min <= 240))) -); - - -ALTER TABLE public.agenda_configuracoes OWNER TO supabase_admin; - --- --- Name: agenda_eventos; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_eventos ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tipo public.tipo_evento_agenda DEFAULT 'sessao'::public.tipo_evento_agenda NOT NULL, - status public.status_evento_agenda DEFAULT 'agendado'::public.status_evento_agenda NOT NULL, - titulo text, - observacoes text, - inicio_em timestamp with time zone NOT NULL, - fim_em timestamp with time zone NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - terapeuta_id uuid, - tenant_id uuid NOT NULL, - visibility_scope text DEFAULT 'public'::text NOT NULL, - mirror_of_event_id uuid, - mirror_source text, - patient_id uuid, - determined_commitment_id uuid, - link_online text, - titulo_custom text, - extra_fields jsonb, - recurrence_id uuid, - recurrence_date date, - modalidade text DEFAULT 'presencial'::text, - price numeric(10,2), - billing_contract_id uuid, - billed boolean DEFAULT false NOT NULL, - services_customized boolean DEFAULT false NOT NULL, - insurance_plan_id uuid, - insurance_guide_number text, - insurance_value numeric(10,2), - insurance_plan_service_id uuid, - CONSTRAINT agenda_eventos_check CHECK ((fim_em > inicio_em)) -); - - -ALTER TABLE public.agenda_eventos OWNER TO supabase_admin; - --- --- Name: COLUMN agenda_eventos.price; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agenda_eventos.price IS 'Valor da sessão em BRL. Preenchido automaticamente pela tabela professional_pricing do profissional.'; - - --- --- Name: agenda_excecoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_excecoes ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - data date NOT NULL, - hora_inicio time without time zone, - hora_fim time without time zone, - tipo public.tipo_excecao_agenda NOT NULL, - motivo text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - status public.status_excecao_agenda DEFAULT 'ativo'::public.status_excecao_agenda NOT NULL, - fonte text DEFAULT 'manual'::text NOT NULL, - aplicavel_online boolean DEFAULT true NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_excecoes_check CHECK ((((hora_inicio IS NULL) AND (hora_fim IS NULL)) OR ((hora_inicio IS NOT NULL) AND (hora_fim IS NOT NULL) AND (hora_fim > hora_inicio)))), - CONSTRAINT agenda_excecoes_fonte_check CHECK ((fonte = ANY (ARRAY['manual'::text, 'feriado_google'::text, 'sistema'::text]))) -); - - -ALTER TABLE public.agenda_excecoes OWNER TO supabase_admin; - --- --- Name: agenda_online_slots; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_online_slots ( - id bigint NOT NULL, - owner_id uuid NOT NULL, - weekday integer NOT NULL, - "time" time without time zone NOT NULL, - enabled boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_online_slots_weekday_check CHECK ((weekday = ANY (ARRAY[0, 1, 2, 3, 4, 5, 6]))) -); - - -ALTER TABLE public.agenda_online_slots OWNER TO supabase_admin; - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -CREATE SEQUENCE public.agenda_online_slots_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE public.agenda_online_slots_id_seq OWNER TO supabase_admin; - --- --- Name: agenda_online_slots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: supabase_admin --- - -ALTER SEQUENCE public.agenda_online_slots_id_seq OWNED BY public.agenda_online_slots.id; - - --- --- Name: agenda_regras_semanais; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_regras_semanais ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - hora_inicio time without time zone NOT NULL, - hora_fim time without time zone NOT NULL, - modalidade text DEFAULT 'ambos'::text NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_regras_semanais_check CHECK ((hora_fim > hora_inicio)), - CONSTRAINT agenda_regras_semanais_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))), - CONSTRAINT agenda_regras_semanais_modalidade_check CHECK (((modalidade = ANY (ARRAY['online'::text, 'presencial'::text, 'ambos'::text])) OR (modalidade IS NULL))) -); - - -ALTER TABLE public.agenda_regras_semanais OWNER TO supabase_admin; - --- --- Name: agenda_slots_bloqueados_semanais; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_slots_bloqueados_semanais ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - hora_inicio time without time zone NOT NULL, - motivo text, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_slots_bloqueados_semanais_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))) -); - - -ALTER TABLE public.agenda_slots_bloqueados_semanais OWNER TO supabase_admin; - --- --- Name: agenda_slots_regras; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agenda_slots_regras ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - dia_semana smallint NOT NULL, - passo_minutos integer NOT NULL, - offset_minutos integer DEFAULT 0 NOT NULL, - buffer_antes_min integer DEFAULT 0 NOT NULL, - buffer_depois_min integer DEFAULT 0 NOT NULL, - min_antecedencia_horas integer DEFAULT 0 NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL, - CONSTRAINT agenda_slots_regras_buffer_antes_min_check CHECK (((buffer_antes_min >= 0) AND (buffer_antes_min <= 240))), - CONSTRAINT agenda_slots_regras_buffer_depois_min_check CHECK (((buffer_depois_min >= 0) AND (buffer_depois_min <= 240))), - CONSTRAINT agenda_slots_regras_dia_semana_check CHECK (((dia_semana >= 0) AND (dia_semana <= 6))), - CONSTRAINT agenda_slots_regras_min_antecedencia_horas_check CHECK (((min_antecedencia_horas >= 0) AND (min_antecedencia_horas <= 720))), - CONSTRAINT agenda_slots_regras_offset_minutos_check CHECK (((offset_minutos >= 0) AND (offset_minutos <= 55))), - CONSTRAINT agenda_slots_regras_passo_minutos_check CHECK (((passo_minutos >= 5) AND (passo_minutos <= 240))) -); - - -ALTER TABLE public.agenda_slots_regras OWNER TO supabase_admin; - --- --- Name: agendador_configuracoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agendador_configuracoes ( - owner_id uuid NOT NULL, - tenant_id uuid, - ativo boolean DEFAULT false NOT NULL, - link_slug text, - imagem_fundo_url text, - imagem_header_url text, - logomarca_url text, - cor_primaria text DEFAULT '#4b6bff'::text, - nome_exibicao text, - endereco text, - botao_como_chegar_ativo boolean DEFAULT true NOT NULL, - maps_url text, - modo_aprovacao text DEFAULT 'aprovacao'::text NOT NULL, - modalidade text DEFAULT 'presencial'::text NOT NULL, - tipos_habilitados jsonb DEFAULT '["primeira", "retorno"]'::jsonb NOT NULL, - duracao_sessao_min integer DEFAULT 50 NOT NULL, - antecedencia_minima_horas integer DEFAULT 24 NOT NULL, - prazo_resposta_horas integer DEFAULT 2 NOT NULL, - reserva_horas integer DEFAULT 2 NOT NULL, - pagamento_obrigatorio boolean DEFAULT false NOT NULL, - pix_chave text, - pix_countdown_minutos integer DEFAULT 20 NOT NULL, - triagem_motivo boolean DEFAULT true NOT NULL, - triagem_como_conheceu boolean DEFAULT false NOT NULL, - verificacao_email boolean DEFAULT false NOT NULL, - exigir_aceite_lgpd boolean DEFAULT true NOT NULL, - mensagem_boas_vindas text, - texto_como_se_preparar text, - texto_termos_lgpd text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - pagamento_modo text DEFAULT 'sem_pagamento'::text NOT NULL, - pagamento_metodos_visiveis text[] DEFAULT '{}'::text[] NOT NULL, - CONSTRAINT agendador_configuracoes_antecedencia_check CHECK (((antecedencia_minima_horas >= 0) AND (antecedencia_minima_horas <= 720))), - CONSTRAINT agendador_configuracoes_duracao_check CHECK (((duracao_sessao_min >= 10) AND (duracao_sessao_min <= 240))), - CONSTRAINT agendador_configuracoes_modalidade_check CHECK ((modalidade = ANY (ARRAY['presencial'::text, 'online'::text, 'ambos'::text]))), - CONSTRAINT agendador_configuracoes_modo_check CHECK ((modo_aprovacao = ANY (ARRAY['automatico'::text, 'aprovacao'::text]))), - CONSTRAINT agendador_configuracoes_pix_countdown_check CHECK (((pix_countdown_minutos >= 5) AND (pix_countdown_minutos <= 120))), - CONSTRAINT agendador_configuracoes_prazo_check CHECK (((prazo_resposta_horas >= 1) AND (prazo_resposta_horas <= 72))), - CONSTRAINT agendador_configuracoes_reserva_check CHECK (((reserva_horas >= 1) AND (reserva_horas <= 48))) -); - - -ALTER TABLE public.agendador_configuracoes OWNER TO supabase_admin; - --- --- Name: COLUMN agendador_configuracoes.pagamento_modo; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agendador_configuracoes.pagamento_modo IS 'sem_pagamento | pagar_na_hora | pix_antecipado'; - - --- --- Name: COLUMN agendador_configuracoes.pagamento_metodos_visiveis; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.agendador_configuracoes.pagamento_metodos_visiveis IS 'Métodos exibidos ao paciente quando pagamento_modo = pagar_na_hora. Ex: {pix, deposito, dinheiro, cartao, convenio}'; - - --- --- Name: agendador_solicitacoes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.agendador_solicitacoes ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - paciente_nome text NOT NULL, - paciente_sobrenome text, - paciente_email text NOT NULL, - paciente_celular text, - paciente_cpf text, - tipo text NOT NULL, - modalidade text NOT NULL, - data_solicitada date NOT NULL, - hora_solicitada time without time zone NOT NULL, - reservado_ate timestamp with time zone, - motivo text, - como_conheceu text, - pix_status text DEFAULT 'pendente'::text, - pix_pago_em timestamp with time zone, - status text DEFAULT 'pendente'::text NOT NULL, - recusado_motivo text, - autorizado_em timestamp with time zone, - autorizado_por uuid, - user_id uuid, - patient_id uuid, - evento_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT agendador_sol_modalidade_check CHECK ((modalidade = ANY (ARRAY['presencial'::text, 'online'::text]))), - CONSTRAINT agendador_sol_pix_check CHECK (((pix_status IS NULL) OR (pix_status = ANY (ARRAY['pendente'::text, 'pago'::text, 'expirado'::text])))), - CONSTRAINT agendador_sol_status_check CHECK ((status = ANY (ARRAY['pendente'::text, 'autorizado'::text, 'recusado'::text, 'expirado'::text, 'convertido'::text]))), - CONSTRAINT agendador_sol_tipo_check CHECK ((tipo = ANY (ARRAY['primeira'::text, 'retorno'::text, 'reagendar'::text]))) -); - - -ALTER TABLE public.agendador_solicitacoes OWNER TO supabase_admin; - --- --- Name: billing_contracts; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.billing_contracts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - patient_id uuid NOT NULL, - type text NOT NULL, - total_sessions integer, - sessions_used integer DEFAULT 0, - package_price numeric(10,2), - amount numeric(10,2), - billing_interval text, - active_from timestamp with time zone DEFAULT now(), - active_to timestamp with time zone, - status text DEFAULT 'active'::text NOT NULL, - created_at timestamp with time zone DEFAULT now(), - CONSTRAINT billing_contracts_interval_chk CHECK (((billing_interval IS NULL) OR (billing_interval = ANY (ARRAY['monthly'::text, 'weekly'::text])))), - CONSTRAINT billing_contracts_sess_used_chk CHECK (((sessions_used IS NULL) OR (sessions_used >= 0))), - CONSTRAINT billing_contracts_status_chk CHECK ((status = ANY (ARRAY['active'::text, 'completed'::text, 'cancelled'::text]))), - CONSTRAINT billing_contracts_total_sess_chk CHECK (((total_sessions IS NULL) OR (total_sessions > 0))), - CONSTRAINT billing_contracts_type_chk CHECK ((type = ANY (ARRAY['per_session'::text, 'package'::text, 'subscription'::text]))) -); - - -ALTER TABLE public.billing_contracts OWNER TO supabase_admin; - --- --- Name: commitment_services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.commitment_services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - commitment_id uuid NOT NULL, - service_id uuid NOT NULL, - quantity integer DEFAULT 1 NOT NULL, - unit_price numeric(10,2) NOT NULL, - discount_pct numeric(5,2) DEFAULT 0, - discount_flat numeric(10,2) DEFAULT 0, - final_price numeric(10,2) NOT NULL, - created_at timestamp with time zone DEFAULT now(), - CONSTRAINT commitment_services_disc_flat_chk CHECK ((discount_flat >= (0)::numeric)), - CONSTRAINT commitment_services_disc_pct_chk CHECK (((discount_pct >= (0)::numeric) AND (discount_pct <= (100)::numeric))), - CONSTRAINT commitment_services_final_price_chk CHECK ((final_price >= (0)::numeric)), - CONSTRAINT commitment_services_quantity_chk CHECK ((quantity > 0)) -); - - -ALTER TABLE public.commitment_services OWNER TO supabase_admin; - --- --- Name: commitment_time_logs; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.commitment_time_logs ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - commitment_id uuid NOT NULL, - calendar_event_id uuid, - source public.commitment_log_source DEFAULT 'manual'::public.commitment_log_source NOT NULL, - started_at timestamp with time zone NOT NULL, - ended_at timestamp with time zone NOT NULL, - minutes integer NOT NULL, - created_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.commitment_time_logs OWNER TO supabase_admin; - --- --- Name: current_tenant_id; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.current_tenant_id AS - SELECT current_setting('request.jwt.claim.tenant_id'::text, true) AS current_setting; - - -ALTER VIEW public.current_tenant_id OWNER TO supabase_admin; - --- --- Name: determined_commitment_fields; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.determined_commitment_fields ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - commitment_id uuid NOT NULL, - key text NOT NULL, - label text NOT NULL, - field_type public.determined_field_type DEFAULT 'text'::public.determined_field_type NOT NULL, - required boolean DEFAULT false NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.determined_commitment_fields OWNER TO supabase_admin; - --- --- Name: determined_commitments; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.determined_commitments ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - created_by uuid, - is_native boolean DEFAULT false NOT NULL, - native_key text, - is_locked boolean DEFAULT false NOT NULL, - active boolean DEFAULT true NOT NULL, - name text NOT NULL, - description text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - bg_color text, - text_color text -); - - -ALTER TABLE public.determined_commitments OWNER TO supabase_admin; - --- --- Name: dev_user_credentials; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.dev_user_credentials ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - email text NOT NULL, - password_dev text NOT NULL, - kind text DEFAULT 'custom'::text NOT NULL, - note text, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.dev_user_credentials OWNER TO supabase_admin; - --- --- Name: entitlements_invalidation; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.entitlements_invalidation ( - owner_id uuid NOT NULL, - changed_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.entitlements_invalidation OWNER TO supabase_admin; - --- --- Name: features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.features ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - description text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - descricao text DEFAULT ''::text NOT NULL, - name text DEFAULT ''::text NOT NULL -); - - -ALTER TABLE public.features OWNER TO supabase_admin; - --- --- Name: COLUMN features.descricao; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.features.descricao IS 'Descrição humana da feature (exibição no admin e documentação).'; - - --- --- Name: feriados; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.feriados ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid, - owner_id uuid, - tipo text DEFAULT 'municipal'::text NOT NULL, - nome text NOT NULL, - data date NOT NULL, - cidade text, - estado text, - observacao text, - bloqueia_sessoes boolean DEFAULT false NOT NULL, - criado_em timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT feriados_tipo_check CHECK ((tipo = ANY (ARRAY['municipal'::text, 'personalizado'::text]))) -); - - -ALTER TABLE public.feriados OWNER TO supabase_admin; - --- --- Name: financial_exceptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.financial_exceptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid, - tenant_id uuid NOT NULL, - exception_type text NOT NULL, - charge_mode text NOT NULL, - charge_value numeric(10,2), - charge_pct numeric(5,2), - min_hours_notice integer, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - CONSTRAINT financial_exceptions_charge_chk CHECK ((charge_mode = ANY (ARRAY['none'::text, 'full'::text, 'fixed_fee'::text, 'percentage'::text]))), - CONSTRAINT financial_exceptions_type_chk CHECK ((exception_type = ANY (ARRAY['patient_no_show'::text, 'patient_cancellation'::text, 'professional_cancellation'::text]))) -); - - -ALTER TABLE public.financial_exceptions OWNER TO supabase_admin; - --- --- Name: insurance_plan_services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.insurance_plan_services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - insurance_plan_id uuid NOT NULL, - name text NOT NULL, - value numeric(10,2) NOT NULL, - active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.insurance_plan_services OWNER TO supabase_admin; - --- --- Name: insurance_plans; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.insurance_plans ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - name text NOT NULL, - notes text, - default_value numeric(10,2), - active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.insurance_plans OWNER TO supabase_admin; - --- --- Name: module_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.module_features ( - module_id uuid NOT NULL, - feature_id uuid NOT NULL, - enabled boolean DEFAULT true NOT NULL, - limits jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.module_features OWNER TO supabase_admin; - --- --- Name: modules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.modules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - name text NOT NULL, - description text, - is_active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.modules OWNER TO supabase_admin; - --- --- Name: plan_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_features ( - plan_id uuid NOT NULL, - feature_id uuid NOT NULL, - enabled boolean DEFAULT true NOT NULL, - limits jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_features OWNER TO supabase_admin; - --- --- Name: tenant_modules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_modules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - module_id uuid NOT NULL, - status text DEFAULT 'active'::text NOT NULL, - settings jsonb, - provider text DEFAULT 'manual'::text NOT NULL, - provider_item_id text, - installed_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_modules OWNER TO supabase_admin; - --- --- Name: owner_feature_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.owner_feature_entitlements AS - WITH base AS ( - SELECT s.user_id AS owner_id, - f.key AS feature_key, - pf.limits, - 'plan'::text AS source - FROM ((public.subscriptions s - JOIN public.plan_features pf ON (((pf.plan_id = s.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))) - WHERE ((s.status = 'active'::text) AND (s.user_id IS NOT NULL)) - UNION ALL - SELECT tm.owner_id, - f.key AS feature_key, - mf.limits, - 'module'::text AS source - FROM (((public.tenant_modules tm - JOIN public.modules m ON (((m.id = tm.module_id) AND (m.is_active = true)))) - JOIN public.module_features mf ON (((mf.module_id = m.id) AND (mf.enabled = true)))) - JOIN public.features f ON ((f.id = mf.feature_id))) - WHERE ((tm.status = 'active'::text) AND (tm.owner_id IS NOT NULL)) - ) - SELECT owner_id, - feature_key, - array_agg(DISTINCT source) AS sources, - jsonb_agg(limits) FILTER (WHERE (limits IS NOT NULL)) AS limits_list - FROM base - GROUP BY owner_id, feature_key; - - -ALTER VIEW public.owner_feature_entitlements OWNER TO supabase_admin; - --- --- Name: owner_users; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.owner_users ( - owner_id uuid NOT NULL, - user_id uuid NOT NULL, - role text DEFAULT 'admin'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.owner_users OWNER TO supabase_admin; - --- --- Name: patient_discounts; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_discounts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - patient_id uuid NOT NULL, - discount_pct numeric(5,2) DEFAULT 0, - discount_flat numeric(10,2) DEFAULT 0, - reason text, - active boolean DEFAULT true NOT NULL, - active_from timestamp with time zone DEFAULT now(), - active_to timestamp with time zone, - created_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.patient_discounts OWNER TO supabase_admin; - --- --- Name: patient_group_patient; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_group_patient ( - patient_group_id uuid NOT NULL, - patient_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now(), - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_group_patient OWNER TO supabase_admin; - --- --- Name: patient_groups; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_groups ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - nome text NOT NULL, - descricao text, - cor text, - is_active boolean DEFAULT true NOT NULL, - is_system boolean DEFAULT false NOT NULL, - owner_id uuid DEFAULT auth.uid() NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - therapist_id uuid, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_groups OWNER TO supabase_admin; - --- --- Name: patient_intake_requests; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_intake_requests ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - token text NOT NULL, - consent boolean DEFAULT false NOT NULL, - status text DEFAULT 'new'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - converted_patient_id uuid, - rejected_reason text, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - cpf text, - rg text, - cep text, - nome_completo text, - email_principal text, - telefone text, - pais text, - cidade text, - estado text, - endereco text, - numero text, - bairro text, - complemento text, - data_nascimento date, - naturalidade text, - genero text, - estado_civil text, - onde_nos_conheceu text, - encaminhado_por text, - observacoes text, - notas_internas text, - email_alternativo text, - telefone_alternativo text, - profissao text, - escolaridade text, - nacionalidade text, - avatar_url text, - tenant_id uuid, - CONSTRAINT chk_intakes_status CHECK ((status = ANY (ARRAY['new'::text, 'converted'::text, 'rejected'::text]))) -); - - -ALTER TABLE public.patient_intake_requests OWNER TO supabase_admin; - --- --- Name: patient_invites; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_invites ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - token text NOT NULL, - active boolean DEFAULT true NOT NULL, - expires_at timestamp with time zone, - max_uses integer, - uses integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid -); - - -ALTER TABLE public.patient_invites OWNER TO supabase_admin; - --- --- Name: patient_patient_tag; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_patient_tag ( - owner_id uuid NOT NULL, - patient_id uuid NOT NULL, - tag_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_patient_tag OWNER TO supabase_admin; - --- --- Name: patient_tags; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patient_tags ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - nome text NOT NULL, - cor text, - is_padrao boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone, - tenant_id uuid NOT NULL -); - - -ALTER TABLE public.patient_tags OWNER TO supabase_admin; - --- --- Name: patients; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.patients ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - nome_completo text NOT NULL, - email_principal text, - telefone text, - created_at timestamp with time zone DEFAULT now(), - owner_id uuid, - avatar_url text, - status text DEFAULT 'Ativo'::text, - last_attended_at timestamp with time zone, - is_native boolean DEFAULT false, - naturalidade text, - data_nascimento date, - rg text, - cpf text, - identification_color text, - genero text, - estado_civil text, - email_alternativo text, - pais text DEFAULT 'Brasil'::text, - cep text, - cidade text, - estado text, - endereco text, - numero text, - bairro text, - complemento text, - escolaridade text, - profissao text, - nome_parente text, - grau_parentesco text, - telefone_alternativo text, - onde_nos_conheceu text, - encaminhado_por text, - nome_responsavel text, - telefone_responsavel text, - cpf_responsavel text, - observacao_responsavel text, - cobranca_no_responsavel boolean DEFAULT false, - observacoes text, - notas_internas text, - updated_at timestamp with time zone DEFAULT now(), - telefone_parente text, - tenant_id uuid NOT NULL, - responsible_member_id uuid NOT NULL, - user_id uuid, - patient_scope text DEFAULT 'clinic'::text NOT NULL, - therapist_member_id uuid, - CONSTRAINT cpf_responsavel_format_check CHECK (((cpf_responsavel IS NULL) OR (cpf_responsavel ~ '^\d{11}$'::text))), - CONSTRAINT patients_cpf_format_check CHECK (((cpf IS NULL) OR (cpf ~ '^\d{11}$'::text))), - CONSTRAINT patients_patient_scope_check CHECK ((patient_scope = ANY (ARRAY['clinic'::text, 'therapist'::text]))), - CONSTRAINT patients_status_check CHECK ((status = ANY (ARRAY['Ativo'::text, 'Inativo'::text, 'Alta'::text, 'Encaminhado'::text]))), - CONSTRAINT patients_therapist_scope_consistency CHECK ((((patient_scope = 'clinic'::text) AND (therapist_member_id IS NULL)) OR ((patient_scope = 'therapist'::text) AND (therapist_member_id IS NOT NULL)))) -); - - -ALTER TABLE public.patients OWNER TO supabase_admin; - --- --- Name: COLUMN patients.avatar_url; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.patients.avatar_url IS 'URL pública da imagem de avatar armazenada no Supabase Storage'; - - --- --- Name: payment_settings; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.payment_settings ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid, - pix_ativo boolean DEFAULT false NOT NULL, - pix_tipo text DEFAULT 'cpf'::text NOT NULL, - pix_chave text DEFAULT ''::text NOT NULL, - pix_nome_titular text DEFAULT ''::text NOT NULL, - deposito_ativo boolean DEFAULT false NOT NULL, - deposito_banco text DEFAULT ''::text NOT NULL, - deposito_agencia text DEFAULT ''::text NOT NULL, - deposito_conta text DEFAULT ''::text NOT NULL, - deposito_tipo_conta text DEFAULT 'corrente'::text NOT NULL, - deposito_titular text DEFAULT ''::text NOT NULL, - deposito_cpf_cnpj text DEFAULT ''::text NOT NULL, - dinheiro_ativo boolean DEFAULT false NOT NULL, - cartao_ativo boolean DEFAULT false NOT NULL, - cartao_instrucao text DEFAULT ''::text NOT NULL, - convenio_ativo boolean DEFAULT false NOT NULL, - convenio_lista text DEFAULT ''::text NOT NULL, - observacoes_pagamento text DEFAULT ''::text NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.payment_settings OWNER TO supabase_admin; - --- --- Name: plan_prices; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_prices ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - plan_id uuid NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - "interval" text NOT NULL, - amount_cents integer NOT NULL, - is_active boolean DEFAULT true NOT NULL, - active_from timestamp with time zone DEFAULT now() NOT NULL, - active_to timestamp with time zone, - source text DEFAULT 'manual'::text NOT NULL, - provider text, - provider_price_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - CONSTRAINT plan_prices_amount_cents_check CHECK ((amount_cents >= 0)), - CONSTRAINT plan_prices_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))) -); - - -ALTER TABLE public.plan_prices OWNER TO supabase_admin; - --- --- Name: TABLE plan_prices; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.plan_prices IS 'Histórico de preços por plano (fonte: manual/gateway).'; - - --- --- Name: plan_public; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_public ( - plan_id uuid NOT NULL, - public_name text DEFAULT ''::text NOT NULL, - public_description text DEFAULT ''::text NOT NULL, - badge text, - is_featured boolean DEFAULT false NOT NULL, - is_visible boolean DEFAULT true NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_public OWNER TO supabase_admin; - --- --- Name: TABLE plan_public; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.plan_public IS 'Configuração de vitrine (página pública) dos planos.'; - - --- --- Name: plan_public_bullets; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plan_public_bullets ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - plan_id uuid NOT NULL, - text text NOT NULL, - sort_order integer DEFAULT 0 NOT NULL, - highlight boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.plan_public_bullets OWNER TO supabase_admin; - --- --- Name: plans; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.plans ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - key text NOT NULL, - name text NOT NULL, - description text, - is_active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - price_cents integer DEFAULT 0 NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - billing_interval text DEFAULT 'month'::text NOT NULL, - target text, - max_supervisees integer, - CONSTRAINT plans_target_check CHECK ((target = ANY (ARRAY['patient'::text, 'therapist'::text, 'clinic'::text, 'supervisor'::text]))) -); - - -ALTER TABLE public.plans OWNER TO supabase_admin; - --- --- Name: COLUMN plans.name; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.name IS 'Nome interno do plano (admin). A key é técnica/imutável.'; - - --- --- Name: COLUMN plans.target; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.target IS 'Público-alvo do plano: patient, therapist ou clinic.'; - - --- --- Name: COLUMN plans.max_supervisees; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.plans.max_supervisees IS 'Limite de terapeutas que podem ser supervisionados. Apenas para planos target=supervisor. NULL = sem limite.'; - - --- --- Name: professional_pricing; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.professional_pricing ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - determined_commitment_id uuid, - price numeric(10,2) NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.professional_pricing OWNER TO supabase_admin; - --- --- Name: TABLE professional_pricing; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.professional_pricing IS 'DEPRECATED: substituída por public.services. Manter até próxima release de limpeza.'; - - --- --- Name: profiles; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.profiles ( - id uuid NOT NULL, - role text DEFAULT 'tenant_member'::text NOT NULL, - full_name text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - avatar_url text, - phone text, - bio text, - language text DEFAULT 'pt-BR'::text NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - notify_system_email boolean DEFAULT true NOT NULL, - notify_reminders boolean DEFAULT true NOT NULL, - notify_news boolean DEFAULT false NOT NULL, - account_type text DEFAULT 'free'::text NOT NULL, - platform_roles text[] DEFAULT '{}'::text[] NOT NULL, - nickname text, - work_description text, - work_description_other text, - site_url text, - social_instagram text, - social_youtube text, - social_facebook text, - social_x text, - social_custom jsonb DEFAULT '[]'::jsonb NOT NULL, - CONSTRAINT profiles_account_type_check CHECK ((account_type = ANY (ARRAY['free'::text, 'patient'::text, 'therapist'::text, 'clinic'::text]))), - CONSTRAINT profiles_role_check CHECK ((role = ANY (ARRAY['saas_admin'::text, 'tenant_member'::text, 'portal_user'::text, 'patient'::text]))) -); - - -ALTER TABLE public.profiles OWNER TO supabase_admin; - --- --- Name: COLUMN profiles.phone; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.phone IS 'WhatsApp / telefone no formato (99) 99999-9999'; - - --- --- Name: COLUMN profiles.bio; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.bio IS 'Breve apresentação pública (máx 300 chars no front)'; - - --- --- Name: COLUMN profiles.account_type; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.account_type IS 'Tipo de conta: free=sem perfil ainda, patient=paciente (imutável), therapist=terapeuta (imutável), clinic=clínica (imutável).'; - - --- --- Name: COLUMN profiles.platform_roles; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.platform_roles IS 'Papéis globais de plataforma, independentes de tenant. Ex: editor de microlearning. Atribuído pelo saas_admin.'; - - --- --- Name: COLUMN profiles.nickname; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.nickname IS 'Apelido preferido para comunicação interna (Agência PSI)'; - - --- --- Name: COLUMN profiles.work_description; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.work_description IS 'Categoria de trabalho selecionada no perfil público'; - - --- --- Name: COLUMN profiles.work_description_other; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.work_description_other IS 'Descrição livre quando work_description = ''outro'''; - - --- --- Name: COLUMN profiles.site_url; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.site_url IS 'Endereço do site pessoal ou profissional'; - - --- --- Name: COLUMN profiles.social_instagram; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.social_instagram IS 'Handle ou URL do Instagram'; - - --- --- Name: COLUMN profiles.social_youtube; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.social_youtube IS 'Handle ou URL do canal no YouTube'; - - --- --- Name: COLUMN profiles.social_facebook; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.social_facebook IS 'Handle ou URL da página no Facebook'; - - --- --- Name: COLUMN profiles.social_x; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.social_x IS 'Handle ou URL do perfil no X (Twitter)'; - - --- --- Name: COLUMN profiles.social_custom; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.profiles.social_custom IS 'Array JSON com redes adicionais livres: [{name, url}]'; - - --- --- Name: recurrence_exceptions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_exceptions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - recurrence_id uuid NOT NULL, - tenant_id uuid NOT NULL, - original_date date NOT NULL, - type public.recurrence_exception_type NOT NULL, - new_date date, - new_start_time time without time zone, - new_end_time time without time zone, - modalidade text, - observacoes text, - titulo_custom text, - extra_fields jsonb, - reason text, - agenda_evento_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.recurrence_exceptions OWNER TO supabase_admin; - --- --- Name: recurrence_rule_services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_rule_services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - rule_id uuid NOT NULL, - service_id uuid NOT NULL, - quantity integer DEFAULT 1 NOT NULL, - unit_price numeric(10,2) NOT NULL, - discount_pct numeric(5,2) DEFAULT 0, - discount_flat numeric(10,2) DEFAULT 0, - final_price numeric(10,2) NOT NULL, - created_at timestamp with time zone DEFAULT now(), - CONSTRAINT recurrence_rule_services_disc_flat_chk CHECK ((discount_flat >= (0)::numeric)), - CONSTRAINT recurrence_rule_services_disc_pct_chk CHECK (((discount_pct >= (0)::numeric) AND (discount_pct <= (100)::numeric))), - CONSTRAINT recurrence_rule_services_final_price_chk CHECK ((final_price >= (0)::numeric)), - CONSTRAINT recurrence_rule_services_quantity_chk CHECK ((quantity > 0)) -); - - -ALTER TABLE public.recurrence_rule_services OWNER TO supabase_admin; - --- --- Name: recurrence_rules; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.recurrence_rules ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - owner_id uuid NOT NULL, - therapist_id uuid, - patient_id uuid, - determined_commitment_id uuid, - type public.recurrence_type DEFAULT 'weekly'::public.recurrence_type NOT NULL, - "interval" smallint DEFAULT 1 NOT NULL, - weekdays smallint[] DEFAULT '{}'::smallint[] NOT NULL, - start_time time without time zone NOT NULL, - end_time time without time zone NOT NULL, - timezone text DEFAULT 'America/Sao_Paulo'::text NOT NULL, - duration_min smallint DEFAULT 50 NOT NULL, - start_date date NOT NULL, - end_date date, - max_occurrences integer, - open_ended boolean DEFAULT true NOT NULL, - modalidade text DEFAULT 'presencial'::text, - titulo_custom text, - observacoes text, - extra_fields jsonb, - status text DEFAULT 'ativo'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - price numeric(10,2), - insurance_plan_id uuid, - insurance_guide_number text, - insurance_value numeric(10,2), - insurance_plan_service_id uuid, - CONSTRAINT recurrence_rules_dates_chk CHECK (((end_date IS NULL) OR (end_date >= start_date))), - CONSTRAINT recurrence_rules_interval_chk CHECK (("interval" >= 1)), - CONSTRAINT recurrence_rules_status_check CHECK ((status = ANY (ARRAY['ativo'::text, 'pausado'::text, 'cancelado'::text]))), - CONSTRAINT recurrence_rules_times_chk CHECK ((end_time > start_time)) -); - - -ALTER TABLE public.recurrence_rules OWNER TO supabase_admin; - --- --- Name: saas_admins; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_admins ( - user_id uuid NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_admins OWNER TO supabase_admin; - --- --- Name: saas_doc_votos; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_doc_votos ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - doc_id uuid NOT NULL, - user_id uuid NOT NULL, - util boolean NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_doc_votos OWNER TO supabase_admin; - --- --- Name: saas_docs; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_docs ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - titulo text NOT NULL, - conteudo text DEFAULT ''::text NOT NULL, - medias jsonb DEFAULT '[]'::jsonb NOT NULL, - tipo_acesso text DEFAULT 'usuario'::text NOT NULL, - pagina_path text NOT NULL, - docs_relacionados uuid[] DEFAULT '{}'::uuid[] NOT NULL, - ativo boolean DEFAULT true NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - categoria text, - exibir_no_faq boolean DEFAULT false NOT NULL, - votos_util integer DEFAULT 0 NOT NULL, - votos_nao_util integer DEFAULT 0 NOT NULL, - CONSTRAINT saas_docs_tipo_acesso_check CHECK ((tipo_acesso = ANY (ARRAY['admin'::text, 'usuario'::text]))) -); - - -ALTER TABLE public.saas_docs OWNER TO supabase_admin; - --- --- Name: COLUMN saas_docs.categoria; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.saas_docs.categoria IS 'Agrupa docs no portal FAQ (ex: Conta, Agenda, Pagamentos)'; - - --- --- Name: COLUMN saas_docs.exibir_no_faq; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.saas_docs.exibir_no_faq IS 'Se true, a doc e seus itens FAQ aparecem no portal de FAQ'; - - --- --- Name: saas_faq; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_faq ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - pergunta text NOT NULL, - categoria text, - publico boolean DEFAULT false NOT NULL, - votos integer DEFAULT 0 NOT NULL, - titulo text, - conteudo text, - tipo_acesso text DEFAULT 'usuario'::text NOT NULL, - pagina_path text NOT NULL, - pagina_label text, - medias jsonb DEFAULT '[]'::jsonb NOT NULL, - faqs_relacionados uuid[] DEFAULT '{}'::uuid[] NOT NULL, - ativo boolean DEFAULT true NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_faq OWNER TO supabase_admin; - --- --- Name: saas_faq_itens; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.saas_faq_itens ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - doc_id uuid NOT NULL, - pergunta text NOT NULL, - resposta text, - ordem integer DEFAULT 0 NOT NULL, - ativo boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.saas_faq_itens OWNER TO supabase_admin; - --- --- Name: TABLE saas_faq_itens; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.saas_faq_itens IS 'Pares pergunta/resposta vinculados a um documento de ajuda'; - - --- --- Name: services; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.services ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - owner_id uuid NOT NULL, - tenant_id uuid NOT NULL, - name text NOT NULL, - description text, - price numeric(10,2) NOT NULL, - duration_min integer, - active boolean DEFAULT true NOT NULL, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE public.services OWNER TO supabase_admin; - --- --- Name: subscription_events; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_events ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - subscription_id uuid NOT NULL, - owner_id uuid NOT NULL, - event_type text NOT NULL, - old_plan_id uuid, - new_plan_id uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - created_by uuid, - source text DEFAULT 'admin_ui'::text, - reason text, - metadata jsonb, - owner_type text NOT NULL, - owner_ref uuid NOT NULL, - CONSTRAINT subscription_events_owner_ref_consistency_chk CHECK ((owner_id = owner_ref)), - CONSTRAINT subscription_events_owner_type_chk CHECK (((owner_type IS NULL) OR (owner_type = ANY (ARRAY['clinic'::text, 'therapist'::text])))) -); - - -ALTER TABLE public.subscription_events OWNER TO supabase_admin; - --- --- Name: subscription_intents_personal; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_personal ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid NOT NULL, - created_by_user_id uuid, - email text NOT NULL, - plan_id uuid NOT NULL, - plan_key text, - "interval" text, - amount_cents integer, - currency text, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'manual'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - subscription_id uuid, - CONSTRAINT sint_personal_interval_check CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::text, 'year'::text])))), - CONSTRAINT sint_personal_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_personal OWNER TO supabase_admin; - --- --- Name: subscription_intents_tenant; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_tenant ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid NOT NULL, - created_by_user_id uuid, - email text NOT NULL, - plan_id uuid NOT NULL, - plan_key text, - "interval" text, - amount_cents integer, - currency text, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'manual'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - tenant_id uuid NOT NULL, - subscription_id uuid, - CONSTRAINT sint_tenant_interval_check CHECK ((("interval" IS NULL) OR ("interval" = ANY (ARRAY['month'::text, 'year'::text])))), - CONSTRAINT sint_tenant_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_tenant OWNER TO supabase_admin; - --- --- Name: subscription_intents; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.subscription_intents AS - SELECT t.id, - t.user_id, - t.created_by_user_id, - t.email, - t.plan_id, - t.plan_key, - t."interval", - t.amount_cents, - t.currency, - t.status, - t.source, - t.notes, - t.created_at, - t.paid_at, - t.tenant_id, - t.subscription_id, - 'clinic'::text AS plan_target - FROM public.subscription_intents_tenant t -UNION ALL - SELECT p.id, - p.user_id, - p.created_by_user_id, - p.email, - p.plan_id, - p.plan_key, - p."interval", - p.amount_cents, - p.currency, - p.status, - p.source, - p.notes, - p.created_at, - p.paid_at, - NULL::uuid AS tenant_id, - p.subscription_id, - 'therapist'::text AS plan_target - FROM public.subscription_intents_personal p; - - -ALTER VIEW public.subscription_intents OWNER TO supabase_admin; - --- --- Name: subscription_intents_legacy; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.subscription_intents_legacy ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - user_id uuid, - email text, - plan_key text NOT NULL, - "interval" text NOT NULL, - amount_cents integer NOT NULL, - currency text DEFAULT 'BRL'::text NOT NULL, - status text DEFAULT 'new'::text NOT NULL, - source text DEFAULT 'landing'::text NOT NULL, - notes text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - paid_at timestamp with time zone, - tenant_id uuid NOT NULL, - created_by_user_id uuid, - CONSTRAINT subscription_intents_interval_check CHECK (("interval" = ANY (ARRAY['month'::text, 'year'::text]))), - CONSTRAINT subscription_intents_status_check CHECK ((status = ANY (ARRAY['new'::text, 'waiting_payment'::text, 'paid'::text, 'canceled'::text]))) -); - - -ALTER TABLE public.subscription_intents_legacy OWNER TO supabase_admin; - --- --- Name: support_sessions; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.support_sessions ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - admin_id uuid NOT NULL, - token text DEFAULT encode(extensions.gen_random_bytes(32), 'hex'::text) NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '01:00:00'::interval) NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.support_sessions OWNER TO supabase_admin; - --- --- Name: tenant_feature_exceptions_log; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_feature_exceptions_log ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - feature_key text NOT NULL, - enabled boolean NOT NULL, - reason text, - created_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_feature_exceptions_log OWNER TO supabase_admin; - --- --- Name: tenant_features; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_features ( - tenant_id uuid NOT NULL, - feature_key text NOT NULL, - enabled boolean DEFAULT false NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.tenant_features OWNER TO supabase_admin; - --- --- Name: tenant_invites; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenant_invites ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - tenant_id uuid NOT NULL, - email text NOT NULL, - role text NOT NULL, - token uuid DEFAULT gen_random_uuid() NOT NULL, - invited_by uuid, - created_at timestamp with time zone DEFAULT now() NOT NULL, - expires_at timestamp with time zone DEFAULT (now() + '7 days'::interval) NOT NULL, - accepted_at timestamp with time zone, - accepted_by uuid, - revoked_at timestamp with time zone, - revoked_by uuid, - CONSTRAINT tenant_invites_role_check CHECK ((role = ANY (ARRAY['therapist'::text, 'secretary'::text]))) -); - - -ALTER TABLE public.tenant_invites OWNER TO supabase_admin; - --- --- Name: tenants; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.tenants ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - name text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - kind text DEFAULT 'saas'::text NOT NULL, - CONSTRAINT tenants_kind_check CHECK ((kind = ANY (ARRAY['therapist'::text, 'clinic_coworking'::text, 'clinic_reception'::text, 'clinic_full'::text, 'clinic'::text, 'saas'::text, 'supervisor'::text]))) -); - - -ALTER TABLE public.tenants OWNER TO supabase_admin; - --- --- Name: COLUMN tenants.kind; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.tenants.kind IS 'Tipo do tenant. Imutável após criação. therapist=terapeuta solo. clinic_coworking/clinic_reception/clinic_full=clínicas. clinic e saas são legados.'; - - --- --- Name: user_settings; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.user_settings ( - user_id uuid NOT NULL, - theme_mode text DEFAULT 'dark'::text NOT NULL, - preset text DEFAULT 'Aura'::text NOT NULL, - primary_color text DEFAULT 'noir'::text NOT NULL, - surface_color text DEFAULT 'slate'::text NOT NULL, - menu_mode text DEFAULT 'static'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - layout_variant text DEFAULT 'classic'::text NOT NULL, - CONSTRAINT user_settings_layout_variant_check CHECK ((layout_variant = ANY (ARRAY['classic'::text, 'rail'::text]))), - CONSTRAINT user_settings_menu_mode_check CHECK ((menu_mode = ANY (ARRAY['static'::text, 'overlay'::text]))), - CONSTRAINT user_settings_theme_mode_check CHECK ((theme_mode = ANY (ARRAY['light'::text, 'dark'::text]))) -); - - -ALTER TABLE public.user_settings OWNER TO supabase_admin; - --- --- Name: TABLE user_settings; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.user_settings IS 'Preferências de aparência e layout por usuário'; - - --- --- Name: COLUMN user_settings.user_id; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.user_id IS 'FK = auth.users.id — um registro por usuário'; - - --- --- Name: COLUMN user_settings.theme_mode; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.theme_mode IS 'light | dark'; - - --- --- Name: COLUMN user_settings.preset; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.preset IS 'Preset PrimeVue: Aura | Lara | Nora'; - - --- --- Name: COLUMN user_settings.primary_color; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.primary_color IS 'Nome da cor primária (ex: blue, emerald, noir)'; - - --- --- Name: COLUMN user_settings.surface_color; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.surface_color IS 'Nome da surface (ex: slate, zinc, neutral)'; - - --- --- Name: COLUMN user_settings.menu_mode; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.menu_mode IS 'static | overlay'; - - --- --- Name: COLUMN user_settings.layout_variant; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.user_settings.layout_variant IS 'classic (sidebar) | rail (mini rail + painel)'; - - --- --- Name: v_auth_users_public; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_auth_users_public AS - SELECT id AS user_id, - email, - created_at, - last_sign_in_at - FROM auth.users u; - - -ALTER VIEW public.v_auth_users_public OWNER TO supabase_admin; - --- --- Name: v_commitment_totals; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_commitment_totals AS - SELECT c.tenant_id, - c.id AS commitment_id, - (COALESCE(sum(l.minutes), (0)::bigint))::integer AS total_minutes - FROM (public.determined_commitments c - LEFT JOIN public.commitment_time_logs l ON ((l.commitment_id = c.id))) - GROUP BY c.tenant_id, c.id; - - -ALTER VIEW public.v_commitment_totals OWNER TO supabase_admin; - --- --- Name: v_patient_groups_with_counts; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_patient_groups_with_counts AS - SELECT pg.id, - pg.nome, - pg.cor, - pg.owner_id, - pg.is_system, - pg.is_active, - pg.created_at, - pg.updated_at, - (COALESCE(count(pgp.patient_id), (0)::bigint))::integer AS patients_count - FROM (public.patient_groups pg - LEFT JOIN public.patient_group_patient pgp ON ((pgp.patient_group_id = pg.id))) - GROUP BY pg.id, pg.nome, pg.cor, pg.owner_id, pg.is_system, pg.is_active, pg.created_at, pg.updated_at; - - -ALTER VIEW public.v_patient_groups_with_counts OWNER TO supabase_admin; - --- --- Name: v_plan_active_prices; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_plan_active_prices AS - SELECT plan_id, - max( - CASE - WHEN (("interval" = 'month'::text) AND is_active) THEN amount_cents - ELSE NULL::integer - END) AS monthly_cents, - max( - CASE - WHEN (("interval" = 'year'::text) AND is_active) THEN amount_cents - ELSE NULL::integer - END) AS yearly_cents, - max( - CASE - WHEN (("interval" = 'month'::text) AND is_active) THEN currency - ELSE NULL::text - END) AS monthly_currency, - max( - CASE - WHEN (("interval" = 'year'::text) AND is_active) THEN currency - ELSE NULL::text - END) AS yearly_currency - FROM public.plan_prices - GROUP BY plan_id; - - -ALTER VIEW public.v_plan_active_prices OWNER TO supabase_admin; - --- --- Name: v_public_pricing; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_public_pricing AS - SELECT p.id AS plan_id, - p.key AS plan_key, - p.name AS plan_name, - COALESCE(pp.public_name, ''::text) AS public_name, - COALESCE(pp.public_description, ''::text) AS public_description, - pp.badge, - COALESCE(pp.is_featured, false) AS is_featured, - COALESCE(pp.is_visible, true) AS is_visible, - COALESCE(pp.sort_order, 0) AS sort_order, - ap.monthly_cents, - ap.yearly_cents, - ap.monthly_currency, - ap.yearly_currency, - COALESCE(( SELECT jsonb_agg(jsonb_build_object('id', b.id, 'text', b.text, 'highlight', b.highlight, 'sort_order', b.sort_order) ORDER BY b.sort_order, b.created_at) AS jsonb_agg - FROM public.plan_public_bullets b - WHERE (b.plan_id = p.id)), '[]'::jsonb) AS bullets, - p.target AS plan_target - FROM ((public.plans p - LEFT JOIN public.plan_public pp ON ((pp.plan_id = p.id))) - LEFT JOIN public.v_plan_active_prices ap ON ((ap.plan_id = p.id))) - ORDER BY COALESCE(pp.sort_order, 0), p.key; - - -ALTER VIEW public.v_public_pricing OWNER TO supabase_admin; - --- --- Name: v_subscription_feature_mismatch; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_feature_mismatch AS - WITH expected AS ( - SELECT s.user_id AS owner_id, - f.key AS feature_key - FROM ((public.subscriptions s - JOIN public.plan_features pf ON (((pf.plan_id = s.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))) - WHERE ((s.status = 'active'::text) AND (s.tenant_id IS NULL) AND (s.user_id IS NOT NULL)) - ), actual AS ( - SELECT e.owner_id, - e.feature_key - FROM public.owner_feature_entitlements e - ) - SELECT COALESCE(expected.owner_id, actual.owner_id) AS owner_id, - COALESCE(expected.feature_key, actual.feature_key) AS feature_key, - CASE - WHEN ((expected.feature_key IS NOT NULL) AND (actual.feature_key IS NULL)) THEN 'missing_entitlement'::text - WHEN ((expected.feature_key IS NULL) AND (actual.feature_key IS NOT NULL)) THEN 'unexpected_entitlement'::text - ELSE NULL::text - END AS mismatch_type - FROM (expected - FULL JOIN actual ON (((expected.owner_id = actual.owner_id) AND (expected.feature_key = actual.feature_key)))) - WHERE ((expected.feature_key IS NULL) OR (actual.feature_key IS NULL)); - - -ALTER VIEW public.v_subscription_feature_mismatch OWNER TO supabase_admin; - --- --- Name: v_subscription_health; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_health AS - SELECT s.id AS subscription_id, - s.user_id AS owner_id, - s.status, - s.plan_id, - p.key AS plan_key, - s.current_period_start, - s.current_period_end, - s.updated_at, - CASE - WHEN (s.plan_id IS NULL) THEN 'missing_plan'::text - WHEN (p.id IS NULL) THEN 'invalid_plan'::text - WHEN ((s.status = 'active'::text) AND (s.current_period_end IS NOT NULL) AND (s.current_period_end < now())) THEN 'expired_but_active'::text - WHEN ((s.status = 'canceled'::text) AND (s.current_period_end > now())) THEN 'canceled_but_still_in_period'::text - ELSE 'ok'::text - END AS health_status, - CASE - WHEN (s.tenant_id IS NOT NULL) THEN 'clinic'::text - ELSE 'therapist'::text - END AS owner_type, - COALESCE(s.tenant_id, s.user_id) AS owner_ref - FROM (public.subscriptions s - LEFT JOIN public.plans p ON ((p.id = s.plan_id))); - - -ALTER VIEW public.v_subscription_health OWNER TO supabase_admin; - --- --- Name: v_subscription_health_v2; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_subscription_health_v2 AS - SELECT s.id AS subscription_id, - s.user_id AS owner_id, - CASE - WHEN (s.tenant_id IS NOT NULL) THEN 'clinic'::text - ELSE 'therapist'::text - END AS owner_type, - COALESCE(s.tenant_id, s.user_id) AS owner_ref, - s.status, - s.plan_id, - p.key AS plan_key, - s.current_period_start, - s.current_period_end, - s.updated_at, - CASE - WHEN (s.plan_id IS NULL) THEN 'missing_plan'::text - WHEN (p.id IS NULL) THEN 'invalid_plan'::text - WHEN ((s.status = 'active'::text) AND (s.current_period_end IS NOT NULL) AND (s.current_period_end < now())) THEN 'expired_but_active'::text - WHEN ((s.status = 'canceled'::text) AND (s.current_period_end > now())) THEN 'canceled_but_still_in_period'::text - ELSE 'ok'::text - END AS health_status - FROM (public.subscriptions s - LEFT JOIN public.plans p ON ((p.id = s.plan_id))); - - -ALTER VIEW public.v_subscription_health_v2 OWNER TO supabase_admin; - --- --- Name: v_tag_patient_counts; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tag_patient_counts AS - SELECT t.id, - t.owner_id, - t.nome, - t.cor, - t.is_padrao, - t.created_at, - t.updated_at, - (COALESCE(count(ppt.patient_id), (0)::bigint))::integer AS pacientes_count, - (COALESCE(count(ppt.patient_id), (0)::bigint))::integer AS patient_count - FROM (public.patient_tags t - LEFT JOIN public.patient_patient_tag ppt ON (((ppt.tag_id = t.id) AND (ppt.owner_id = t.owner_id)))) - GROUP BY t.id, t.owner_id, t.nome, t.cor, t.is_padrao, t.created_at, t.updated_at; - - -ALTER VIEW public.v_tag_patient_counts OWNER TO supabase_admin; - --- --- Name: v_tenant_active_subscription; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_active_subscription AS - SELECT DISTINCT ON (tenant_id) tenant_id, - plan_id, - plan_key, - "interval", - status, - current_period_start, - current_period_end, - created_at - FROM public.subscriptions s - WHERE ((tenant_id IS NOT NULL) AND (status = 'active'::text) AND ((current_period_end IS NULL) OR (current_period_end > now()))) - ORDER BY tenant_id, created_at DESC; - - -ALTER VIEW public.v_tenant_active_subscription OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements AS - SELECT a.tenant_id, - f.key AS feature_key, - true AS allowed - FROM ((public.v_tenant_active_subscription a - JOIN public.plan_features pf ON (((pf.plan_id = a.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))); - - -ALTER VIEW public.v_tenant_entitlements OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements_full; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements_full AS - SELECT a.tenant_id, - f.key AS feature_key, - (pf.enabled = true) AS allowed, - pf.limits, - a.plan_id, - p.key AS plan_key - FROM (((public.v_tenant_active_subscription a - JOIN public.plan_features pf ON ((pf.plan_id = a.plan_id))) - JOIN public.features f ON ((f.id = pf.feature_id))) - JOIN public.plans p ON ((p.id = a.plan_id))); - - -ALTER VIEW public.v_tenant_entitlements_full OWNER TO supabase_admin; - --- --- Name: v_tenant_entitlements_json; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_entitlements_json AS - SELECT tenant_id, - max(plan_key) AS plan_key, - jsonb_object_agg(feature_key, jsonb_build_object('allowed', allowed, 'limits', COALESCE(limits, '{}'::jsonb)) ORDER BY feature_key) AS entitlements - FROM public.v_tenant_entitlements_full - GROUP BY tenant_id; - - -ALTER VIEW public.v_tenant_entitlements_json OWNER TO supabase_admin; - --- --- Name: v_tenant_feature_exceptions; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_feature_exceptions AS - SELECT tf.tenant_id, - a.plan_key, - tf.feature_key, - 'commercial_exception'::text AS exception_type - FROM ((public.tenant_features tf - JOIN public.v_tenant_active_subscription a ON ((a.tenant_id = tf.tenant_id))) - LEFT JOIN public.v_tenant_entitlements_full v ON (((v.tenant_id = tf.tenant_id) AND (v.feature_key = tf.feature_key)))) - WHERE ((tf.enabled = true) AND (COALESCE(v.allowed, false) = false)); - - -ALTER VIEW public.v_tenant_feature_exceptions OWNER TO supabase_admin; - --- --- Name: v_tenant_feature_mismatch; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_feature_mismatch AS - WITH plan_allowed AS ( - SELECT v.tenant_id, - v.feature_key, - v.allowed - FROM public.v_tenant_entitlements_full v - ), overrides AS ( - SELECT tf.tenant_id, - tf.feature_key, - tf.enabled - FROM public.tenant_features tf - ) - SELECT o.tenant_id, - o.feature_key, - CASE - WHEN ((o.enabled = true) AND (COALESCE(p.allowed, false) = false)) THEN 'unexpected_override'::text - ELSE NULL::text - END AS mismatch_type - FROM (overrides o - LEFT JOIN plan_allowed p ON (((p.tenant_id = o.tenant_id) AND (p.feature_key = o.feature_key)))) - WHERE ((o.enabled = true) AND (COALESCE(p.allowed, false) = false)); - - -ALTER VIEW public.v_tenant_feature_mismatch OWNER TO supabase_admin; - --- --- Name: v_tenant_members_with_profiles; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_members_with_profiles AS - SELECT tm.id AS tenant_member_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at, - p.full_name, - au.email - FROM ((public.tenant_members tm - LEFT JOIN public.profiles p ON ((p.id = tm.user_id))) - LEFT JOIN auth.users au ON ((au.id = tm.user_id))); - - -ALTER VIEW public.v_tenant_members_with_profiles OWNER TO supabase_admin; - --- --- Name: v_tenant_people; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_people AS - SELECT 'member'::text AS type, - m.tenant_id, - m.user_id, - u.email, - m.role, - m.status, - NULL::uuid AS invite_token, - NULL::timestamp with time zone AS expires_at - FROM (public.tenant_members m - JOIN auth.users u ON ((u.id = m.user_id))) -UNION ALL - SELECT 'invite'::text AS type, - i.tenant_id, - NULL::uuid AS user_id, - i.email, - i.role, - 'invited'::text AS status, - i.token AS invite_token, - i.expires_at - FROM public.tenant_invites i - WHERE ((i.accepted_at IS NULL) AND (i.revoked_at IS NULL)); - - -ALTER VIEW public.v_tenant_people OWNER TO supabase_admin; - --- --- Name: v_tenant_staff; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_tenant_staff AS - SELECT ('m_'::text || (tm.id)::text) AS row_id, - tm.tenant_id, - tm.user_id, - tm.role, - tm.status, - tm.created_at, - p.full_name, - au.email, - NULL::uuid AS invite_token - FROM ((public.tenant_members tm - LEFT JOIN public.profiles p ON ((p.id = tm.user_id))) - LEFT JOIN auth.users au ON ((au.id = tm.user_id))) -UNION ALL - SELECT ('i_'::text || (ti.id)::text) AS row_id, - ti.tenant_id, - NULL::uuid AS user_id, - ti.role, - 'invited'::text AS status, - ti.created_at, - NULL::text AS full_name, - ti.email, - ti.token AS invite_token - FROM public.tenant_invites ti - WHERE ((ti.accepted_at IS NULL) AND (ti.revoked_at IS NULL) AND (ti.expires_at > now())); - - -ALTER VIEW public.v_tenant_staff OWNER TO supabase_admin; - --- --- Name: v_user_active_subscription; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_user_active_subscription AS - SELECT DISTINCT ON (user_id) user_id, - plan_id, - plan_key, - "interval", - status, - current_period_start, - current_period_end, - created_at - FROM public.subscriptions s - WHERE ((tenant_id IS NULL) AND (user_id IS NOT NULL) AND (status = 'active'::text) AND ((current_period_end IS NULL) OR (current_period_end > now()))) - ORDER BY user_id, created_at DESC; - - -ALTER VIEW public.v_user_active_subscription OWNER TO supabase_admin; - --- --- Name: v_user_entitlements; Type: VIEW; Schema: public; Owner: supabase_admin --- - -CREATE VIEW public.v_user_entitlements AS - SELECT a.user_id, - f.key AS feature_key, - true AS allowed - FROM ((public.v_user_active_subscription a - JOIN public.plan_features pf ON (((pf.plan_id = a.plan_id) AND (pf.enabled = true)))) - JOIN public.features f ON ((f.id = pf.feature_id))); - - -ALTER VIEW public.v_user_entitlements OWNER TO supabase_admin; - --- --- Name: messages; Type: TABLE; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE TABLE realtime.messages ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -) -PARTITION BY RANGE (inserted_at); - - -ALTER TABLE realtime.messages OWNER TO supabase_realtime_admin; - --- --- Name: messages_2026_03_12; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_12 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_12 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_13; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_13 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_13 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_14; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_14 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_14 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_15; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_15 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_15 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_16; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_16 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_16 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_17; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_17 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_17 OWNER TO supabase_admin; - --- --- Name: messages_2026_03_18; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.messages_2026_03_18 ( - topic text NOT NULL, - extension text NOT NULL, - payload jsonb, - event text, - private boolean DEFAULT false, - updated_at timestamp without time zone DEFAULT now() NOT NULL, - inserted_at timestamp without time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL -); - - -ALTER TABLE realtime.messages_2026_03_18 OWNER TO supabase_admin; - --- --- Name: schema_migrations; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.schema_migrations ( - version bigint NOT NULL, - inserted_at timestamp(0) without time zone -); - - -ALTER TABLE realtime.schema_migrations OWNER TO supabase_admin; - --- --- Name: subscription; Type: TABLE; Schema: realtime; Owner: supabase_admin --- - -CREATE TABLE realtime.subscription ( - id bigint NOT NULL, - subscription_id uuid NOT NULL, - entity regclass NOT NULL, - filters realtime.user_defined_filter[] DEFAULT '{}'::realtime.user_defined_filter[] NOT NULL, - claims jsonb NOT NULL, - claims_role regrole GENERATED ALWAYS AS (realtime.to_regrole((claims ->> 'role'::text))) STORED NOT NULL, - created_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL -); - - -ALTER TABLE realtime.subscription OWNER TO supabase_admin; - --- --- Name: subscription_id_seq; Type: SEQUENCE; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE realtime.subscription ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( - SEQUENCE NAME realtime.subscription_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: buckets; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets ( - id text NOT NULL, - name text NOT NULL, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - public boolean DEFAULT false, - avif_autodetection boolean DEFAULT false, - file_size_limit bigint, - allowed_mime_types text[], - owner_id text, - type storage.buckettype DEFAULT 'STANDARD'::storage.buckettype NOT NULL -); - - -ALTER TABLE storage.buckets OWNER TO supabase_storage_admin; - --- --- Name: COLUMN buckets.owner; Type: COMMENT; Schema: storage; Owner: supabase_storage_admin --- - -COMMENT ON COLUMN storage.buckets.owner IS 'Field is deprecated, use owner_id instead'; - - --- --- Name: buckets_analytics; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets_analytics ( - name text NOT NULL, - type storage.buckettype DEFAULT 'ANALYTICS'::storage.buckettype NOT NULL, - format text DEFAULT 'ICEBERG'::text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - id uuid DEFAULT gen_random_uuid() NOT NULL, - deleted_at timestamp with time zone -); - - -ALTER TABLE storage.buckets_analytics OWNER TO supabase_storage_admin; - --- --- Name: buckets_vectors; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets_vectors ( - id text NOT NULL, - type storage.buckettype DEFAULT 'VECTOR'::storage.buckettype NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.buckets_vectors OWNER TO supabase_storage_admin; - --- --- Name: iceberg_namespaces; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.iceberg_namespaces ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - bucket_name text NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - metadata jsonb DEFAULT '{}'::jsonb NOT NULL, - catalog_id uuid NOT NULL -); - - -ALTER TABLE storage.iceberg_namespaces OWNER TO supabase_storage_admin; - --- --- Name: iceberg_tables; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.iceberg_tables ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - namespace_id uuid NOT NULL, - bucket_name text NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - location text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL, - remote_table_id text, - shard_key text, - shard_id text, - catalog_id uuid NOT NULL -); - - -ALTER TABLE storage.iceberg_tables OWNER TO supabase_storage_admin; - --- --- Name: migrations; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.migrations ( - id integer NOT NULL, - name character varying(100) NOT NULL, - hash character varying(40) NOT NULL, - executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP -); - - -ALTER TABLE storage.migrations OWNER TO supabase_storage_admin; - --- --- Name: objects; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.objects ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - bucket_id text, - name text, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - last_accessed_at timestamp with time zone DEFAULT now(), - metadata jsonb, - path_tokens text[] GENERATED ALWAYS AS (string_to_array(name, '/'::text)) STORED, - version text, - owner_id text, - user_metadata jsonb -); - - -ALTER TABLE storage.objects OWNER TO supabase_storage_admin; - --- --- Name: COLUMN objects.owner; Type: COMMENT; Schema: storage; Owner: supabase_storage_admin --- - -COMMENT ON COLUMN storage.objects.owner IS 'Field is deprecated, use owner_id instead'; - - --- --- Name: s3_multipart_uploads; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.s3_multipart_uploads ( - id text NOT NULL, - in_progress_size bigint DEFAULT 0 NOT NULL, - upload_signature text NOT NULL, - bucket_id text NOT NULL, - key text NOT NULL COLLATE pg_catalog."C", - version text NOT NULL, - owner_id text, - created_at timestamp with time zone DEFAULT now() NOT NULL, - user_metadata jsonb -); - - -ALTER TABLE storage.s3_multipart_uploads OWNER TO supabase_storage_admin; - --- --- Name: s3_multipart_uploads_parts; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.s3_multipart_uploads_parts ( - id uuid DEFAULT gen_random_uuid() NOT NULL, - upload_id text NOT NULL, - size bigint DEFAULT 0 NOT NULL, - part_number integer NOT NULL, - bucket_id text NOT NULL, - key text NOT NULL COLLATE pg_catalog."C", - etag text NOT NULL, - owner_id text, - version text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.s3_multipart_uploads_parts OWNER TO supabase_storage_admin; - --- --- Name: vector_indexes; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.vector_indexes ( - id text DEFAULT gen_random_uuid() NOT NULL, - name text NOT NULL COLLATE pg_catalog."C", - bucket_id text NOT NULL, - data_type text NOT NULL, - dimension integer NOT NULL, - distance_metric text NOT NULL, - metadata_configuration jsonb, - created_at timestamp with time zone DEFAULT now() NOT NULL, - updated_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE storage.vector_indexes OWNER TO supabase_storage_admin; - --- --- Name: hooks; Type: TABLE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE TABLE supabase_functions.hooks ( - id bigint NOT NULL, - hook_table_id integer NOT NULL, - hook_name text NOT NULL, - created_at timestamp with time zone DEFAULT now() NOT NULL, - request_id bigint -); - - -ALTER TABLE supabase_functions.hooks OWNER TO supabase_functions_admin; - --- --- Name: TABLE hooks; Type: COMMENT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -COMMENT ON TABLE supabase_functions.hooks IS 'Supabase Functions Hooks: Audit trail for triggered hooks.'; - - --- --- Name: hooks_id_seq; Type: SEQUENCE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE SEQUENCE supabase_functions.hooks_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE supabase_functions.hooks_id_seq OWNER TO supabase_functions_admin; - --- --- Name: hooks_id_seq; Type: SEQUENCE OWNED BY; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER SEQUENCE supabase_functions.hooks_id_seq OWNED BY supabase_functions.hooks.id; - - --- --- Name: migrations; Type: TABLE; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE TABLE supabase_functions.migrations ( - version text NOT NULL, - inserted_at timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE supabase_functions.migrations OWNER TO supabase_functions_admin; - --- --- Name: messages_2026_03_12; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_12 FOR VALUES FROM ('2026-03-12 00:00:00') TO ('2026-03-13 00:00:00'); - - --- --- Name: messages_2026_03_13; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_13 FOR VALUES FROM ('2026-03-13 00:00:00') TO ('2026-03-14 00:00:00'); - - --- --- Name: messages_2026_03_14; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_14 FOR VALUES FROM ('2026-03-14 00:00:00') TO ('2026-03-15 00:00:00'); - - --- --- Name: messages_2026_03_15; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_15 FOR VALUES FROM ('2026-03-15 00:00:00') TO ('2026-03-16 00:00:00'); - - --- --- Name: messages_2026_03_16; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_16 FOR VALUES FROM ('2026-03-16 00:00:00') TO ('2026-03-17 00:00:00'); - - --- --- Name: messages_2026_03_17; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_17 FOR VALUES FROM ('2026-03-17 00:00:00') TO ('2026-03-18 00:00:00'); - - --- --- Name: messages_2026_03_18; Type: TABLE ATTACH; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages ATTACH PARTITION realtime.messages_2026_03_18 FOR VALUES FROM ('2026-03-18 00:00:00') TO ('2026-03-19 00:00:00'); - - --- --- Name: refresh_tokens id; Type: DEFAULT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens ALTER COLUMN id SET DEFAULT nextval('auth.refresh_tokens_id_seq'::regclass); - - --- --- Name: agenda_online_slots id; Type: DEFAULT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots ALTER COLUMN id SET DEFAULT nextval('public.agenda_online_slots_id_seq'::regclass); - - --- --- Name: hooks id; Type: DEFAULT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.hooks ALTER COLUMN id SET DEFAULT nextval('supabase_functions.hooks_id_seq'::regclass); - - --- --- Name: extensions extensions_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.extensions - ADD CONSTRAINT extensions_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.tenants - ADD CONSTRAINT tenants_pkey PRIMARY KEY (id); - - --- --- Name: mfa_amr_claims amr_id_pk; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT amr_id_pk PRIMARY KEY (id); - - --- --- Name: audit_log_entries audit_log_entries_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.audit_log_entries - ADD CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id); - - --- --- Name: flow_state flow_state_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.flow_state - ADD CONSTRAINT flow_state_pkey PRIMARY KEY (id); - - --- --- Name: identities identities_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_pkey PRIMARY KEY (id); - - --- --- Name: identities identities_provider_id_provider_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_provider_id_provider_unique UNIQUE (provider_id, provider); - - --- --- Name: instances instances_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.instances - ADD CONSTRAINT instances_pkey PRIMARY KEY (id); - - --- --- Name: mfa_amr_claims mfa_amr_claims_session_id_authentication_method_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT mfa_amr_claims_session_id_authentication_method_pkey UNIQUE (session_id, authentication_method); - - --- --- Name: mfa_challenges mfa_challenges_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_challenges - ADD CONSTRAINT mfa_challenges_pkey PRIMARY KEY (id); - - --- --- Name: mfa_factors mfa_factors_last_challenged_at_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_last_challenged_at_key UNIQUE (last_challenged_at); - - --- --- Name: mfa_factors mfa_factors_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_pkey PRIMARY KEY (id); - - --- --- Name: oauth_authorizations oauth_authorizations_authorization_code_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_authorization_code_key UNIQUE (authorization_code); - - --- --- Name: oauth_authorizations oauth_authorizations_authorization_id_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_authorization_id_key UNIQUE (authorization_id); - - --- --- Name: oauth_authorizations oauth_authorizations_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_pkey PRIMARY KEY (id); - - --- --- Name: oauth_client_states oauth_client_states_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_client_states - ADD CONSTRAINT oauth_client_states_pkey PRIMARY KEY (id); - - --- --- Name: oauth_clients oauth_clients_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_clients - ADD CONSTRAINT oauth_clients_pkey PRIMARY KEY (id); - - --- --- Name: oauth_consents oauth_consents_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_pkey PRIMARY KEY (id); - - --- --- Name: oauth_consents oauth_consents_user_client_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_user_client_unique UNIQUE (user_id, client_id); - - --- --- Name: one_time_tokens one_time_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.one_time_tokens - ADD CONSTRAINT one_time_tokens_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_token_unique; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_token_unique UNIQUE (token); - - --- --- Name: saml_providers saml_providers_entity_id_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_entity_id_key UNIQUE (entity_id); - - --- --- Name: saml_providers saml_providers_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_pkey PRIMARY KEY (id); - - --- --- Name: saml_relay_states saml_relay_states_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_pkey PRIMARY KEY (id); - - --- --- Name: sso_domains sso_domains_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_domains - ADD CONSTRAINT sso_domains_pkey PRIMARY KEY (id); - - --- --- Name: sso_providers sso_providers_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_providers - ADD CONSTRAINT sso_providers_pkey PRIMARY KEY (id); - - --- --- Name: users users_phone_key; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_phone_key UNIQUE (phone); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: agenda_bloqueios agenda_bloqueios_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_pkey PRIMARY KEY (id); - - --- --- Name: agenda_configuracoes agenda_configuracoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_configuracoes - ADD CONSTRAINT agenda_configuracoes_pkey PRIMARY KEY (owner_id); - - --- --- Name: agenda_eventos agenda_eventos_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_pkey PRIMARY KEY (id); - - --- --- Name: agenda_eventos agenda_eventos_sem_sobreposicao; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_sem_sobreposicao EXCLUDE USING gist (owner_id WITH =, tstzrange(inicio_em, fim_em, '[)'::text) WITH &&); - - --- --- Name: agenda_excecoes agenda_excecoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_excecoes - ADD CONSTRAINT agenda_excecoes_pkey PRIMARY KEY (id); - - --- --- Name: agenda_online_slots agenda_online_slots_owner_id_weekday_time_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_owner_id_weekday_time_key UNIQUE (owner_id, weekday, "time"); - - --- --- Name: agenda_online_slots agenda_online_slots_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_pkey PRIMARY KEY (id); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_pkey PRIMARY KEY (id); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_unique UNIQUE (owner_id, dia_semana, hora_inicio, hora_fim, modalidade); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_seman_owner_id_dia_semana_hora_inic_key UNIQUE (owner_id, dia_semana, hora_inicio); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_semanais_pkey PRIMARY KEY (id); - - --- --- Name: agenda_slots_regras agenda_slots_regras_owner_id_dia_semana_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_owner_id_dia_semana_key UNIQUE (owner_id, dia_semana); - - --- --- Name: agenda_slots_regras agenda_slots_regras_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_pkey PRIMARY KEY (id); - - --- --- Name: agendador_configuracoes agendador_configuracoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_pkey PRIMARY KEY (owner_id); - - --- --- Name: agendador_solicitacoes agendador_solicitacoes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_solicitacoes_pkey PRIMARY KEY (id); - - --- --- Name: billing_contracts billing_contracts_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.billing_contracts - ADD CONSTRAINT billing_contracts_pkey PRIMARY KEY (id); - - --- --- Name: commitment_services commitment_services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_services - ADD CONSTRAINT commitment_services_pkey PRIMARY KEY (id); - - --- --- Name: commitment_time_logs commitment_time_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitment_fields determined_commitment_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitments determined_commitments_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_pkey PRIMARY KEY (id); - - --- --- Name: determined_commitments determined_commitments_tenant_native_key_uq; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_tenant_native_key_uq UNIQUE (tenant_id, native_key); - - --- --- Name: dev_user_credentials dev_user_credentials_email_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.dev_user_credentials - ADD CONSTRAINT dev_user_credentials_email_key UNIQUE (email); - - --- --- Name: dev_user_credentials dev_user_credentials_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.dev_user_credentials - ADD CONSTRAINT dev_user_credentials_pkey PRIMARY KEY (id); - - --- --- Name: entitlements_invalidation entitlements_invalidation_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.entitlements_invalidation - ADD CONSTRAINT entitlements_invalidation_pkey PRIMARY KEY (owner_id); - - --- --- Name: features features_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.features - ADD CONSTRAINT features_key_key UNIQUE (key); - - --- --- Name: features features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.features - ADD CONSTRAINT features_pkey PRIMARY KEY (id); - - --- --- Name: feriados feriados_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_pkey PRIMARY KEY (id); - - --- --- Name: feriados feriados_tenant_id_data_nome_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_tenant_id_data_nome_key UNIQUE (tenant_id, data, nome); - - --- --- Name: financial_exceptions financial_exceptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.financial_exceptions - ADD CONSTRAINT financial_exceptions_pkey PRIMARY KEY (id); - - --- --- Name: insurance_plan_services insurance_plan_services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plan_services - ADD CONSTRAINT insurance_plan_services_pkey PRIMARY KEY (id); - - --- --- Name: insurance_plans insurance_plans_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plans - ADD CONSTRAINT insurance_plans_pkey PRIMARY KEY (id); - - --- --- Name: module_features module_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_pkey PRIMARY KEY (module_id, feature_id); - - --- --- Name: modules modules_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.modules - ADD CONSTRAINT modules_key_key UNIQUE (key); - - --- --- Name: modules modules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.modules - ADD CONSTRAINT modules_pkey PRIMARY KEY (id); - - --- --- Name: owner_users owner_users_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.owner_users - ADD CONSTRAINT owner_users_pkey PRIMARY KEY (owner_id, user_id); - - --- --- Name: patient_discounts patient_discounts_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_discounts - ADD CONSTRAINT patient_discounts_pkey PRIMARY KEY (id); - - --- --- Name: patient_group_patient patient_group_patient_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_pkey PRIMARY KEY (patient_group_id, patient_id); - - --- --- Name: patient_groups patient_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_groups - ADD CONSTRAINT patient_groups_pkey PRIMARY KEY (id); - - --- --- Name: patient_intake_requests patient_intake_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_intake_requests - ADD CONSTRAINT patient_intake_requests_pkey PRIMARY KEY (id); - - --- --- Name: patient_invites patient_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_pkey PRIMARY KEY (id); - - --- --- Name: patient_invites patient_invites_token_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_token_key UNIQUE (token); - - --- --- Name: patient_patient_tag patient_patient_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_pkey PRIMARY KEY (patient_id, tag_id); - - --- --- Name: patient_tags patient_tags_owner_name_uniq; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_owner_name_uniq UNIQUE (owner_id, nome); - - --- --- Name: patient_tags patient_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_pkey PRIMARY KEY (id); - - --- --- Name: patients patients_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_pkey PRIMARY KEY (id); - - --- --- Name: payment_settings payment_settings_owner_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_owner_id_key UNIQUE (owner_id); - - --- --- Name: payment_settings payment_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_pkey PRIMARY KEY (id); - - --- --- Name: plan_features plan_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_pkey PRIMARY KEY (plan_id, feature_id); - - --- --- Name: plan_prices plan_prices_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_prices - ADD CONSTRAINT plan_prices_pkey PRIMARY KEY (id); - - --- --- Name: plan_public_bullets plan_public_bullets_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public_bullets - ADD CONSTRAINT plan_public_bullets_pkey PRIMARY KEY (id); - - --- --- Name: plan_public plan_public_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public - ADD CONSTRAINT plan_public_pkey PRIMARY KEY (plan_id); - - --- --- Name: plans plans_key_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plans - ADD CONSTRAINT plans_key_key UNIQUE (key); - - --- --- Name: plans plans_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plans - ADD CONSTRAINT plans_pkey PRIMARY KEY (id); - - --- --- Name: professional_pricing professional_pricing_owner_commitment_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_owner_commitment_key UNIQUE (owner_id, determined_commitment_id); - - --- --- Name: professional_pricing professional_pricing_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_pkey PRIMARY KEY (id); - - --- --- Name: profiles profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.profiles - ADD CONSTRAINT profiles_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_exceptions recurrence_exceptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_exceptions recurrence_exceptions_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_unique UNIQUE (recurrence_id, original_date); - - --- --- Name: recurrence_rule_services recurrence_rule_services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rule_services - ADD CONSTRAINT recurrence_rule_services_pkey PRIMARY KEY (id); - - --- --- Name: recurrence_rules recurrence_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_pkey PRIMARY KEY (id); - - --- --- Name: saas_admins saas_admins_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_admins - ADD CONSTRAINT saas_admins_pkey PRIMARY KEY (user_id); - - --- --- Name: saas_doc_votos saas_doc_votos_doc_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_doc_id_user_id_key UNIQUE (doc_id, user_id); - - --- --- Name: saas_doc_votos saas_doc_votos_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_pkey PRIMARY KEY (id); - - --- --- Name: saas_docs saas_docs_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_docs - ADD CONSTRAINT saas_docs_pkey PRIMARY KEY (id); - - --- --- Name: saas_faq_itens saas_faq_itens_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq_itens - ADD CONSTRAINT saas_faq_itens_pkey PRIMARY KEY (id); - - --- --- Name: saas_faq saas_faq_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq - ADD CONSTRAINT saas_faq_pkey PRIMARY KEY (id); - - --- --- Name: services services_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.services - ADD CONSTRAINT services_pkey PRIMARY KEY (id); - - --- --- Name: subscription_events subscription_events_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_events - ADD CONSTRAINT subscription_events_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_personal subscription_intents_personal_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT subscription_intents_personal_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_legacy subscription_intents_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_legacy - ADD CONSTRAINT subscription_intents_pkey PRIMARY KEY (id); - - --- --- Name: subscription_intents_tenant subscription_intents_tenant_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT subscription_intents_tenant_pkey PRIMARY KEY (id); - - --- --- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id); - - --- --- Name: support_sessions support_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_pkey PRIMARY KEY (id); - - --- --- Name: support_sessions support_sessions_token_unique; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_token_unique UNIQUE (token); - - --- --- Name: tenant_feature_exceptions_log tenant_feature_exceptions_log_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_feature_exceptions_log - ADD CONSTRAINT tenant_feature_exceptions_log_pkey PRIMARY KEY (id); - - --- --- Name: tenant_features tenant_features_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_features - ADD CONSTRAINT tenant_features_pkey PRIMARY KEY (tenant_id, feature_key); - - --- --- Name: tenant_invites tenant_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_pkey PRIMARY KEY (id); - - --- --- Name: tenant_members tenant_members_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_pkey PRIMARY KEY (id); - - --- --- Name: tenant_members tenant_members_tenant_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_tenant_id_user_id_key UNIQUE (tenant_id, user_id); - - --- --- Name: tenant_modules tenant_modules_owner_id_module_id_key; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_owner_id_module_id_key UNIQUE (owner_id, module_id); - - --- --- Name: tenant_modules tenant_modules_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_pkey PRIMARY KEY (id); - - --- --- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenants - ADD CONSTRAINT tenants_pkey PRIMARY KEY (id); - - --- --- Name: user_settings user_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.user_settings - ADD CONSTRAINT user_settings_pkey PRIMARY KEY (user_id); - - --- --- Name: messages messages_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER TABLE ONLY realtime.messages - ADD CONSTRAINT messages_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_12 messages_2026_03_12_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_12 - ADD CONSTRAINT messages_2026_03_12_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_13 messages_2026_03_13_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_13 - ADD CONSTRAINT messages_2026_03_13_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_14 messages_2026_03_14_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_14 - ADD CONSTRAINT messages_2026_03_14_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_15 messages_2026_03_15_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_15 - ADD CONSTRAINT messages_2026_03_15_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_16 messages_2026_03_16_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_16 - ADD CONSTRAINT messages_2026_03_16_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_17 messages_2026_03_17_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_17 - ADD CONSTRAINT messages_2026_03_17_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: messages_2026_03_18 messages_2026_03_18_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.messages_2026_03_18 - ADD CONSTRAINT messages_2026_03_18_pkey PRIMARY KEY (id, inserted_at); - - --- --- Name: subscription pk_subscription; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.subscription - ADD CONSTRAINT pk_subscription PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY realtime.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: buckets_analytics buckets_analytics_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets_analytics - ADD CONSTRAINT buckets_analytics_pkey PRIMARY KEY (id); - - --- --- Name: buckets buckets_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets - ADD CONSTRAINT buckets_pkey PRIMARY KEY (id); - - --- --- Name: buckets_vectors buckets_vectors_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets_vectors - ADD CONSTRAINT buckets_vectors_pkey PRIMARY KEY (id); - - --- --- Name: iceberg_namespaces iceberg_namespaces_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_namespaces - ADD CONSTRAINT iceberg_namespaces_pkey PRIMARY KEY (id); - - --- --- Name: iceberg_tables iceberg_tables_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_name_key; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_name_key UNIQUE (name); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); - - --- --- Name: objects objects_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT objects_pkey PRIMARY KEY (id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_pkey PRIMARY KEY (id); - - --- --- Name: s3_multipart_uploads s3_multipart_uploads_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads - ADD CONSTRAINT s3_multipart_uploads_pkey PRIMARY KEY (id); - - --- --- Name: vector_indexes vector_indexes_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.vector_indexes - ADD CONSTRAINT vector_indexes_pkey PRIMARY KEY (id); - - --- --- Name: hooks hooks_pkey; Type: CONSTRAINT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.hooks - ADD CONSTRAINT hooks_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: supabase_functions; Owner: supabase_functions_admin --- - -ALTER TABLE ONLY supabase_functions.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (version); - - --- --- Name: extensions_tenant_external_id_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE INDEX extensions_tenant_external_id_index ON _realtime.extensions USING btree (tenant_external_id); - - --- --- Name: extensions_tenant_external_id_type_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX extensions_tenant_external_id_type_index ON _realtime.extensions USING btree (tenant_external_id, type); - - --- --- Name: tenants_external_id_index; Type: INDEX; Schema: _realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX tenants_external_id_index ON _realtime.tenants USING btree (external_id); - - --- --- Name: audit_logs_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id); - - --- --- Name: confirmation_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX confirmation_token_idx ON auth.users USING btree (confirmation_token) WHERE ((confirmation_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: email_change_token_current_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX email_change_token_current_idx ON auth.users USING btree (email_change_token_current) WHERE ((email_change_token_current)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: email_change_token_new_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX email_change_token_new_idx ON auth.users USING btree (email_change_token_new) WHERE ((email_change_token_new)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: factor_id_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX factor_id_created_at_idx ON auth.mfa_factors USING btree (user_id, created_at); - - --- --- Name: flow_state_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX flow_state_created_at_idx ON auth.flow_state USING btree (created_at DESC); - - --- --- Name: identities_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX identities_email_idx ON auth.identities USING btree (email text_pattern_ops); - - --- --- Name: INDEX identities_email_idx; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON INDEX auth.identities_email_idx IS 'Auth: Ensures indexed queries on the email column'; - - --- --- Name: identities_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX identities_user_id_idx ON auth.identities USING btree (user_id); - - --- --- Name: idx_auth_code; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_auth_code ON auth.flow_state USING btree (auth_code); - - --- --- Name: idx_oauth_client_states_created_at; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_oauth_client_states_created_at ON auth.oauth_client_states USING btree (created_at); - - --- --- Name: idx_user_id_auth_method; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX idx_user_id_auth_method ON auth.flow_state USING btree (user_id, authentication_method); - - --- --- Name: mfa_challenge_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX mfa_challenge_created_at_idx ON auth.mfa_challenges USING btree (created_at DESC); - - --- --- Name: mfa_factors_user_friendly_name_unique; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX mfa_factors_user_friendly_name_unique ON auth.mfa_factors USING btree (friendly_name, user_id) WHERE (TRIM(BOTH FROM friendly_name) <> ''::text); - - --- --- Name: mfa_factors_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX mfa_factors_user_id_idx ON auth.mfa_factors USING btree (user_id); - - --- --- Name: oauth_auth_pending_exp_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_auth_pending_exp_idx ON auth.oauth_authorizations USING btree (expires_at) WHERE (status = 'pending'::auth.oauth_authorization_status); - - --- --- Name: oauth_clients_deleted_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_clients_deleted_at_idx ON auth.oauth_clients USING btree (deleted_at); - - --- --- Name: oauth_consents_active_client_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_active_client_idx ON auth.oauth_consents USING btree (client_id) WHERE (revoked_at IS NULL); - - --- --- Name: oauth_consents_active_user_client_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_active_user_client_idx ON auth.oauth_consents USING btree (user_id, client_id) WHERE (revoked_at IS NULL); - - --- --- Name: oauth_consents_user_order_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX oauth_consents_user_order_idx ON auth.oauth_consents USING btree (user_id, granted_at DESC); - - --- --- Name: one_time_tokens_relates_to_hash_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX one_time_tokens_relates_to_hash_idx ON auth.one_time_tokens USING hash (relates_to); - - --- --- Name: one_time_tokens_token_hash_hash_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX one_time_tokens_token_hash_hash_idx ON auth.one_time_tokens USING hash (token_hash); - - --- --- Name: one_time_tokens_user_id_token_type_key; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX one_time_tokens_user_id_token_type_key ON auth.one_time_tokens USING btree (user_id, token_type); - - --- --- Name: reauthentication_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX reauthentication_token_idx ON auth.users USING btree (reauthentication_token) WHERE ((reauthentication_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: recovery_token_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX recovery_token_idx ON auth.users USING btree (recovery_token) WHERE ((recovery_token)::text !~ '^[0-9 ]*$'::text); - - --- --- Name: refresh_tokens_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id); - - --- --- Name: refresh_tokens_instance_id_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id); - - --- --- Name: refresh_tokens_parent_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_parent_idx ON auth.refresh_tokens USING btree (parent); - - --- --- Name: refresh_tokens_session_id_revoked_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_session_id_revoked_idx ON auth.refresh_tokens USING btree (session_id, revoked); - - --- --- Name: refresh_tokens_updated_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX refresh_tokens_updated_at_idx ON auth.refresh_tokens USING btree (updated_at DESC); - - --- --- Name: saml_providers_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_providers_sso_provider_id_idx ON auth.saml_providers USING btree (sso_provider_id); - - --- --- Name: saml_relay_states_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_created_at_idx ON auth.saml_relay_states USING btree (created_at DESC); - - --- --- Name: saml_relay_states_for_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_for_email_idx ON auth.saml_relay_states USING btree (for_email); - - --- --- Name: saml_relay_states_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX saml_relay_states_sso_provider_id_idx ON auth.saml_relay_states USING btree (sso_provider_id); - - --- --- Name: sessions_not_after_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_not_after_idx ON auth.sessions USING btree (not_after DESC); - - --- --- Name: sessions_oauth_client_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_oauth_client_id_idx ON auth.sessions USING btree (oauth_client_id); - - --- --- Name: sessions_user_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sessions_user_id_idx ON auth.sessions USING btree (user_id); - - --- --- Name: sso_domains_domain_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX sso_domains_domain_idx ON auth.sso_domains USING btree (lower(domain)); - - --- --- Name: sso_domains_sso_provider_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sso_domains_sso_provider_id_idx ON auth.sso_domains USING btree (sso_provider_id); - - --- --- Name: sso_providers_resource_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX sso_providers_resource_id_idx ON auth.sso_providers USING btree (lower(resource_id)); - - --- --- Name: sso_providers_resource_id_pattern_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX sso_providers_resource_id_pattern_idx ON auth.sso_providers USING btree (resource_id text_pattern_ops); - - --- --- Name: unique_phone_factor_per_user; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX unique_phone_factor_per_user ON auth.mfa_factors USING btree (user_id, phone); - - --- --- Name: user_id_created_at_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX user_id_created_at_idx ON auth.sessions USING btree (user_id, created_at); - - --- --- Name: users_email_partial_key; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE UNIQUE INDEX users_email_partial_key ON auth.users USING btree (email) WHERE (is_sso_user = false); - - --- --- Name: INDEX users_email_partial_key; Type: COMMENT; Schema: auth; Owner: supabase_auth_admin --- - -COMMENT ON INDEX auth.users_email_partial_key IS 'Auth: A partial unique index that applies only when is_sso_user is false'; - - --- --- Name: users_instance_id_email_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, lower((email)::text)); - - --- --- Name: users_instance_id_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id); - - --- --- Name: users_is_anonymous_idx; Type: INDEX; Schema: auth; Owner: supabase_auth_admin --- - -CREATE INDEX users_is_anonymous_idx ON auth.users USING btree (is_anonymous); - - --- --- Name: agenda_bloqueios_owner_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_owner_data_idx ON public.agenda_bloqueios USING btree (owner_id, data_inicio, data_fim); - - --- --- Name: agenda_bloqueios_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_owner_id_idx ON public.agenda_bloqueios USING btree (owner_id); - - --- --- Name: agenda_bloqueios_recorrente_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_recorrente_idx ON public.agenda_bloqueios USING btree (owner_id, dia_semana) WHERE (recorrente = true); - - --- --- Name: agenda_bloqueios_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_bloqueios_tenant_id_idx ON public.agenda_bloqueios USING btree (tenant_id); - - --- --- Name: agenda_configuracoes_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_configuracoes_tenant_idx ON public.agenda_configuracoes USING btree (tenant_id); - - --- --- Name: agenda_configuracoes_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_configuracoes_tenant_owner_idx ON public.agenda_configuracoes USING btree (tenant_id, owner_id); - - --- --- Name: agenda_eventos_billing_contract_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_billing_contract_idx ON public.agenda_eventos USING btree (billing_contract_id) WHERE (billing_contract_id IS NOT NULL); - - --- --- Name: agenda_eventos_insurance_plan_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_insurance_plan_idx ON public.agenda_eventos USING btree (insurance_plan_id); - - --- --- Name: agenda_eventos_owner_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_owner_inicio_idx ON public.agenda_eventos USING btree (owner_id, inicio_em); - - --- --- Name: agenda_eventos_owner_terapeuta_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_owner_terapeuta_inicio_idx ON public.agenda_eventos USING btree (owner_id, terapeuta_id, inicio_em); - - --- --- Name: agenda_eventos_recurrence_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_recurrence_idx ON public.agenda_eventos USING btree (recurrence_id) WHERE (recurrence_id IS NOT NULL); - - --- --- Name: agenda_eventos_tenant_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_tenant_inicio_idx ON public.agenda_eventos USING btree (tenant_id, inicio_em); - - --- --- Name: agenda_eventos_tenant_owner_inicio_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_eventos_tenant_owner_inicio_idx ON public.agenda_eventos USING btree (tenant_id, owner_id, inicio_em); - - --- --- Name: agenda_excecoes_owner_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_owner_data_idx ON public.agenda_excecoes USING btree (owner_id, data); - - --- --- Name: agenda_excecoes_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_tenant_idx ON public.agenda_excecoes USING btree (tenant_id); - - --- --- Name: agenda_excecoes_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_excecoes_tenant_owner_idx ON public.agenda_excecoes USING btree (tenant_id, owner_id); - - --- --- Name: agenda_online_slots_owner_weekday_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_owner_weekday_idx ON public.agenda_online_slots USING btree (owner_id, weekday); - - --- --- Name: agenda_online_slots_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_tenant_idx ON public.agenda_online_slots USING btree (tenant_id); - - --- --- Name: agenda_online_slots_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_online_slots_tenant_owner_idx ON public.agenda_online_slots USING btree (tenant_id, owner_id); - - --- --- Name: agenda_regras_semanais_owner_dia_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_owner_dia_idx ON public.agenda_regras_semanais USING btree (owner_id, dia_semana); - - --- --- Name: agenda_regras_semanais_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_tenant_idx ON public.agenda_regras_semanais USING btree (tenant_id); - - --- --- Name: agenda_regras_semanais_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_regras_semanais_tenant_owner_idx ON public.agenda_regras_semanais USING btree (tenant_id, owner_id); - - --- --- Name: agenda_slots_bloqueados_semanais_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_bloqueados_semanais_tenant_idx ON public.agenda_slots_bloqueados_semanais USING btree (tenant_id); - - --- --- Name: agenda_slots_bloqueados_semanais_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_bloqueados_semanais_tenant_owner_idx ON public.agenda_slots_bloqueados_semanais USING btree (tenant_id, owner_id); - - --- --- Name: agenda_slots_regras_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_regras_tenant_idx ON public.agenda_slots_regras USING btree (tenant_id); - - --- --- Name: agenda_slots_regras_tenant_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agenda_slots_regras_tenant_owner_idx ON public.agenda_slots_regras USING btree (tenant_id, owner_id); - - --- --- Name: agendador_cfg_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_cfg_tenant_idx ON public.agendador_configuracoes USING btree (tenant_id); - - --- --- Name: agendador_sol_data_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_data_idx ON public.agendador_solicitacoes USING btree (data_solicitada, hora_solicitada); - - --- --- Name: agendador_sol_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_owner_idx ON public.agendador_solicitacoes USING btree (owner_id, status); - - --- --- Name: agendador_sol_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX agendador_sol_tenant_idx ON public.agendador_solicitacoes USING btree (tenant_id); - - --- --- Name: billing_contracts_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX billing_contracts_owner_idx ON public.billing_contracts USING btree (owner_id); - - --- --- Name: billing_contracts_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX billing_contracts_patient_idx ON public.billing_contracts USING btree (patient_id); - - --- --- Name: billing_contracts_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX billing_contracts_tenant_idx ON public.billing_contracts USING btree (tenant_id); - - --- --- Name: commitment_services_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_services_commitment_idx ON public.commitment_services USING btree (commitment_id); - - --- --- Name: commitment_services_service_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_services_service_idx ON public.commitment_services USING btree (service_id); - - --- --- Name: commitment_time_logs_calendar_event_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_calendar_event_idx ON public.commitment_time_logs USING btree (calendar_event_id); - - --- --- Name: commitment_time_logs_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_commitment_idx ON public.commitment_time_logs USING btree (commitment_id, created_at DESC); - - --- --- Name: commitment_time_logs_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX commitment_time_logs_tenant_idx ON public.commitment_time_logs USING btree (tenant_id, created_at DESC); - - --- --- Name: determined_commitment_fields_commitment_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitment_fields_commitment_idx ON public.determined_commitment_fields USING btree (commitment_id, sort_order); - - --- --- Name: determined_commitment_fields_key_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX determined_commitment_fields_key_uniq ON public.determined_commitment_fields USING btree (commitment_id, key); - - --- --- Name: determined_commitment_fields_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitment_fields_tenant_idx ON public.determined_commitment_fields USING btree (tenant_id); - - --- --- Name: determined_commitments_active_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitments_active_idx ON public.determined_commitments USING btree (tenant_id, active); - - --- --- Name: determined_commitments_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX determined_commitments_tenant_idx ON public.determined_commitments USING btree (tenant_id); - - --- --- Name: determined_commitments_tenant_name_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX determined_commitments_tenant_name_uniq ON public.determined_commitments USING btree (tenant_id, lower(name)); - - --- --- Name: feriados_global_unique; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX feriados_global_unique ON public.feriados USING btree (data, nome) WHERE (tenant_id IS NULL); - - --- --- Name: financial_exceptions_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX financial_exceptions_owner_idx ON public.financial_exceptions USING btree (owner_id); - - --- --- Name: financial_exceptions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX financial_exceptions_tenant_idx ON public.financial_exceptions USING btree (tenant_id); - - --- --- Name: idx_agenda_eventos_determined_commitment_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_eventos_determined_commitment_id ON public.agenda_eventos USING btree (determined_commitment_id); - - --- --- Name: idx_agenda_excecoes_owner_data; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_excecoes_owner_data ON public.agenda_excecoes USING btree (owner_id, data); - - --- --- Name: idx_agenda_slots_regras_owner_dia; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_agenda_slots_regras_owner_dia ON public.agenda_slots_regras USING btree (owner_id, dia_semana); - - --- --- Name: idx_intakes_converted_patient_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_converted_patient_id ON public.patient_intake_requests USING btree (converted_patient_id); - - --- --- Name: idx_intakes_owner_cpf; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_cpf ON public.patient_intake_requests USING btree (owner_id, cpf); - - --- --- Name: idx_intakes_owner_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_created ON public.patient_intake_requests USING btree (owner_id, created_at DESC); - - --- --- Name: idx_intakes_owner_status_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_owner_status_created ON public.patient_intake_requests USING btree (owner_id, status, created_at DESC); - - --- --- Name: idx_intakes_status_created; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_intakes_status_created ON public.patient_intake_requests USING btree (status, created_at DESC); - - --- --- Name: idx_patient_group_patient_group_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_group_patient_group_id ON public.patient_group_patient USING btree (patient_group_id); - - --- --- Name: idx_patient_groups_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_groups_owner ON public.patient_groups USING btree (owner_id); - - --- --- Name: idx_patient_groups_owner_system_nome; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_groups_owner_system_nome ON public.patient_groups USING btree (owner_id, is_system, nome); - - --- --- Name: idx_patient_tags_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patient_tags_owner ON public.patient_tags USING btree (owner_id); - - --- --- Name: idx_patients_created_at; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_created_at ON public.patients USING btree (created_at DESC); - - --- --- Name: idx_patients_last_attended; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_last_attended ON public.patients USING btree (last_attended_at DESC); - - --- --- Name: idx_patients_owner_email_principal; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_email_principal ON public.patients USING btree (owner_id, email_principal); - - --- --- Name: idx_patients_owner_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_id ON public.patients USING btree (owner_id); - - --- --- Name: idx_patients_owner_nome; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_owner_nome ON public.patients USING btree (owner_id, nome_completo); - - --- --- Name: idx_patients_responsible_member; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_responsible_member ON public.patients USING btree (responsible_member_id); - - --- --- Name: idx_patients_status; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_status ON public.patients USING btree (status); - - --- --- Name: idx_patients_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_tenant ON public.patients USING btree (tenant_id); - - --- --- Name: idx_patients_tenant_email_norm; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_patients_tenant_email_norm ON public.patients USING btree (tenant_id, lower(TRIM(BOTH FROM email_principal))); - - --- --- Name: idx_pgp_group; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_pgp_group ON public.patient_group_patient USING btree (patient_group_id); - - --- --- Name: idx_pgp_patient; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_pgp_patient ON public.patient_group_patient USING btree (patient_id); - - --- --- Name: idx_ppt_patient; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_ppt_patient ON public.patient_patient_tag USING btree (patient_id); - - --- --- Name: idx_ppt_tag; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_ppt_tag ON public.patient_patient_tag USING btree (tag_id); - - --- --- Name: idx_slots_bloq_owner_dia; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_slots_bloq_owner_dia ON public.agenda_slots_bloqueados_semanais USING btree (owner_id, dia_semana); - - --- --- Name: idx_subscription_intents_plan_interval; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_plan_interval ON public.subscription_intents_legacy USING btree (plan_key, "interval"); - - --- --- Name: idx_subscription_intents_status; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_status ON public.subscription_intents_legacy USING btree (status); - - --- --- Name: idx_subscription_intents_user_id; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_subscription_intents_user_id ON public.subscription_intents_legacy USING btree (user_id); - - --- --- Name: idx_tenant_features_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_features_tenant ON public.tenant_features USING btree (tenant_id); - - --- --- Name: idx_tenant_invites_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_invites_tenant ON public.tenant_invites USING btree (tenant_id); - - --- --- Name: idx_tenant_invites_token; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX idx_tenant_invites_token ON public.tenant_invites USING btree (token); - - --- --- Name: insurance_plans_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX insurance_plans_owner_idx ON public.insurance_plans USING btree (owner_id); - - --- --- Name: insurance_plans_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX insurance_plans_tenant_idx ON public.insurance_plans USING btree (tenant_id); - - --- --- Name: ix_plan_prices_plan; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_prices_plan ON public.plan_prices USING btree (plan_id); - - --- --- Name: ix_plan_public_bullets_plan; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_public_bullets_plan ON public.plan_public_bullets USING btree (plan_id); - - --- --- Name: ix_plan_public_sort; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ix_plan_public_sort ON public.plan_public USING btree (sort_order); - - --- --- Name: patient_discounts_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_discounts_owner_idx ON public.patient_discounts USING btree (owner_id); - - --- --- Name: patient_discounts_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_discounts_patient_idx ON public.patient_discounts USING btree (patient_id); - - --- --- Name: patient_discounts_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_discounts_tenant_idx ON public.patient_discounts USING btree (tenant_id); - - --- --- Name: patient_group_patient_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_group_patient_tenant_idx ON public.patient_group_patient USING btree (tenant_id); - - --- --- Name: patient_groups_owner_nome_uniq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_groups_owner_nome_uniq ON public.patient_groups USING btree (owner_id, nome); - - --- --- Name: patient_groups_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_groups_tenant_idx ON public.patient_groups USING btree (tenant_id); - - --- --- Name: patient_intake_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_owner_id_idx ON public.patient_intake_requests USING btree (owner_id); - - --- --- Name: patient_intake_requests_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_requests_tenant_idx ON public.patient_intake_requests USING btree (tenant_id); - - --- --- Name: patient_intake_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_status_idx ON public.patient_intake_requests USING btree (status); - - --- --- Name: patient_intake_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_intake_token_idx ON public.patient_intake_requests USING btree (token); - - --- --- Name: patient_invites_one_active_per_owner; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_invites_one_active_per_owner ON public.patient_invites USING btree (owner_id) WHERE (active = true); - - --- --- Name: patient_invites_owner_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_owner_id_idx ON public.patient_invites USING btree (owner_id); - - --- --- Name: patient_invites_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_tenant_idx ON public.patient_invites USING btree (tenant_id); - - --- --- Name: patient_invites_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_invites_token_idx ON public.patient_invites USING btree (token); - - --- --- Name: patient_patient_tag_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_patient_tag_tenant_idx ON public.patient_patient_tag USING btree (tenant_id); - - --- --- Name: patient_tags_owner_name_uq; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX patient_tags_owner_name_uq ON public.patient_tags USING btree (owner_id, lower(nome)); - - --- --- Name: patient_tags_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX patient_tags_tenant_idx ON public.patient_tags USING btree (tenant_id); - - --- --- Name: payment_settings_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX payment_settings_tenant_id_idx ON public.payment_settings USING btree (tenant_id); - - --- --- Name: ppt_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_owner_idx ON public.patient_patient_tag USING btree (owner_id); - - --- --- Name: ppt_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_patient_idx ON public.patient_patient_tag USING btree (patient_id); - - --- --- Name: ppt_tag_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX ppt_tag_idx ON public.patient_patient_tag USING btree (tag_id); - - --- --- Name: professional_pricing_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX professional_pricing_tenant_idx ON public.professional_pricing USING btree (tenant_id); - - --- --- Name: profiles_work_description_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX profiles_work_description_idx ON public.profiles USING btree (work_description) WHERE (work_description IS NOT NULL); - - --- --- Name: recurrence_exceptions_rule_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_exceptions_rule_idx ON public.recurrence_exceptions USING btree (recurrence_id); - - --- --- Name: recurrence_exceptions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_exceptions_tenant_idx ON public.recurrence_exceptions USING btree (tenant_id); - - --- --- Name: recurrence_rule_services_rule_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rule_services_rule_idx ON public.recurrence_rule_services USING btree (rule_id); - - --- --- Name: recurrence_rule_services_service_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rule_services_service_idx ON public.recurrence_rule_services USING btree (service_id); - - --- --- Name: recurrence_rules_active_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_active_idx ON public.recurrence_rules USING btree (owner_id, status) WHERE (status = 'ativo'::text); - - --- --- Name: recurrence_rules_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_owner_idx ON public.recurrence_rules USING btree (owner_id); - - --- --- Name: recurrence_rules_patient_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_patient_idx ON public.recurrence_rules USING btree (patient_id); - - --- --- Name: recurrence_rules_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX recurrence_rules_tenant_idx ON public.recurrence_rules USING btree (tenant_id); - - --- --- Name: saas_doc_votos_doc_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_doc_votos_doc_id_idx ON public.saas_doc_votos USING btree (doc_id); - - --- --- Name: saas_doc_votos_user_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_doc_votos_user_id_idx ON public.saas_doc_votos USING btree (user_id); - - --- --- Name: saas_docs_categoria_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_categoria_idx ON public.saas_docs USING btree (categoria); - - --- --- Name: saas_docs_exibir_no_faq_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_exibir_no_faq_idx ON public.saas_docs USING btree (exibir_no_faq) WHERE (exibir_no_faq = true); - - --- --- Name: saas_docs_path_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_docs_path_ativo_idx ON public.saas_docs USING btree (pagina_path, ativo); - - --- --- Name: saas_faq_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_ativo_idx ON public.saas_faq USING btree (ativo); - - --- --- Name: saas_faq_categoria_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_categoria_idx ON public.saas_faq USING btree (categoria); - - --- --- Name: saas_faq_fts_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_fts_idx ON public.saas_faq USING gin (to_tsvector('portuguese'::regconfig, ((COALESCE(pergunta, ''::text) || ' '::text) || COALESCE(conteudo, ''::text)))); - - --- --- Name: saas_faq_itens_ativo_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_itens_ativo_idx ON public.saas_faq_itens USING btree (ativo); - - --- --- Name: saas_faq_itens_doc_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_itens_doc_id_idx ON public.saas_faq_itens USING btree (doc_id); - - --- --- Name: saas_faq_pagina_path_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_pagina_path_idx ON public.saas_faq USING btree (pagina_path); - - --- --- Name: saas_faq_publico_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_publico_idx ON public.saas_faq USING btree (publico); - - --- --- Name: saas_faq_votos_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX saas_faq_votos_idx ON public.saas_faq USING btree (votos DESC); - - --- --- Name: services_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX services_owner_idx ON public.services USING btree (owner_id); - - --- --- Name: services_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX services_tenant_idx ON public.services USING btree (tenant_id); - - --- --- Name: sint_personal_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_personal_created_idx ON public.subscription_intents_personal USING btree (created_at DESC); - - --- --- Name: sint_personal_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_personal_status_idx ON public.subscription_intents_personal USING btree (status); - - --- --- Name: sint_tenant_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_created_idx ON public.subscription_intents_tenant USING btree (created_at DESC); - - --- --- Name: sint_tenant_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_status_idx ON public.subscription_intents_tenant USING btree (status); - - --- --- Name: sint_tenant_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX sint_tenant_tenant_idx ON public.subscription_intents_tenant USING btree (tenant_id); - - --- --- Name: subscription_events_created_at_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_created_at_idx ON public.subscription_events USING btree (created_at DESC); - - --- --- Name: subscription_events_owner_ref_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_owner_ref_idx ON public.subscription_events USING btree (owner_type, owner_ref); - - --- --- Name: subscription_events_sub_created_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_sub_created_idx ON public.subscription_events USING btree (subscription_id, created_at DESC); - - --- --- Name: subscription_events_subscription_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscription_events_subscription_id_idx ON public.subscription_events USING btree (subscription_id); - - --- --- Name: subscriptions_one_active_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_tenant ON public.subscriptions USING btree (tenant_id) WHERE (status = 'active'::text); - - --- --- Name: subscriptions_one_active_per_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_user ON public.subscriptions USING btree (user_id) WHERE (status = 'active'::text); - - --- --- Name: subscriptions_one_active_per_user_personal; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscriptions_one_active_per_user_personal ON public.subscriptions USING btree (user_id) WHERE ((tenant_id IS NULL) AND (status = 'active'::text)); - - --- --- Name: subscriptions_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_owner_idx ON public.subscriptions USING btree (user_id); - - --- --- Name: subscriptions_plan_key_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_plan_key_idx ON public.subscriptions USING btree (plan_key); - - --- --- Name: subscriptions_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_status_idx ON public.subscriptions USING btree (status); - - --- --- Name: subscriptions_tenant_id_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_id_idx ON public.subscriptions USING btree (tenant_id); - - --- --- Name: subscriptions_tenant_period_end_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_period_end_idx ON public.subscriptions USING btree (tenant_id, current_period_end); - - --- --- Name: subscriptions_tenant_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_tenant_status_idx ON public.subscriptions USING btree (tenant_id, status); - - --- --- Name: subscriptions_user_status_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX subscriptions_user_status_idx ON public.subscriptions USING btree (user_id, status, created_at DESC); - - --- --- Name: support_sessions_expires_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_expires_idx ON public.support_sessions USING btree (expires_at); - - --- --- Name: support_sessions_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_tenant_idx ON public.support_sessions USING btree (tenant_id); - - --- --- Name: support_sessions_token_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX support_sessions_token_idx ON public.support_sessions USING btree (token); - - --- --- Name: tenant_members_tenant_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_members_tenant_idx ON public.tenant_members USING btree (tenant_id); - - --- --- Name: tenant_members_user_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_members_user_idx ON public.tenant_members USING btree (user_id); - - --- --- Name: tenant_modules_owner_idx; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE INDEX tenant_modules_owner_idx ON public.tenant_modules USING btree (owner_id); - - --- --- Name: unique_member_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX unique_member_per_tenant ON public.tenant_members USING btree (tenant_id, user_id); - - --- --- Name: uq_patients_tenant_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_patients_tenant_user ON public.patients USING btree (tenant_id, user_id) WHERE (user_id IS NOT NULL); - - --- --- Name: uq_plan_price_active; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_plan_price_active ON public.plan_prices USING btree (plan_id, "interval", currency) WHERE ((is_active = true) AND (active_to IS NULL)); - - --- --- Name: uq_plan_prices_active; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_plan_prices_active ON public.plan_prices USING btree (plan_id, "interval") WHERE (is_active = true); - - --- --- Name: uq_subscriptions_active_by_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_subscriptions_active_by_tenant ON public.subscriptions USING btree (tenant_id) WHERE ((tenant_id IS NOT NULL) AND (status = 'active'::text)); - - --- --- Name: uq_subscriptions_active_personal_by_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_subscriptions_active_personal_by_user ON public.subscriptions USING btree (user_id) WHERE ((tenant_id IS NULL) AND (status = 'active'::text)); - - --- --- Name: uq_tenant_invites_pending; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_tenant_invites_pending ON public.tenant_invites USING btree (tenant_id, lower(email), role) WHERE ((accepted_at IS NULL) AND (revoked_at IS NULL)); - - --- --- Name: uq_tenant_members_tenant_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX uq_tenant_members_tenant_user ON public.tenant_members USING btree (tenant_id, user_id); - - --- --- Name: ux_subscriptions_active_per_personal_user; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX ux_subscriptions_active_per_personal_user ON public.subscriptions USING btree (user_id) WHERE ((status = 'active'::text) AND (tenant_id IS NULL)); - - --- --- Name: ux_subscriptions_active_per_tenant; Type: INDEX; Schema: public; Owner: supabase_admin --- - -CREATE UNIQUE INDEX ux_subscriptions_active_per_tenant ON public.subscriptions USING btree (tenant_id) WHERE ((status = 'active'::text) AND (tenant_id IS NOT NULL)); - - --- --- Name: ix_realtime_subscription_entity; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX ix_realtime_subscription_entity ON realtime.subscription USING btree (entity); - - --- --- Name: messages_inserted_at_topic_index; Type: INDEX; Schema: realtime; Owner: supabase_realtime_admin --- - -CREATE INDEX messages_inserted_at_topic_index ON ONLY realtime.messages USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_12_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_12_inserted_at_topic_idx ON realtime.messages_2026_03_12 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_13_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_13_inserted_at_topic_idx ON realtime.messages_2026_03_13 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_14_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_14_inserted_at_topic_idx ON realtime.messages_2026_03_14 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_15_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_15_inserted_at_topic_idx ON realtime.messages_2026_03_15 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_16_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_16_inserted_at_topic_idx ON realtime.messages_2026_03_16 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_17_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_17_inserted_at_topic_idx ON realtime.messages_2026_03_17 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: messages_2026_03_18_inserted_at_topic_idx; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE INDEX messages_2026_03_18_inserted_at_topic_idx ON realtime.messages_2026_03_18 USING btree (inserted_at DESC, topic) WHERE ((extension = 'broadcast'::text) AND (private IS TRUE)); - - --- --- Name: subscription_subscription_id_entity_filters_key; Type: INDEX; Schema: realtime; Owner: supabase_admin --- - -CREATE UNIQUE INDEX subscription_subscription_id_entity_filters_key ON realtime.subscription USING btree (subscription_id, entity, filters); - - --- --- Name: bname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bname ON storage.buckets USING btree (name); - - --- --- Name: bucketid_objname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bucketid_objname ON storage.objects USING btree (bucket_id, name); - - --- --- Name: buckets_analytics_unique_name_idx; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX buckets_analytics_unique_name_idx ON storage.buckets_analytics USING btree (name) WHERE (deleted_at IS NULL); - - --- --- Name: idx_iceberg_namespaces_bucket_id; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_namespaces_bucket_id ON storage.iceberg_namespaces USING btree (catalog_id, name); - - --- --- Name: idx_iceberg_tables_location; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_tables_location ON storage.iceberg_tables USING btree (location); - - --- --- Name: idx_iceberg_tables_namespace_id; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX idx_iceberg_tables_namespace_id ON storage.iceberg_tables USING btree (catalog_id, namespace_id, name); - - --- --- Name: idx_multipart_uploads_list; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_multipart_uploads_list ON storage.s3_multipart_uploads USING btree (bucket_id, key, created_at); - - --- --- Name: idx_objects_bucket_id_name; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_objects_bucket_id_name ON storage.objects USING btree (bucket_id, name COLLATE "C"); - - --- --- Name: idx_objects_bucket_id_name_lower; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX idx_objects_bucket_id_name_lower ON storage.objects USING btree (bucket_id, lower(name) COLLATE "C"); - - --- --- Name: name_prefix_search; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX name_prefix_search ON storage.objects USING btree (name text_pattern_ops); - - --- --- Name: vector_indexes_name_bucket_id_idx; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX vector_indexes_name_bucket_id_idx ON storage.vector_indexes USING btree (name, bucket_id); - - --- --- Name: supabase_functions_hooks_h_table_id_h_name_idx; Type: INDEX; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE INDEX supabase_functions_hooks_h_table_id_h_name_idx ON supabase_functions.hooks USING btree (hook_table_id, hook_name); - - --- --- Name: supabase_functions_hooks_request_id_idx; Type: INDEX; Schema: supabase_functions; Owner: supabase_functions_admin --- - -CREATE INDEX supabase_functions_hooks_request_id_idx ON supabase_functions.hooks USING btree (request_id); - - --- --- Name: messages_2026_03_12_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_12_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_12_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_12_pkey; - - --- --- Name: messages_2026_03_13_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_13_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_13_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_13_pkey; - - --- --- Name: messages_2026_03_14_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_14_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_14_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_14_pkey; - - --- --- Name: messages_2026_03_15_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_15_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_15_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_15_pkey; - - --- --- Name: messages_2026_03_16_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_16_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_16_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_16_pkey; - - --- --- Name: messages_2026_03_17_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_17_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_17_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_17_pkey; - - --- --- Name: messages_2026_03_18_inserted_at_topic_idx; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_inserted_at_topic_index ATTACH PARTITION realtime.messages_2026_03_18_inserted_at_topic_idx; - - --- --- Name: messages_2026_03_18_pkey; Type: INDEX ATTACH; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER INDEX realtime.messages_pkey ATTACH PARTITION realtime.messages_2026_03_18_pkey; - - --- --- Name: users on_auth_user_created; Type: TRIGGER; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.handle_new_user(); - - --- --- Name: users trg_seed_patient_groups; Type: TRIGGER; Schema: auth; Owner: supabase_auth_admin --- - -CREATE TRIGGER trg_seed_patient_groups AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.on_new_user_seed_patient_groups(); - - --- --- Name: agenda_bloqueios agenda_bloqueios_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER agenda_bloqueios_updated_at BEFORE UPDATE ON public.agenda_bloqueios FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agendador_configuracoes agendador_slug_trigger; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER agendador_slug_trigger BEFORE INSERT OR UPDATE ON public.agendador_configuracoes FOR EACH ROW EXECUTE FUNCTION public.agendador_gerar_slug(); - - --- --- Name: tenant_members prevent_saas_membership_trigger; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER prevent_saas_membership_trigger BEFORE INSERT ON public.tenant_members FOR EACH ROW EXECUTE FUNCTION public.prevent_saas_membership(); - - --- --- Name: insurance_plan_services set_insurance_plan_services_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER set_insurance_plan_services_updated_at BEFORE UPDATE ON public.insurance_plan_services FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: user_settings t_user_settings_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER t_user_settings_set_updated_at BEFORE UPDATE ON public.user_settings FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_configuracoes tg_agenda_configuracoes_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_configuracoes_updated_at BEFORE UPDATE ON public.agenda_configuracoes FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_eventos tg_agenda_eventos_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_eventos_updated_at BEFORE UPDATE ON public.agenda_eventos FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_excecoes tg_agenda_excecoes_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_excecoes_updated_at BEFORE UPDATE ON public.agenda_excecoes FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: agenda_regras_semanais tg_agenda_regras_semanais_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_agenda_regras_semanais_updated_at BEFORE UPDATE ON public.agenda_regras_semanais FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: recurrence_rules tg_recurrence_rules_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tg_recurrence_rules_updated_at BEFORE UPDATE ON public.recurrence_rules FOR EACH ROW EXECUTE FUNCTION public.set_updated_at_recurrence(); - - --- --- Name: plan_public tr_plan_public_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER tr_plan_public_updated_at BEFORE UPDATE ON public.plan_public FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: profiles trg_account_type_immutable; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_account_type_immutable BEFORE UPDATE OF account_type ON public.profiles FOR EACH ROW EXECUTE FUNCTION public.guard_account_type_immutable(); - - --- --- Name: agenda_configuracoes trg_agenda_cfg_sync; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_cfg_sync BEFORE INSERT OR UPDATE ON public.agenda_configuracoes FOR EACH ROW EXECUTE FUNCTION public.agenda_cfg_sync(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_del; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_del AFTER DELETE ON public.agenda_eventos FOR EACH ROW WHEN (((old.mirror_of_event_id IS NULL) AND (old.tenant_id = old.owner_id))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_ins; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_ins AFTER INSERT ON public.agenda_eventos FOR EACH ROW WHEN (((new.mirror_of_event_id IS NULL) AND (new.tenant_id = new.owner_id) AND (new.visibility_scope = ANY (ARRAY['busy_only'::text, 'private'::text])))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_eventos trg_agenda_eventos_busy_mirror_upd; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_eventos_busy_mirror_upd AFTER UPDATE ON public.agenda_eventos FOR EACH ROW WHEN (((new.mirror_of_event_id IS NULL) AND (new.tenant_id = new.owner_id) AND ((new.visibility_scope IS DISTINCT FROM old.visibility_scope) OR (new.inicio_em IS DISTINCT FROM old.inicio_em) OR (new.fim_em IS DISTINCT FROM old.fim_em) OR (new.owner_id IS DISTINCT FROM old.owner_id) OR (new.tenant_id IS DISTINCT FROM old.tenant_id)))) EXECUTE FUNCTION public.sync_busy_mirror_agenda_eventos(); - - --- --- Name: agenda_regras_semanais trg_agenda_regras_semanais_no_overlap; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_agenda_regras_semanais_no_overlap BEFORE INSERT OR UPDATE ON public.agenda_regras_semanais FOR EACH ROW EXECUTE FUNCTION public.fn_agenda_regras_semanais_no_overlap(); - - --- --- Name: determined_commitment_fields trg_determined_commitment_fields_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_determined_commitment_fields_updated_at BEFORE UPDATE ON public.determined_commitment_fields FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: determined_commitments trg_determined_commitments_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_determined_commitments_updated_at BEFORE UPDATE ON public.determined_commitments FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: financial_exceptions trg_financial_exceptions_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_financial_exceptions_updated_at BEFORE UPDATE ON public.financial_exceptions FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: insurance_plans trg_insurance_plans_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_insurance_plans_updated_at BEFORE UPDATE ON public.insurance_plans FOR EACH ROW EXECUTE FUNCTION public.set_insurance_plans_updated_at(); - - --- --- Name: plans trg_no_change_core_plan_key; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_change_core_plan_key BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_change_core_plan_key(); - - --- --- Name: plans trg_no_change_plan_target; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_change_plan_target BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_change_plan_target(); - - --- --- Name: plans trg_no_delete_core_plans; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_no_delete_core_plans BEFORE DELETE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.guard_no_delete_core_plans(); - - --- --- Name: tenant_members trg_patient_cannot_own_tenant; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_cannot_own_tenant BEFORE INSERT OR UPDATE ON public.tenant_members FOR EACH ROW EXECUTE FUNCTION public.guard_patient_cannot_own_tenant(); - - --- --- Name: patient_groups trg_patient_groups_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_groups_set_updated_at BEFORE UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patient_intake_requests trg_patient_intake_requests_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_intake_requests_updated_at BEFORE UPDATE ON public.patient_intake_requests FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patient_tags trg_patient_tags_set_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patient_tags_set_updated_at BEFORE UPDATE ON public.patient_tags FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patients trg_patients_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patients_updated_at BEFORE UPDATE ON public.patients FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: patients trg_patients_validate_members; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_patients_validate_members BEFORE INSERT OR UPDATE OF tenant_id, responsible_member_id, patient_scope, therapist_member_id ON public.patients FOR EACH ROW EXECUTE FUNCTION public.patients_validate_member_consistency(); - - --- --- Name: payment_settings trg_payment_settings_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_payment_settings_updated_at BEFORE UPDATE ON public.payment_settings FOR EACH ROW EXECUTE FUNCTION public.update_payment_settings_updated_at(); - - --- --- Name: patient_groups trg_prevent_promoting_to_system; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_prevent_promoting_to_system BEFORE UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.prevent_promoting_to_system(); - - --- --- Name: patient_groups trg_prevent_system_group_changes; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_prevent_system_group_changes BEFORE DELETE OR UPDATE ON public.patient_groups FOR EACH ROW EXECUTE FUNCTION public.prevent_system_group_changes(); - - --- --- Name: professional_pricing trg_professional_pricing_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_professional_pricing_updated_at BEFORE UPDATE ON public.professional_pricing FOR EACH ROW EXECUTE FUNCTION public.update_professional_pricing_updated_at(); - - --- --- Name: profiles trg_profiles_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_profiles_updated_at BEFORE UPDATE ON public.profiles FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: services trg_services_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_services_updated_at BEFORE UPDATE ON public.services FOR EACH ROW EXECUTE FUNCTION public.set_services_updated_at(); - - --- --- Name: subscription_intents trg_subscription_intents_view_insert; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_subscription_intents_view_insert INSTEAD OF INSERT ON public.subscription_intents FOR EACH ROW EXECUTE FUNCTION public.subscription_intents_view_insert(); - - --- --- Name: subscriptions trg_subscriptions_validate_scope; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_subscriptions_validate_scope BEFORE INSERT OR UPDATE ON public.subscriptions FOR EACH ROW EXECUTE FUNCTION public.subscriptions_validate_scope(); - - --- --- Name: tenant_features trg_tenant_features_guard_with_plan; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_features_guard_with_plan BEFORE INSERT OR UPDATE ON public.tenant_features FOR EACH ROW EXECUTE FUNCTION public.tenant_features_guard_with_plan(); - - --- --- Name: tenant_features trg_tenant_features_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_features_updated_at BEFORE UPDATE ON public.tenant_features FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: tenants trg_tenant_kind_immutable; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_tenant_kind_immutable BEFORE UPDATE OF kind ON public.tenants FOR EACH ROW EXECUTE FUNCTION public.guard_tenant_kind_immutable(); - - --- --- Name: user_settings trg_user_settings_updated_at; Type: TRIGGER; Schema: public; Owner: supabase_admin --- - -CREATE TRIGGER trg_user_settings_updated_at BEFORE UPDATE ON public.user_settings FOR EACH ROW EXECUTE FUNCTION public.set_updated_at(); - - --- --- Name: subscription tr_check_filters; Type: TRIGGER; Schema: realtime; Owner: supabase_admin --- - -CREATE TRIGGER tr_check_filters BEFORE INSERT OR UPDATE ON realtime.subscription FOR EACH ROW EXECUTE FUNCTION realtime.subscription_check_filters(); - - --- --- Name: buckets enforce_bucket_name_length_trigger; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER enforce_bucket_name_length_trigger BEFORE INSERT OR UPDATE OF name ON storage.buckets FOR EACH ROW EXECUTE FUNCTION storage.enforce_bucket_name_length(); - - --- --- Name: buckets protect_buckets_delete; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER protect_buckets_delete BEFORE DELETE ON storage.buckets FOR EACH STATEMENT EXECUTE FUNCTION storage.protect_delete(); - - --- --- Name: objects protect_objects_delete; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER protect_objects_delete BEFORE DELETE ON storage.objects FOR EACH STATEMENT EXECUTE FUNCTION storage.protect_delete(); - - --- --- Name: objects update_objects_updated_at; Type: TRIGGER; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TRIGGER update_objects_updated_at BEFORE UPDATE ON storage.objects FOR EACH ROW EXECUTE FUNCTION storage.update_updated_at_column(); - - --- --- Name: extensions extensions_tenant_external_id_fkey; Type: FK CONSTRAINT; Schema: _realtime; Owner: supabase_admin --- - -ALTER TABLE ONLY _realtime.extensions - ADD CONSTRAINT extensions_tenant_external_id_fkey FOREIGN KEY (tenant_external_id) REFERENCES _realtime.tenants(external_id) ON DELETE CASCADE; - - --- --- Name: identities identities_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.identities - ADD CONSTRAINT identities_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: mfa_amr_claims mfa_amr_claims_session_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_amr_claims - ADD CONSTRAINT mfa_amr_claims_session_id_fkey FOREIGN KEY (session_id) REFERENCES auth.sessions(id) ON DELETE CASCADE; - - --- --- Name: mfa_challenges mfa_challenges_auth_factor_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_challenges - ADD CONSTRAINT mfa_challenges_auth_factor_id_fkey FOREIGN KEY (factor_id) REFERENCES auth.mfa_factors(id) ON DELETE CASCADE; - - --- --- Name: mfa_factors mfa_factors_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.mfa_factors - ADD CONSTRAINT mfa_factors_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: oauth_authorizations oauth_authorizations_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_client_id_fkey FOREIGN KEY (client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: oauth_authorizations oauth_authorizations_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_authorizations - ADD CONSTRAINT oauth_authorizations_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: oauth_consents oauth_consents_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_client_id_fkey FOREIGN KEY (client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: oauth_consents oauth_consents_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.oauth_consents - ADD CONSTRAINT oauth_consents_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: one_time_tokens one_time_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.one_time_tokens - ADD CONSTRAINT one_time_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: refresh_tokens refresh_tokens_session_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_session_id_fkey FOREIGN KEY (session_id) REFERENCES auth.sessions(id) ON DELETE CASCADE; - - --- --- Name: saml_providers saml_providers_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_providers - ADD CONSTRAINT saml_providers_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: saml_relay_states saml_relay_states_flow_state_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_flow_state_id_fkey FOREIGN KEY (flow_state_id) REFERENCES auth.flow_state(id) ON DELETE CASCADE; - - --- --- Name: saml_relay_states saml_relay_states_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.saml_relay_states - ADD CONSTRAINT saml_relay_states_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: sessions sessions_oauth_client_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_oauth_client_id_fkey FOREIGN KEY (oauth_client_id) REFERENCES auth.oauth_clients(id) ON DELETE CASCADE; - - --- --- Name: sessions sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sessions - ADD CONSTRAINT sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: sso_domains sso_domains_sso_provider_id_fkey; Type: FK CONSTRAINT; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE ONLY auth.sso_domains - ADD CONSTRAINT sso_domains_sso_provider_id_fkey FOREIGN KEY (sso_provider_id) REFERENCES auth.sso_providers(id) ON DELETE CASCADE; - - --- --- Name: agenda_bloqueios agenda_bloqueios_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agenda_bloqueios agenda_bloqueios_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_bloqueios - ADD CONSTRAINT agenda_bloqueios_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE SET NULL; - - --- --- Name: agenda_configuracoes agenda_configuracoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_configuracoes - ADD CONSTRAINT agenda_configuracoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_eventos agenda_eventos_billing_contract_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_billing_contract_id_fkey FOREIGN KEY (billing_contract_id) REFERENCES public.billing_contracts(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_determined_commitment_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_determined_commitment_fk FOREIGN KEY (determined_commitment_id) REFERENCES public.determined_commitments(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_insurance_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_insurance_plan_id_fkey FOREIGN KEY (insurance_plan_id) REFERENCES public.insurance_plans(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_insurance_plan_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_insurance_plan_service_id_fkey FOREIGN KEY (insurance_plan_service_id) REFERENCES public.insurance_plan_services(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.recurrence_rules(id) ON DELETE SET NULL; - - --- --- Name: agenda_eventos agenda_eventos_terapeuta_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_eventos - ADD CONSTRAINT agenda_eventos_terapeuta_fk FOREIGN KEY (terapeuta_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: agenda_excecoes agenda_excecoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_excecoes - ADD CONSTRAINT agenda_excecoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_online_slots agenda_online_slots_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agenda_online_slots agenda_online_slots_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_online_slots - ADD CONSTRAINT agenda_online_slots_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_regras_semanais - ADD CONSTRAINT agenda_regras_semanais_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_bloqueados_semanais - ADD CONSTRAINT agenda_slots_bloqueados_semanais_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agenda_slots_regras agenda_slots_regras_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agenda_slots_regras - ADD CONSTRAINT agenda_slots_regras_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agendador_configuracoes agendador_configuracoes_owner_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_owner_fk FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agendador_configuracoes agendador_configuracoes_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_configuracoes - ADD CONSTRAINT agendador_configuracoes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: agendador_solicitacoes agendador_sol_owner_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_sol_owner_fk FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: agendador_solicitacoes agendador_sol_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.agendador_solicitacoes - ADD CONSTRAINT agendador_sol_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: billing_contracts billing_contracts_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.billing_contracts - ADD CONSTRAINT billing_contracts_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: billing_contracts billing_contracts_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.billing_contracts - ADD CONSTRAINT billing_contracts_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: commitment_services commitment_services_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_services - ADD CONSTRAINT commitment_services_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.agenda_eventos(id) ON DELETE CASCADE; - - --- --- Name: commitment_services commitment_services_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_services - ADD CONSTRAINT commitment_services_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE RESTRICT; - - --- --- Name: commitment_time_logs commitment_time_logs_calendar_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_calendar_event_id_fkey FOREIGN KEY (calendar_event_id) REFERENCES public.agenda_eventos(id) ON DELETE SET NULL; - - --- --- Name: commitment_time_logs commitment_time_logs_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.determined_commitments(id) ON DELETE CASCADE; - - --- --- Name: commitment_time_logs commitment_time_logs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.commitment_time_logs - ADD CONSTRAINT commitment_time_logs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: determined_commitment_fields determined_commitment_fields_commitment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_commitment_id_fkey FOREIGN KEY (commitment_id) REFERENCES public.determined_commitments(id) ON DELETE CASCADE; - - --- --- Name: determined_commitment_fields determined_commitment_fields_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitment_fields - ADD CONSTRAINT determined_commitment_fields_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: determined_commitments determined_commitments_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.determined_commitments - ADD CONSTRAINT determined_commitments_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: feriados feriados_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: feriados feriados_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.feriados - ADD CONSTRAINT feriados_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: financial_exceptions financial_exceptions_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.financial_exceptions - ADD CONSTRAINT financial_exceptions_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: insurance_plan_services insurance_plan_services_plan_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plan_services - ADD CONSTRAINT insurance_plan_services_plan_fkey FOREIGN KEY (insurance_plan_id) REFERENCES public.insurance_plans(id) ON DELETE CASCADE; - - --- --- Name: insurance_plans insurance_plans_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.insurance_plans - ADD CONSTRAINT insurance_plans_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: module_features module_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.features(id) ON DELETE CASCADE; - - --- --- Name: module_features module_features_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.module_features - ADD CONSTRAINT module_features_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.modules(id) ON DELETE CASCADE; - - --- --- Name: patient_discounts patient_discounts_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_discounts - ADD CONSTRAINT patient_discounts_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: patient_discounts patient_discounts_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_discounts - ADD CONSTRAINT patient_discounts_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_group_patient patient_group_patient_patient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_patient_id_fkey FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_group_patient patient_group_patient_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_group_patient - ADD CONSTRAINT patient_group_patient_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_groups patient_groups_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_groups - ADD CONSTRAINT patient_groups_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_intake_requests patient_intake_requests_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_intake_requests - ADD CONSTRAINT patient_intake_requests_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_invites patient_invites_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_invites - ADD CONSTRAINT patient_invites_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag patient_patient_tag_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.patient_tags(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag patient_patient_tag_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT patient_patient_tag_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patient_tags patient_tags_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_tags - ADD CONSTRAINT patient_tags_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patients patients_responsible_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_responsible_member_id_fkey FOREIGN KEY (responsible_member_id) REFERENCES public.tenant_members(id) ON DELETE RESTRICT; - - --- --- Name: patients patients_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: patients patients_therapist_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_therapist_member_id_fkey FOREIGN KEY (therapist_member_id) REFERENCES public.tenant_members(id); - - --- --- Name: patients patients_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patients - ADD CONSTRAINT patients_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: payment_settings payment_settings_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: payment_settings payment_settings_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.payment_settings - ADD CONSTRAINT payment_settings_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: plan_features plan_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.features(id) ON DELETE CASCADE; - - --- --- Name: plan_features plan_features_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_features - ADD CONSTRAINT plan_features_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_prices plan_prices_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_prices - ADD CONSTRAINT plan_prices_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_public_bullets plan_public_bullets_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public_bullets - ADD CONSTRAINT plan_public_bullets_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: plan_public plan_public_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.plan_public - ADD CONSTRAINT plan_public_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag ppt_patient_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT ppt_patient_fk FOREIGN KEY (patient_id) REFERENCES public.patients(id) ON DELETE CASCADE; - - --- --- Name: patient_patient_tag ppt_tag_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.patient_patient_tag - ADD CONSTRAINT ppt_tag_fk FOREIGN KEY (tag_id) REFERENCES public.patient_tags(id) ON DELETE CASCADE; - - --- --- Name: professional_pricing professional_pricing_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.professional_pricing - ADD CONSTRAINT professional_pricing_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: profiles profiles_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.profiles - ADD CONSTRAINT profiles_id_fkey FOREIGN KEY (id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: recurrence_exceptions recurrence_exceptions_agenda_evento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_agenda_evento_id_fkey FOREIGN KEY (agenda_evento_id) REFERENCES public.agenda_eventos(id) ON DELETE SET NULL; - - --- --- Name: recurrence_exceptions recurrence_exceptions_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_exceptions - ADD CONSTRAINT recurrence_exceptions_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.recurrence_rules(id) ON DELETE CASCADE; - - --- --- Name: recurrence_rule_services recurrence_rule_services_rule_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rule_services - ADD CONSTRAINT recurrence_rule_services_rule_id_fkey FOREIGN KEY (rule_id) REFERENCES public.recurrence_rules(id) ON DELETE CASCADE; - - --- --- Name: recurrence_rule_services recurrence_rule_services_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rule_services - ADD CONSTRAINT recurrence_rule_services_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE RESTRICT; - - --- --- Name: recurrence_rules recurrence_rules_insurance_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_insurance_plan_id_fkey FOREIGN KEY (insurance_plan_id) REFERENCES public.insurance_plans(id) ON DELETE SET NULL; - - --- --- Name: recurrence_rules recurrence_rules_insurance_plan_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.recurrence_rules - ADD CONSTRAINT recurrence_rules_insurance_plan_service_id_fkey FOREIGN KEY (insurance_plan_service_id) REFERENCES public.insurance_plan_services(id) ON DELETE SET NULL; - - --- --- Name: saas_admins saas_admins_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_admins - ADD CONSTRAINT saas_admins_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: saas_doc_votos saas_doc_votos_doc_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_doc_id_fkey FOREIGN KEY (doc_id) REFERENCES public.saas_docs(id) ON DELETE CASCADE; - - --- --- Name: saas_doc_votos saas_doc_votos_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_doc_votos - ADD CONSTRAINT saas_doc_votos_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: saas_faq_itens saas_faq_itens_doc_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.saas_faq_itens - ADD CONSTRAINT saas_faq_itens_doc_id_fkey FOREIGN KEY (doc_id) REFERENCES public.saas_docs(id) ON DELETE CASCADE; - - --- --- Name: services services_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.services - ADD CONSTRAINT services_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: subscription_intents_personal sint_personal_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT sint_personal_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE SET NULL; - - --- --- Name: subscription_intents_tenant sint_tenant_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT sint_tenant_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE SET NULL; - - --- --- Name: subscription_events subscription_events_subscription_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_events - ADD CONSTRAINT subscription_events_subscription_id_fkey FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id) ON DELETE CASCADE; - - --- --- Name: subscription_intents_personal subscription_intents_personal_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_personal - ADD CONSTRAINT subscription_intents_personal_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: subscription_intents_tenant subscription_intents_tenant_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_tenant - ADD CONSTRAINT subscription_intents_tenant_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: subscription_intents_legacy subscription_intents_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscription_intents_legacy - ADD CONSTRAINT subscription_intents_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: subscriptions subscriptions_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_owner_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: subscriptions subscriptions_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.subscriptions - ADD CONSTRAINT subscriptions_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE RESTRICT; - - --- --- Name: support_sessions support_sessions_admin_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_admin_fk FOREIGN KEY (admin_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: support_sessions support_sessions_tenant_fk; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.support_sessions - ADD CONSTRAINT support_sessions_tenant_fk FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_features tenant_features_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_features - ADD CONSTRAINT tenant_features_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_invites tenant_invites_accepted_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_accepted_by_fkey FOREIGN KEY (accepted_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_invited_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_invited_by_fkey FOREIGN KEY (invited_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_revoked_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_revoked_by_fkey FOREIGN KEY (revoked_by) REFERENCES auth.users(id) ON DELETE SET NULL; - - --- --- Name: tenant_invites tenant_invites_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_invites - ADD CONSTRAINT tenant_invites_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_members tenant_members_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON DELETE CASCADE; - - --- --- Name: tenant_members tenant_members_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_members - ADD CONSTRAINT tenant_members_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: tenant_modules tenant_modules_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.modules(id) ON DELETE CASCADE; - - --- --- Name: tenant_modules tenant_modules_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.tenant_modules - ADD CONSTRAINT tenant_modules_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: user_settings user_settings_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.user_settings - ADD CONSTRAINT user_settings_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE; - - --- --- Name: iceberg_namespaces iceberg_namespaces_catalog_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_namespaces - ADD CONSTRAINT iceberg_namespaces_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES storage.buckets_analytics(id) ON DELETE CASCADE; - - --- --- Name: iceberg_tables iceberg_tables_catalog_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES storage.buckets_analytics(id) ON DELETE CASCADE; - - --- --- Name: iceberg_tables iceberg_tables_namespace_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.iceberg_tables - ADD CONSTRAINT iceberg_tables_namespace_id_fkey FOREIGN KEY (namespace_id) REFERENCES storage.iceberg_namespaces(id) ON DELETE CASCADE; - - --- --- Name: objects objects_bucketId_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT "objects_bucketId_fkey" FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads s3_multipart_uploads_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads - ADD CONSTRAINT s3_multipart_uploads_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: s3_multipart_uploads_parts s3_multipart_uploads_parts_upload_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.s3_multipart_uploads_parts - ADD CONSTRAINT s3_multipart_uploads_parts_upload_id_fkey FOREIGN KEY (upload_id) REFERENCES storage.s3_multipart_uploads(id) ON DELETE CASCADE; - - --- --- Name: vector_indexes vector_indexes_bucket_id_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.vector_indexes - ADD CONSTRAINT vector_indexes_bucket_id_fkey FOREIGN KEY (bucket_id) REFERENCES storage.buckets_vectors(id); - - --- --- Name: audit_log_entries; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.audit_log_entries ENABLE ROW LEVEL SECURITY; - --- --- Name: flow_state; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.flow_state ENABLE ROW LEVEL SECURITY; - --- --- Name: identities; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.identities ENABLE ROW LEVEL SECURITY; - --- --- Name: instances; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.instances ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_amr_claims; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_amr_claims ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_challenges; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_challenges ENABLE ROW LEVEL SECURITY; - --- --- Name: mfa_factors; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.mfa_factors ENABLE ROW LEVEL SECURITY; - --- --- Name: one_time_tokens; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.one_time_tokens ENABLE ROW LEVEL SECURITY; - --- --- Name: refresh_tokens; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.refresh_tokens ENABLE ROW LEVEL SECURITY; - --- --- Name: saml_providers; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.saml_providers ENABLE ROW LEVEL SECURITY; - --- --- Name: saml_relay_states; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.saml_relay_states ENABLE ROW LEVEL SECURITY; - --- --- Name: schema_migrations; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.schema_migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: sessions; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sessions ENABLE ROW LEVEL SECURITY; - --- --- Name: sso_domains; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sso_domains ENABLE ROW LEVEL SECURITY; - --- --- Name: sso_providers; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.sso_providers ENABLE ROW LEVEL SECURITY; - --- --- Name: users; Type: ROW SECURITY; Schema: auth; Owner: supabase_auth_admin --- - -ALTER TABLE auth.users ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_bloqueios ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_configuracoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_configuracoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_configuracoes agenda_configuracoes_clinic_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_clinic_read ON public.agenda_configuracoes FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_configuracoes agenda_configuracoes_clinic_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_clinic_write ON public.agenda_configuracoes USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_configuracoes agenda_configuracoes_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_configuracoes_owner ON public.agenda_configuracoes USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_eventos; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_eventos ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_eventos agenda_eventos_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_delete ON public.agenda_eventos FOR DELETE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.delete'::text))); - - --- --- Name: agenda_eventos agenda_eventos_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_insert ON public.agenda_eventos FOR INSERT WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.create'::text))); - - --- --- Name: agenda_eventos agenda_eventos_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_owner_all ON public.agenda_eventos TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_eventos agenda_eventos_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_select ON public.agenda_eventos FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_eventos agenda_eventos_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_eventos_update ON public.agenda_eventos FOR UPDATE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_excecoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_excecoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_excecoes agenda_excecoes_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_owner ON public.agenda_excecoes USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_excecoes agenda_excecoes_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_select ON public.agenda_excecoes FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_excecoes agenda_excecoes_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_excecoes_write ON public.agenda_excecoes USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_online_slots; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_online_slots ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_online_slots agenda_online_slots_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_owner ON public.agenda_online_slots USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_online_slots agenda_online_slots_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_select ON public.agenda_online_slots FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_online_slots agenda_online_slots_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_online_slots_write ON public.agenda_online_slots USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_regras_semanais; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_regras_semanais ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_regras_semanais agenda_regras_semanais_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_owner ON public.agenda_regras_semanais USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_select ON public.agenda_regras_semanais FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_regras_semanais agenda_regras_semanais_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_regras_semanais_write ON public.agenda_regras_semanais USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_slots_bloqueados_semanais; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_slots_bloqueados_semanais ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_bloqueados_semanais_select ON public.agenda_slots_bloqueados_semanais FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_slots_bloqueados_semanais agenda_slots_bloqueados_semanais_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_bloqueados_semanais_write ON public.agenda_slots_bloqueados_semanais USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agenda_slots_regras; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agenda_slots_regras ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_slots_regras agenda_slots_regras_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_regras_select ON public.agenda_slots_regras FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: agenda_slots_regras agenda_slots_regras_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agenda_slots_regras_write ON public.agenda_slots_regras USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: agendador_configuracoes agendador_cfg_public_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_public_read ON public.agendador_configuracoes FOR SELECT TO anon USING (((ativo = true) AND (link_slug IS NOT NULL))); - - --- --- Name: agendador_configuracoes agendador_cfg_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_select ON public.agendador_configuracoes FOR SELECT USING ((auth.uid() = owner_id)); - - --- --- Name: agendador_configuracoes agendador_cfg_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_cfg_write ON public.agendador_configuracoes USING ((auth.uid() = owner_id)) WITH CHECK ((auth.uid() = owner_id)); - - --- --- Name: agendador_configuracoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agendador_configuracoes ENABLE ROW LEVEL SECURITY; - --- --- Name: agendador_solicitacoes agendador_sol_owner_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_owner_select ON public.agendador_solicitacoes FOR SELECT USING ((auth.uid() = owner_id)); - - --- --- Name: agendador_solicitacoes agendador_sol_owner_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_owner_write ON public.agendador_solicitacoes USING ((auth.uid() = owner_id)) WITH CHECK ((auth.uid() = owner_id)); - - --- --- Name: agendador_solicitacoes agendador_sol_patient_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_patient_read ON public.agendador_solicitacoes FOR SELECT TO authenticated USING (((auth.uid() = user_id) OR (auth.uid() = owner_id))); - - --- --- Name: agendador_solicitacoes agendador_sol_public_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY agendador_sol_public_insert ON public.agendador_solicitacoes FOR INSERT TO anon WITH CHECK (true); - - --- --- Name: agendador_solicitacoes; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.agendador_solicitacoes ENABLE ROW LEVEL SECURITY; - --- --- Name: billing_contracts; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.billing_contracts ENABLE ROW LEVEL SECURITY; - --- --- Name: billing_contracts billing_contracts: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "billing_contracts: owner full access" ON public.billing_contracts USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_delete ON public.agenda_bloqueios FOR DELETE TO authenticated USING ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_insert ON public.agenda_bloqueios FOR INSERT TO authenticated WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_select_clinic; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_select_clinic ON public.agenda_bloqueios FOR SELECT TO authenticated USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE ((tenant_members.user_id = auth.uid()) AND (tenant_members.role = ANY (ARRAY['admin'::text, 'clinic_admin'::text, 'tenant_admin'::text, 'secretary'::text])))))); - - --- --- Name: agenda_bloqueios bloqueios_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_select_own ON public.agenda_bloqueios FOR SELECT TO authenticated USING ((owner_id = auth.uid())); - - --- --- Name: agenda_bloqueios bloqueios_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY bloqueios_update ON public.agenda_bloqueios FOR UPDATE TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: saas_docs clinic_admin_read_all_docs; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY clinic_admin_read_all_docs ON public.saas_docs FOR SELECT TO authenticated USING (((ativo = true) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['clinic_admin'::text, 'tenant_admin'::text]))))))); - - --- --- Name: commitment_services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.commitment_services ENABLE ROW LEVEL SECURITY; - --- --- Name: commitment_services commitment_services: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "commitment_services: owner full access" ON public.commitment_services USING ((EXISTS ( SELECT 1 - FROM public.services s - WHERE ((s.id = commitment_services.service_id) AND (s.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.services s - WHERE ((s.id = commitment_services.service_id) AND (s.owner_id = auth.uid()))))); - - --- --- Name: commitment_time_logs; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.commitment_time_logs ENABLE ROW LEVEL SECURITY; - --- --- Name: commitment_time_logs ctl_delete_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_delete_for_active_member ON public.commitment_time_logs FOR DELETE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_insert_for_active_member ON public.commitment_time_logs FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_select_for_active_member ON public.commitment_time_logs FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: commitment_time_logs ctl_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ctl_update_for_active_member ON public.commitment_time_logs FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = commitment_time_logs.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_delete_custom_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_delete_custom_for_active_member ON public.determined_commitments FOR DELETE TO authenticated USING (((is_native = false) AND (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: determined_commitments dc_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_insert_for_active_member ON public.determined_commitments FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_select_for_active_member ON public.determined_commitments FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitments dc_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dc_update_for_active_member ON public.determined_commitments FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitments.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_delete_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_delete_for_active_member ON public.determined_commitment_fields FOR DELETE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_insert_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_insert_for_active_member ON public.determined_commitment_fields FOR INSERT TO authenticated WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_select_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_select_for_active_member ON public.determined_commitment_fields FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: determined_commitment_fields dcf_update_for_active_member; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dcf_update_for_active_member ON public.determined_commitment_fields FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = determined_commitment_fields.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text))))); - - --- --- Name: agenda_bloqueios delete own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "delete own" ON public.agenda_bloqueios FOR DELETE USING ((owner_id = auth.uid())); - - --- --- Name: determined_commitment_fields; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.determined_commitment_fields ENABLE ROW LEVEL SECURITY; - --- --- Name: determined_commitments; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.determined_commitments ENABLE ROW LEVEL SECURITY; - --- --- Name: dev_user_credentials dev_creds_select_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dev_creds_select_saas_admin ON public.dev_user_credentials FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))); - - --- --- Name: dev_user_credentials dev_creds_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY dev_creds_write_saas_admin ON public.dev_user_credentials TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.profiles p - WHERE ((p.id = auth.uid()) AND (p.role = 'saas_admin'::text))))); - - --- --- Name: dev_user_credentials; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.dev_user_credentials ENABLE ROW LEVEL SECURITY; - --- --- Name: entitlements_invalidation ent_inv_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_select_own ON public.entitlements_invalidation FOR SELECT USING (((owner_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: entitlements_invalidation ent_inv_update_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_update_saas ON public.entitlements_invalidation FOR UPDATE USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: entitlements_invalidation ent_inv_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY ent_inv_write_saas ON public.entitlements_invalidation FOR INSERT WITH CHECK (public.is_saas_admin()); - - --- --- Name: entitlements_invalidation; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.entitlements_invalidation ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq faq_admin_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_admin_write ON public.saas_faq TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['saas_admin'::text, 'tenant_admin'::text, 'clinic_admin'::text])))))); - - --- --- Name: saas_faq faq_auth_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_auth_read ON public.saas_faq FOR SELECT TO authenticated USING ((ativo = true)); - - --- --- Name: saas_faq_itens faq_itens_admin_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_itens_admin_write ON public.saas_faq_itens TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = ANY (ARRAY['saas_admin'::text, 'tenant_admin'::text, 'clinic_admin'::text])))))); - - --- --- Name: saas_faq_itens faq_itens_auth_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_itens_auth_read ON public.saas_faq_itens FOR SELECT TO authenticated USING (((ativo = true) AND (EXISTS ( SELECT 1 - FROM public.saas_docs d - WHERE ((d.id = saas_faq_itens.doc_id) AND (d.ativo = true)))))); - - --- --- Name: saas_faq faq_public_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY faq_public_read ON public.saas_faq FOR SELECT USING (((publico = true) AND (ativo = true))); - - --- --- Name: features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.features ENABLE ROW LEVEL SECURITY; - --- --- Name: features features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY features_read_authenticated ON public.features FOR SELECT TO authenticated USING (true); - - --- --- Name: features features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY features_write_saas_admin ON public.features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: feriados; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.feriados ENABLE ROW LEVEL SECURITY; - --- --- Name: feriados feriados_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_delete ON public.feriados FOR DELETE USING ((owner_id = auth.uid())); - - --- --- Name: feriados feriados_global_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_global_select ON public.feriados FOR SELECT USING ((tenant_id IS NULL)); - - --- --- Name: feriados feriados_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_insert ON public.feriados FOR INSERT WITH CHECK ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_delete ON public.feriados FOR DELETE USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_insert ON public.feriados FOR INSERT WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_saas_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_saas_select ON public.feriados FOR SELECT USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: feriados feriados_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY feriados_select ON public.feriados FOR SELECT USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: financial_exceptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.financial_exceptions ENABLE ROW LEVEL SECURITY; - --- --- Name: financial_exceptions financial_exceptions: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "financial_exceptions: owner full access" ON public.financial_exceptions USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: financial_exceptions financial_exceptions: tenant members read clinic rules; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "financial_exceptions: tenant members read clinic rules" ON public.financial_exceptions FOR SELECT USING (((owner_id IS NULL) AND (EXISTS ( SELECT 1 - FROM public.owner_users ou - WHERE ((ou.owner_id = financial_exceptions.tenant_id) AND (ou.user_id = auth.uid())))))); - - --- --- Name: agenda_bloqueios insert own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "insert own" ON public.agenda_bloqueios FOR INSERT WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: insurance_plan_services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.insurance_plan_services ENABLE ROW LEVEL SECURITY; - --- --- Name: insurance_plan_services insurance_plan_services_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY insurance_plan_services_owner ON public.insurance_plan_services USING ((EXISTS ( SELECT 1 - FROM public.insurance_plans ip - WHERE ((ip.id = insurance_plan_services.insurance_plan_id) AND (ip.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.insurance_plans ip - WHERE ((ip.id = insurance_plan_services.insurance_plan_id) AND (ip.owner_id = auth.uid()))))); - - --- --- Name: insurance_plans; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.insurance_plans ENABLE ROW LEVEL SECURITY; - --- --- Name: insurance_plans insurance_plans: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "insurance_plans: owner full access" ON public.insurance_plans USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: module_features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.module_features ENABLE ROW LEVEL SECURITY; - --- --- Name: module_features module_features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY module_features_read_authenticated ON public.module_features FOR SELECT TO authenticated USING (true); - - --- --- Name: module_features module_features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY module_features_write_saas_admin ON public.module_features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: modules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.modules ENABLE ROW LEVEL SECURITY; - --- --- Name: modules modules_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY modules_read_authenticated ON public.modules FOR SELECT TO authenticated USING (true); - - --- --- Name: modules modules_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY modules_write_saas_admin ON public.modules TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: owner_users; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.owner_users ENABLE ROW LEVEL SECURITY; - --- --- Name: owner_users owner_users: user can read own links; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "owner_users: user can read own links" ON public.owner_users FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: patient_discounts; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_discounts ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_discounts patient_discounts: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "patient_discounts: owner full access" ON public.patient_discounts USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_group_patient; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_group_patient ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_group_patient patient_group_patient_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_owner_all ON public.patient_group_patient TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.patients p - WHERE ((p.id = patient_group_patient.patient_id) AND (p.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.patients p - WHERE ((p.id = patient_group_patient.patient_id) AND (p.owner_id = auth.uid()))))); - - --- --- Name: patient_group_patient patient_group_patient_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_select ON public.patient_group_patient FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_group_patient patient_group_patient_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_group_patient_write ON public.patient_group_patient USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_groups; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_groups ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_groups patient_groups_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_owner_all ON public.patient_groups TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_groups patient_groups_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_select ON public.patient_groups FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_groups patient_groups_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_groups_write ON public.patient_groups USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_intake_requests; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_intake_requests ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_intake_requests patient_intake_requests_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_owner_all ON public.patient_intake_requests TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_intake_requests patient_intake_requests_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_select ON public.patient_intake_requests FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_intake_requests patient_intake_requests_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_intake_requests_write ON public.patient_intake_requests USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_invites; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_invites ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_invites patient_invites_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_owner_all ON public.patient_invites TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_invites patient_invites_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_select ON public.patient_invites FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_invites patient_invites_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_invites_write ON public.patient_invites USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_patient_tag; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_patient_tag ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_patient_tag patient_patient_tag_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_owner_all ON public.patient_patient_tag TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_patient_tag patient_patient_tag_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_select ON public.patient_patient_tag FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_patient_tag patient_patient_tag_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_patient_tag_write ON public.patient_patient_tag USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patient_tags; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patient_tags ENABLE ROW LEVEL SECURITY; - --- --- Name: patient_tags patient_tags_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_owner_all ON public.patient_tags TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patient_tags patient_tags_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_select ON public.patient_tags FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patient_tags patient_tags_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patient_tags_write ON public.patient_tags USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: patients; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.patients ENABLE ROW LEVEL SECURITY; - --- --- Name: patients patients_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_delete ON public.patients FOR DELETE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.delete'::text))); - - --- --- Name: patients patients_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_insert ON public.patients FOR INSERT WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.create'::text))); - - --- --- Name: patients patients_owner_all; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_owner_all ON public.patients TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: patients patients_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_select ON public.patients FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.view'::text))); - - --- --- Name: patients patients_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY patients_update ON public.patients FOR UPDATE USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'patients.edit'::text))); - - --- --- Name: payment_settings; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.payment_settings ENABLE ROW LEVEL SECURITY; - --- --- Name: payment_settings payment_settings: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "payment_settings: owner full access" ON public.payment_settings USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: plan_features; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.plan_features ENABLE ROW LEVEL SECURITY; - --- --- Name: plan_features plan_features_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plan_features_read_authenticated ON public.plan_features FOR SELECT TO authenticated USING (true); - - --- --- Name: plan_features plan_features_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plan_features_write_saas_admin ON public.plan_features TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: plans; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.plans ENABLE ROW LEVEL SECURITY; - --- --- Name: plans plans_read_authenticated; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plans_read_authenticated ON public.plans FOR SELECT TO authenticated USING (true); - - --- --- Name: plans plans_write_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY plans_write_saas_admin ON public.plans TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: professional_pricing; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.professional_pricing ENABLE ROW LEVEL SECURITY; - --- --- Name: professional_pricing professional_pricing: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "professional_pricing: owner full access" ON public.professional_pricing USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: profiles; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY; - --- --- Name: profiles profiles_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_insert_own ON public.profiles FOR INSERT WITH CHECK ((id = auth.uid())); - - --- --- Name: profiles profiles_read_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_read_saas_admin ON public.profiles FOR SELECT USING (public.is_saas_admin()); - - --- --- Name: profiles profiles_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_select_own ON public.profiles FOR SELECT USING ((id = auth.uid())); - - --- --- Name: profiles profiles_update_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY profiles_update_own ON public.profiles FOR UPDATE USING ((id = auth.uid())) WITH CHECK ((id = auth.uid())); - - --- --- Name: features read features (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read features (auth)" ON public.features FOR SELECT TO authenticated USING (true); - - --- --- Name: plan_features read plan_features (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read plan_features (auth)" ON public.plan_features FOR SELECT TO authenticated USING (true); - - --- --- Name: plans read plans (auth); Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "read plans (auth)" ON public.plans FOR SELECT TO authenticated USING (true); - - --- --- Name: recurrence_exceptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_exceptions ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_exceptions recurrence_exceptions_tenant; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_exceptions_tenant ON public.recurrence_exceptions TO authenticated USING ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))) WITH CHECK ((tenant_id IN ( SELECT tenant_members.tenant_id - FROM public.tenant_members - WHERE (tenant_members.user_id = auth.uid())))); - - --- --- Name: recurrence_rule_services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_rule_services ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_rule_services recurrence_rule_services: clinic read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "recurrence_rule_services: clinic read" ON public.recurrence_rule_services FOR SELECT USING ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND public.is_clinic_tenant(r.tenant_id) AND public.is_tenant_member(r.tenant_id) AND public.tenant_has_feature(r.tenant_id, 'agenda.view'::text))))); - - --- --- Name: recurrence_rule_services recurrence_rule_services: clinic write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "recurrence_rule_services: clinic write" ON public.recurrence_rule_services USING ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND public.is_clinic_tenant(r.tenant_id) AND public.is_tenant_member(r.tenant_id) AND public.tenant_has_feature(r.tenant_id, 'agenda.edit'::text))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND public.is_clinic_tenant(r.tenant_id) AND public.is_tenant_member(r.tenant_id) AND public.tenant_has_feature(r.tenant_id, 'agenda.edit'::text))))); - - --- --- Name: recurrence_rule_services recurrence_rule_services: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "recurrence_rule_services: owner full access" ON public.recurrence_rule_services TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND (r.owner_id = auth.uid()))))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.recurrence_rules r - WHERE ((r.id = recurrence_rule_services.rule_id) AND (r.owner_id = auth.uid()))))); - - --- --- Name: recurrence_rules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.recurrence_rules ENABLE ROW LEVEL SECURITY; - --- --- Name: recurrence_rules recurrence_rules_clinic_read; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_clinic_read ON public.recurrence_rules FOR SELECT USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.view'::text))); - - --- --- Name: recurrence_rules recurrence_rules_clinic_write; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_clinic_write ON public.recurrence_rules USING ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))) WITH CHECK ((public.is_clinic_tenant(tenant_id) AND public.is_tenant_member(tenant_id) AND public.tenant_has_feature(tenant_id, 'agenda.edit'::text))); - - --- --- Name: recurrence_rules recurrence_rules_owner; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY recurrence_rules_owner ON public.recurrence_rules TO authenticated USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: subscription_intents_legacy saas_admin can read subscription_intents; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "saas_admin can read subscription_intents" ON public.subscription_intents_legacy FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))); - - --- --- Name: subscription_intents_legacy saas_admin can update subscription_intents; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "saas_admin can update subscription_intents" ON public.subscription_intents_legacy FOR UPDATE TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins a - WHERE (a.user_id = auth.uid())))); - - --- --- Name: saas_docs saas_admin_full_access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY saas_admin_full_access ON public.saas_docs TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))) WITH CHECK ((EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid())))); - - --- --- Name: saas_admins; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_admins ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_admins saas_admins_select_self; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY saas_admins_select_self ON public.saas_admins FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: saas_doc_votos; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_doc_votos ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_docs; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_docs ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_faq ENABLE ROW LEVEL SECURITY; - --- --- Name: saas_faq_itens; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.saas_faq_itens ENABLE ROW LEVEL SECURITY; - --- --- Name: agenda_bloqueios select own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "select own" ON public.agenda_bloqueios FOR SELECT USING ((owner_id = auth.uid())); - - --- --- Name: services; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.services ENABLE ROW LEVEL SECURITY; - --- --- Name: services services: owner full access; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "services: owner full access" ON public.services USING ((owner_id = auth.uid())) WITH CHECK ((owner_id = auth.uid())); - - --- --- Name: subscription_events; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscription_events ENABLE ROW LEVEL SECURITY; - --- --- Name: subscription_events subscription_events_read_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_events_read_saas ON public.subscription_events FOR SELECT USING (public.is_saas_admin()); - - --- --- Name: subscription_events subscription_events_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_events_write_saas ON public.subscription_events FOR INSERT WITH CHECK (public.is_saas_admin()); - - --- --- Name: subscription_intents_legacy subscription_intents_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_intents_insert_own ON public.subscription_intents_legacy FOR INSERT TO authenticated WITH CHECK ((user_id = auth.uid())); - - --- --- Name: subscription_intents_legacy; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscription_intents_legacy ENABLE ROW LEVEL SECURITY; - --- --- Name: subscription_intents_legacy subscription_intents_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscription_intents_select_own ON public.subscription_intents_legacy FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: subscriptions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.subscriptions ENABLE ROW LEVEL SECURITY; - --- --- Name: subscriptions subscriptions read own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "subscriptions read own" ON public.subscriptions FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: subscriptions subscriptions: read if linked owner_users; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "subscriptions: read if linked owner_users" ON public.subscriptions FOR SELECT TO authenticated USING ((EXISTS ( SELECT 1 - FROM public.owner_users ou - WHERE ((ou.owner_id = subscriptions.user_id) AND (ou.user_id = auth.uid()))))); - - --- --- Name: subscriptions subscriptions_insert_own_personal; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_insert_own_personal ON public.subscriptions FOR INSERT TO authenticated WITH CHECK (((user_id = auth.uid()) AND (tenant_id IS NULL))); - - --- --- Name: subscriptions subscriptions_no_direct_update; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_no_direct_update ON public.subscriptions FOR UPDATE TO authenticated USING (false) WITH CHECK (false); - - --- --- Name: subscriptions subscriptions_read_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_read_own ON public.subscriptions FOR SELECT TO authenticated USING (((user_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: subscriptions subscriptions_select_for_tenant_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_select_for_tenant_members ON public.subscriptions FOR SELECT TO authenticated USING (((tenant_id IS NOT NULL) AND (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = subscriptions.tenant_id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: subscriptions subscriptions_select_own_personal; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_select_own_personal ON public.subscriptions FOR SELECT TO authenticated USING (((user_id = auth.uid()) AND (tenant_id IS NULL))); - - --- --- Name: subscriptions subscriptions_update_only_saas_admin; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY subscriptions_update_only_saas_admin ON public.subscriptions FOR UPDATE TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: support_sessions; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.support_sessions ENABLE ROW LEVEL SECURITY; - --- --- Name: support_sessions support_sessions_saas_delete; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_delete ON public.support_sessions FOR DELETE USING (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: support_sessions support_sessions_saas_insert; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_insert ON public.support_sessions FOR INSERT WITH CHECK (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: support_sessions support_sessions_saas_select; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY support_sessions_saas_select ON public.support_sessions FOR SELECT USING (((auth.uid() = admin_id) AND (EXISTS ( SELECT 1 - FROM public.profiles - WHERE ((profiles.id = auth.uid()) AND (profiles.role = 'saas_admin'::text)))))); - - --- --- Name: tenant_members; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenant_members ENABLE ROW LEVEL SECURITY; - --- --- Name: tenant_members tenant_members_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_members_write_saas ON public.tenant_members TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenant_modules; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenant_modules ENABLE ROW LEVEL SECURITY; - --- --- Name: tenant_modules tenant_modules_read_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_modules_read_own ON public.tenant_modules FOR SELECT TO authenticated USING (((owner_id = auth.uid()) OR public.is_saas_admin())); - - --- --- Name: tenant_modules tenant_modules_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenant_modules_write_saas ON public.tenant_modules TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenants; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.tenants ENABLE ROW LEVEL SECURITY; - --- --- Name: tenants tenants_read_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenants_read_members ON public.tenants FOR SELECT TO authenticated USING ((public.is_saas_admin() OR (EXISTS ( SELECT 1 - FROM public.tenant_members tm - WHERE ((tm.tenant_id = tenants.id) AND (tm.user_id = auth.uid()) AND (tm.status = 'active'::text)))))); - - --- --- Name: tenants tenants_write_saas; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tenants_write_saas ON public.tenants TO authenticated USING (public.is_saas_admin()) WITH CHECK (public.is_saas_admin()); - - --- --- Name: tenant_members tm_select_admin_all_members; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tm_select_admin_all_members ON public.tenant_members FOR SELECT TO authenticated USING (public.is_tenant_admin(tenant_id)); - - --- --- Name: tenant_members tm_select_own_membership; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY tm_select_own_membership ON public.tenant_members FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: agenda_bloqueios update own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY "update own" ON public.agenda_bloqueios FOR UPDATE USING ((owner_id = auth.uid())); - - --- --- Name: user_settings; Type: ROW SECURITY; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.user_settings ENABLE ROW LEVEL SECURITY; - --- --- Name: user_settings user_settings_insert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_insert_own ON public.user_settings FOR INSERT WITH CHECK ((user_id = auth.uid())); - - --- --- Name: user_settings user_settings_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_select_own ON public.user_settings FOR SELECT USING ((user_id = auth.uid())); - - --- --- Name: user_settings user_settings_update_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY user_settings_update_own ON public.user_settings FOR UPDATE USING ((user_id = auth.uid())) WITH CHECK ((user_id = auth.uid())); - - --- --- Name: saas_docs users_read_usuario_docs; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY users_read_usuario_docs ON public.saas_docs FOR SELECT TO authenticated USING (((ativo = true) AND (tipo_acesso = 'usuario'::text))); - - --- --- Name: saas_doc_votos votos_select_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY votos_select_own ON public.saas_doc_votos FOR SELECT TO authenticated USING ((user_id = auth.uid())); - - --- --- Name: saas_doc_votos votos_upsert_own; Type: POLICY; Schema: public; Owner: supabase_admin --- - -CREATE POLICY votos_upsert_own ON public.saas_doc_votos TO authenticated USING ((user_id = auth.uid())) WITH CHECK ((user_id = auth.uid())); - - --- --- Name: messages; Type: ROW SECURITY; Schema: realtime; Owner: supabase_realtime_admin --- - -ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY; - --- --- Name: objects agendador_storage_owner_delete; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_delete ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_owner_insert; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_insert ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_owner_update; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_owner_update ON storage.objects FOR UPDATE TO authenticated USING (((bucket_id = 'agendador'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text))); - - --- --- Name: objects agendador_storage_public_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY agendador_storage_public_read ON storage.objects FOR SELECT USING ((bucket_id = 'agendador'::text)); - - --- --- Name: objects avatars_delete_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_delete_own ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_delete_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_delete_own_folder ON storage.objects FOR DELETE USING (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: objects avatars_insert_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_insert_own ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_insert_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_insert_own_folder ON storage.objects FOR INSERT WITH CHECK (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: objects avatars_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_read ON storage.objects FOR SELECT USING ((bucket_id = 'avatars'::text)); - - --- --- Name: objects avatars_select_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_select_own ON storage.objects FOR SELECT TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_update_own; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_update_own ON storage.objects FOR UPDATE TO authenticated USING (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))) WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ ((auth.uid())::text || '/%'::text)))); - - --- --- Name: objects avatars_update_own_folder; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY avatars_update_own_folder ON storage.objects FOR UPDATE USING (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))) WITH CHECK (((bucket_id = 'avatars'::text) AND (auth.role() = 'authenticated'::text) AND (name ~~ (('owners/'::text || auth.uid()) || '/%'::text)))); - - --- --- Name: buckets; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets ENABLE ROW LEVEL SECURITY; - --- --- Name: buckets_analytics; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets_analytics ENABLE ROW LEVEL SECURITY; - --- --- Name: buckets_vectors; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets_vectors ENABLE ROW LEVEL SECURITY; - --- --- Name: iceberg_namespaces; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.iceberg_namespaces ENABLE ROW LEVEL SECURITY; - --- --- Name: iceberg_tables; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.iceberg_tables ENABLE ROW LEVEL SECURITY; - --- --- Name: objects intake_read_anon; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_read_anon ON storage.objects FOR SELECT TO anon USING (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_read_public; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_read_public ON storage.objects FOR SELECT USING (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_upload_anon; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_upload_anon ON storage.objects FOR INSERT TO anon WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: objects intake_upload_public; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY intake_upload_public ON storage.objects FOR INSERT WITH CHECK (((bucket_id = 'avatars'::text) AND (name ~~ 'intakes/%'::text))); - - --- --- Name: migrations; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: objects; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY; - --- --- Name: objects public_read; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY public_read ON storage.objects FOR SELECT USING ((bucket_id = 'saas-docs'::text)); - - --- --- Name: s3_multipart_uploads; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.s3_multipart_uploads ENABLE ROW LEVEL SECURITY; - --- --- Name: s3_multipart_uploads_parts; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.s3_multipart_uploads_parts ENABLE ROW LEVEL SECURITY; - --- --- Name: objects saas_admin_delete; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY saas_admin_delete ON storage.objects FOR DELETE TO authenticated USING (((bucket_id = 'saas-docs'::text) AND (EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid()))))); - - --- --- Name: objects saas_admin_upload; Type: POLICY; Schema: storage; Owner: supabase_storage_admin --- - -CREATE POLICY saas_admin_upload ON storage.objects FOR INSERT TO authenticated WITH CHECK (((bucket_id = 'saas-docs'::text) AND (EXISTS ( SELECT 1 - FROM public.saas_admins - WHERE (saas_admins.user_id = auth.uid()))))); - - --- --- Name: vector_indexes; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.vector_indexes ENABLE ROW LEVEL SECURITY; - --- --- Name: supabase_realtime; Type: PUBLICATION; Schema: -; Owner: postgres --- - -CREATE PUBLICATION supabase_realtime WITH (publish = 'insert, update, delete, truncate'); - - -ALTER PUBLICATION supabase_realtime OWNER TO postgres; - --- --- Name: SCHEMA auth; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA auth TO anon; -GRANT USAGE ON SCHEMA auth TO authenticated; -GRANT USAGE ON SCHEMA auth TO service_role; -GRANT ALL ON SCHEMA auth TO supabase_auth_admin; -GRANT ALL ON SCHEMA auth TO dashboard_user; -GRANT USAGE ON SCHEMA auth TO postgres; - - --- --- Name: SCHEMA extensions; Type: ACL; Schema: -; Owner: postgres --- - -GRANT USAGE ON SCHEMA extensions TO anon; -GRANT USAGE ON SCHEMA extensions TO authenticated; -GRANT USAGE ON SCHEMA extensions TO service_role; -GRANT ALL ON SCHEMA extensions TO dashboard_user; - - --- --- Name: SCHEMA net; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA net TO supabase_functions_admin; -GRANT USAGE ON SCHEMA net TO postgres; -GRANT USAGE ON SCHEMA net TO anon; -GRANT USAGE ON SCHEMA net TO authenticated; -GRANT USAGE ON SCHEMA net TO service_role; - - --- --- Name: SCHEMA public; Type: ACL; Schema: -; Owner: pg_database_owner --- - -GRANT USAGE ON SCHEMA public TO postgres; -GRANT USAGE ON SCHEMA public TO anon; -GRANT USAGE ON SCHEMA public TO authenticated; -GRANT USAGE ON SCHEMA public TO service_role; - - --- --- Name: SCHEMA realtime; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA realtime TO postgres; -GRANT USAGE ON SCHEMA realtime TO anon; -GRANT USAGE ON SCHEMA realtime TO authenticated; -GRANT USAGE ON SCHEMA realtime TO service_role; -GRANT ALL ON SCHEMA realtime TO supabase_realtime_admin; - - --- --- Name: SCHEMA storage; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA storage TO postgres WITH GRANT OPTION; -GRANT USAGE ON SCHEMA storage TO anon; -GRANT USAGE ON SCHEMA storage TO authenticated; -GRANT USAGE ON SCHEMA storage TO service_role; -GRANT ALL ON SCHEMA storage TO supabase_storage_admin WITH GRANT OPTION; -GRANT ALL ON SCHEMA storage TO dashboard_user; - - --- --- Name: SCHEMA supabase_functions; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA supabase_functions TO postgres; -GRANT USAGE ON SCHEMA supabase_functions TO anon; -GRANT USAGE ON SCHEMA supabase_functions TO authenticated; -GRANT USAGE ON SCHEMA supabase_functions TO service_role; -GRANT ALL ON SCHEMA supabase_functions TO supabase_functions_admin; - - --- --- Name: SCHEMA vault; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA vault TO postgres WITH GRANT OPTION; -GRANT USAGE ON SCHEMA vault TO service_role; - - --- --- Name: FUNCTION citextin(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextin(cstring) TO postgres; -GRANT ALL ON FUNCTION public.citextin(cstring) TO anon; -GRANT ALL ON FUNCTION public.citextin(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.citextin(cstring) TO service_role; - - --- --- Name: FUNCTION citextout(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextout(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citextout(public.citext) TO service_role; - - --- --- Name: FUNCTION citextrecv(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextrecv(internal) TO postgres; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO anon; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO authenticated; -GRANT ALL ON FUNCTION public.citextrecv(internal) TO service_role; - - --- --- Name: FUNCTION citextsend(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citextsend(public.citext) TO service_role; - - --- --- Name: FUNCTION gbtreekey16_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey16_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey16_out(public.gbtreekey16); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey16_out(public.gbtreekey16) TO service_role; - - --- --- Name: FUNCTION gbtreekey2_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey2_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey2_out(public.gbtreekey2); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey2_out(public.gbtreekey2) TO service_role; - - --- --- Name: FUNCTION gbtreekey32_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey32_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey32_out(public.gbtreekey32); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey32_out(public.gbtreekey32) TO service_role; - - --- --- Name: FUNCTION gbtreekey4_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey4_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey4_out(public.gbtreekey4); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey4_out(public.gbtreekey4) TO service_role; - - --- --- Name: FUNCTION gbtreekey8_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey8_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey8_out(public.gbtreekey8); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey8_out(public.gbtreekey8) TO service_role; - - --- --- Name: FUNCTION gbtreekey_var_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey_var_in(cstring) TO service_role; - - --- --- Name: FUNCTION gbtreekey_var_out(public.gbtreekey_var); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO postgres; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO anon; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO authenticated; -GRANT ALL ON FUNCTION public.gbtreekey_var_out(public.gbtreekey_var) TO service_role; - - --- --- Name: FUNCTION gtrgm_in(cstring); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_in(cstring) TO service_role; - - --- --- Name: FUNCTION gtrgm_out(public.gtrgm); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_out(public.gtrgm) TO service_role; - - --- --- Name: FUNCTION citext(boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(boolean) TO postgres; -GRANT ALL ON FUNCTION public.citext(boolean) TO anon; -GRANT ALL ON FUNCTION public.citext(boolean) TO authenticated; -GRANT ALL ON FUNCTION public.citext(boolean) TO service_role; - - --- --- Name: FUNCTION citext(character); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(character) TO postgres; -GRANT ALL ON FUNCTION public.citext(character) TO anon; -GRANT ALL ON FUNCTION public.citext(character) TO authenticated; -GRANT ALL ON FUNCTION public.citext(character) TO service_role; - - --- --- Name: FUNCTION citext(inet); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext(inet) TO postgres; -GRANT ALL ON FUNCTION public.citext(inet) TO anon; -GRANT ALL ON FUNCTION public.citext(inet) TO authenticated; -GRANT ALL ON FUNCTION public.citext(inet) TO service_role; - - --- --- Name: FUNCTION email(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.email() TO dashboard_user; - - --- --- Name: FUNCTION jwt(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.jwt() TO postgres; -GRANT ALL ON FUNCTION auth.jwt() TO dashboard_user; - - --- --- Name: FUNCTION role(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.role() TO dashboard_user; - - --- --- Name: FUNCTION uid(); Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON FUNCTION auth.uid() TO dashboard_user; - - --- --- Name: FUNCTION armor(bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.armor(bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.armor(bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION armor(bytea, text[], text[]); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.armor(bytea, text[], text[]) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.armor(bytea, text[], text[]) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION crypt(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.crypt(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.crypt(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION dearmor(text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.dearmor(text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.dearmor(text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION decrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.decrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.decrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION decrypt_iv(bytea, bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.decrypt_iv(bytea, bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.decrypt_iv(bytea, bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION digest(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.digest(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.digest(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION digest(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.digest(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.digest(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION encrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.encrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.encrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION encrypt_iv(bytea, bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.encrypt_iv(bytea, bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.encrypt_iv(bytea, bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_random_bytes(integer); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_random_bytes(integer) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_random_bytes(integer) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_random_uuid(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_random_uuid() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_random_uuid() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_salt(text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_salt(text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_salt(text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION gen_salt(text, integer); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.gen_salt(text, integer) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.gen_salt(text, integer) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION grant_pg_cron_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION extensions.grant_pg_cron_access() FROM supabase_admin; -GRANT ALL ON FUNCTION extensions.grant_pg_cron_access() TO supabase_admin WITH GRANT OPTION; -GRANT ALL ON FUNCTION extensions.grant_pg_cron_access() TO dashboard_user; - - --- --- Name: FUNCTION grant_pg_graphql_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.grant_pg_graphql_access() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION grant_pg_net_access(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION extensions.grant_pg_net_access() FROM supabase_admin; -GRANT ALL ON FUNCTION extensions.grant_pg_net_access() TO supabase_admin WITH GRANT OPTION; -GRANT ALL ON FUNCTION extensions.grant_pg_net_access() TO dashboard_user; - - --- --- Name: FUNCTION hmac(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.hmac(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.hmac(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION hmac(text, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.hmac(text, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.hmac(text, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT shared_blk_read_time double precision, OUT shared_blk_write_time double precision, OUT local_blk_read_time double precision, OUT local_blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision, OUT jit_deform_count bigint, OUT jit_deform_time double precision, OUT stats_since timestamp with time zone, OUT minmax_stats_since timestamp with time zone); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT shared_blk_read_time double precision, OUT shared_blk_write_time double precision, OUT local_blk_read_time double precision, OUT local_blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision, OUT jit_deform_count bigint, OUT jit_deform_time double precision, OUT stats_since timestamp with time zone, OUT minmax_stats_since timestamp with time zone) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pg_stat_statements_reset(userid oid, dbid oid, queryid bigint, minmax_only boolean); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pg_stat_statements_reset(userid oid, dbid oid, queryid bigint, minmax_only boolean) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_armor_headers(text, OUT key text, OUT value text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_armor_headers(text, OUT key text, OUT value text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_armor_headers(text, OUT key text, OUT value text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_key_id(bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_key_id(bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_key_id(bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt(bytea, bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt(bytea, bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_decrypt_bytea(bytea, bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt(text, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt(text, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt(text, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt_bytea(bytea, bytea); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_pub_encrypt_bytea(bytea, bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_pub_encrypt_bytea(bytea, bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt_bytea(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_decrypt_bytea(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_decrypt_bytea(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt(text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt(text, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt(text, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt_bytea(bytea, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgp_sym_encrypt_bytea(bytea, text, text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text, text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.pgp_sym_encrypt_bytea(bytea, text, text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgrst_ddl_watch(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgrst_ddl_watch() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION pgrst_drop_watch(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.pgrst_drop_watch() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION set_graphql_placeholder(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.set_graphql_placeholder() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v1(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v1() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v1() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v1mc(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v1mc() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v1mc() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v3(namespace uuid, name text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v3(namespace uuid, name text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v3(namespace uuid, name text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v4(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v4() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v4() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_generate_v5(namespace uuid, name text); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_generate_v5(namespace uuid, name text) TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_generate_v5(namespace uuid, name text) TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_nil(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_nil() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_nil() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_dns(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_dns() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_dns() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_oid(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_oid() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_oid() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_url(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_url() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_url() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION uuid_ns_x500(); Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION extensions.uuid_ns_x500() TO dashboard_user; -GRANT ALL ON FUNCTION extensions.uuid_ns_x500() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION graphql("operationName" text, query text, variables jsonb, extensions jsonb); Type: ACL; Schema: graphql_public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO postgres; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO anon; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO authenticated; -GRANT ALL ON FUNCTION graphql_public.graphql("operationName" text, query text, variables jsonb, extensions jsonb) TO service_role; - - --- --- Name: FUNCTION http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer); Type: ACL; Schema: net; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO anon; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO authenticated; -GRANT ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO service_role; - - --- --- Name: FUNCTION http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer); Type: ACL; Schema: net; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO anon; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO authenticated; -GRANT ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO service_role; - - --- --- Name: FUNCTION pg_reload_conf(); Type: ACL; Schema: pg_catalog; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION pg_catalog.pg_reload_conf() TO postgres WITH GRANT OPTION; - - --- --- Name: FUNCTION get_auth(p_usename text); Type: ACL; Schema: pgbouncer; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION pgbouncer.get_auth(p_usename text) FROM PUBLIC; -GRANT ALL ON FUNCTION pgbouncer.get_auth(p_usename text) TO pgbouncer; - - --- --- Name: FUNCTION __rls_ping(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.__rls_ping() TO postgres; -GRANT ALL ON FUNCTION public.__rls_ping() TO anon; -GRANT ALL ON FUNCTION public.__rls_ping() TO authenticated; -GRANT ALL ON FUNCTION public.__rls_ping() TO service_role; - - --- --- Name: TABLE subscriptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscriptions TO postgres; -GRANT ALL ON TABLE public.subscriptions TO anon; -GRANT ALL ON TABLE public.subscriptions TO authenticated; -GRANT ALL ON TABLE public.subscriptions TO service_role; - - --- --- Name: FUNCTION activate_subscription_from_intent(p_intent_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO anon; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) TO service_role; - - --- --- Name: FUNCTION admin_fix_plan_target(p_plan_key text, p_new_target text); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) FROM PUBLIC; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO postgres; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO anon; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO authenticated; -GRANT ALL ON FUNCTION public.admin_fix_plan_target(p_plan_key text, p_new_target text) TO service_role; - - --- --- Name: FUNCTION agenda_cfg_sync(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO postgres; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO anon; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO authenticated; -GRANT ALL ON FUNCTION public.agenda_cfg_sync() TO service_role; - - --- --- Name: FUNCTION agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO postgres; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO anon; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO authenticated; -GRANT ALL ON FUNCTION public.agendador_dias_disponiveis(p_slug text, p_ano integer, p_mes integer) TO service_role; - - --- --- Name: FUNCTION agendador_gerar_slug(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO postgres; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO anon; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO authenticated; -GRANT ALL ON FUNCTION public.agendador_gerar_slug() TO service_role; - - --- --- Name: FUNCTION agendador_slots_disponiveis(p_slug text, p_data date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO postgres; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO anon; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO authenticated; -GRANT ALL ON FUNCTION public.agendador_slots_disponiveis(p_slug text, p_data date) TO service_role; - - --- --- Name: FUNCTION cancel_recurrence_from(p_recurrence_id uuid, p_from_date date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO postgres; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO anon; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO authenticated; -GRANT ALL ON FUNCTION public.cancel_recurrence_from(p_recurrence_id uuid, p_from_date date) TO service_role; - - --- --- Name: FUNCTION cancel_subscription(p_subscription_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO anon; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.cancel_subscription(p_subscription_id uuid) TO service_role; - - --- --- Name: FUNCTION cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO postgres; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO anon; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO authenticated; -GRANT ALL ON FUNCTION public.cancelar_eventos_serie(p_serie_id uuid, p_a_partir_de timestamp with time zone) TO service_role; - - --- --- Name: FUNCTION cash_dist(money, money); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO postgres; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO anon; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO authenticated; -GRANT ALL ON FUNCTION public.cash_dist(money, money) TO service_role; - - --- --- Name: FUNCTION change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO anon; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.change_subscription_plan(p_subscription_id uuid, p_new_plan_id uuid) TO service_role; - - --- --- Name: FUNCTION citext_cmp(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_cmp(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_eq(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_eq(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_ge(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_ge(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_gt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_gt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_hash(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_hash(public.citext) TO service_role; - - --- --- Name: FUNCTION citext_hash_extended(public.citext, bigint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO postgres; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO anon; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO authenticated; -GRANT ALL ON FUNCTION public.citext_hash_extended(public.citext, bigint) TO service_role; - - --- --- Name: FUNCTION citext_larger(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_larger(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_le(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_le(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_lt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_lt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_ne(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_ne(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_cmp(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_cmp(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_ge(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_ge(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_gt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_gt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_le(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_le(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_pattern_lt(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_pattern_lt(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION citext_smaller(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.citext_smaller(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION create_clinic_tenant(p_name text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO postgres; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO anon; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO authenticated; -GRANT ALL ON FUNCTION public.create_clinic_tenant(p_name text) TO service_role; - - --- --- Name: FUNCTION create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO postgres; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO anon; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO authenticated; -GRANT ALL ON FUNCTION public.create_patient_intake_request(p_token text, p_name text, p_email text, p_phone text, p_notes text, p_consent boolean) TO service_role; - - --- --- Name: FUNCTION create_patient_intake_request_v2(p_token text, p_payload jsonb); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) FROM PUBLIC; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO postgres; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO anon; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO authenticated; -GRANT ALL ON FUNCTION public.create_patient_intake_request_v2(p_token text, p_payload jsonb) TO service_role; - - --- --- Name: FUNCTION create_support_session(p_tenant_id uuid, p_ttl_minutes integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO postgres; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO anon; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO authenticated; -GRANT ALL ON FUNCTION public.create_support_session(p_tenant_id uuid, p_ttl_minutes integer) TO service_role; - - --- --- Name: FUNCTION current_member_id(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.current_member_id(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION current_member_role(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.current_member_role(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION date_dist(date, date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.date_dist(date, date) TO postgres; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO anon; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO authenticated; -GRANT ALL ON FUNCTION public.date_dist(date, date) TO service_role; - - --- --- Name: FUNCTION delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid); Type: ACL; Schema: public; Owner: postgres --- - -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO anon; -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.delete_commitment_full(p_tenant_id uuid, p_commitment_id uuid) TO service_role; - - --- --- Name: FUNCTION delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO anon; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.delete_determined_commitment(p_tenant_id uuid, p_commitment_id uuid) TO service_role; - - --- --- Name: FUNCTION dev_list_auth_users(p_limit integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO postgres; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO anon; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_auth_users(p_limit integer) TO service_role; - - --- --- Name: FUNCTION dev_list_custom_users(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.dev_list_custom_users() FROM PUBLIC; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO postgres; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO anon; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_custom_users() TO service_role; - - --- --- Name: FUNCTION dev_list_intent_leads(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.dev_list_intent_leads() FROM PUBLIC; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO postgres; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO anon; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO authenticated; -GRANT ALL ON FUNCTION public.dev_list_intent_leads() TO service_role; - - --- --- Name: FUNCTION dev_public_debug_snapshot(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO postgres; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO anon; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO authenticated; -GRANT ALL ON FUNCTION public.dev_public_debug_snapshot() TO service_role; - - --- --- Name: FUNCTION ensure_personal_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO postgres; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO anon; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.ensure_personal_tenant() TO service_role; - - --- --- Name: FUNCTION ensure_personal_tenant_for_user(p_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.ensure_personal_tenant_for_user(p_user_id uuid) TO service_role; - - --- --- Name: FUNCTION faq_votar(faq_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO anon; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.faq_votar(faq_id uuid) TO service_role; - - --- --- Name: FUNCTION fix_all_subscription_mismatches(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO postgres; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO anon; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO authenticated; -GRANT ALL ON FUNCTION public.fix_all_subscription_mismatches() TO service_role; - - --- --- Name: FUNCTION float4_dist(real, real); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO postgres; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO anon; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO authenticated; -GRANT ALL ON FUNCTION public.float4_dist(real, real) TO service_role; - - --- --- Name: FUNCTION float8_dist(double precision, double precision); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO postgres; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO anon; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO authenticated; -GRANT ALL ON FUNCTION public.float8_dist(double precision, double precision) TO service_role; - - --- --- Name: FUNCTION fn_agenda_regras_semanais_no_overlap(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO postgres; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO anon; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO authenticated; -GRANT ALL ON FUNCTION public.fn_agenda_regras_semanais_no_overlap() TO service_role; - - --- --- Name: FUNCTION gbt_bit_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_consistent(internal, bit, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_consistent(internal, bit, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bit_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bit_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_consistent(internal, boolean, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_consistent(internal, boolean, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_same(public.gbtreekey2, public.gbtreekey2, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bool_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bool_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bpchar_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bpchar_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bpchar_consistent(internal, character, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bpchar_consistent(internal, character, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_consistent(internal, bytea, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_consistent(internal, bytea, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_bytea_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_bytea_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_consistent(internal, money, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_consistent(internal, money, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_distance(internal, money, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_distance(internal, money, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_cash_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_cash_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_consistent(internal, date, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_consistent(internal, date, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_distance(internal, date, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_distance(internal, date, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_date_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_date_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_consistent(internal, anyenum, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_consistent(internal, anyenum, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_enum_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_enum_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_consistent(internal, real, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_consistent(internal, real, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_distance(internal, real, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_distance(internal, real, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float4_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float4_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_consistent(internal, double precision, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_consistent(internal, double precision, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_distance(internal, double precision, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_distance(internal, double precision, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_float8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_float8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_consistent(internal, inet, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_consistent(internal, inet, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_inet_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_inet_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_consistent(internal, smallint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_consistent(internal, smallint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_distance(internal, smallint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_distance(internal, smallint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_same(public.gbtreekey4, public.gbtreekey4, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int2_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int2_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_consistent(internal, integer, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_consistent(internal, integer, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_distance(internal, integer, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_distance(internal, integer, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int4_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int4_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_consistent(internal, bigint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_consistent(internal, bigint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_distance(internal, bigint, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_distance(internal, bigint, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_int8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_int8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_consistent(internal, interval, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_consistent(internal, interval, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_distance(internal, interval, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_distance(internal, interval, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_same(public.gbtreekey32, public.gbtreekey32, internal) TO service_role; - - --- --- Name: FUNCTION gbt_intv_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_intv_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_consistent(internal, macaddr8, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad8_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad8_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_consistent(internal, macaddr, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_consistent(internal, macaddr, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_macad_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_macad_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_consistent(internal, numeric, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_consistent(internal, numeric, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_numeric_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_numeric_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_consistent(internal, oid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_consistent(internal, oid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_distance(internal, oid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_distance(internal, oid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_same(public.gbtreekey8, public.gbtreekey8, internal) TO service_role; - - --- --- Name: FUNCTION gbt_oid_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_oid_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_consistent(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_same(public.gbtreekey_var, public.gbtreekey_var, internal) TO service_role; - - --- --- Name: FUNCTION gbt_text_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_text_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_consistent(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_consistent(internal, time without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_distance(internal, time without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_distance(internal, time without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_time_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_time_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_timetz_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_timetz_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_timetz_consistent(internal, time with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_consistent(internal, timestamp without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_distance(internal, timestamp without time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_same(public.gbtreekey16, public.gbtreekey16, internal) TO service_role; - - --- --- Name: FUNCTION gbt_ts_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_ts_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_consistent(internal, timestamp with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_tstz_distance(internal, timestamp with time zone, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_compress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_consistent(internal, uuid, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_consistent(internal, uuid, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_fetch(internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_same(public.gbtreekey32, public.gbtreekey32, internal) TO service_role; - - --- --- Name: FUNCTION gbt_uuid_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_uuid_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION gbt_var_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_var_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gbt_var_fetch(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO postgres; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO anon; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gbt_var_fetch(internal) TO service_role; - - --- --- Name: FUNCTION get_my_email(); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.get_my_email() FROM PUBLIC; -GRANT ALL ON FUNCTION public.get_my_email() TO postgres; -GRANT ALL ON FUNCTION public.get_my_email() TO anon; -GRANT ALL ON FUNCTION public.get_my_email() TO authenticated; -GRANT ALL ON FUNCTION public.get_my_email() TO service_role; - - --- --- Name: FUNCTION gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_extract_query_trgm(text, internal, smallint, internal, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gin_extract_value_trgm(text, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_extract_value_trgm(text, internal) TO service_role; - - --- --- Name: FUNCTION gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_trgm_consistent(internal, smallint, text, integer, internal, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gin_trgm_triconsistent(internal, smallint, text, integer, internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_compress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_compress(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_consistent(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_consistent(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_decompress(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_decompress(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_distance(internal, text, smallint, oid, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_distance(internal, text, smallint, oid, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_options(internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_options(internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_penalty(internal, internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_penalty(internal, internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_picksplit(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_picksplit(internal, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_same(public.gtrgm, public.gtrgm, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_same(public.gtrgm, public.gtrgm, internal) TO service_role; - - --- --- Name: FUNCTION gtrgm_union(internal, internal); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO postgres; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO anon; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO authenticated; -GRANT ALL ON FUNCTION public.gtrgm_union(internal, internal) TO service_role; - - --- --- Name: FUNCTION guard_account_type_immutable(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO postgres; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO anon; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO authenticated; -GRANT ALL ON FUNCTION public.guard_account_type_immutable() TO service_role; - - --- --- Name: FUNCTION guard_locked_commitment(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO postgres; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO anon; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO authenticated; -GRANT ALL ON FUNCTION public.guard_locked_commitment() TO service_role; - - --- --- Name: FUNCTION guard_no_change_core_plan_key(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO anon; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_change_core_plan_key() TO service_role; - - --- --- Name: FUNCTION guard_no_change_plan_target(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO anon; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_change_plan_target() TO service_role; - - --- --- Name: FUNCTION guard_no_delete_core_plans(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO postgres; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO anon; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO authenticated; -GRANT ALL ON FUNCTION public.guard_no_delete_core_plans() TO service_role; - - --- --- Name: FUNCTION guard_patient_cannot_own_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO postgres; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO anon; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.guard_patient_cannot_own_tenant() TO service_role; - - --- --- Name: FUNCTION guard_tenant_kind_immutable(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO postgres; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO anon; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO authenticated; -GRANT ALL ON FUNCTION public.guard_tenant_kind_immutable() TO service_role; - - --- --- Name: FUNCTION handle_new_user(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.handle_new_user() TO postgres; -GRANT ALL ON FUNCTION public.handle_new_user() TO anon; -GRANT ALL ON FUNCTION public.handle_new_user() TO authenticated; -GRANT ALL ON FUNCTION public.handle_new_user() TO service_role; - - --- --- Name: FUNCTION handle_new_user_create_personal_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO postgres; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO anon; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.handle_new_user_create_personal_tenant() TO service_role; - - --- --- Name: FUNCTION has_feature(p_owner_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.has_feature(p_owner_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION int2_dist(smallint, smallint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO postgres; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO anon; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO authenticated; -GRANT ALL ON FUNCTION public.int2_dist(smallint, smallint) TO service_role; - - --- --- Name: FUNCTION int4_dist(integer, integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO postgres; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO anon; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO authenticated; -GRANT ALL ON FUNCTION public.int4_dist(integer, integer) TO service_role; - - --- --- Name: FUNCTION int8_dist(bigint, bigint); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO postgres; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO anon; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO authenticated; -GRANT ALL ON FUNCTION public.int8_dist(bigint, bigint) TO service_role; - - --- --- Name: FUNCTION interval_dist(interval, interval); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO postgres; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO anon; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO authenticated; -GRANT ALL ON FUNCTION public.interval_dist(interval, interval) TO service_role; - - --- --- Name: FUNCTION is_clinic_tenant(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_clinic_tenant(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_saas_admin(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_saas_admin() TO postgres; -GRANT ALL ON FUNCTION public.is_saas_admin() TO anon; -GRANT ALL ON FUNCTION public.is_saas_admin() TO authenticated; -GRANT ALL ON FUNCTION public.is_saas_admin() TO service_role; - - --- --- Name: FUNCTION is_tenant_admin(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_tenant_admin(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_tenant_member(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_tenant_member(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION is_therapist_tenant(_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.is_therapist_tenant(_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION jwt_email(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.jwt_email() TO postgres; -GRANT ALL ON FUNCTION public.jwt_email() TO anon; -GRANT ALL ON FUNCTION public.jwt_email() TO authenticated; -GRANT ALL ON FUNCTION public.jwt_email() TO service_role; - - --- --- Name: FUNCTION my_tenants(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.my_tenants() TO postgres; -GRANT ALL ON FUNCTION public.my_tenants() TO anon; -GRANT ALL ON FUNCTION public.my_tenants() TO authenticated; -GRANT ALL ON FUNCTION public.my_tenants() TO service_role; - - --- --- Name: FUNCTION oid_dist(oid, oid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO postgres; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO anon; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO authenticated; -GRANT ALL ON FUNCTION public.oid_dist(oid, oid) TO service_role; - - --- --- Name: FUNCTION on_new_user_seed_patient_groups(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO postgres; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO anon; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO authenticated; -GRANT ALL ON FUNCTION public.on_new_user_seed_patient_groups() TO service_role; - - --- --- Name: FUNCTION patients_validate_member_consistency(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO postgres; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO anon; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO authenticated; -GRANT ALL ON FUNCTION public.patients_validate_member_consistency() TO service_role; - - --- --- Name: FUNCTION patients_validate_responsible_member_tenant(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO postgres; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO anon; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO authenticated; -GRANT ALL ON FUNCTION public.patients_validate_responsible_member_tenant() TO service_role; - - --- --- Name: FUNCTION prevent_promoting_to_system(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO postgres; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO anon; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_promoting_to_system() TO service_role; - - --- --- Name: FUNCTION prevent_saas_membership(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO postgres; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO anon; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_saas_membership() TO service_role; - - --- --- Name: FUNCTION prevent_system_group_changes(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO postgres; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO anon; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO authenticated; -GRANT ALL ON FUNCTION public.prevent_system_group_changes() TO service_role; - - --- --- Name: FUNCTION provision_account_tenant(p_user_id uuid, p_kind text, p_name text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO postgres; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO anon; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO authenticated; -GRANT ALL ON FUNCTION public.provision_account_tenant(p_user_id uuid, p_kind text, p_name text) TO service_role; - - --- --- Name: FUNCTION reactivate_subscription(p_subscription_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO anon; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.reactivate_subscription(p_subscription_id uuid) TO service_role; - - --- --- Name: FUNCTION rebuild_owner_entitlements(p_owner_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO anon; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.rebuild_owner_entitlements(p_owner_id uuid) TO service_role; - - --- --- Name: FUNCTION regexp_match(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_match(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_match(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_matches(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_matches(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_matches(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_replace(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_replace(public.citext, public.citext, text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_replace(public.citext, public.citext, text, text) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_array(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_array(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_array(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_table(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION regexp_split_to_table(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.regexp_split_to_table(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION replace(public.citext, public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.replace(public.citext, public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION revoke_support_session(p_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO postgres; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO anon; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO authenticated; -GRANT ALL ON FUNCTION public.revoke_support_session(p_token text) TO service_role; - - --- --- Name: FUNCTION rotate_patient_invite_token(p_new_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO postgres; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO anon; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO authenticated; -GRANT ALL ON FUNCTION public.rotate_patient_invite_token(p_new_token text) TO service_role; - - --- --- Name: FUNCTION saas_votar_doc(p_doc_id uuid, p_util boolean); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO postgres; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO anon; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO authenticated; -GRANT ALL ON FUNCTION public.saas_votar_doc(p_doc_id uuid, p_util boolean) TO service_role; - - --- --- Name: FUNCTION seed_determined_commitments(p_tenant_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO anon; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.seed_determined_commitments(p_tenant_id uuid) TO service_role; - - --- --- Name: FUNCTION set_insurance_plans_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_insurance_plans_updated_at() TO service_role; - - --- --- Name: FUNCTION set_limit(real); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_limit(real) TO postgres; -GRANT ALL ON FUNCTION public.set_limit(real) TO anon; -GRANT ALL ON FUNCTION public.set_limit(real) TO authenticated; -GRANT ALL ON FUNCTION public.set_limit(real) TO service_role; - - --- --- Name: FUNCTION set_owner_id(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_owner_id() TO postgres; -GRANT ALL ON FUNCTION public.set_owner_id() TO anon; -GRANT ALL ON FUNCTION public.set_owner_id() TO authenticated; -GRANT ALL ON FUNCTION public.set_owner_id() TO service_role; - - --- --- Name: FUNCTION set_services_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_services_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_services_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_services_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_services_updated_at() TO service_role; - - --- --- Name: FUNCTION set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO postgres; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO anon; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO authenticated; -GRANT ALL ON FUNCTION public.set_tenant_feature_exception(p_tenant_id uuid, p_feature_key text, p_enabled boolean, p_reason text) TO service_role; - - --- --- Name: FUNCTION set_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.set_updated_at() TO anon; -GRANT ALL ON FUNCTION public.set_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.set_updated_at() TO service_role; - - --- --- Name: FUNCTION set_updated_at_recurrence(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO postgres; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO anon; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO authenticated; -GRANT ALL ON FUNCTION public.set_updated_at_recurrence() TO service_role; - - --- --- Name: FUNCTION show_limit(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.show_limit() TO postgres; -GRANT ALL ON FUNCTION public.show_limit() TO anon; -GRANT ALL ON FUNCTION public.show_limit() TO authenticated; -GRANT ALL ON FUNCTION public.show_limit() TO service_role; - - --- --- Name: FUNCTION show_trgm(text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.show_trgm(text) TO postgres; -GRANT ALL ON FUNCTION public.show_trgm(text) TO anon; -GRANT ALL ON FUNCTION public.show_trgm(text) TO authenticated; -GRANT ALL ON FUNCTION public.show_trgm(text) TO service_role; - - --- --- Name: FUNCTION similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity(text, text) TO service_role; - - --- --- Name: FUNCTION similarity_dist(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity_dist(text, text) TO service_role; - - --- --- Name: FUNCTION similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION split_part(public.citext, public.citext, integer); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO postgres; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO anon; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO authenticated; -GRANT ALL ON FUNCTION public.split_part(public.citext, public.citext, integer) TO service_role; - - --- --- Name: FUNCTION split_recurrence_at(p_recurrence_id uuid, p_from_date date); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO postgres; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO anon; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO authenticated; -GRANT ALL ON FUNCTION public.split_recurrence_at(p_recurrence_id uuid, p_from_date date) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_dist_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_dist_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_dist_op(text, text) TO service_role; - - --- --- Name: FUNCTION strict_word_similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.strict_word_similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION strpos(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.strpos(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION subscription_intents_view_insert(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO postgres; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO anon; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO authenticated; -GRANT ALL ON FUNCTION public.subscription_intents_view_insert() TO service_role; - - --- --- Name: FUNCTION subscriptions_validate_scope(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO postgres; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO anon; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO authenticated; -GRANT ALL ON FUNCTION public.subscriptions_validate_scope() TO service_role; - - --- --- Name: FUNCTION sync_busy_mirror_agenda_eventos(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO postgres; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO anon; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO authenticated; -GRANT ALL ON FUNCTION public.sync_busy_mirror_agenda_eventos() TO service_role; - - --- --- Name: FUNCTION tenant_accept_invite(p_token uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_accept_invite(p_token uuid) TO service_role; - - --- --- Name: TABLE tenant_members; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_members TO postgres; -GRANT SELECT,REFERENCES,TRIGGER,TRUNCATE,MAINTAIN ON TABLE public.tenant_members TO authenticated; -GRANT ALL ON TABLE public.tenant_members TO service_role; - - --- --- Name: FUNCTION tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_add_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_feature_allowed(p_tenant_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_feature_allowed(p_tenant_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION tenant_feature_enabled(p_tenant_id uuid, p_feature_key text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO anon; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_feature_enabled(p_tenant_id uuid, p_feature_key text) TO service_role; - - --- --- Name: FUNCTION tenant_features_guard_with_plan(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO postgres; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO anon; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO authenticated; -GRANT ALL ON FUNCTION public.tenant_features_guard_with_plan() TO service_role; - - --- --- Name: FUNCTION tenant_has_feature(_tenant_id uuid, _feature text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO anon; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_has_feature(_tenant_id uuid, _feature text) TO service_role; - - --- --- Name: FUNCTION tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -REVOKE ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) FROM PUBLIC; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_invite_member_by_email(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_reactivate_member(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_remove_member(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO postgres; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO anon; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_remove_member_soft(p_tenant_id uuid, p_member_user_id uuid) TO service_role; - - --- --- Name: FUNCTION tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_revoke_invite(p_tenant_id uuid, p_email text, p_role text) TO service_role; - - --- --- Name: FUNCTION tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO anon; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_set_member_status(p_tenant_id uuid, p_member_user_id uuid, p_new_status text) TO service_role; - - --- --- Name: FUNCTION tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO postgres; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO anon; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO authenticated; -GRANT ALL ON FUNCTION public.tenant_update_member_role(p_tenant_id uuid, p_member_user_id uuid, p_new_role text) TO service_role; - - --- --- Name: FUNCTION texticlike(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticlike(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticlike(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticlike(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticnlike(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticnlike(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticnlike(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticregexeq(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticregexeq(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexeq(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION texticregexne(public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, text) TO service_role; - - --- --- Name: FUNCTION texticregexne(public.citext, public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO postgres; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO anon; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.texticregexne(public.citext, public.citext) TO service_role; - - --- --- Name: FUNCTION time_dist(time without time zone, time without time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO postgres; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO anon; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO authenticated; -GRANT ALL ON FUNCTION public.time_dist(time without time zone, time without time zone) TO service_role; - - --- --- Name: FUNCTION toggle_plan(owner uuid); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO postgres; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO anon; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO authenticated; -GRANT ALL ON FUNCTION public.toggle_plan(owner uuid) TO service_role; - - --- --- Name: FUNCTION transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO postgres; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO anon; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO authenticated; -GRANT ALL ON FUNCTION public.transition_subscription(p_subscription_id uuid, p_to_status text, p_reason text, p_metadata jsonb) TO service_role; - - --- --- Name: FUNCTION translate(public.citext, public.citext, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO postgres; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO anon; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO authenticated; -GRANT ALL ON FUNCTION public.translate(public.citext, public.citext, text) TO service_role; - - --- --- Name: FUNCTION ts_dist(timestamp without time zone, timestamp without time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO postgres; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO anon; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO authenticated; -GRANT ALL ON FUNCTION public.ts_dist(timestamp without time zone, timestamp without time zone) TO service_role; - - --- --- Name: FUNCTION tstz_dist(timestamp with time zone, timestamp with time zone); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO postgres; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO anon; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO authenticated; -GRANT ALL ON FUNCTION public.tstz_dist(timestamp with time zone, timestamp with time zone) TO service_role; - - --- --- Name: FUNCTION update_payment_settings_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO anon; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.update_payment_settings_updated_at() TO service_role; - - --- --- Name: FUNCTION update_professional_pricing_updated_at(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO postgres; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO anon; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO authenticated; -GRANT ALL ON FUNCTION public.update_professional_pricing_updated_at() TO service_role; - - --- --- Name: FUNCTION user_has_feature(_user_id uuid, _feature text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO postgres; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO anon; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO authenticated; -GRANT ALL ON FUNCTION public.user_has_feature(_user_id uuid, _feature text) TO service_role; - - --- --- Name: FUNCTION validate_support_session(p_token text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO postgres; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO anon; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO authenticated; -GRANT ALL ON FUNCTION public.validate_support_session(p_token text) TO service_role; - - --- --- Name: FUNCTION whoami(); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.whoami() TO postgres; -GRANT ALL ON FUNCTION public.whoami() TO anon; -GRANT ALL ON FUNCTION public.whoami() TO authenticated; -GRANT ALL ON FUNCTION public.whoami() TO service_role; - - --- --- Name: FUNCTION word_similarity(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_dist_commutator_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_dist_commutator_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_dist_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_dist_op(text, text) TO service_role; - - --- --- Name: FUNCTION word_similarity_op(text, text); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO postgres; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO anon; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO authenticated; -GRANT ALL ON FUNCTION public.word_similarity_op(text, text) TO service_role; - - --- --- Name: FUNCTION apply_rls(wal jsonb, max_record_bytes integer); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO postgres; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO anon; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO authenticated; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO service_role; -GRANT ALL ON FUNCTION realtime.apply_rls(wal jsonb, max_record_bytes integer) TO supabase_realtime_admin; - - --- --- Name: FUNCTION broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) TO postgres; -GRANT ALL ON FUNCTION realtime.broadcast_changes(topic_name text, event_name text, operation text, table_name text, table_schema text, new record, old record, level text) TO dashboard_user; - - --- --- Name: FUNCTION build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO postgres; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO anon; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO authenticated; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO service_role; -GRANT ALL ON FUNCTION realtime.build_prepared_statement_sql(prepared_statement_name text, entity regclass, columns realtime.wal_column[]) TO supabase_realtime_admin; - - --- --- Name: FUNCTION "cast"(val text, type_ regtype); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO postgres; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO dashboard_user; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO anon; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO authenticated; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO service_role; -GRANT ALL ON FUNCTION realtime."cast"(val text, type_ regtype) TO supabase_realtime_admin; - - --- --- Name: FUNCTION check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO postgres; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO anon; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO authenticated; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO service_role; -GRANT ALL ON FUNCTION realtime.check_equality_op(op realtime.equality_op, type_ regtype, val_1 text, val_2 text) TO supabase_realtime_admin; - - --- --- Name: FUNCTION is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO postgres; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO anon; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO authenticated; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO service_role; -GRANT ALL ON FUNCTION realtime.is_visible_through_filters(columns realtime.wal_column[], filters realtime.user_defined_filter[]) TO supabase_realtime_admin; - - --- --- Name: FUNCTION list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO postgres; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO anon; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO authenticated; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO service_role; -GRANT ALL ON FUNCTION realtime.list_changes(publication name, slot_name name, max_changes integer, max_record_bytes integer) TO supabase_realtime_admin; - - --- --- Name: FUNCTION quote_wal2json(entity regclass); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO postgres; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO anon; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO authenticated; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO service_role; -GRANT ALL ON FUNCTION realtime.quote_wal2json(entity regclass) TO supabase_realtime_admin; - - --- --- Name: FUNCTION send(payload jsonb, event text, topic text, private boolean); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) TO postgres; -GRANT ALL ON FUNCTION realtime.send(payload jsonb, event text, topic text, private boolean) TO dashboard_user; - - --- --- Name: FUNCTION subscription_check_filters(); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO postgres; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO dashboard_user; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO anon; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO authenticated; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO service_role; -GRANT ALL ON FUNCTION realtime.subscription_check_filters() TO supabase_realtime_admin; - - --- --- Name: FUNCTION to_regrole(role_name text); Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO postgres; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO dashboard_user; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO anon; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO authenticated; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO service_role; -GRANT ALL ON FUNCTION realtime.to_regrole(role_name text) TO supabase_realtime_admin; - - --- --- Name: FUNCTION topic(); Type: ACL; Schema: realtime; Owner: supabase_realtime_admin --- - -GRANT ALL ON FUNCTION realtime.topic() TO postgres; -GRANT ALL ON FUNCTION realtime.topic() TO dashboard_user; - - --- --- Name: FUNCTION http_request(); Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -REVOKE ALL ON FUNCTION supabase_functions.http_request() FROM PUBLIC; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO postgres; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO anon; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO authenticated; -GRANT ALL ON FUNCTION supabase_functions.http_request() TO service_role; - - --- --- Name: FUNCTION _crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault._crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault._crypto_aead_det_decrypt(message bytea, additional bytea, key_id bigint, context bytea, nonce bytea) TO service_role; - - --- --- Name: FUNCTION create_secret(new_secret text, new_name text, new_description text, new_key_id uuid); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault.create_secret(new_secret text, new_name text, new_description text, new_key_id uuid) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault.create_secret(new_secret text, new_name text, new_description text, new_key_id uuid) TO service_role; - - --- --- Name: FUNCTION update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid); Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION vault.update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid) TO postgres WITH GRANT OPTION; -GRANT ALL ON FUNCTION vault.update_secret(secret_id uuid, new_secret text, new_name text, new_description text, new_key_id uuid) TO service_role; - - --- --- Name: FUNCTION max(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.max(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.max(public.citext) TO anon; -GRANT ALL ON FUNCTION public.max(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.max(public.citext) TO service_role; - - --- --- Name: FUNCTION min(public.citext); Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON FUNCTION public.min(public.citext) TO postgres; -GRANT ALL ON FUNCTION public.min(public.citext) TO anon; -GRANT ALL ON FUNCTION public.min(public.citext) TO authenticated; -GRANT ALL ON FUNCTION public.min(public.citext) TO service_role; - - --- --- Name: TABLE audit_log_entries; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.audit_log_entries TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.audit_log_entries TO postgres; -GRANT SELECT ON TABLE auth.audit_log_entries TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE flow_state; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.flow_state TO postgres; -GRANT SELECT ON TABLE auth.flow_state TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.flow_state TO dashboard_user; - - --- --- Name: TABLE identities; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.identities TO postgres; -GRANT SELECT ON TABLE auth.identities TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.identities TO dashboard_user; - - --- --- Name: TABLE instances; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.instances TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.instances TO postgres; -GRANT SELECT ON TABLE auth.instances TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE mfa_amr_claims; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_amr_claims TO postgres; -GRANT SELECT ON TABLE auth.mfa_amr_claims TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_amr_claims TO dashboard_user; - - --- --- Name: TABLE mfa_challenges; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_challenges TO postgres; -GRANT SELECT ON TABLE auth.mfa_challenges TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_challenges TO dashboard_user; - - --- --- Name: TABLE mfa_factors; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.mfa_factors TO postgres; -GRANT SELECT ON TABLE auth.mfa_factors TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.mfa_factors TO dashboard_user; - - --- --- Name: TABLE oauth_authorizations; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_authorizations TO postgres; -GRANT ALL ON TABLE auth.oauth_authorizations TO dashboard_user; - - --- --- Name: TABLE oauth_client_states; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_client_states TO postgres; -GRANT ALL ON TABLE auth.oauth_client_states TO dashboard_user; - - --- --- Name: TABLE oauth_clients; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_clients TO postgres; -GRANT ALL ON TABLE auth.oauth_clients TO dashboard_user; - - --- --- Name: TABLE oauth_consents; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.oauth_consents TO postgres; -GRANT ALL ON TABLE auth.oauth_consents TO dashboard_user; - - --- --- Name: TABLE one_time_tokens; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.one_time_tokens TO postgres; -GRANT SELECT ON TABLE auth.one_time_tokens TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.one_time_tokens TO dashboard_user; - - --- --- Name: TABLE refresh_tokens; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.refresh_tokens TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.refresh_tokens TO postgres; -GRANT SELECT ON TABLE auth.refresh_tokens TO postgres WITH GRANT OPTION; - - --- --- Name: SEQUENCE refresh_tokens_id_seq; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO dashboard_user; -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO postgres; - - --- --- Name: TABLE saml_providers; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.saml_providers TO postgres; -GRANT SELECT ON TABLE auth.saml_providers TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.saml_providers TO dashboard_user; - - --- --- Name: TABLE saml_relay_states; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.saml_relay_states TO postgres; -GRANT SELECT ON TABLE auth.saml_relay_states TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.saml_relay_states TO dashboard_user; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT SELECT ON TABLE auth.schema_migrations TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE sessions; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sessions TO postgres; -GRANT SELECT ON TABLE auth.sessions TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sessions TO dashboard_user; - - --- --- Name: TABLE sso_domains; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sso_domains TO postgres; -GRANT SELECT ON TABLE auth.sso_domains TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sso_domains TO dashboard_user; - - --- --- Name: TABLE sso_providers; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.sso_providers TO postgres; -GRANT SELECT ON TABLE auth.sso_providers TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE auth.sso_providers TO dashboard_user; - - --- --- Name: TABLE users; Type: ACL; Schema: auth; Owner: supabase_auth_admin --- - -GRANT ALL ON TABLE auth.users TO dashboard_user; -GRANT INSERT,REFERENCES,DELETE,TRIGGER,TRUNCATE,MAINTAIN,UPDATE ON TABLE auth.users TO postgres; -GRANT SELECT ON TABLE auth.users TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE pg_stat_statements; Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON TABLE extensions.pg_stat_statements TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE pg_stat_statements_info; Type: ACL; Schema: extensions; Owner: supabase_admin --- - -GRANT ALL ON TABLE extensions.pg_stat_statements_info TO postgres WITH GRANT OPTION; - - --- --- Name: TABLE agenda_bloqueios; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_bloqueios TO postgres; -GRANT ALL ON TABLE public.agenda_bloqueios TO anon; -GRANT ALL ON TABLE public.agenda_bloqueios TO authenticated; -GRANT ALL ON TABLE public.agenda_bloqueios TO service_role; - - --- --- Name: TABLE agenda_configuracoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_configuracoes TO postgres; -GRANT ALL ON TABLE public.agenda_configuracoes TO anon; -GRANT ALL ON TABLE public.agenda_configuracoes TO authenticated; -GRANT ALL ON TABLE public.agenda_configuracoes TO service_role; - - --- --- Name: TABLE agenda_eventos; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_eventos TO postgres; -GRANT ALL ON TABLE public.agenda_eventos TO anon; -GRANT ALL ON TABLE public.agenda_eventos TO authenticated; -GRANT ALL ON TABLE public.agenda_eventos TO service_role; - - --- --- Name: TABLE agenda_excecoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_excecoes TO postgres; -GRANT ALL ON TABLE public.agenda_excecoes TO anon; -GRANT ALL ON TABLE public.agenda_excecoes TO authenticated; -GRANT ALL ON TABLE public.agenda_excecoes TO service_role; - - --- --- Name: TABLE agenda_online_slots; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_online_slots TO postgres; -GRANT ALL ON TABLE public.agenda_online_slots TO anon; -GRANT ALL ON TABLE public.agenda_online_slots TO authenticated; -GRANT ALL ON TABLE public.agenda_online_slots TO service_role; - - --- --- Name: SEQUENCE agenda_online_slots_id_seq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO postgres; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO anon; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO authenticated; -GRANT ALL ON SEQUENCE public.agenda_online_slots_id_seq TO service_role; - - --- --- Name: TABLE agenda_regras_semanais; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_regras_semanais TO postgres; -GRANT ALL ON TABLE public.agenda_regras_semanais TO anon; -GRANT ALL ON TABLE public.agenda_regras_semanais TO authenticated; -GRANT ALL ON TABLE public.agenda_regras_semanais TO service_role; - - --- --- Name: TABLE agenda_slots_bloqueados_semanais; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO postgres; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO anon; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO authenticated; -GRANT ALL ON TABLE public.agenda_slots_bloqueados_semanais TO service_role; - - --- --- Name: TABLE agenda_slots_regras; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agenda_slots_regras TO postgres; -GRANT ALL ON TABLE public.agenda_slots_regras TO anon; -GRANT ALL ON TABLE public.agenda_slots_regras TO authenticated; -GRANT ALL ON TABLE public.agenda_slots_regras TO service_role; - - --- --- Name: TABLE agendador_configuracoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agendador_configuracoes TO postgres; -GRANT ALL ON TABLE public.agendador_configuracoes TO anon; -GRANT ALL ON TABLE public.agendador_configuracoes TO authenticated; -GRANT ALL ON TABLE public.agendador_configuracoes TO service_role; - - --- --- Name: TABLE agendador_solicitacoes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.agendador_solicitacoes TO postgres; -GRANT ALL ON TABLE public.agendador_solicitacoes TO anon; -GRANT ALL ON TABLE public.agendador_solicitacoes TO authenticated; -GRANT ALL ON TABLE public.agendador_solicitacoes TO service_role; - - --- --- Name: TABLE billing_contracts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.billing_contracts TO postgres; -GRANT ALL ON TABLE public.billing_contracts TO anon; -GRANT ALL ON TABLE public.billing_contracts TO authenticated; -GRANT ALL ON TABLE public.billing_contracts TO service_role; - - --- --- Name: TABLE commitment_services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.commitment_services TO postgres; -GRANT ALL ON TABLE public.commitment_services TO anon; -GRANT ALL ON TABLE public.commitment_services TO authenticated; -GRANT ALL ON TABLE public.commitment_services TO service_role; - - --- --- Name: TABLE commitment_time_logs; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.commitment_time_logs TO postgres; -GRANT ALL ON TABLE public.commitment_time_logs TO anon; -GRANT ALL ON TABLE public.commitment_time_logs TO authenticated; -GRANT ALL ON TABLE public.commitment_time_logs TO service_role; - - --- --- Name: TABLE current_tenant_id; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.current_tenant_id TO postgres; -GRANT ALL ON TABLE public.current_tenant_id TO anon; -GRANT ALL ON TABLE public.current_tenant_id TO authenticated; -GRANT ALL ON TABLE public.current_tenant_id TO service_role; - - --- --- Name: TABLE determined_commitment_fields; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.determined_commitment_fields TO postgres; -GRANT ALL ON TABLE public.determined_commitment_fields TO anon; -GRANT ALL ON TABLE public.determined_commitment_fields TO authenticated; -GRANT ALL ON TABLE public.determined_commitment_fields TO service_role; - - --- --- Name: TABLE determined_commitments; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.determined_commitments TO postgres; -GRANT ALL ON TABLE public.determined_commitments TO anon; -GRANT ALL ON TABLE public.determined_commitments TO authenticated; -GRANT ALL ON TABLE public.determined_commitments TO service_role; - - --- --- Name: TABLE dev_user_credentials; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.dev_user_credentials TO postgres; -GRANT ALL ON TABLE public.dev_user_credentials TO anon; -GRANT ALL ON TABLE public.dev_user_credentials TO authenticated; -GRANT ALL ON TABLE public.dev_user_credentials TO service_role; - - --- --- Name: TABLE entitlements_invalidation; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.entitlements_invalidation TO postgres; -GRANT ALL ON TABLE public.entitlements_invalidation TO anon; -GRANT ALL ON TABLE public.entitlements_invalidation TO authenticated; -GRANT ALL ON TABLE public.entitlements_invalidation TO service_role; - - --- --- Name: TABLE features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.features TO postgres; -GRANT ALL ON TABLE public.features TO anon; -GRANT ALL ON TABLE public.features TO authenticated; -GRANT ALL ON TABLE public.features TO service_role; - - --- --- Name: TABLE feriados; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.feriados TO postgres; -GRANT ALL ON TABLE public.feriados TO anon; -GRANT ALL ON TABLE public.feriados TO authenticated; -GRANT ALL ON TABLE public.feriados TO service_role; - - --- --- Name: TABLE financial_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.financial_exceptions TO postgres; -GRANT ALL ON TABLE public.financial_exceptions TO anon; -GRANT ALL ON TABLE public.financial_exceptions TO authenticated; -GRANT ALL ON TABLE public.financial_exceptions TO service_role; - - --- --- Name: TABLE insurance_plan_services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.insurance_plan_services TO postgres; -GRANT ALL ON TABLE public.insurance_plan_services TO anon; -GRANT ALL ON TABLE public.insurance_plan_services TO authenticated; -GRANT ALL ON TABLE public.insurance_plan_services TO service_role; - - --- --- Name: TABLE insurance_plans; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.insurance_plans TO postgres; -GRANT ALL ON TABLE public.insurance_plans TO anon; -GRANT ALL ON TABLE public.insurance_plans TO authenticated; -GRANT ALL ON TABLE public.insurance_plans TO service_role; - - --- --- Name: TABLE module_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.module_features TO postgres; -GRANT ALL ON TABLE public.module_features TO anon; -GRANT ALL ON TABLE public.module_features TO authenticated; -GRANT ALL ON TABLE public.module_features TO service_role; - - --- --- Name: TABLE modules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.modules TO postgres; -GRANT ALL ON TABLE public.modules TO anon; -GRANT ALL ON TABLE public.modules TO authenticated; -GRANT ALL ON TABLE public.modules TO service_role; - - --- --- Name: TABLE plan_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_features TO postgres; -GRANT ALL ON TABLE public.plan_features TO anon; -GRANT ALL ON TABLE public.plan_features TO authenticated; -GRANT ALL ON TABLE public.plan_features TO service_role; - - --- --- Name: TABLE tenant_modules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_modules TO postgres; -GRANT ALL ON TABLE public.tenant_modules TO anon; -GRANT ALL ON TABLE public.tenant_modules TO authenticated; -GRANT ALL ON TABLE public.tenant_modules TO service_role; - - --- --- Name: TABLE owner_feature_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.owner_feature_entitlements TO postgres; -GRANT ALL ON TABLE public.owner_feature_entitlements TO anon; -GRANT ALL ON TABLE public.owner_feature_entitlements TO authenticated; -GRANT ALL ON TABLE public.owner_feature_entitlements TO service_role; - - --- --- Name: TABLE owner_users; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.owner_users TO postgres; -GRANT ALL ON TABLE public.owner_users TO anon; -GRANT ALL ON TABLE public.owner_users TO authenticated; -GRANT ALL ON TABLE public.owner_users TO service_role; - - --- --- Name: TABLE patient_discounts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_discounts TO postgres; -GRANT ALL ON TABLE public.patient_discounts TO anon; -GRANT ALL ON TABLE public.patient_discounts TO authenticated; -GRANT ALL ON TABLE public.patient_discounts TO service_role; - - --- --- Name: TABLE patient_group_patient; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_group_patient TO postgres; -GRANT ALL ON TABLE public.patient_group_patient TO anon; -GRANT ALL ON TABLE public.patient_group_patient TO authenticated; -GRANT ALL ON TABLE public.patient_group_patient TO service_role; - - --- --- Name: TABLE patient_groups; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_groups TO postgres; -GRANT ALL ON TABLE public.patient_groups TO anon; -GRANT ALL ON TABLE public.patient_groups TO authenticated; -GRANT ALL ON TABLE public.patient_groups TO service_role; - - --- --- Name: TABLE patient_intake_requests; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_intake_requests TO postgres; -GRANT ALL ON TABLE public.patient_intake_requests TO authenticated; -GRANT ALL ON TABLE public.patient_intake_requests TO service_role; - - --- --- Name: TABLE patient_invites; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_invites TO postgres; -GRANT ALL ON TABLE public.patient_invites TO authenticated; -GRANT ALL ON TABLE public.patient_invites TO service_role; - - --- --- Name: TABLE patient_patient_tag; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_patient_tag TO postgres; -GRANT ALL ON TABLE public.patient_patient_tag TO anon; -GRANT ALL ON TABLE public.patient_patient_tag TO authenticated; -GRANT ALL ON TABLE public.patient_patient_tag TO service_role; - - --- --- Name: TABLE patient_tags; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patient_tags TO postgres; -GRANT ALL ON TABLE public.patient_tags TO anon; -GRANT ALL ON TABLE public.patient_tags TO authenticated; -GRANT ALL ON TABLE public.patient_tags TO service_role; - - --- --- Name: TABLE patients; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.patients TO postgres; -GRANT ALL ON TABLE public.patients TO anon; -GRANT ALL ON TABLE public.patients TO authenticated; -GRANT ALL ON TABLE public.patients TO service_role; - - --- --- Name: TABLE payment_settings; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.payment_settings TO postgres; -GRANT ALL ON TABLE public.payment_settings TO anon; -GRANT ALL ON TABLE public.payment_settings TO authenticated; -GRANT ALL ON TABLE public.payment_settings TO service_role; - - --- --- Name: TABLE plan_prices; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_prices TO postgres; -GRANT ALL ON TABLE public.plan_prices TO anon; -GRANT ALL ON TABLE public.plan_prices TO authenticated; -GRANT ALL ON TABLE public.plan_prices TO service_role; - - --- --- Name: TABLE plan_public; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_public TO postgres; -GRANT ALL ON TABLE public.plan_public TO anon; -GRANT ALL ON TABLE public.plan_public TO authenticated; -GRANT ALL ON TABLE public.plan_public TO service_role; - - --- --- Name: TABLE plan_public_bullets; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plan_public_bullets TO postgres; -GRANT ALL ON TABLE public.plan_public_bullets TO anon; -GRANT ALL ON TABLE public.plan_public_bullets TO authenticated; -GRANT ALL ON TABLE public.plan_public_bullets TO service_role; - - --- --- Name: TABLE plans; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.plans TO postgres; -GRANT ALL ON TABLE public.plans TO anon; -GRANT ALL ON TABLE public.plans TO authenticated; -GRANT ALL ON TABLE public.plans TO service_role; - - --- --- Name: TABLE professional_pricing; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.professional_pricing TO postgres; -GRANT ALL ON TABLE public.professional_pricing TO anon; -GRANT ALL ON TABLE public.professional_pricing TO authenticated; -GRANT ALL ON TABLE public.professional_pricing TO service_role; - - --- --- Name: TABLE profiles; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.profiles TO postgres; -GRANT ALL ON TABLE public.profiles TO anon; -GRANT ALL ON TABLE public.profiles TO authenticated; -GRANT ALL ON TABLE public.profiles TO service_role; - - --- --- Name: TABLE recurrence_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_exceptions TO postgres; -GRANT ALL ON TABLE public.recurrence_exceptions TO anon; -GRANT ALL ON TABLE public.recurrence_exceptions TO authenticated; -GRANT ALL ON TABLE public.recurrence_exceptions TO service_role; - - --- --- Name: TABLE recurrence_rule_services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_rule_services TO postgres; -GRANT ALL ON TABLE public.recurrence_rule_services TO anon; -GRANT ALL ON TABLE public.recurrence_rule_services TO authenticated; -GRANT ALL ON TABLE public.recurrence_rule_services TO service_role; - - --- --- Name: TABLE recurrence_rules; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.recurrence_rules TO postgres; -GRANT ALL ON TABLE public.recurrence_rules TO anon; -GRANT ALL ON TABLE public.recurrence_rules TO authenticated; -GRANT ALL ON TABLE public.recurrence_rules TO service_role; - - --- --- Name: TABLE saas_admins; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_admins TO postgres; -GRANT ALL ON TABLE public.saas_admins TO anon; -GRANT ALL ON TABLE public.saas_admins TO authenticated; -GRANT ALL ON TABLE public.saas_admins TO service_role; - - --- --- Name: TABLE saas_doc_votos; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_doc_votos TO postgres; -GRANT ALL ON TABLE public.saas_doc_votos TO anon; -GRANT ALL ON TABLE public.saas_doc_votos TO authenticated; -GRANT ALL ON TABLE public.saas_doc_votos TO service_role; - - --- --- Name: TABLE saas_docs; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_docs TO postgres; -GRANT ALL ON TABLE public.saas_docs TO anon; -GRANT ALL ON TABLE public.saas_docs TO authenticated; -GRANT ALL ON TABLE public.saas_docs TO service_role; - - --- --- Name: TABLE saas_faq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_faq TO postgres; -GRANT ALL ON TABLE public.saas_faq TO anon; -GRANT ALL ON TABLE public.saas_faq TO authenticated; -GRANT ALL ON TABLE public.saas_faq TO service_role; - - --- --- Name: TABLE saas_faq_itens; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.saas_faq_itens TO postgres; -GRANT ALL ON TABLE public.saas_faq_itens TO anon; -GRANT ALL ON TABLE public.saas_faq_itens TO authenticated; -GRANT ALL ON TABLE public.saas_faq_itens TO service_role; - - --- --- Name: TABLE services; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.services TO postgres; -GRANT ALL ON TABLE public.services TO anon; -GRANT ALL ON TABLE public.services TO authenticated; -GRANT ALL ON TABLE public.services TO service_role; - - --- --- Name: TABLE subscription_events; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_events TO postgres; -GRANT ALL ON TABLE public.subscription_events TO anon; -GRANT ALL ON TABLE public.subscription_events TO authenticated; -GRANT ALL ON TABLE public.subscription_events TO service_role; - - --- --- Name: TABLE subscription_intents_personal; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_personal TO postgres; -GRANT ALL ON TABLE public.subscription_intents_personal TO anon; -GRANT ALL ON TABLE public.subscription_intents_personal TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_personal TO service_role; - - --- --- Name: TABLE subscription_intents_tenant; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_tenant TO postgres; -GRANT ALL ON TABLE public.subscription_intents_tenant TO anon; -GRANT ALL ON TABLE public.subscription_intents_tenant TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_tenant TO service_role; - - --- --- Name: TABLE subscription_intents; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents TO postgres; -GRANT ALL ON TABLE public.subscription_intents TO anon; -GRANT ALL ON TABLE public.subscription_intents TO authenticated; -GRANT ALL ON TABLE public.subscription_intents TO service_role; - - --- --- Name: TABLE subscription_intents_legacy; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.subscription_intents_legacy TO postgres; -GRANT ALL ON TABLE public.subscription_intents_legacy TO anon; -GRANT ALL ON TABLE public.subscription_intents_legacy TO authenticated; -GRANT ALL ON TABLE public.subscription_intents_legacy TO service_role; - - --- --- Name: TABLE support_sessions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.support_sessions TO postgres; -GRANT ALL ON TABLE public.support_sessions TO anon; -GRANT ALL ON TABLE public.support_sessions TO authenticated; -GRANT ALL ON TABLE public.support_sessions TO service_role; - - --- --- Name: TABLE tenant_feature_exceptions_log; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO postgres; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO anon; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO authenticated; -GRANT ALL ON TABLE public.tenant_feature_exceptions_log TO service_role; - - --- --- Name: TABLE tenant_features; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_features TO postgres; -GRANT ALL ON TABLE public.tenant_features TO anon; -GRANT ALL ON TABLE public.tenant_features TO authenticated; -GRANT ALL ON TABLE public.tenant_features TO service_role; - - --- --- Name: TABLE tenant_invites; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenant_invites TO postgres; -GRANT ALL ON TABLE public.tenant_invites TO authenticated; -GRANT ALL ON TABLE public.tenant_invites TO service_role; - - --- --- Name: TABLE tenants; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.tenants TO postgres; -GRANT ALL ON TABLE public.tenants TO anon; -GRANT ALL ON TABLE public.tenants TO authenticated; -GRANT ALL ON TABLE public.tenants TO service_role; - - --- --- Name: TABLE user_settings; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.user_settings TO postgres; -GRANT ALL ON TABLE public.user_settings TO anon; -GRANT ALL ON TABLE public.user_settings TO authenticated; -GRANT ALL ON TABLE public.user_settings TO service_role; - - --- --- Name: TABLE v_auth_users_public; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_auth_users_public TO postgres; -GRANT ALL ON TABLE public.v_auth_users_public TO anon; -GRANT ALL ON TABLE public.v_auth_users_public TO authenticated; -GRANT ALL ON TABLE public.v_auth_users_public TO service_role; - - --- --- Name: TABLE v_commitment_totals; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_commitment_totals TO postgres; -GRANT ALL ON TABLE public.v_commitment_totals TO anon; -GRANT ALL ON TABLE public.v_commitment_totals TO authenticated; -GRANT ALL ON TABLE public.v_commitment_totals TO service_role; - - --- --- Name: TABLE v_patient_groups_with_counts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO postgres; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO anon; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO authenticated; -GRANT ALL ON TABLE public.v_patient_groups_with_counts TO service_role; - - --- --- Name: TABLE v_plan_active_prices; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_plan_active_prices TO postgres; -GRANT ALL ON TABLE public.v_plan_active_prices TO anon; -GRANT ALL ON TABLE public.v_plan_active_prices TO authenticated; -GRANT ALL ON TABLE public.v_plan_active_prices TO service_role; - - --- --- Name: TABLE v_public_pricing; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_public_pricing TO postgres; -GRANT ALL ON TABLE public.v_public_pricing TO anon; -GRANT ALL ON TABLE public.v_public_pricing TO authenticated; -GRANT ALL ON TABLE public.v_public_pricing TO service_role; - - --- --- Name: TABLE v_subscription_feature_mismatch; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO postgres; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO anon; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO authenticated; -GRANT ALL ON TABLE public.v_subscription_feature_mismatch TO service_role; - - --- --- Name: TABLE v_subscription_health; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_health TO postgres; -GRANT ALL ON TABLE public.v_subscription_health TO anon; -GRANT ALL ON TABLE public.v_subscription_health TO authenticated; -GRANT ALL ON TABLE public.v_subscription_health TO service_role; - - --- --- Name: TABLE v_subscription_health_v2; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_subscription_health_v2 TO postgres; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO anon; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO authenticated; -GRANT ALL ON TABLE public.v_subscription_health_v2 TO service_role; - - --- --- Name: TABLE v_tag_patient_counts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tag_patient_counts TO postgres; -GRANT ALL ON TABLE public.v_tag_patient_counts TO anon; -GRANT ALL ON TABLE public.v_tag_patient_counts TO authenticated; -GRANT ALL ON TABLE public.v_tag_patient_counts TO service_role; - - --- --- Name: TABLE v_tenant_active_subscription; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_active_subscription TO postgres; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO anon; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO authenticated; -GRANT ALL ON TABLE public.v_tenant_active_subscription TO service_role; - - --- --- Name: TABLE v_tenant_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements TO service_role; - - --- --- Name: TABLE v_tenant_entitlements_full; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements_full TO service_role; - - --- --- Name: TABLE v_tenant_entitlements_json; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO postgres; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO anon; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO authenticated; -GRANT ALL ON TABLE public.v_tenant_entitlements_json TO service_role; - - --- --- Name: TABLE v_tenant_feature_exceptions; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO postgres; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO anon; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO authenticated; -GRANT ALL ON TABLE public.v_tenant_feature_exceptions TO service_role; - - --- --- Name: TABLE v_tenant_feature_mismatch; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO postgres; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO anon; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO authenticated; -GRANT ALL ON TABLE public.v_tenant_feature_mismatch TO service_role; - - --- --- Name: TABLE v_tenant_members_with_profiles; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO postgres; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO anon; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO authenticated; -GRANT ALL ON TABLE public.v_tenant_members_with_profiles TO service_role; - - --- --- Name: TABLE v_tenant_people; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_people TO postgres; -GRANT ALL ON TABLE public.v_tenant_people TO anon; -GRANT ALL ON TABLE public.v_tenant_people TO authenticated; -GRANT ALL ON TABLE public.v_tenant_people TO service_role; - - --- --- Name: TABLE v_tenant_staff; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_tenant_staff TO postgres; -GRANT ALL ON TABLE public.v_tenant_staff TO anon; -GRANT ALL ON TABLE public.v_tenant_staff TO authenticated; -GRANT ALL ON TABLE public.v_tenant_staff TO service_role; - - --- --- Name: TABLE v_user_active_subscription; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_user_active_subscription TO postgres; -GRANT ALL ON TABLE public.v_user_active_subscription TO anon; -GRANT ALL ON TABLE public.v_user_active_subscription TO authenticated; -GRANT ALL ON TABLE public.v_user_active_subscription TO service_role; - - --- --- Name: TABLE v_user_entitlements; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.v_user_entitlements TO postgres; -GRANT ALL ON TABLE public.v_user_entitlements TO anon; -GRANT ALL ON TABLE public.v_user_entitlements TO authenticated; -GRANT ALL ON TABLE public.v_user_entitlements TO service_role; - - --- --- Name: TABLE messages; Type: ACL; Schema: realtime; Owner: supabase_realtime_admin --- - -GRANT ALL ON TABLE realtime.messages TO postgres; -GRANT ALL ON TABLE realtime.messages TO dashboard_user; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO anon; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO authenticated; -GRANT SELECT,INSERT,UPDATE ON TABLE realtime.messages TO service_role; - - --- --- Name: TABLE messages_2026_03_12; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_12 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_12 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_13; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_13 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_13 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_14; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_14 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_14 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_15; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_15 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_15 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_16; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_16 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_16 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_17; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_17 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_17 TO dashboard_user; - - --- --- Name: TABLE messages_2026_03_18; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.messages_2026_03_18 TO postgres; -GRANT ALL ON TABLE realtime.messages_2026_03_18 TO dashboard_user; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.schema_migrations TO postgres; -GRANT ALL ON TABLE realtime.schema_migrations TO dashboard_user; -GRANT SELECT ON TABLE realtime.schema_migrations TO anon; -GRANT SELECT ON TABLE realtime.schema_migrations TO authenticated; -GRANT SELECT ON TABLE realtime.schema_migrations TO service_role; -GRANT ALL ON TABLE realtime.schema_migrations TO supabase_realtime_admin; - - --- --- Name: TABLE subscription; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON TABLE realtime.subscription TO postgres; -GRANT ALL ON TABLE realtime.subscription TO dashboard_user; -GRANT SELECT ON TABLE realtime.subscription TO anon; -GRANT SELECT ON TABLE realtime.subscription TO authenticated; -GRANT SELECT ON TABLE realtime.subscription TO service_role; -GRANT ALL ON TABLE realtime.subscription TO supabase_realtime_admin; - - --- --- Name: SEQUENCE subscription_id_seq; Type: ACL; Schema: realtime; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO postgres; -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO dashboard_user; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO anon; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO authenticated; -GRANT USAGE ON SEQUENCE realtime.subscription_id_seq TO service_role; -GRANT ALL ON SEQUENCE realtime.subscription_id_seq TO supabase_realtime_admin; - - --- --- Name: TABLE buckets; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE storage.buckets TO service_role; -GRANT ALL ON TABLE storage.buckets TO authenticated; -GRANT ALL ON TABLE storage.buckets TO anon; - - --- --- Name: TABLE buckets_analytics; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets_analytics TO service_role; -GRANT ALL ON TABLE storage.buckets_analytics TO authenticated; -GRANT ALL ON TABLE storage.buckets_analytics TO anon; - - --- --- Name: TABLE buckets_vectors; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT SELECT ON TABLE storage.buckets_vectors TO service_role; -GRANT SELECT ON TABLE storage.buckets_vectors TO authenticated; -GRANT SELECT ON TABLE storage.buckets_vectors TO anon; - - --- --- Name: TABLE iceberg_namespaces; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.iceberg_namespaces TO service_role; -GRANT SELECT ON TABLE storage.iceberg_namespaces TO authenticated; -GRANT SELECT ON TABLE storage.iceberg_namespaces TO anon; - - --- --- Name: TABLE iceberg_tables; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.iceberg_tables TO service_role; -GRANT SELECT ON TABLE storage.iceberg_tables TO authenticated; -GRANT SELECT ON TABLE storage.iceberg_tables TO anon; - - --- --- Name: TABLE objects; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.objects TO postgres WITH GRANT OPTION; -GRANT ALL ON TABLE storage.objects TO service_role; -GRANT ALL ON TABLE storage.objects TO authenticated; -GRANT ALL ON TABLE storage.objects TO anon; - - --- --- Name: TABLE s3_multipart_uploads; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.s3_multipart_uploads TO service_role; -GRANT SELECT ON TABLE storage.s3_multipart_uploads TO authenticated; -GRANT SELECT ON TABLE storage.s3_multipart_uploads TO anon; - - --- --- Name: TABLE s3_multipart_uploads_parts; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.s3_multipart_uploads_parts TO service_role; -GRANT SELECT ON TABLE storage.s3_multipart_uploads_parts TO authenticated; -GRANT SELECT ON TABLE storage.s3_multipart_uploads_parts TO anon; - - --- --- Name: TABLE vector_indexes; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT SELECT ON TABLE storage.vector_indexes TO service_role; -GRANT SELECT ON TABLE storage.vector_indexes TO authenticated; -GRANT SELECT ON TABLE storage.vector_indexes TO anon; - - --- --- Name: TABLE hooks; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON TABLE supabase_functions.hooks TO postgres; -GRANT ALL ON TABLE supabase_functions.hooks TO anon; -GRANT ALL ON TABLE supabase_functions.hooks TO authenticated; -GRANT ALL ON TABLE supabase_functions.hooks TO service_role; - - --- --- Name: SEQUENCE hooks_id_seq; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO postgres; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO anon; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO authenticated; -GRANT ALL ON SEQUENCE supabase_functions.hooks_id_seq TO service_role; - - --- --- Name: TABLE migrations; Type: ACL; Schema: supabase_functions; Owner: supabase_functions_admin --- - -GRANT ALL ON TABLE supabase_functions.migrations TO postgres; -GRANT ALL ON TABLE supabase_functions.migrations TO anon; -GRANT ALL ON TABLE supabase_functions.migrations TO authenticated; -GRANT ALL ON TABLE supabase_functions.migrations TO service_role; - - --- --- Name: TABLE secrets; Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT SELECT,REFERENCES,DELETE,TRUNCATE ON TABLE vault.secrets TO postgres WITH GRANT OPTION; -GRANT SELECT,DELETE ON TABLE vault.secrets TO service_role; - - --- --- Name: TABLE decrypted_secrets; Type: ACL; Schema: vault; Owner: supabase_admin --- - -GRANT SELECT,REFERENCES,DELETE,TRUNCATE ON TABLE vault.decrypted_secrets TO postgres WITH GRANT OPTION; -GRANT SELECT,DELETE ON TABLE vault.decrypted_secrets TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON SEQUENCES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON FUNCTIONS TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: auth; Owner: supabase_auth_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_auth_admin IN SCHEMA auth GRANT ALL ON TABLES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON SEQUENCES TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON FUNCTIONS TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: extensions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA extensions GRANT ALL ON TABLES TO postgres WITH GRANT OPTION; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: graphql; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: graphql_public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA graphql_public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON SEQUENCES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON FUNCTIONS TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: realtime; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA realtime GRANT ALL ON TABLES TO dashboard_user; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: supabase_functions; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA supabase_functions GRANT ALL ON TABLES TO service_role; - - --- --- Name: issue_graphql_placeholder; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_graphql_placeholder ON sql_drop - WHEN TAG IN ('DROP EXTENSION') - EXECUTE FUNCTION extensions.set_graphql_placeholder(); - - -ALTER EVENT TRIGGER issue_graphql_placeholder OWNER TO supabase_admin; - --- --- Name: issue_pg_cron_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_cron_access ON ddl_command_end - WHEN TAG IN ('CREATE EXTENSION') - EXECUTE FUNCTION extensions.grant_pg_cron_access(); - - -ALTER EVENT TRIGGER issue_pg_cron_access OWNER TO supabase_admin; - --- --- Name: issue_pg_graphql_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_graphql_access ON ddl_command_end - WHEN TAG IN ('CREATE FUNCTION') - EXECUTE FUNCTION extensions.grant_pg_graphql_access(); - - -ALTER EVENT TRIGGER issue_pg_graphql_access OWNER TO supabase_admin; - --- --- Name: issue_pg_net_access; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER issue_pg_net_access ON ddl_command_end - WHEN TAG IN ('CREATE EXTENSION') - EXECUTE FUNCTION extensions.grant_pg_net_access(); - - -ALTER EVENT TRIGGER issue_pg_net_access OWNER TO supabase_admin; - --- --- Name: pgrst_ddl_watch; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER pgrst_ddl_watch ON ddl_command_end - EXECUTE FUNCTION extensions.pgrst_ddl_watch(); - - -ALTER EVENT TRIGGER pgrst_ddl_watch OWNER TO supabase_admin; - --- --- Name: pgrst_drop_watch; Type: EVENT TRIGGER; Schema: -; Owner: supabase_admin --- - -CREATE EVENT TRIGGER pgrst_drop_watch ON sql_drop - EXECUTE FUNCTION extensions.pgrst_drop_watch(); - - -ALTER EVENT TRIGGER pgrst_drop_watch OWNER TO supabase_admin; - --- --- PostgreSQL database dump complete --- - -\unrestrict jIaZyygk9Cg9Z4ELczVcfs8ceh7EIWutd6NCBTzG3dunNfjBgnAm5uGtlm0D4Zf - diff --git a/Nova-Dev-Doc/supervisor_fase1.sql b/Nova-Dev-Doc/supervisor_fase1.sql deleted file mode 100644 index 87ecaa1..0000000 --- a/Nova-Dev-Doc/supervisor_fase1.sql +++ /dev/null @@ -1,414 +0,0 @@ --- ============================================================ --- SUPERVISOR — Fase 1 --- Aplicar no Supabase SQL Editor (em ordem) --- ============================================================ - - --- ──────────────────────────────────────────────────────────── --- 1. tenants.kind → adiciona 'supervisor' --- ──────────────────────────────────────────────────────────── -ALTER TABLE public.tenants - DROP CONSTRAINT IF EXISTS tenants_kind_check; - -ALTER TABLE public.tenants - ADD CONSTRAINT tenants_kind_check - CHECK (kind = ANY (ARRAY[ - 'therapist', - 'clinic_coworking', - 'clinic_reception', - 'clinic_full', - 'clinic', - 'saas', - 'supervisor' -- ← novo - ])); - - --- ──────────────────────────────────────────────────────────── --- 2. plans.target → adiciona 'supervisor' --- ──────────────────────────────────────────────────────────── -ALTER TABLE public.plans - DROP CONSTRAINT IF EXISTS plans_target_check; - -ALTER TABLE public.plans - ADD CONSTRAINT plans_target_check - CHECK (target = ANY (ARRAY[ - 'patient', - 'therapist', - 'clinic', - 'supervisor' -- ← novo - ])); - - --- ──────────────────────────────────────────────────────────── --- 3. plans.max_supervisees — limite de supervisionados --- ──────────────────────────────────────────────────────────── -ALTER TABLE public.plans - ADD COLUMN IF NOT EXISTS max_supervisees integer DEFAULT NULL; - -COMMENT ON COLUMN public.plans.max_supervisees IS - 'Limite de terapeutas que podem ser supervisionados. Apenas para planos target=supervisor. NULL = sem limite.'; - - --- ──────────────────────────────────────────────────────────── --- 4. Planos supervisor_free e supervisor_pro --- ──────────────────────────────────────────────────────────── -INSERT INTO public.plans (key, name, description, target, is_active, max_supervisees) -VALUES - ( - 'supervisor_free', - 'Supervisor Free', - 'Plano gratuito de supervisão. Até 3 terapeutas supervisionados.', - 'supervisor', - true, - 3 - ), - ( - 'supervisor_pro', - 'Supervisor PRO', - 'Plano profissional de supervisão. Até 20 terapeutas supervisionados.', - 'supervisor', - true, - 20 - ) -ON CONFLICT (key) DO UPDATE - SET - name = EXCLUDED.name, - description = EXCLUDED.description, - target = EXCLUDED.target, - is_active = EXCLUDED.is_active, - max_supervisees = EXCLUDED.max_supervisees; - - --- ──────────────────────────────────────────────────────────── --- 5. Features de supervisor --- ──────────────────────────────────────────────────────────── -INSERT INTO public.features (key, name, descricao) -VALUES - ( - 'supervisor.access', - 'Acesso à Supervisão', - 'Acesso básico ao espaço de supervisão (sala, lista de supervisionados).' - ), - ( - 'supervisor.invite', - 'Convidar Supervisionados', - 'Permite convidar terapeutas para participar da sala de supervisão.' - ), - ( - 'supervisor.sessions', - 'Sessões de Supervisão', - 'Agendamento e registro de sessões de supervisão.' - ), - ( - 'supervisor.reports', - 'Relatórios de Supervisão', - 'Relatórios avançados de progresso e evolução dos supervisionados.' - ) -ON CONFLICT (key) DO UPDATE - SET - name = EXCLUDED.name, - descricao = EXCLUDED.descricao; - - --- ──────────────────────────────────────────────────────────── --- 6. plan_features — vincula features aos planos supervisor --- ──────────────────────────────────────────────────────────── -DO $$ -DECLARE - v_free_id uuid; - v_pro_id uuid; - v_f_access uuid; - v_f_invite uuid; - v_f_sessions uuid; - v_f_reports uuid; -BEGIN - SELECT id INTO v_free_id FROM public.plans WHERE key = 'supervisor_free'; - SELECT id INTO v_pro_id FROM public.plans WHERE key = 'supervisor_pro'; - - SELECT id INTO v_f_access FROM public.features WHERE key = 'supervisor.access'; - SELECT id INTO v_f_invite FROM public.features WHERE key = 'supervisor.invite'; - SELECT id INTO v_f_sessions FROM public.features WHERE key = 'supervisor.sessions'; - SELECT id INTO v_f_reports FROM public.features WHERE key = 'supervisor.reports'; - - -- supervisor_free: access + invite (limitado por max_supervisees=3) - INSERT INTO public.plan_features (plan_id, feature_id) - VALUES - (v_free_id, v_f_access), - (v_free_id, v_f_invite) - ON CONFLICT DO NOTHING; - - -- supervisor_pro: tudo - INSERT INTO public.plan_features (plan_id, feature_id) - VALUES - (v_pro_id, v_f_access), - (v_pro_id, v_f_invite), - (v_pro_id, v_f_sessions), - (v_pro_id, v_f_reports) - ON CONFLICT DO NOTHING; -END; -$$; - - --- ──────────────────────────────────────────────────────────── --- 7. activate_subscription_from_intent — suporte a supervisor --- Supervisor = pessoal (user_id), sem tenant_id (igual therapist) --- ──────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.activate_subscription_from_intent(p_intent_id uuid) -RETURNS public.subscriptions -LANGUAGE plpgsql SECURITY DEFINER -AS $$ -declare - v_intent record; - v_sub public.subscriptions; - v_days int; - v_user_id uuid; - v_plan_id uuid; - v_target text; -begin - -- lê pela VIEW unificada - select * into v_intent - from public.subscription_intents - where id = p_intent_id; - - if not found then - raise exception 'Intent não encontrado: %', p_intent_id; - end if; - - if v_intent.status <> 'paid' then - raise exception 'Intent precisa estar paid para ativar assinatura'; - end if; - - -- resolve target e plan_id via plans.key - select p.id, p.target - into v_plan_id, v_target - from public.plans p - where p.key = v_intent.plan_key - limit 1; - - if v_plan_id is null then - raise exception 'Plano não encontrado em plans.key = %', v_intent.plan_key; - end if; - - v_target := lower(coalesce(v_target, '')); - - -- ✅ supervisor adicionado - if v_target not in ('clinic', 'therapist', 'supervisor') then - raise exception 'Target inválido em plans.target: %', v_target; - end if; - - -- regra por target - if v_target = 'clinic' then - if v_intent.tenant_id is null then - raise exception 'Intent sem tenant_id'; - end if; - else - -- therapist ou supervisor: vinculado ao user - v_user_id := v_intent.user_id; - if v_user_id is null then - v_user_id := v_intent.created_by_user_id; - end if; - end if; - - if v_target in ('therapist', 'supervisor') and v_user_id is null then - raise exception 'Não foi possível determinar user_id para assinatura %.', v_target; - end if; - - -- cancela assinatura ativa anterior - if v_target = 'clinic' then - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where tenant_id = v_intent.tenant_id - and plan_id = v_plan_id - and status = 'active'; - else - -- therapist ou supervisor - update public.subscriptions - set status = 'cancelled', - cancelled_at = now() - where user_id = v_user_id - and plan_id = v_plan_id - and status = 'active' - and tenant_id is null; - end if; - - -- duração do plano (30 dias para mensal) - v_days := case - when lower(coalesce(v_intent.interval, 'month')) = 'year' then 365 - else 30 - end; - - -- cria nova assinatura - insert into public.subscriptions ( - user_id, - plan_id, - status, - started_at, - expires_at, - cancelled_at, - activated_at, - tenant_id, - plan_key, - interval, - source, - created_at, - updated_at - ) - values ( - case when v_target = 'clinic' then null else v_user_id end, - v_plan_id, - 'active', - now(), - now() + make_interval(days => v_days), - null, - now(), - case when v_target = 'clinic' then v_intent.tenant_id else null end, - v_intent.plan_key, - v_intent.interval, - 'manual', - now(), - now() - ) - returning * into v_sub; - - -- grava vínculo intent → subscription - if v_target = 'clinic' then - update public.subscription_intents_tenant - set subscription_id = v_sub.id - where id = p_intent_id; - else - update public.subscription_intents_personal - set subscription_id = v_sub.id - where id = p_intent_id; - end if; - - return v_sub; -end; -$$; - - --- ──────────────────────────────────────────────────────────── --- 8. subscriptions_validate_scope — suporte a supervisor --- ──────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.subscriptions_validate_scope() -RETURNS trigger -LANGUAGE plpgsql -AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target IN ('therapist', 'supervisor') THEN - -- supervisor é pessoal como therapist - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura % não deve ter tenant_id.', v_target; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura % exige user_id.', v_target; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - - --- ──────────────────────────────────────────────────────────── --- 9. subscription_intents_view_insert — suporte a supervisor --- supervisor é roteado como therapist (tabela personal) --- ──────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.subscription_intents_view_insert() -RETURNS trigger -LANGUAGE plpgsql SECURITY DEFINER -AS $$ -declare - v_target text; - v_plan_id uuid; -begin - select p.id, p.target into v_plan_id, v_target - from public.plans p - where p.key = new.plan_key; - - if v_plan_id is null then - raise exception 'Plano inválido: plan_key=%', new.plan_key; - end if; - - if lower(v_target) = 'clinic' then - if new.tenant_id is null then - raise exception 'Intenção clinic exige tenant_id.'; - end if; - - insert into public.subscription_intents_tenant ( - id, tenant_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.tenant_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := 'clinic'; - return new; - end if; - - -- therapist ou supervisor → tabela personal - if lower(v_target) in ('therapist', 'supervisor') then - insert into public.subscription_intents_personal ( - id, user_id, created_by_user_id, email, - plan_id, plan_key, interval, amount_cents, currency, - status, source, notes, created_at, paid_at - ) values ( - coalesce(new.id, gen_random_uuid()), - new.user_id, new.created_by_user_id, new.email, - v_plan_id, new.plan_key, coalesce(new.interval,'month'), - new.amount_cents, coalesce(new.currency,'BRL'), - coalesce(new.status,'pending'), coalesce(new.source,'manual'), - new.notes, coalesce(new.created_at, now()), new.paid_at - ); - - new.plan_target := lower(v_target); -- 'therapist' ou 'supervisor' - return new; - end if; - - raise exception 'Target de plano não suportado: %', v_target; -end; -$$; - - --- ──────────────────────────────────────────────────────────── --- FIM — verificação rápida --- ──────────────────────────────────────────────────────────── -SELECT key, name, target, max_supervisees -FROM public.plans -WHERE target = 'supervisor' -ORDER BY key; diff --git a/Novo-DB/fix_missing_subscriptions.sql b/Novo-DB/fix_missing_subscriptions.sql deleted file mode 100644 index 898766d..0000000 --- a/Novo-DB/fix_missing_subscriptions.sql +++ /dev/null @@ -1,220 +0,0 @@ --- ============================================================================= --- FIX: Atribuir plano free a usuários/tenants sem assinatura ativa --- ============================================================================= --- Execute no SQL Editor do Supabase (service_role) --- Idempotente: só insere onde não existe assinatura ativa. --- --- Regras: --- • tenant kind = 'therapist' → therapist_free (por user_id do admin) --- • tenant kind IN (clinic_*) → clinic_free (por tenant_id) --- • profiles.account_type = 'patient' / portal_user → patient_free (por user_id) --- ============================================================================= - -BEGIN; - --- ────────────────────────────────────────────────────────────────────────────── --- DIAGNÓSTICO — mostra o estado atual antes de corrigir --- ────────────────────────────────────────────────────────────────────────────── - -DO $$ -DECLARE - r RECORD; -BEGIN - RAISE NOTICE '=== DIAGNÓSTICO DE ASSINATURAS ==='; - RAISE NOTICE ''; - - -- Terapeutas sem plano - RAISE NOTICE '--- Terapeutas SEM assinatura ativa ---'; - FOR r IN - SELECT - tm.user_id, - p.full_name, - t.id AS tenant_id, - t.name AS tenant_name - FROM public.tenant_members tm - JOIN public.tenants t ON t.id = tm.tenant_id - JOIN public.profiles p ON p.id = tm.user_id - WHERE t.kind = 'therapist' - AND tm.role = 'tenant_admin' - AND tm.status = 'active' - AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.user_id = tm.user_id - AND s.status = 'active' - ) - LOOP - RAISE NOTICE ' FALTANDO: % (%) — tenant %', r.full_name, r.user_id, r.tenant_id; - END LOOP; - - -- Clínicas sem plano - RAISE NOTICE ''; - RAISE NOTICE '--- Clínicas SEM assinatura ativa ---'; - FOR r IN - SELECT t.id, t.name, t.kind - FROM public.tenants t - WHERE t.kind IN ('clinic_coworking', 'clinic_reception', 'clinic_full', 'clinic') - AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.tenant_id = t.id - AND s.status = 'active' - ) - LOOP - RAISE NOTICE ' FALTANDO: % (%) — kind %', r.name, r.id, r.kind; - END LOOP; - - -- Pacientes sem plano - RAISE NOTICE ''; - RAISE NOTICE '--- Pacientes SEM assinatura ativa ---'; - FOR r IN - SELECT p.id, p.full_name - FROM public.profiles p - WHERE p.account_type = 'patient' - AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.user_id = p.id - AND s.status = 'active' - ) - LOOP - RAISE NOTICE ' FALTANDO: % (%)', r.full_name, r.id; - END LOOP; - - RAISE NOTICE ''; - RAISE NOTICE '=== FIM DO DIAGNÓSTICO — aplicando correções... ==='; -END; -$$; - - --- ────────────────────────────────────────────────────────────────────────────── --- CORREÇÃO 1: Terapeutas sem assinatura → therapist_free --- Escopo: user_id do tenant_admin do tenant kind='therapist' --- ────────────────────────────────────────────────────────────────────────────── - -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - tm.user_id, - p.id, - p.key, - 'active', - 'month', - now(), - now() + interval '30 days', - 'fix_seed', - now(), - now() -FROM public.tenant_members tm -JOIN public.tenants t ON t.id = tm.tenant_id -JOIN public.plans p ON p.key = 'therapist_free' -WHERE t.kind = 'therapist' - AND tm.role = 'tenant_admin' - AND tm.status = 'active' - AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.user_id = tm.user_id - AND s.status = 'active' - ); - - --- ────────────────────────────────────────────────────────────────────────────── --- CORREÇÃO 2: Clínicas sem assinatura → clinic_free --- Escopo: tenant_id --- ────────────────────────────────────────────────────────────────────────────── - -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - t.id, - p.id, - p.key, - 'active', - 'month', - now(), - now() + interval '30 days', - 'fix_seed', - now(), - now() -FROM public.tenants t -JOIN public.plans p ON p.key = 'clinic_free' -WHERE t.kind IN ('clinic_coworking', 'clinic_reception', 'clinic_full', 'clinic') - AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.tenant_id = t.id - AND s.status = 'active' - ); - - --- ────────────────────────────────────────────────────────────────────────────── --- CORREÇÃO 3: Pacientes sem assinatura → patient_free --- Escopo: user_id --- ────────────────────────────────────────────────────────────────────────────── - -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, - source, started_at, activated_at -) -SELECT - pr.id, - p.id, - p.key, - 'active', - 'month', - now(), - now() + interval '30 days', - 'fix_seed', - now(), - now() -FROM public.profiles pr -JOIN public.plans p ON p.key = 'patient_free' -WHERE pr.account_type = 'patient' - AND NOT EXISTS ( - SELECT 1 FROM public.subscriptions s - WHERE s.user_id = pr.id - AND s.status = 'active' - ); - - --- ────────────────────────────────────────────────────────────────────────────── --- CONFIRMAÇÃO — mostra o que foi inserido (source = 'fix_seed') --- ────────────────────────────────────────────────────────────────────────────── - -DO $$ -DECLARE - r RECORD; - total INT := 0; -BEGIN - RAISE NOTICE ''; - RAISE NOTICE '=== ASSINATURAS CRIADAS NESTA EXECUÇÃO ==='; - - FOR r IN - SELECT - s.plan_key, - COALESCE(pr.full_name, t.name) AS nome, - COALESCE(s.user_id::text, s.tenant_id::text) AS owner_id - FROM public.subscriptions s - LEFT JOIN public.profiles pr ON pr.id = s.user_id - LEFT JOIN public.tenants t ON t.id = s.tenant_id - WHERE s.source = 'fix_seed' - AND s.started_at >= now() - interval '5 seconds' - ORDER BY s.plan_key, nome - LOOP - RAISE NOTICE ' ✅ % → % (%)', r.plan_key, r.nome, r.owner_id; - total := total + 1; - END LOOP; - - IF total = 0 THEN - RAISE NOTICE ' (nenhuma nova assinatura criada — todos já tinham plano ativo)'; - ELSE - RAISE NOTICE ''; - RAISE NOTICE ' Total: % assinatura(s) criada(s).', total; - END IF; -END; -$$; - -COMMIT; diff --git a/Novo-DB/fix_subscriptions_validate_scope.sql b/Novo-DB/fix_subscriptions_validate_scope.sql deleted file mode 100644 index 8aa8b69..0000000 --- a/Novo-DB/fix_subscriptions_validate_scope.sql +++ /dev/null @@ -1,50 +0,0 @@ --- Fix: subscriptions_validate_scope — adiciona suporte a target='patient' - -CREATE OR REPLACE FUNCTION public.subscriptions_validate_scope() -RETURNS trigger -LANGUAGE plpgsql -AS $$ -DECLARE - v_target text; -BEGIN - SELECT lower(p.target) INTO v_target - FROM public.plans p - WHERE p.id = NEW.plan_id; - - IF v_target IS NULL THEN - RAISE EXCEPTION 'Plano inválido (target nulo).'; - END IF; - - IF v_target = 'clinic' THEN - IF NEW.tenant_id IS NULL THEN - RAISE EXCEPTION 'Assinatura clinic exige tenant_id.'; - END IF; - IF NEW.user_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura clinic não pode ter user_id (XOR).'; - END IF; - - ELSIF v_target = 'therapist' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura therapist não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura therapist exige user_id.'; - END IF; - - ELSIF v_target = 'patient' THEN - IF NEW.tenant_id IS NOT NULL THEN - RAISE EXCEPTION 'Assinatura patient não deve ter tenant_id.'; - END IF; - IF NEW.user_id IS NULL THEN - RAISE EXCEPTION 'Assinatura patient exige user_id.'; - END IF; - - ELSE - RAISE EXCEPTION 'Target de plano inválido: %', v_target; - END IF; - - RETURN NEW; -END; -$$; - -ALTER FUNCTION public.subscriptions_validate_scope() OWNER TO supabase_admin; diff --git a/Novo-DB/migration_001.sql b/Novo-DB/migration_001.sql deleted file mode 100644 index 74c6764..0000000 --- a/Novo-DB/migration_001.sql +++ /dev/null @@ -1,296 +0,0 @@ --- ============================================================================= --- SEED 001 — Usuários fictícios para teste --- ============================================================================= --- Execute APÓS migration_001.sql --- --- Usuários criados: --- paciente@agenciapsi.com.br senha: Teste@123 → patient --- terapeuta@agenciapsi.com.br senha: Teste@123 → therapist --- clinica1@agenciapsi.com.br senha: Teste@123 → clinic_coworking --- clinica2@agenciapsi.com.br senha: Teste@123 → clinic_reception --- clinica3@agenciapsi.com.br senha: Teste@123 → clinic_full --- saas@agenciapsi.com.br senha: Teste@123 → saas_admin --- ============================================================================= - - --- ============================================================ --- Limpeza de seeds anteriores --- ============================================================ - -ALTER TABLE public.patient_groups DISABLE TRIGGER ALL; - -DELETE FROM public.tenant_members -WHERE user_id IN ( - SELECT id FROM auth.users - WHERE email IN ( - 'paciente@agenciapsi.com.br', - 'terapeuta@agenciapsi.com.br', - 'clinica1@agenciapsi.com.br', - 'clinica2@agenciapsi.com.br', - 'clinica3@agenciapsi.com.br', - 'saas@agenciapsi.com.br' - ) -); - -DELETE FROM public.tenants WHERE id IN ( - 'bbbbbbbb-0002-0002-0002-000000000002', - 'bbbbbbbb-0003-0003-0003-000000000003', - 'bbbbbbbb-0004-0004-0004-000000000004', - 'bbbbbbbb-0005-0005-0005-000000000005' -); - -DELETE FROM auth.users WHERE email IN ( - 'paciente@agenciapsi.com.br', - 'terapeuta@agenciapsi.com.br', - 'clinica1@agenciapsi.com.br', - 'clinica2@agenciapsi.com.br', - 'clinica3@agenciapsi.com.br', - 'saas@agenciapsi.com.br' -); - -ALTER TABLE public.patient_groups ENABLE TRIGGER ALL; - - --- ============================================================ --- 1. Usuários no auth.users --- ============================================================ - -INSERT INTO auth.users ( - id, email, encrypted_password, email_confirmed_at, - created_at, updated_at, raw_user_meta_data, role, aud -) -VALUES - ( - 'aaaaaaaa-0001-0001-0001-000000000001', - 'paciente@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Ana Paciente"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0002-0002-0002-000000000002', - 'terapeuta@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Bruno Terapeuta"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0003-0003-0003-000000000003', - 'clinica1@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Clinica Espaco Psi"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0004-0004-0004-000000000004', - 'clinica2@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Clinica Mente Sa"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0005-0005-0005-000000000005', - 'clinica3@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Clinica Bem Estar"}'::jsonb, - 'authenticated', 'authenticated' - ), - ( - 'aaaaaaaa-0006-0006-0006-000000000006', - 'saas@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Admin Plataforma"}'::jsonb, - 'authenticated', 'authenticated' - ); - - --- ============================================================ --- 2. Profiles --- ============================================================ - -INSERT INTO public.profiles (id, role, account_type, full_name) -VALUES - ('aaaaaaaa-0001-0001-0001-000000000001', 'portal_user', 'patient', 'Ana Paciente'), - ('aaaaaaaa-0002-0002-0002-000000000002', 'portal_user', 'therapist', 'Bruno Terapeuta'), - ('aaaaaaaa-0003-0003-0003-000000000003', 'portal_user', 'clinic', 'Clinica Espaco Psi'), - ('aaaaaaaa-0004-0004-0004-000000000004', 'portal_user', 'clinic', 'Clinica Mente Sa'), - ('aaaaaaaa-0005-0005-0005-000000000005', 'portal_user', 'clinic', 'Clinica Bem Estar'), - ('aaaaaaaa-0006-0006-0006-000000000006', 'saas_admin', 'free', 'Admin Plataforma') -ON CONFLICT (id) DO UPDATE SET - role = EXCLUDED.role, - account_type = EXCLUDED.account_type, - full_name = EXCLUDED.full_name; - - --- ============================================================ --- 3. SaaS Admin --- ============================================================ - -INSERT INTO public.saas_admins (user_id, created_at) -VALUES ('aaaaaaaa-0006-0006-0006-000000000006', now()) -ON CONFLICT (user_id) DO NOTHING; - - --- ============================================================ --- 4. Tenant do terapeuta --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0002-0002-0002-000000000002', 'Bruno Terapeuta', 'therapist', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0002-0002-0002-000000000002', 'aaaaaaaa-0002-0002-0002-000000000002', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0002-0002-0002-000000000002'); -END; $$; - - --- ============================================================ --- 5. Tenant Clinica 1 — Coworking --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0003-0003-0003-000000000003', 'Clinica Espaco Psi', 'clinic_coworking', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0003-0003-0003-000000000003', 'aaaaaaaa-0003-0003-0003-000000000003', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0003-0003-0003-000000000003'); -END; $$; - - --- ============================================================ --- 6. Tenant Clinica 2 — Recepcao --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0004-0004-0004-000000000004', 'Clinica Mente Sa', 'clinic_reception', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0004-0004-0004-000000000004', 'aaaaaaaa-0004-0004-0004-000000000004', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0004-0004-0004-000000000004'); -END; $$; - - --- ============================================================ --- 7. Tenant Clinica 3 — Full --- ============================================================ - -INSERT INTO public.tenants (id, name, kind, created_at) -VALUES ('bbbbbbbb-0005-0005-0005-000000000005', 'Clinica Bem Estar', 'clinic_full', now()) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ('bbbbbbbb-0005-0005-0005-000000000005', 'aaaaaaaa-0005-0005-0005-000000000005', 'tenant_admin', 'active', now()) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - -DO $$ BEGIN - PERFORM public.seed_determined_commitments('bbbbbbbb-0005-0005-0005-000000000005'); -END; $$; - - --- ============================================================ --- 8. Subscriptions ativas --- ============================================================ - --- Paciente → patient_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0001-0001-0001-000000000001', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'patient_free'; - --- Terapeuta → therapist_free -INSERT INTO public.subscriptions ( - user_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'aaaaaaaa-0002-0002-0002-000000000002', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'therapist_free'; - --- Clinica 1 → clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0003-0003-0003-000000000003', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Clinica 2 → clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0004-0004-0004-000000000004', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - --- Clinica 3 → clinic_free -INSERT INTO public.subscriptions ( - tenant_id, plan_id, plan_key, status, interval, - current_period_start, current_period_end, source, started_at, activated_at -) -SELECT - 'bbbbbbbb-0005-0005-0005-000000000005', - p.id, p.key, 'active', 'month', - now(), now() + interval '30 days', 'seed', now(), now() -FROM public.plans p WHERE p.key = 'clinic_free'; - - --- ============================================================ --- 9. Vincula terapeuta à Clinica 3 (exemplo de associacao) --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0005-0005-0005-000000000005', - 'aaaaaaaa-0002-0002-0002-000000000002', - 'therapist', 'active', now() -) -ON CONFLICT (tenant_id, user_id) DO NOTHING; - - --- ============================================================ --- Confirmacao --- ============================================================ - -DO $$ -BEGIN - RAISE NOTICE '✅ Seed aplicado com sucesso.'; - RAISE NOTICE ' paciente@agenciapsi.com.br → patient'; - RAISE NOTICE ' terapeuta@agenciapsi.com.br → therapist'; - RAISE NOTICE ' clinica1@agenciapsi.com.br → clinic_coworking'; - RAISE NOTICE ' clinica2@agenciapsi.com.br → clinic_reception'; - RAISE NOTICE ' clinica3@agenciapsi.com.br → clinic_full'; - RAISE NOTICE ' saas@agenciapsi.com.br → saas_admin'; - RAISE NOTICE ' Senha: Teste@123'; -END; -$$; diff --git a/Novo-DB/migration_002_layout_variant.sql b/Novo-DB/migration_002_layout_variant.sql deleted file mode 100644 index 6a74e0c..0000000 --- a/Novo-DB/migration_002_layout_variant.sql +++ /dev/null @@ -1,13 +0,0 @@ --- ============================================================================= --- Migration 002 — Adiciona layout_variant em user_settings --- ============================================================================= --- Execute no SQL Editor do Supabase (ou via Docker psql). --- Tolerante: usa IF NOT EXISTS / DEFAULT para não quebrar dados existentes. --- ============================================================================= - -ALTER TABLE public.user_settings - ADD COLUMN IF NOT EXISTS layout_variant TEXT NOT NULL DEFAULT 'classic'; - --- ============================================================================= -RAISE NOTICE '✅ Coluna layout_variant adicionada a user_settings.'; --- ============================================================================= diff --git a/Novo-DB/seed_002.sql b/Novo-DB/seed_002.sql deleted file mode 100644 index a9fc80f..0000000 --- a/Novo-DB/seed_002.sql +++ /dev/null @@ -1,199 +0,0 @@ --- ============================================================================= --- SEED 002 — Supervisor e Editor --- ============================================================================= --- Execute APÓS seed_001.sql --- Requer: pgcrypto (já ativo no Supabase) --- --- Cria os seguintes usuários de teste: --- --- supervisor@agenciapsi.com.br senha: Teste@123 → supervisor da Clínica 3 --- editor@agenciapsi.com.br senha: Teste@123 → editor de conteúdo (plataforma) --- --- UUIDs reservados: --- Supervisor → aaaaaaaa-0007-0007-0007-000000000007 --- Editor → aaaaaaaa-0008-0008-0008-000000000008 --- --- ============================================================================= - -BEGIN; - --- ============================================================ --- 0. Migration: adiciona platform_roles em profiles (se não existir) --- ============================================================ - -ALTER TABLE public.profiles - ADD COLUMN IF NOT EXISTS platform_roles text[] NOT NULL DEFAULT '{}'; - -COMMENT ON COLUMN public.profiles.platform_roles IS - 'Papéis globais de plataforma, independentes de tenant. Ex: editor de microlearning. Atribuído pelo saas_admin.'; - - --- ============================================================ --- 1. Remove seeds anteriores (idempotente) --- ============================================================ - -DELETE FROM auth.users -WHERE email IN ( - 'supervisor@agenciapsi.com.br', - 'editor@agenciapsi.com.br' -); - - --- ============================================================ --- 2. Cria usuários no auth.users --- ============================================================ - -INSERT INTO auth.users ( - instance_id, - id, - email, - encrypted_password, - email_confirmed_at, - created_at, - updated_at, - raw_user_meta_data, - raw_app_meta_data, - role, - aud, - is_sso_user, - is_anonymous, - confirmation_token, - recovery_token, - email_change_token_new, - email_change_token_current, - email_change -) -VALUES - -- Supervisor - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0007-0007-0007-000000000007', - 'supervisor@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Carlos Supervisor"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ), - -- Editor de Conteúdo - ( - '00000000-0000-0000-0000-000000000000', - 'aaaaaaaa-0008-0008-0008-000000000008', - 'editor@agenciapsi.com.br', - crypt('Teste@123', gen_salt('bf')), - now(), now(), now(), - '{"name": "Diana Editora"}'::jsonb, - '{"provider": "email", "providers": ["email"]}'::jsonb, - 'authenticated', 'authenticated', false, false, '', '', '', '', '' - ); - - --- ============================================================ --- 3. auth.identities (obrigatório para GoTrue reconhecer login) --- ============================================================ - -INSERT INTO auth.identities (id, user_id, provider_id, provider, identity_data, created_at, updated_at, last_sign_in_at) -VALUES - ( - gen_random_uuid(), - 'aaaaaaaa-0007-0007-0007-000000000007', - 'supervisor@agenciapsi.com.br', - 'email', - '{"sub": "aaaaaaaa-0007-0007-0007-000000000007", "email": "supervisor@agenciapsi.com.br", "email_verified": true}'::jsonb, - now(), now(), now() - ), - ( - gen_random_uuid(), - 'aaaaaaaa-0008-0008-0008-000000000008', - 'editor@agenciapsi.com.br', - 'email', - '{"sub": "aaaaaaaa-0008-0008-0008-000000000008", "email": "editor@agenciapsi.com.br", "email_verified": true}'::jsonb, - now(), now(), now() - ) -ON CONFLICT (provider, provider_id) DO NOTHING; - - --- ============================================================ --- 4. Profiles --- Supervisor → tenant_member (papel no tenant via tenant_members.role) --- Editor → tenant_member + platform_roles = '{editor}' --- ============================================================ - -INSERT INTO public.profiles (id, role, account_type, full_name, platform_roles) -VALUES - ( - 'aaaaaaaa-0007-0007-0007-000000000007', - 'tenant_member', - 'therapist', - 'Carlos Supervisor', - '{}' - ), - ( - 'aaaaaaaa-0008-0008-0008-000000000008', - 'tenant_member', - 'therapist', - 'Diana Editora', - '{editor}' -- permissão de plataforma: acesso à área do editor - ) -ON CONFLICT (id) DO UPDATE SET - role = EXCLUDED.role, - account_type = EXCLUDED.account_type, - full_name = EXCLUDED.full_name, - platform_roles = EXCLUDED.platform_roles; - - --- ============================================================ --- 5. Vincula Supervisor à Clínica 3 (Full) com role 'supervisor' --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0005-0005-0005-000000000005', -- Clínica Bem Estar (Full) - 'aaaaaaaa-0007-0007-0007-000000000007', -- Carlos Supervisor - 'supervisor', - 'active', - now() -) -ON CONFLICT (tenant_id, user_id) DO UPDATE SET - role = EXCLUDED.role, - status = EXCLUDED.status; - - --- ============================================================ --- 6. Vincula Editor à Clínica 3 como terapeuta --- (contexto de tenant para o editor poder usar /therapist também, --- se necessário. O papel de editor vem de platform_roles.) --- ============================================================ - -INSERT INTO public.tenant_members (tenant_id, user_id, role, status, created_at) -VALUES ( - 'bbbbbbbb-0005-0005-0005-000000000005', -- Clínica Bem Estar (Full) - 'aaaaaaaa-0008-0008-0008-000000000008', -- Diana Editora - 'therapist', - 'active', - now() -) -ON CONFLICT (tenant_id, user_id) DO UPDATE SET - role = EXCLUDED.role, - status = EXCLUDED.status; - - --- ============================================================ --- 7. Confirma --- ============================================================ - -DO $$ -BEGIN - RAISE NOTICE '✅ Seed 002 aplicado com sucesso.'; - RAISE NOTICE ''; - RAISE NOTICE ' Migration aplicada:'; - RAISE NOTICE ' → profiles.platform_roles text[] adicionada (se não existia)'; - RAISE NOTICE ''; - RAISE NOTICE ' Usuários criados:'; - RAISE NOTICE ' supervisor@agenciapsi.com.br → supervisor da Clínica Bem Estar (Full)'; - RAISE NOTICE ' editor@agenciapsi.com.br → editor de conteúdo (platform_roles = {editor})'; - RAISE NOTICE ' Senha de todos: Teste@123'; -END; -$$; - -COMMIT; diff --git a/blueprints/DialogConfirmation-blueprint.md b/blueprints/DialogConfirmation-blueprint.md new file mode 100644 index 0000000..9a2d7c7 --- /dev/null +++ b/blueprints/DialogConfirmation-blueprint.md @@ -0,0 +1,159 @@ +# DialogConfirmation — Padrão de Componente + +> **Stack**: Vue 3 + PrimeVue 4 + Tailwind CSS + +--- + +## Regras gerais + +| Propriedade | Valor obrigatório | +|---|---| +| `group` | sempre `"headless"` — desacopla o template do trigger | +| `ConfirmDialog` | declarado **uma única vez**, no componente pai (página) | +| Filhos | disparam via `useConfirm()` com `group: 'headless'` — sem declarar `ConfirmDialog` próprio | +| `icon` | passado em `confirm.require({ icon })` — classe PrimeIcons sem o prefixo `pi` (ex: `'pi-trash'`) | +| `color` | passado em `confirm.require({ color })` — hex; define o fundo do círculo e a cor do botão Confirmar | +| `ConfirmationService` | obrigatório em `main.js` — `app.use(ConfirmationService)` | + +--- + +## Arquitetura pai / filho + +``` +Pai (página) + └── ← único, renderiza aqui + ├── Filho A (componente qualquer) → confirm.require({ group: 'headless', ... }) + └── Filho B (Dialog interno) → confirm.require({ group: 'headless', ... }) +``` + +> O `ConfirmDialog` **não** deve ser colocado dentro de um `` filho — isso causaria dois popups simultâneos. Sempre no pai. + +--- + +## Setup obrigatório — `main.js` + +```js +import ConfirmationService from 'primevue/confirmationservice' + +app.use(ConfirmationService) // sem isso, useConfirm() não funciona +``` + +--- + +## Template do `ConfirmDialog` (somente no pai) + +```vue + + + + +``` + +--- + +## Uso nos componentes (pai ou filhos) + +```vue + +``` + +--- + +## Paleta de ícones e cores por ação + +| Ação | `icon` | `color` | Observação | +|---|---|---|---| +| Excluir / Remover | `pi-trash` | `#ef4444` | Vermelho — ação destrutiva | +| Salvar / Confirmar | `pi-save` | `var(--p-primary-color)` | Cor primária do tema | +| Editar / Atualizar | `pi-pencil` | `#f97316` | Laranja — mudança de estado | +| Aviso / Atenção | `pi-exclamation-triangle` | `#eab308` | Amarelo — ação reversível | +| Info / Neutro | `pi-info-circle` | `#3b82f6` | Azul — informativo | + +--- + +## Referência completa de `confirm.require` + +```js +confirm.require({ + group: 'headless', // obrigatório — aponta para o ConfirmDialog correto + header: 'Título do popup', // linha em negrito + message: 'Descrição clara.', // linha secundária + icon: 'pi-trash', // sufixo PrimeIcons sem o "pi " inicial + color: '#ef4444', // hex — fundo do círculo + cor do botão Confirmar + accept: () => { /* ação confirmada */ }, + reject: () => { /* opcional — ação cancelada */ } +}) +``` + +--- + +## Checklist antes de usar + +- [ ] `ConfirmationService` registrado no `main.js` +- [ ] `` declarado **apenas no pai**, antes do conteúdo +- [ ] Filhos usam `useConfirm()` com `group: 'headless'` — sem `ConfirmDialog` próprio +- [ ] `icon` passado como sufixo PrimeIcons: `'pi-trash'`, não `'pi pi-trash'` +- [ ] `color` em hex para ações com semântica de cor (delete = `#ef4444`) +- [ ] `header` curto e direto | `message` com contexto suficiente para o usuário decidir +- [ ] `accept` contém a ação real — `reject` é opcional + +--- + +## Variações de confirmação + +| Contexto | `header` | `icon` | `color` | +|---|---|---|---| +| Excluir registro | `'Excluir ?'` | `pi-trash` | `#ef4444` | +| Remover item de lista | `'Remover campo?'` | `pi-trash` | `#ef4444` | +| Salvar com impacto | `'Confirmar alterações?'` | `pi-save` | primária | +| Atualizar com risco | `'Atualizar ?'` | `pi-pencil` | `#f97316` | +| Ação irreversível genérica | `'Tem certeza?'` | `pi-exclamation-triangle` | `#eab308` | diff --git a/blueprints/dialog-blueprint.md b/blueprints/dialog-blueprint.md new file mode 100644 index 0000000..2cdbf75 --- /dev/null +++ b/blueprints/dialog-blueprint.md @@ -0,0 +1,183 @@ +# Dialog — Padrão de Componente + +> **Stack**: Vue 3 + PrimeVue 4 + Tailwind CSS + +--- + +## Regras gerais + +| Propriedade | Valor obrigatório | +|---|---| +| `modal` | sempre `true` | +| `maximizable` | sempre presente — botão nativo do PrimeVue, sem estado manual | +| `:draggable` | sempre `false` | +| `:closable` | `!saving` — desabilita o X durante operações assíncronas | +| `:dismissableMask` | `!saving` — impede fechar clicando fora durante saving | +| `pt:mask:class` | `backdrop-blur-xs` | +| Largura | `w-[50rem]` (padrão); responsivo via `:breakpoints` | +| Breakpoints | `{ '1199px': '90vw', '768px': '94vw' }` | + +--- + +## Estrutura obrigatória + +``` + + ├── #header ← dot de cor (se aplicável), título/subtítulo, btn Excluir + ├── Banner ← preview visual (opcional — apenas quando há cor/identidade visual) + ├── Corpo ← campos do formulário + └── #footer ← Cancelar (flat) | Salvar (primary) +``` + +--- + +## Configuração completa do `` + +```vue + +``` + +### Detalhes do `pt` + +| Chave | O que faz | +|---|---| +| `header` | `!p-3` padding uniforme; `!rounded-t-[12px]` borda top arredondada; `border-b` + `shadow` separador com profundidade; `bg-gray-100` fundo levemente cinza | +| `content` | `!p-3` padding interno do corpo | +| `footer` | `!p-0` remove padding nativo (controlado pelo wrapper interno); `!rounded-b-[12px]` borda bottom arredondada; `border-t` + `shadow` separador; `bg-gray-100` fundo levemente cinza | +| `pcCloseButton` | `!rounded-md` remove o círculo nativo; `hover:!text-red-500` feedback de danger no hover | +| `pcMaximizeButton` | `!rounded-md` remove o círculo nativo; `hover:!text-primary` feedback de cor primária no hover | + +> O `!` (important) é necessário porque o PrimeVue injeta estilos inline nos botões e no root do Dialog — sem ele o Tailwind perde a disputa de especificidade. + +--- + +## Header — slot `#header` + +``` +[dot-cor] [título / subtítulo] [btn-excluir] ← Close e Maximize nativos vêm após +``` + +- O PrimeVue injeta **Maximize** e **Close** automaticamente à direita do slot `#header`. +- O botão **Excluir** fica **sempre no header**, nunca no footer. +- Excluir desabilitado quando o registro é nativo/padrão: `:disabled="saving || isNativeRecord"`. + +```vue + +``` + +--- + +## Footer — slot `#footer` + +```vue + +``` + +> **Regra**: Cancelar = `severity="secondary" text` + `hover:!text-red-500`. Salvar = primary (sem severity, usa o padrão do tema). Padding controlado pelo `div` interno (`px-3 py-3`), não pelo `pt.footer`. + +--- + +## Maximizar + +Use a prop nativa `maximizable`. O PrimeVue injeta e gerencia o botão automaticamente — sem `ref`, sem `isMaximized`, sem ` + +
+ + + + + +
+
+
+
+

Documento Estratégico Fundacional

+

Plataforma de
Saúde Mental

+

Ecossistema completo para gestão clínica, educação continuada e conexão terapêutica — com modelo de dados real documentado

+
+ Versão 2.0 + Confidencial + Schema Supabase v17.6 + PostgreSQL 17 + 2025 +
+
+
scroll
+
+ + +
+ + +
+
+ 01 +

Visão Geral do Projeto

+
+

Este documento descreve de forma completa e minuciosa o projeto de uma Plataforma de Saúde Mental — um ecossistema digital integrado que reúne gestão clínica, educação continuada e conexão entre profissionais e pacientes em um único ambiente.

+

A versão 2.0 deste documento incorpora a realidade do banco de dados já construído: tabelas reais, enums implementados, funções RPC em produção e decisões arquiteturais que foram tomadas durante o desenvolvimento. Este não é mais um documento de intenções — é o espelho fiel do que existe e do que está sendo construído.

+
"Não estamos construindo um software de gestão. Estamos construindo o ecossistema que o profissional de saúde mental brasileiro nunca teve."
+ +
+ O que mudou na v2.0: Adicionados os capítulos 11, 12 e 13 com a documentação completa do schema real do banco de dados (Supabase/PostgreSQL 17.6), incluindo as 60+ tabelas do schema público, todos os enums implementados e as principais funções RPC de negócio. O capítulo 07 foi expandido com os tipos de tenant reais. O capítulo 10 foi atualizado com as chaves de plano reais (plans.target: patient, therapist, clinic, supervisor). +
+ +
+

Pilares Fundadores

+
+
+
🏛
+
Confiança Clínica
+

Seriedade, conformidade com LGPD e segurança de dados sensíveis desde a fundação.

+
+
+
+
Redução de Fricção
+

Cada funcionalidade deve economizar tempo real do profissional, nunca criar mais trabalho.

+
+
+
🕸
+
Efeito de Rede
+

Quanto mais profissionais entram, mais o produto vale para cada um deles.

+
+
+
📚
+
Educação como Aquisição
+

Conteúdo de microlearning que atrai, engaja e converte o profissional ideal.

+
+
+
🔐
+
RLS por Design
+

Row Level Security do Supabase garante que cada tenant só acessa seus próprios dados — sem possibilidade de vazamento cruzado.

+
+
+
🧩
+
Multi-Tenant Real
+

A coluna tenant_id está em todas as tabelas críticas, garantindo isolamento total por clínica ou terapeuta.

+
+
+
+
+ +
+ + +
+
+ 02 +

Origem e Motivação

+
+

O projeto surgiu da observação direta de um problema recorrente: profissionais de saúde mental altamente capacitados clinicamente, mas completamente despreparados para gerir o aspecto administrativo e financeiro de suas práticas.

+

A pandemia de COVID-19 acelerou a digitalização do setor — o atendimento online normalizou-se, a demanda por terapia explodiu e o número de profissionais cresceu. Porém, as ferramentas disponíveis no mercado não acompanharam essa evolução em profundidade. Resolvem o agendamento, mas ignoram a clínica. Resolvem o financeiro, mas ignoram o paciente.

+

A motivação central é construir o produto que o mercado deveria ter criado há anos: uma plataforma que entende que o terapeuta também é paciente, que a clínica é feita de relações humanas, e que educação e prática clínica são inseparáveis.

+
+

O Papel do Parceiro Acadêmico

+

Um dos diferenciais estratégicos do projeto é a parceria com um profissional em formação em psicologia e já atuante como psicanalista. Essa combinação une a visão clínica prática com o rigor acadêmico, permitindo a produção de conteúdo de microlearning com autoridade real.

+

Com o tempo, esse parceiro poderá atuar como supervisor clínico dentro da plataforma. O schema já prevê isso: plans.target = 'supervisor' e tenants.kind = 'supervisor' são tipos nativos do sistema, não adições futuras.

+
+
+ +
+ + +
+
+ 03 +

O Problema que Resolvemos

+
+
+

1. Fragmentação de Ferramentas

+

O profissional usa Google Agenda para agendamento, WhatsApp para comunicação, planilha para financeiro, Word para prontuário e e-mail para cobrança. São 5 ferramentas para uma única prática clínica.

+

2. Ausência de Visão Clínica nos Sistemas Atuais

+

Os softwares existentes tratam o atendimento como uma transação comercial. Não há suporte para acompanhamento de evolução do paciente, aplicação de escalas validadas ou registro estruturado por abordagem terapêutica.

+

3. Isolamento Profissional

+

Terapeutas trabalham em silos. Não há plataforma que facilite encaminhamentos entre colegas, supervisão clínica estruturada ou rede de colaboração profissional.

+

4. Falta de Educação em Gestão

+

A formação em psicologia, psicanálise e psiquiatria é excelente clinicamente, mas praticamente nula em gestão. O profissional não sabe precificar, não sabe lidar com inadimplência, não conhece suas obrigações fiscais e de LGPD.

+

5. Experiência do Paciente Negligenciada

+

O paciente é tratado como destinatário passivo do serviço. Não existe ferramenta que engaje o paciente entre sessões, acompanhe seu humor, envie tarefas terapêuticas ou registre seu progresso de forma visual.

+
+
+ +
+ + +
+
+ 04 +

O Mercado e seus Concorrentes

+
+

O mercado brasileiro de software para saúde mental está em crescimento acelerado, mas ainda dominado por soluções parciais. Os principais players cobrem bem o básico administrativo, porém falham na profundidade clínica e na experiência do usuário.

+
+ + + + + + + + + +
PlayerPontos FortesLacunas Críticas
PsicoManagerProntuário, agendamento sólidoUX datada, sem app do paciente, sem microlearning
Clínica ÁgilInterface moderna, financeiroSem escalas clínicas, sem rede entre profissionais
AmplimedMulti-especialidade, robustoComplexo demais para terapeuta solo, custo elevado
Nuvem PsicologiaFoco em psicólogos, simplesFuncionalidades limitadas, sem crescimento de produto
Google Agenda + PlanilhaGratuito, familiarNão é um produto — é um remendo
+
+
Nossa plataforma compete em uma categoria nova: ecossistema terapêutico integrado. Enquanto os concorrentes vendem software de gestão, vendemos crescimento profissional, conexão clínica e educação continuada — com a gestão como consequência natural.
+
+ +
+ + +
+
+ 05 +

Lacunas de Mercado Identificadas

+
+

A análise competitiva revelou oportunidades concretas que nenhum player atual preenche de forma satisfatória. São estas lacunas que definem nossa vantagem estratégica.

+
+

Lacuna 1 — Acompanhamento de Progresso Clínico Visual

+

Nenhum sistema entrega um painel visual que mostre a evolução do paciente sessão a sessão com métricas e gráficos. Nossa tabela agenda_eventos já registra cada sessão com status, modalidade e preço — base para dashboards longitudinais.

+

Lacuna 2 — Ferramentas para o Paciente entre Sessões

+

Um módulo do paciente com diário de humor, tarefas terapêuticas e check-ins automáticos é praticamente inexistente no Brasil. A tabela patients já prevê user_id, permitindo que pacientes tenham login nativo na plataforma.

+

Lacuna 3 — Escalas Psicológicas Integradas

+

PHQ-9, GAD-7, BDI e outras escalas não estão integradas com envio ao paciente, correção automática e gráfico de evolução temporal. O sistema de determined_commitments com campos dinâmicos (determined_commitment_fields) forma a base técnica para isso.

+

Lacuna 4 — Rede de Encaminhamentos

+

Terapeutas frequentemente precisam encaminhar pacientes para colegas. O campo patients.encaminhado_por e o status 'Encaminhado' já existem na tabela de pacientes. A estrutura de rede é o passo seguinte.

+

Lacuna 5 — Módulo de Supervisão Clínica

+

Nenhum sistema tem módulo específico para supervisores. No nosso schema: plans.target = 'supervisor', tenants.kind = 'supervisor' e plans.max_supervisees (limite de supervisionados) já estão modelados nativamente.

+

Lacuna 6 — Educação em Gestão para a Área

+

A plataforma de microlearning — produto 2 — é um diferencial único. Conteúdos específicos sobre gestão de clínica, precificação, LGPD aplicada à psicologia e finanças do autônomo.

+

Lacuna 7 — IA de Suporte Clínico

+

Sugestão de bibliografias por apresentação clínica e rascunho de evoluções por voz são funcionalidades com altíssimo valor e quase inexistentes. O campo agenda_eventos.extra_fields (jsonb) e os campos de notas estruturadas já preparam o terreno para ingestão de IA.

+
+
+ +
+ + +
+
+ 06 +

Arquitetura do Produto

+
+

A plataforma é composta por dois produtos complementares que compartilham a mesma base de usuários, infraestrutura Supabase e identidade de marca:

+
+
+
+
Produto 1
+
Sistema de Gestão Clínica
+
+
Agendamento com recorrência, prontuário, financeiro com Pix/Asaas, multi-papel, escalas clínicas, módulo do paciente, rede de profissionais e supervisão clínica.
+
+
+
+
Produto 2
+
Plataforma de Microlearning
+
+
Trilhas de microlearning por especialidade, carrossel de slides, quiz, vídeo, banners no sistema e assinatura independente ou inclusa no plano.
+
+
+
+

Stack Tecnológica Real

+
+
🗄
Supabase (Backend)

PostgreSQL 17.6, Auth, Storage, RLS, Realtime. Hospeda 60+ tabelas do schema público.

+
🔐
Auth Supabase

JWT com refresh token. auth.uid() em todas as RLS policies. Login por e-mail e Google (Apple futuro).

+
💳
Asaas (Pagamentos)

Integração via webhooks para Pix, boleto. Tabela payment_settings guarda configurações por owner.

+
📬
Notificações

Sistema completo com notification_queue, canais (email, WhatsApp, SMS), opt-in por paciente e cleanup automático.

+
+
+
+

Como os Dois Produtos se Integram

+
    +
  • O mesmo login (auth.usersprofiles) acessa os dois produtos.
  • +
  • Banners rotativos dentro do sistema de gestão exibem conteúdos do microlearning — tabela login_carousel_slides já existe no schema.
  • +
  • O modelo de planos (plans) pode incluir acesso ao microlearning como benefício por meio de plan_features.
  • +
  • O sistema de módulos (modules, module_features, tenant_modules) controla quais funcionalidades cada tenant tem acesso.
  • +
+
+
+ +
+ + +
+
+ 07 +

O Sistema Multi-Papel e Multi-Tenant

+
+

Um dos diferenciais arquiteturais mais importantes da plataforma é o sistema de multi-papel por usuário combinado com multi-tenant. Na maioria dos concorrentes, um usuário é ou terapeuta ou paciente. Em nossa plataforma, um único usuário pode exercer múltiplos papéis simultaneamente, refletindo a realidade clínica.

+
Insight central: O terapeuta também faz análise pessoal. Logo, ele é simultaneamente profissional de saúde mental e paciente de outro profissional. O sistema precisa respeitar e suportar essa dualidade de forma natural e sem fricção.
+ +
+

Os Papéis do Sistema

+
+
+
PAPEL 01
+
Paciente
+

Agenda sessões, acessa histórico, responde escalas, usa o diário entre sessões e visualiza tarefas.

+ profiles.account_type = 'patient' +
+
+
PAPEL 02
+
Terapeuta
+

Gerencia agenda e pacientes, registra prontuário, aplica escalas, emite cobranças e acessa relatórios.

+ profiles.account_type = 'therapist' +
+
+
PAPEL 03
+
Clínica
+

Gerencia múltiplos terapeutas, controla agenda compartilhada, realiza repasse financeiro e métricas.

+ profiles.account_type = 'clinic' +
+
+
PAPEL 04
+
Supervisor
+

Acompanha casos de supervisionados com acesso controlado. Plano com limite de supervisionados via plans.max_supervisees.

+ plans.target = 'supervisor' +
+
+
+ +
+

Tipos de Tenant — tenants.kind

+

Cada workspace (tenant) tem um tipo imutável definido na criação. Isso determina o comportamento, permissões e funcionalidades disponíveis:

+
+
+
therapist
+
Terapeuta Solo
+

Terapeuta autônomo que gerencia sua própria prática. Um tenant por profissional.

+
+
+
clinic_coworking
+
Clínica Coworking
+

Múltiplos terapeutas com espaço compartilhado, agenda independente por profissional.

+
+
+
clinic_reception
+
Clínica com Recepção
+

Clínica com recepcionista centralizada gerenciando agendamento de múltiplos profissionais.

+
+
+
clinic_full
+
Clínica Completa
+

Gestão completa: recepção, financeiro centralizado, repasse, relatórios gerenciais.

+
+
+
supervisor
+
Workspace de Supervisão
+

Ambiente dedicado à supervisão clínica. Supervisores acompanham casos de supervisionados.

+
+
+
+ +
+

Regras de Transição entre Papéis

+
    +
  • Todo usuário começa com profiles.account_type = 'free' — sem perfil definido ainda.
  • +
  • O usuário escolhe se é paciente ('patient') ou terapeuta ('therapist') — o campo é imutável após a escolha.
  • +
  • Um Terapeuta pode criar ou se vincular a uma Clínica via tenant_members com role = 'tenant_admin' ou 'therapist'.
  • +
  • A tabela tenant_members controla quem pertence a qual tenant e com qual papel (admin, terapeuta, recepcionista).
  • +
  • Um usuário Terapeuta pode simultaneamente ser Paciente de outro terapeuta — os dados são segregados por tenant_id e owner_id.
  • +
  • A troca de contexto entre papéis na interface não contamina dados — RLS garante isolamento total no banco.
  • +
  • Papéis globais de plataforma (ex: editor de microlearning) ficam em profiles.platform_roles[], independentes de tenant.
  • +
+
+
+ +
+ + +
+
+ 08 +

Módulos do Sistema de Gestão

+
+ +
+
M1
Autenticação e Multi-Papel
+
+

Fundação de toda a plataforma. Usa auth.users (Supabase Auth) + profiles para dados do usuário. O profiles.role controla acesso administrativo ao sistema SaaS; profiles.account_type controla o tipo de conta do usuário.

+
    +
  • Login com e-mail, Google e futuramente Apple
  • +
  • JWT com auth.uid() usado em todas as RLS policies
  • +
  • Middleware de permissão por papel em todas as rotas
  • +
  • Auditoria via support_sessions — admins SaaS podem acessar tenants com token temporário
  • +
  • profiles.platform_roles[] para permissões globais independentes de tenant
  • +
+
+
+ +
+
M2
Agendamento com Recorrência
+
+

Sistema de agenda completo com suporte a sessões recorrentes, exceções, bloqueios e agendamento online pelo paciente. Núcleo operacional do produto.

+
    +
  • agenda_regras_semanais — disponibilidade semanal do terapeuta (dia, horário, modalidade)
  • +
  • agenda_eventos — cada sessão individual (status: agendado, realizado, faltou, cancelado, remarcar)
  • +
  • recurrence_rules — regras de recorrência (weekly, biweekly, monthly, yearly, custom_weekdays)
  • +
  • recurrence_exceptions — exceções pontuais: cancelamento, remarcação, feriado
  • +
  • agenda_excecoes — bloqueios e horários extras do terapeuta
  • +
  • agendador_solicitacoes — agendamento online pelos pacientes com aprovação do terapeuta
  • +
  • Conflito de horário validado pela função cancelar_eventos_serie()
  • +
+
+
+ +
+
M3
Cadastro de Pacientes
+
+

Cadastro completo do paciente com dados pessoais, endereço, responsável, notas clínicas e vínculo com terapeuta. Suporta escopo clínica (patient_scope = 'clinic') e terapeuta (patient_scope = 'therapist').

+
    +
  • Tabela patients com 40+ campos: dados pessoais, endereço completo, responsável, CPF/RG
  • +
  • Status do paciente: Ativo, Inativo, Alta, Encaminhado, Arquivado
  • +
  • patient_invites — link de auto-cadastro com token, expiração e limite de usos
  • +
  • patient_intake_requests — ficha de anamnese via link público (função create_patient_intake_request_v2)
  • +
  • patient_tags e patient_groups — organização e segmentação de pacientes
  • +
  • patient_discounts — descontos por paciente com data de vigência
  • +
  • Suporte a responsável: campos de nome, telefone, CPF e cobrança no responsável
  • +
+
+
+ +
+
M4
Financeiro
+
+

Controle financeiro completo com receitas, despesas, parcelamentos, repasse para clínica e integração com gateway de pagamento.

+
    +
  • financial_records — registro financeiro (receita/despesa) com status: pending, paid, partial, overdue, cancelled, refunded
  • +
  • Criação automática de cobrança quando sessão é marcada como realizada (trigger auto_create_financial_record_from_session)
  • +
  • financial_categories — categorias personalizáveis de receita e despesa
  • +
  • billing_contracts — contratos de cobrança por paciente (preço, frequência, método)
  • +
  • therapist_payouts e therapist_payout_records — repasse financeiro para terapeutas em clínicas
  • +
  • payment_settings — configuração de formas de pagamento aceitas (Pix, depósito, dinheiro, cartão, convênio)
  • +
  • insurance_plans e insurance_plan_services — gestão de convênios e planos de saúde
  • +
  • Campo clinic_fee_pct e clinic_fee_amount para split entre clínica e terapeuta
  • +
+
+
+ +
+
M5
Notificações
+
+

Sistema de notificações multi-canal com fila, agendamento, opt-in por canal e limpeza automática de mensagens antigas.

+
    +
  • notification_queue — fila de notificações (pendente → processando → enviado)
  • +
  • Canais: email, WhatsApp, SMS — opt-in individual por paciente em notification_preferences
  • +
  • notification_templates e email_templates_tenant — templates personalizáveis por tenant
  • +
  • Cancelamento automático de notificações quando sessão é cancelada ou paciente faz opt-out
  • +
  • Cleanup automático de mensagens enviadas/canceladas após 90 dias
  • +
+
+
+ +
+
M6
Serviços e Precificação
+
+

Catálogo de serviços por terapeuta/clínica com vínculo à recorrência e precificação por sessão.

+
    +
  • services — catálogo de serviços (consulta, avaliação, retorno etc.) por owner/tenant
  • +
  • recurrence_rule_services — serviços vinculados a uma recorrência com quantidade, preço unitário e desconto
  • +
  • Prioridade de preço na sessão: recurrence_rule_services > recurrence_rules.price > agenda_eventos.price
  • +
  • professional_pricing — tabela legada, substituída por services
  • +
+
+
+
+ +
+ + +
+
+ 09 +

Plataforma de Microlearning

+
+

O produto de microlearning é o motor de aquisição orgânica da plataforma. Profissionais chegam pelo conteúdo e descobrem o sistema de gestão. É a estratégia que transforma educação em produto.

+
Insight-chave: o melhor canal de aquisição de um terapeuta é outro terapeuta. O microlearning cria o contexto social onde isso acontece naturalmente.
+
+

Trilhas de Conteúdo por Abordagem

+
+
Gestão de Clínica para Psicólogos (TCC, Gestalt, Humanista)
+
+
    +
  • Como precificar sua sessão sem culpa e com consciência de mercado
  • +
  • LGPD na prática clínica: o que você precisa fazer hoje
  • +
  • Gestão de inadimplência sem comprometer o vínculo terapêutico
  • +
  • Quando e como reajustar o valor da sessão
  • +
  • Organização financeira para o profissional autônomo
  • +
+
+
+
+
Gestão de Clínica para Psicanalistas
+
+
    +
  • Frequência de sessões e modelo de cobrança na psicanálise
  • +
  • Documentação mínima necessária na clínica psicanalítica
  • +
  • Como estruturar uma clínica particular sendo psicanalista
  • +
  • Supervisão e análise pessoal: como e onde buscar
  • +
+
+
+
+
Gestão de Clínica para Psiquiatras
+
+
    +
  • Receituário, laudos e documentação clínica
  • +
  • Credenciamento e faturamento com planos de saúde
  • +
  • Integração com outros profissionais de saúde mental
  • +
  • Como montar um consultório particular de psiquiatria
  • +
+
+
+
+
Para Clínicas Multiprofissionais
+
+
    +
  • Como estruturar o repasse financeiro entre profissionais
  • +
  • Gestão de agenda compartilhada sem conflitos
  • +
  • Contrato de parceria entre clínica e profissional
  • +
+
+
+
+
+ +
+ + +
+
+ 10 +

Modelo de Negócio e Monetização

+
+

O modelo de negócio é SaaS com camada freemium. Os planos são gerenciados pela tabela plans com preços em plan_prices e vitrine pública em plan_public. Cada plano tem um target que define para qual tipo de conta ele é válido.

+
+

Estrutura de Planos

+
+
+
Gratuito
+
Paciente / Terapeuta iniciante
+
target: patient / therapist
+
    +
  • Até 10 pacientes
  • +
  • Agendamento básico
  • +
  • Conteúdo introdutório grátis
  • +
+
+
+
Profissional
+
Terapeuta autônomo
+
target: therapist
+
    +
  • Pacientes ilimitados
  • +
  • Prontuário completo
  • +
  • Financeiro + escalas
  • +
  • Todas as trilhas de conteúdo
  • +
+
+
+
Clínica
+
Múltiplos terapeutas
+
target: clinic
+
    +
  • Multi-terapeuta via tenant_members
  • +
  • Repasse financeiro (therapist_payouts)
  • +
  • Agenda compartilhada
  • +
  • Acesso para toda a equipe
  • +
+
+
+
Supervisor
+
Psicanalistas / supervisores
+
target: supervisor
+
    +
  • Limite de supervisionados (max_supervisees)
  • +
  • Acesso controlado a casos
  • +
  • Workspace próprio de supervisão
  • +
+
+
+
Conteúdo
+
Estudante / Paciente curioso
+
target: patient
+
    +
  • Acesso completo às trilhas
  • +
  • Sem sistema de gestão
  • +
  • Assinatura mensal independente
  • +
+
+
+
+
+

Infraestrutura de Assinaturas

+
    +
  • Tabela subscriptions — assinatura ativa do usuário ou tenant (XOR: ou user_id ou tenant_id, nunca ambos)
  • +
  • Status de assinatura: pending, active, past_due, suspended, cancelled, expired
  • +
  • Tabela subscription_intents_personal e subscription_intents_tenant — intenção de pagamento antes da ativação
  • +
  • Função activate_subscription_from_intent() — ativa assinatura após confirmação de pagamento
  • +
  • Função change_subscription_plan() — muda plano com log em subscription_events
  • +
  • entitlements_invalidation — cache de entitlements é invalidado quando o plano muda
  • +
  • plan_prices — histórico de preços por plano com intervalos (month/year)
  • +
+
+
+ +
+ + +
+
+ 11 +

Modelo de Dados — Schema Real

+
+

Documentação minuciosa das tabelas principais do schema public do banco de dados PostgreSQL 17.6 via Supabase. Este capítulo é a referência autoritativa para qualquer decisão de desenvolvimento.

+ +
+ Convenção: Todas as tabelas usam uuid como PK via gen_random_uuid(). Campos tenant_id e owner_id estão presentes em todas as tabelas de negócio para garantir isolamento multi-tenant. O campo deleted_at implementa soft-delete onde aplicável. +
+ +
+

Tabela: profiles

+

Extensão do auth.users do Supabase. Criado automaticamente no signup. Contém dados públicos do usuário e configurações de perfil.

+
+
+ public.profiles + 1 registro por auth.users +
+
+
idPKFK→auth.usersuuidMesmo ID do auth.users
+
roletextPapel no sistema SaaS: saas_admin | tenant_member | portal_user | patient
+
account_typetextTipo de conta: free | patient | therapist | clinic. Imutável após definição.
+
platform_rolestext[]Papéis globais de plataforma (ex: editor de microlearning). Atribuído pelo saas_admin.
+
full_nametextNome completo do usuário
+
avatar_urltextURL pública no Supabase Storage
+
phonetextWhatsApp no formato (99) 99999-9999
+
biotextBreve apresentação pública (máx 300 chars no front)
+
languagetextDefault: 'pt-BR'
+
timezonetextDefault: 'America/Sao_Paulo'
+
social_customjsonbRedes sociais adicionais: [{name, url}]
+
+
+
+ +
+

Tabela: tenants

+

Representa um workspace isolado — pode ser um terapeuta solo, uma clínica ou um workspace de supervisão. O kind é imutável após criação.

+
+
+ public.tenants + Workspaces isolados multi-tenant +
+
+
idPKuuidID único do tenant
+
nametextNome do workspace (clínica ou nome do terapeuta)
+
kindNNtexttherapist | clinic_coworking | clinic_reception | clinic_full | supervisor | clinic (legado) | saas (legado)
+
created_attimestamptzData de criação
+
+
+
+ +
+

Tabela: tenant_members

+

Vincula usuários a tenants com um papel específico. Um usuário pode pertencer a múltiplos tenants (ex: terapeuta em duas clínicas).

+
+
+ public.tenant_members + Membros por workspace +
+
+
tenant_idFK→tenantsuuidWorkspace ao qual pertence
+
user_idFK→profilesuuidUsuário membro
+
roletextPapel no tenant: tenant_admin | therapist | receptionist | viewer
+
statustextactive | invited | suspended
+
+
+
+ +
+

Tabela: patients

+

Registro completo do paciente. O campo patient_scope define se o paciente pertence à clínica ou a um terapeuta específico. Quando patient_scope = 'therapist', o campo therapist_member_id é obrigatório.

+
+
+ public.patients + ~40 campos por paciente +
+
+
idPKuuidID único do paciente
+
tenant_idFK→tenantsNNuuidWorkspace ao qual pertence
+
owner_idFK→profilesuuidQuem criou/é responsável pelo paciente
+
responsible_member_idNNuuidMembro responsável pelo paciente no tenant
+
therapist_member_iduuidTerapeuta vinculado (obrigatório quando patient_scope = 'therapist')
+
user_idFK→profilesuuidConta de login do paciente (quando é usuário nativo)
+
patient_scopetext'clinic' | 'therapist' — define a quem o paciente pertence
+
statustextAtivo | Inativo | Alta | Encaminhado | Arquivado
+
nome_completoNNtextNome completo do paciente
+
cpftextCPF sem formatação (validado por regex ^\d{11}$)
+
data_nascimentodateData de nascimento
+
cobranca_no_responsavelbooleanCobrar no responsável em vez do paciente
+
notas_internastextNotas privadas do terapeuta (não visíveis ao paciente)
+
+
+
+ +
+

Tabela: agenda_eventos

+

Cada sessão individual na agenda. Gerada manualmente ou automaticamente por regras de recorrência. O campo billed controla se já foi gerada cobrança.

+
+
+ public.agenda_eventos + Sessões e bloqueios de agenda +
+
+
idPKuuidID único do evento
+
tenant_idNNuuidWorkspace
+
owner_idNNuuidTerapeuta dono do evento
+
patient_idFK→patientsuuidPaciente da sessão (null em bloqueios)
+
tipotipo_evento_agenda'sessao' | 'bloqueio'
+
statusstatus_evento_agendaagendado | realizado | faltou | cancelado | remarcar
+
inicio_emNNtimestamptzInício da sessão (com timezone)
+
fim_emNNtimestamptzFim da sessão — constraint: fim_em > inicio_em
+
modalidadetext'presencial' | 'online' — default: 'presencial'
+
recurrence_idFK→recurrence_rulesuuidRegra de recorrência que gerou este evento
+
pricenumeric(10,2)Valor da sessão em BRL
+
billedbooleantrue = cobrança já foi gerada para esta sessão
+
extra_fieldsjsonbCampos customizáveis por abordagem/tenant
+
insurance_plan_iduuidPlano de saúde da sessão (quando convênio)
+
+
+
+ +
+

Tabela: financial_records

+

Registro financeiro central. Gerado automaticamente por trigger quando sessão é marcada como realizada. Suporta parcelamento, split de comissão e múltiplos status.

+
+
+ public.financial_records + Receitas e despesas +
+
+
idPKuuidID único
+
owner_idNNuuidTerapeuta dono do registro
+
tenant_iduuidClínica (quando em contexto de clínica)
+
typefinancial_record_type'receita' | 'despesa'
+
amountNNnumeric(10,2)Valor bruto
+
discount_amountnumeric(10,2)Desconto aplicado
+
final_amountnumeric(10,2)Valor final após desconto
+
clinic_fee_pctnumeric(5,2)Percentual da clínica (0–100)
+
clinic_fee_amountnumeric(10,2)Valor absoluto da taxa da clínica
+
net_amountnumeric(10,2)GENERATED: amount - clinic_fee_amount (valor líquido do terapeuta)
+
statusNNtextpending | paid | partial | overdue | cancelled | refunded
+
agenda_evento_idFK→agenda_eventosuuidSessão que originou a cobrança
+
installmentssmallintNúmero de parcelas (default: 1)
+
installment_groupuuidUUID que agrupa parcelas de um mesmo parcelamento
+
deleted_attimestamptzSoft-delete — null = registro ativo
+
+
+
+ +
+

Tabela: recurrence_rules

+

Regras de recorrência de sessões. Define o padrão de repetição (semanal, quinzenal etc.) com data de início e fim opcional. Gera os agenda_eventos automaticamente.

+
+
+ public.recurrence_rules + Padrões de sessões recorrentes +
+
+
typerecurrence_typeweekly | biweekly | monthly | yearly | custom_weekdays
+
intervalsmallintIntervalo entre ocorrências (ex: 2 para quinzenal)
+
weekdayssmallint[]Dias da semana (0=Dom, 1=Seg...6=Sab) para custom_weekdays
+
start_time / end_timetimeHorário de início e fim da sessão
+
duration_minsmallintDuração em minutos (default: 50)
+
open_endedbooleantrue = sem data de fim definida
+
statustextativo | pausado | cancelado
+
pricenumeric(10,2)Preço padrão da sessão desta recorrência
+
modalidadetext'presencial' | 'online'
+
insurance_plan_iduuidConvênio vinculado a esta recorrência
+
+
+
+ +
+

Tabelas de Suporte — Referência Rápida

+
+ + + + + + + + + + + + + + + + + + + + + +
TabelaFinalidadeObservação
subscriptionsAssinatura ativa do usuário ou tenantXOR: user_id OU tenant_id
plansPlanos disponíveis com preço e targettarget: patient/therapist/clinic/supervisor
plan_featuresFeatures incluídas em cada planoVincula plans ↔ features
featuresCatálogo de funcionalidadesChave técnica imutável
modules + tenant_modulesMódulos disponíveis por tenantControle granular de acesso
notification_queueFila de notificações multi-canalEmail, WhatsApp, SMS
patient_invitesLinks de auto-cadastro para pacientesToken + expiração + limite de usos
patient_intake_requestsFichas de anamnese via link públicoAprovadas pelo terapeuta
billing_contractsContratos de cobrança por pacientePreço, frequência, método
servicesCatálogo de serviços do terapeutaSubstitui professional_pricing
insurance_plansConvênios e planos de saúdeVinculado a sessões e recorrências
therapist_payoutsRepasse financeiro do terapeutaPeríodo, sessões, valor líquido
support_sessionsSessões de suporte do saas_adminToken temporário com TTL (1–120 min)
user_settingsPreferências de UI por usuárioTheme, layout, modo de menu
feriadosFeriados nacionais/locaisIntegração com bloqueios de agenda
global_noticesAvisos da plataforma para usuáriosCom dismissal individual
saas_docs + saas_faqDocumentação e FAQ da plataformaCom votos de utilidade
+
+
+
+ +
+ + +
+
+ 12 +

Enums e Tipos — Referência Completa

+
+

O schema define enums PostgreSQL para todos os campos com valores discretos. Isso garante integridade de dados no nível do banco — sem strings inválidas passando pelo sistema.

+ +
+

Enums do Schema public

+
+ +
+
status_evento_agendapublic
+
+ agendado + realizado + faltou + cancelado + remarcar +
+
+ +
+
recurrence_typepublic
+
+ weekly + biweekly + monthly + yearly + custom_weekdays +
+
+ +
+
tipo_evento_agendapublic
+
+ sessao + bloqueio +
+
+ +
+
recurrence_exception_typepublic
+
+ cancel_session + reschedule_session + patient_missed + therapist_canceled + holiday_block +
+
+ +
+
financial_record_typepublic
+
+ receita + despesa +
+
+ +
+
status_agenda_seriepublic
+
+ ativo + pausado + cancelado +
+
+ +
+
tipo_excecao_agendapublic
+
+ bloqueio + horario_extra +
+
+ +
+
status_excecao_agendapublic
+
+ pendente + ativo + arquivado +
+
+ +
+
determined_field_typepublic
+
+ text + textarea + number + date + select + boolean +
+
+ +
+
commitment_log_sourcepublic
+
+ manual + auto +
+
+ +
+
+ +
+

Constraints de Texto — Equivalentes a Enums

+

Alguns campos usam CHECK constraints em vez de enums PostgreSQL. São igualmente seguros no banco:

+
+ + + + + + + + + + + + + + + + + +
Tabela.ColunaValores Permitidos
profiles.rolesaas_admin | tenant_member | portal_user | patient
profiles.account_typefree | patient | therapist | clinic
tenants.kindtherapist | clinic_coworking | clinic_reception | clinic_full | clinic | saas | supervisor
patients.statusAtivo | Inativo | Alta | Encaminhado | Arquivado
patients.patient_scopeclinic | therapist
financial_records.statuspending | paid | partial | overdue | cancelled | refunded
subscriptions.statuspending | active | past_due | suspended | cancelled | expired
subscriptions.intervalmonth | year
plans.targetpatient | therapist | clinic | supervisor
therapist_payouts.statuspending | paid | cancelled
agenda_eventos.modalidadepresencial | online
user_settings.theme_modelight | dark
user_settings.layout_variantclassic | rail
+
+
+
+ +
+ + +
+
+ 13 +

Funções RPC — Lógica de Negócio no Banco

+
+

O sistema usa extensivamente funções PostgreSQL SECURITY DEFINER para encapsular lógica de negócio complexa e garantir atomicidade. Todas são chamadas via supabase.rpc() no frontend.

+ +
Atenção arquitetural: Funções SECURITY DEFINER executam com as permissões do dono da função (supabase_admin), não do usuário chamador. Isso permite operações que burlariam o RLS de forma controlada. Use com responsabilidade.
+ +
+

Funções Críticas de Negócio

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunçãoO que fazObservação crítica
create_clinic_tenant(p_name)Cria um tenant do tipo 'clinic' e já vincula o usuário atual como tenant_adminAtômico: cria tenant + tenant_members em uma transação
activate_subscription_from_intent(p_intent_id)Ativa assinatura após pagamento confirmado (intent.status = 'paid')Valida target (clinic/therapist/supervisor). Suporta todos os 3 tipos.
change_subscription_plan(p_subscription_id, p_new_plan_id)Muda o plano de uma assinatura ativa com log em subscription_eventsValida compatibilidade de target (clinic ≠ therapist)
cancel_subscription(p_subscription_id)Cancela assinatura e invalida cache de entitlementsLogs em subscription_events, invalida entitlements_invalidation
create_financial_record_for_session(...)Cria cobrança para uma sessão, com idempotência (não duplica)Marca billed=true na agenda_eventos após criar
auto_create_financial_record_from_session()Trigger: cria financial_record automaticamente quando sessão é marcada como realizadaPrioridade de preço: recurrence_rule_services > recurrence_rules.price > agenda_eventos.price
create_patient_intake_request_v2(p_token, p_payload)Cria ficha de anamnese via link público com validação do tokenValida token, expiração, limite de usos e processa 30+ campos do paciente
cancelar_eventos_serie(p_serie_id, p_a_partir_de)Cancela todos os eventos futuros de uma série recorrenteNão cancela eventos já realizados
cancel_recurrence_from(p_recurrence_id, p_from_date)Encerra uma recorrência a partir de uma data, ajustando end_dateSe from_date <= start_date, cancela a recorrência inteira
create_therapist_payout(p_tenant_id, p_therapist_id, p_period_start, p_period_end)Calcula e registra repasse financeiro para terapeuta em uma clínicaAgrega sessões realizadas no período com cálculo de comissão
create_support_session(p_tenant_id, p_ttl_minutes)Cria sessão temporária de acesso ao suporte (saas_admin only)TTL: 1–120 minutos. Valida role = 'saas_admin'
cancel_patient_pending_notifications(patient_id, channel, evento_id)Cancela notificações pendentes de um paciente por canal ou eventoChamada por trigger quando sessão é cancelada ou paciente faz opt-out
can_delete_patient(p_patient_id)Verifica se é seguro deletar um paciente (sem eventos, recorrências ou contratos)Retorna boolean — chame antes de qualquer DELETE em patients
+
+
+ +
+

Triggers Automáticos

+
    +
  • Sessão realizada → cobrança criada: Trigger auto_create_financial_record_from_session dispara quando agenda_eventos.status muda para 'realizado'. Cria financial_record com status 'pending' e vencimento 7 dias após a sessão.
  • +
  • Sessão cancelada → notificações canceladas: Trigger cancel_notifications_on_session_cancel cancela todas as notificações pendentes relacionadas à sessão.
  • +
  • Opt-out do paciente → notificações canceladas: Trigger cancel_notifications_on_opt_out cancela notificações do canal específico quando paciente faz opt-out.
  • +
+
+
+ +
+ + +
+
+ 14 +

Estratégia de Fases de Desenvolvimento

+
+

O desenvolvimento é organizado em quatro fases estratégicas. A infraestrutura de banco de dados (tenants, profiles, agenda, financeiro, notificações) já está substancialmente implementada — o foco atual é na experiência de produto sobre ela.

+ +
+
+
FASE 1MVP e Validação
+ Meses 1–3 +
+
+
    +
  • Sistema multi-papel funcional e sólido — profiles, tenants, tenant_members implementados
  • +
  • Agendamento completo com recorrência e lembretes via e-mail e WhatsApp
  • +
  • Cadastro de pacientes com vínculo terapeuta-paciente e ficha de anamnese online
  • +
  • Prontuário com anotações de sessão em agenda_eventos.extra_fields
  • +
  • Financeiro básico: cobrança automática por trigger, integração Asaas (Pix)
  • +
  • LGPD implementada: criptografia, consentimento, auditoria via support_sessions
  • +
  • Beta fechado com 10–20 terapeutas reais
  • +
  • Landing page de microlearning com 1 trilha inicial
  • +
+
+
+ +
+
+
FASE 2Diferenciação Clínica
+ Meses 4–8 +
+
+
    +
  • Escalas psicológicas integradas (PHQ-9, GAD-7, BDI) usando determined_commitments com campos dinâmicos
  • +
  • Dashboard de evolução do paciente com gráficos longitudinais
  • +
  • Módulo do paciente: diário de humor, tarefas, visualização de agenda (PWA)
  • +
  • Relatórios e laudos com template e exportação em PDF
  • +
  • Módulo de Clínica: tenant kind clinic_*, repasse financeiro (therapist_payouts)
  • +
  • Prontuário completo com campos estruturados por abordagem via extra_fields
  • +
  • Expansão do microlearning: 3–5 trilhas completas
  • +
  • Meta: 100 terapeutas pagantes, churn abaixo de 5%/mês
  • +
+
+
+ +
+
+
FASE 3Rede e Crescimento
+ Meses 9–18 +
+
+
    +
  • Diretório de terapeutas: pacientes encontram profissionais usando profiles públicos
  • +
  • Rede de encaminhamentos estruturada — status 'Encaminhado' em patients com rastreio
  • +
  • Módulo de supervisão clínica — tenant kind 'supervisor' + plano target='supervisor' + max_supervisees
  • +
  • Programa de indicação com benefícios para terapeutas indicadores
  • +
  • Expansão para clínicas multiprofissionais — kind clinic_full
  • +
  • Meta: 1.000 terapeutas ativos, 20+ clínicas, efeito de rede ativado
  • +
+
+
+ +
+
+
FASE 4Inteligência e Escala
+ 18+ meses +
+
+
    +
  • IA de suporte clínico: sugestão bibliográfica por CID, rascunho de evolução por voz — ingerindo agenda_eventos.extra_fields
  • +
  • Alertas de risco baseados em padrões comportamentais do paciente
  • +
  • Integração com planos de saúde: tabelas insurance_plans, insurance_plan_services já existem no schema
  • +
  • API aberta para parceiros — profiles.platform_roles já suporta roles de API
  • +
  • Expansão internacional para mercados lusófonos
  • +
+
+
+
+ +
+ + +
+
+ 15 +

Cronograma do MVP (3 Meses)

+
+

Cronograma desenhado para um time com frontend e backend separados, priorizando entregas que gerem valor real para o primeiro usuário no prazo de 2 a 3 meses. A infraestrutura de banco já existe — o trabalho é de produto, UX e integração.

+ +
+
+
MÊS 1 Fundação Sólida
+
+
+
Frontend
+
Backend
+
Entrega
+
+
+
+
Sem
1–2
+
Telas de login, cadastro, seleção de account_type, navegação base por papel
+
Auth Supabase, profiles criado no signup, middleware de permissão por role e account_type
+
Usuário cria conta, define se é terapeuta ou paciente e navega no ambiente correto
+
+
+
Sem
3–4
+
Dashboard por papel, perfil do usuário, criação de tenant (clínica/solo)
+
RPC create_clinic_tenant, tenant_members, RLS policies por tenant_id
+
Terapeuta cria workspace, convida colegas — multi-tenant funcionando
+
+
+
+ +
+
MÊS 2 Core do Produto
+
+
+
Frontend
+
Backend
+
Entrega
+
+
+
+
Sem
1–2
+
Tela de agenda do terapeuta, configuração de disponibilidade (agenda_regras_semanais)
+
CRUD de agenda_regras_semanais, recurrence_rules, geração de agenda_eventos
+
Terapeuta configura agenda semanal com recorrência
+
+
+
Sem
3–4
+
Cadastro de pacientes, ficha de anamnese, link de auto-cadastro
+
CRUD patients, patient_invites, create_patient_intake_request_v2, notificações de agendamento
+
Paciente agenda sessão via link, terapeuta recebe notificação
+
+
+
+ +
+
MÊS 3 Fechar o Ciclo e Lançar
+
+
+
Frontend
+
Backend
+
Entrega
+
+
+
+
Sem
1–2
+
Tela financeira, histórico de sessões, status de pagamento (financial_records)
+
Integração Asaas (Pix), trigger auto_create_financial_record_from_session, webhooks
+
Ciclo financeiro completo: sessão realizada → cobrança automática → confirmação Pix
+
+
+
Sem
3–4
+
Anotações de sessão em extra_fields, UX refinado, landing page de microlearning
+
Revisão de segurança, RLS audit via support_sessions, ambiente de produção, monitoramento
+
Beta com 10–20 terapeutas reais
+
+
+
+
+
+ +
+ + +
+
+ 16 +

Riscos e Mitigações

+
+ +
+
+
RLS mal configurada vazando dados entre tenants
+

O risco mais crítico do sistema. Toda query deve filtrar por tenant_id = auth.uid() ou similar. Testar com usuário de tenant B tentando acessar dados do tenant A. Usar support_sessions para auditoria. Code review obrigatório em toda RLS policy nova.

+
+
Impacto AltoProb. Médio
+
+ +
+
+
Trigger financeiro falhando silenciosamente
+

O trigger auto_create_financial_record_from_session usa EXCEPTION WHEN OTHERS com RAISE WARNING — nunca bloqueia a agenda. Monitorar logs do Supabase para warnings. Implementar painel de sessões billed=false com status 'realizado' como alerta de cobrança perdida.

+
+
Impacto MédioProb. Médio
+
+ +
+
+
Integração de pagamento subestimada
+

Reservar pelo menos 2 semanas dedicadas para a integração com Asaas. Testar todos os fluxos de webhook, falha de pagamento e conciliação. A tabela payment_settings já existe — focar na lógica de webhook e mapeamento de status.

+
+
Impacto MédioProb. Alto
+
+ +
+
+
Dados sensíveis sem criptografia
+

Implementar criptografia em repouso para prontuários e anotações desde o início. O campo notas_internas dos pacientes e extra_fields das sessões são os mais críticos. Usar Supabase Vault para secrets. Tratar como requisito não-negociável.

+
+
Impacto AltoProb. Baixo
+
+ +
+
+
Complexidade do sistema multi-tenant na UI
+

O schema suporta todos os tipos de tenant, mas a UI precisa ser simples. Terapeuta solo não deve ver opções de clínica. Usar tenants.kind para esconder/mostrar funcionalidades. Criar versão simplificada do onboarding para kind='therapist'.

+
+
Impacto MédioProb. Alto
+
+ +
+
+
Adoção lenta pelos terapeutas
+

Beta fechado com 10–20 terapeutas antes do lançamento público. Onboarding em 5 minutos. Plano gratuito generoso. Microlearning como canal de aquisição orgânica. Usar global_notices para comunicação de novidades in-app.

+
+
Impacto AltoProb. Médio
+
+ +
+
+
Escopo crescente comprometendo o prazo
+

O schema já tem muitas funcionalidades implementadas (convênios, repasse, supervisão). Resistir à tentação de ativar tudo no MVP. Usar o sistema de modules e tenant_modules para liberar features gradualmente por tenant, sem reescrever código.

+
+
Impacto AltoProb. Alto
+
+
+ +
+ + +
+
+ 17 +

Estratégia de Adoção e Crescimento

+
+
+

O Funil de Aquisição

+
+
+
📢
+
+
Topo do Funil — Conteúdo
+

Microlearning gratuito atrai terapeutas buscando aprender gestão. SEO em conteúdo de blog e trilhas. Presença no Instagram e LinkedIn com dicas de gestão clínica.

+
+
+
+
🔬
+
+
Meio do Funil — Experimentação
+

Plano gratuito com limite generoso (account_type = 'free'). Onboarding em 5 minutos. O terapeuta experimenta sem compromisso e vê valor antes de pagar.

+
+
+
+
💳
+
+
Fundo do Funil — Conversão
+

Quando ultrapassa o limite do plano gratuito, a conversão é natural. O sistema de subscription_intents facilita o checkout sem atrito.

+
+
+
+
🔒
+
+
Retenção — Profundidade
+

Escalas clínicas, prontuário acumulado em agenda_eventos e histórico financeiro criam lock-in legítimo. O custo de sair é alto porque os dados clínicos estão na plataforma.

+
+
+
+
🌐
+
+
Expansão — Indicação
+

Programa de indicação: terapeuta indica colega, ambos ganham benefício. O sistema de patient_invites é o modelo para o sistema de indicação de terapeutas.

+
+
+
+
+
+

Estratégia de Beta — Os Primeiros 20 Terapeutas

+
    +
  • Recrutar manualmente via LinkedIn, grupos de psicólogos no WhatsApp e Facebook, indicações pessoais.
  • +
  • Oferecer 6 meses gratuitos no plano Profissional em troca de uso semanal e feedback honesto — configurado via subscriptions com source = 'manual'.
  • +
  • Realizar call de 30 minutos com cada beta-tester após 2 semanas de uso.
  • +
  • Observar onde travam no onboarding, o que tentam fazer e não encontram, o que elogiam espontaneamente.
  • +
  • Usar esses aprendizados para uma rodada de ajustes de 2 semanas antes do lançamento público.
  • +
  • Transformar os melhores beta-testers em embaixadores com benefícios permanentes.
  • +
+
+
+ +
+ + +
+
+ 18 +

Visão de Longo Prazo

+
+

Em 5 anos, a plataforma deve ser reconhecida como a infraestrutura da saúde mental brasileira — o ambiente onde profissionais aprendem, trabalham, colaboram e crescem.

+
Visão de longo prazo: Ser para o terapeuta brasileiro o que a Bloomberg é para o mercado financeiro — a plataforma que nenhum profissional sério consegue imaginar trabalhar sem ela.
+ +
+
+
🗺
+
Plataforma de Referência Nacional
+

O maior diretório de terapeutas do Brasil, com pacientes encontrando profissionais por abordagem, especialidade e localização. Base técnica: profiles públicos com bio e redes sociais.

+
+
+
🎓
+
Educação Continuada Reconhecida
+

Certificações reconhecidas pelo mercado. Parcerias com conselhos profissionais e universidades. Base: plataforma de microlearning e platform_roles.

+
+
+
🤖
+
IA Clínica de Suporte
+

Assistente que apoia na documentação, sugestão de intervenções e identificação de padrões de risco — ingerindo agenda_eventos.extra_fields e histórico longitudinal.

+
+
+
🌍
+
Expansão Lusófona
+

Portugal, Angola e Moçambique como mercados naturais. O schema já prevê profiles.language e profiles.timezone para internacionalização.

+
+
+
💚
+
Impacto Social Mensurável
+

Contribuir para o aumento da qualidade e acessibilidade do cuidado em saúde mental no Brasil, com métricas públicas de impacto.

+
+
+ +
+

Este documento é vivo. Deve ser revisado e atualizado a cada fase concluída, incorporando os aprendizados do mercado, as decisões do time e as evoluções do schema de banco de dados.

+
+
+ +
+ + +
+ Plataforma de Saúde Mental — Documento Estratégico Fundacional
+ Versão 2.0 · 2025 · Uso interno restrito · PostgreSQL 17.6 · Supabase +
+ + + + diff --git a/docs/estrategia/plataforma_saude_mental_v2.pdf b/docs/estrategia/plataforma_saude_mental_v2.pdf new file mode 100644 index 0000000..d577925 --- /dev/null +++ b/docs/estrategia/plataforma_saude_mental_v2.pdf @@ -0,0 +1,710 @@ +%PDF-1.4 +% ReportLab Generated PDF document (opensource) +1 0 obj +<< +/F1 2 0 R /F2 3 0 R /F3 6 0 R /F4 10 0 R /F5 13 0 R /F6 15 0 R + /F7 22 0 R +>> +endobj +2 0 obj +<< +/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font +>> +endobj +3 0 obj +<< +/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font +>> +endobj +4 0 obj +<< +/Contents 40 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/ExtGState << +/gRLs0 << +/ca .3 +>> /gRLs1 << +/ca .2925 +>> /gRLs10 << +/ca .225 +>> /gRLs11 << +/ca .2175 +>> /gRLs12 << +/ca .21 +>> /gRLs13 << +/ca .2025 +>> + /gRLs14 << +/ca .195 +>> /gRLs15 << +/ca .1875 +>> /gRLs16 << +/ca .18 +>> /gRLs17 << +/ca .1725 +>> /gRLs18 << +/ca .165 +>> /gRLs19 << +/ca .1575 +>> + /gRLs2 << +/ca .285 +>> /gRLs20 << +/ca .15 +>> /gRLs21 << +/ca .1425 +>> /gRLs22 << +/ca .135 +>> /gRLs23 << +/ca .1275 +>> /gRLs24 << +/ca .12 +>> + /gRLs25 << +/ca .1125 +>> /gRLs26 << +/ca .105 +>> /gRLs27 << +/ca .0975 +>> /gRLs28 << +/ca .09 +>> /gRLs29 << +/ca .0825 +>> /gRLs3 << +/ca .2775 +>> + /gRLs30 << +/ca .075 +>> /gRLs31 << +/ca .0675 +>> /gRLs32 << +/ca .06 +>> /gRLs33 << +/ca .0525 +>> /gRLs34 << +/ca .045 +>> /gRLs35 << +/ca .0375 +>> + /gRLs36 << +/ca .03 +>> /gRLs37 << +/ca .0225 +>> /gRLs38 << +/ca .015 +>> /gRLs39 << +/ca .0075 +>> /gRLs4 << +/ca .27 +>> /gRLs40 << +/ca 1 +>> + /gRLs5 << +/ca .2625 +>> /gRLs6 << +/ca .255 +>> /gRLs7 << +/ca .2475 +>> /gRLs8 << +/ca .24 +>> /gRLs9 << +/ca .2325 +>> +>> /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +5 0 obj +<< +/Contents 41 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +6 0 obj +<< +/BaseFont /Helvetica-Oblique /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font +>> +endobj +7 0 obj +<< +/Contents 42 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +8 0 obj +<< +/Contents 43 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +9 0 obj +<< +/Contents 44 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +10 0 obj +<< +/BaseFont /Helvetica-BoldOblique /Encoding /WinAnsiEncoding /Name /F4 /Subtype /Type1 /Type /Font +>> +endobj +11 0 obj +<< +/Contents 45 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +12 0 obj +<< +/Contents 46 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +13 0 obj +<< +/BaseFont /Symbol /Name /F5 /Subtype /Type1 /Type /Font +>> +endobj +14 0 obj +<< +/Contents 47 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +15 0 obj +<< +/BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F6 /Subtype /Type1 /Type /Font +>> +endobj +16 0 obj +<< +/Contents 48 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +17 0 obj +<< +/Contents 49 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +18 0 obj +<< +/Contents 50 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +19 0 obj +<< +/Contents 51 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +20 0 obj +<< +/Contents 52 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +21 0 obj +<< +/Contents 53 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +22 0 obj +<< +/BaseFont /Courier-Bold /Encoding /WinAnsiEncoding /Name /F7 /Subtype /Type1 /Type /Font +>> +endobj +23 0 obj +<< +/Contents 54 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +24 0 obj +<< +/Contents 55 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +25 0 obj +<< +/Contents 56 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +26 0 obj +<< +/Contents 57 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +27 0 obj +<< +/Contents 58 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +28 0 obj +<< +/Contents 59 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +29 0 obj +<< +/Contents 60 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +30 0 obj +<< +/Contents 61 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +31 0 obj +<< +/Contents 62 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +32 0 obj +<< +/Contents 63 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +33 0 obj +<< +/Contents 64 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +34 0 obj +<< +/Contents 65 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +35 0 obj +<< +/Contents 66 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +36 0 obj +<< +/Contents 67 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 39 0 R /Resources << +/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] +>> /Rotate 0 /Trans << + +>> + /Type /Page +>> +endobj +37 0 obj +<< +/PageMode /UseNone /Pages 39 0 R /Type /Catalog +>> +endobj +38 0 obj +<< +/Author (Uso interno restrito) /CreationDate (D:20260322013413+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260322013413+00'00') /Producer (ReportLab PDF Library - \(opensource\)) + /Subject (Ecossistema de Sa\372de Mental Brasileira) /Title (Plataforma de Sa\372de Mental \204 Documento Estrat\351gico v2.0) /Trapped /False +>> +endobj +39 0 obj +<< +/Count 28 /Kids [ 4 0 R 5 0 R 7 0 R 8 0 R 9 0 R 11 0 R 12 0 R 14 0 R 16 0 R 17 0 R + 18 0 R 19 0 R 20 0 R 21 0 R 23 0 R 24 0 R 25 0 R 26 0 R 27 0 R 28 0 R + 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R 34 0 R 35 0 R 36 0 R ] /Type /Pages +>> +endobj +40 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 1874 +>> +stream +Gb!So95iQS&AIa;bb[QC1`PlLP=NTXK+q(NfM$Y^7A1SfJKBgs\,H,nI?7WiEh!1s%kGOEGJBR%R;[ku!Bf@)I?`hi!B!gi0$[104A$#h[3C6CJb/naH`oY+`->\g2!]\0f2LTQ(1u]=kL1Pq0Bf$aXbV-[PV"l@"Jc=$Ed_P9YfO_HUY]_iY$-B>(h/U!d"G7#cIf$N<"t>ES"\k77`C])^.:pO9`j4O!,Aa3JL4\bR%oDDoY[E`0^iCW=WPl6mP-YfoV=*3G(WJ2WU57);1*]2H43SNS.-j%5h`b75iY_%:+-I4G';&(MmYI/I(h+!9aHV%mVuPWWV1r,XL4iLXZl5$"SgQ4[:Vn'$(N/8.Hf25\::ieCc'b'Bk7.KF'B/66ofl+W2J46Oqe2#odp+L.p6]6T/JlL)R@k&iS7$%@+/kL289%T((,>-d[qaS]8WG?mKRP+WEIN_[P3P#odKtL.U#O6T.WTL)mR.'/o3=%@aS1LMYVa#3-Jd!bRZibV//2Qb*mm]4,'=ngDO/.4\NrU#LZ(Jjcl>A^Do'[UOjVHsHDuVPkarL+@829@_LVRt=*2%BC0Mkk.aq;juP[DW-&k'`H>U*2`Ql>hZqe7Lo"E*Q6_R'Y-:RF*CIBm\%k]6'Jp52KoD,g`>JOQSR7G1-GGCL1alZS-!:p(\%_^80`@f//kC9nV-N1mi\cKA"j5R!h\]g"/'JI8,@If//kC9nV-N1a;gc7V#lTM!SmqOaTqKZEIt1p,.iN^8;Lqf/+]KRRUghe!-Rn@'Xf3jJo:R4T%-&e2ON<8!qYmG3F")?&p(bDZu2MQ/(cQdIe)cVKc[F=Zms:AMq\&0UG]nOYp@7PB?$un*S,.G/h[7Y9^H&oXMi[>P-YIA#hG#VPL&*=Lcf)i>G?U34Vl_i?diVngF[UGFu=naZasMPq[M?,[PO;[]D\jn@KXmG<[b@^1pc(ccX-sTX&>3,3oAdW1c#b';.[)j0@gZ?],@tnd/F^@p[*-I:TNHlSsJ[kU6q]82c!9rbp1'J9;[EJ+B;%]0;$to@L`4fVe&NI7'e7:(AFtm1pj+Uk0G>ZOd>_b+H-Fu0lF,.Q-f:V"u3]GP._2p^C3.pkq:.S+5J9rY=qSGr]++BMh=R5Phqu9^;-Ae@9rfZY4"h<1RAO68/YtA*Y'lI4juS!i<@Ba?>"/_1p6"EQ*(_Q8Xj+,RECkf_sfecBIOHfY]%&>8>_.ok(H6AnVs]IHH8;m^OCOXVAOrn#)!qoW)j8~>endstream +endobj +41 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 1546 +>> +stream +GauaA?Z4p`&A[3!'_Bs_WF#UaP=Gtel3[k'Blss!jFZ>gKt'iD:YJUZG(9S)Ks#NW6Nmh5p5J/n[V$p5JB]1853"N99aKWo#nRI&&dUuI_BB?)c>*YniVSiA,*W?d!(7u;FY_EA"rR0-7mI1Y;(4U="C]G8dmCnACBkFnZ[`,:J\;%/H%7Pi-i8@aI7_nZfbYdgp=ZDnXbM;,TXd^=EsVn9$2)(](eO(`L24;f%(fsBG!$dfTg+'1GKq$_(Sef6fH#Eln/9*H]5d3$*YNXDBgeO7+&bQ^hi?UGnReo/;T#.Uo;J085upRY@88pquS4@FQN572\^;meM_'g\F&Dr;Q8^3,9>/AnoNg$p>tZHHVk::oJT&TW*Q4_ks-OiO7.`W/M\EV8Y6:[F0iK3.rs5rRW"HIb;V2!'(;5rBdc1r\OWHIT,%I-_u'Dhd;gT9A"k]i03@_Eu-cf?`_m6(Z6[j<4(*!PBeJ@MAs:q(Z-i(#)Bn5/)FjqR_#;?h-V'N4862OUHQtM=:#rU-5*T6([+!=fF8,)!Nf$M[WfmnTB_Q43'p3j$S:Z7fkB'o-LNUe'g4H@WDX.W:Y_?O;Nc>sY`.CVu6f1^logLD]OA3,\/9bnJJ:c7$T'1S>11,3,[[ofIWXE@2`,ek>+$'0R:co.;PqiB_38@J4L(:<7??A#uCc!ND$WQIpVm:*KB`c8*B45W#Rh]>JEk[?/DeV)EFr^4e%pZI12U^bo::aS+!W%AG^?\&T8R<#9_GmP11Ei_C5bPCT//6]g`OOue<05/,o"=kR9$*&L30P"'#ieG0mC.#E#9W[Q2VCulE]F,j5,QST<1jC6XIQ"l6K6*9LjN>#T/d$ZAI+7=15;ng*`h`=To>[EHO30TsLak_%\H=L1@mW\QgfnTSK-g`2jUriJf_>!dQE@A7!nlbmo4YEVsU_*"1kG7E,Kq/p"*HQ)'%QDHelb[H^@Ig_%3`Sh.1ZMqssJPWM)sQq&g%+iaOHm1IY$KAPXY@06P:O,F'u[[1fl-B!c%%s'89]8[.teYDu@:t_=5hid90Y?U2]SF8>F]ps^3=^g[Y3n(,l>$".bdF/6\endstream +endobj +42 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2890 +>> +stream +Gau0DBi!e\')g+Z#`UZ=FV!OmICm8!I7Yr8RKdBt$dpME,t0""eNSlDq=XV/drla2d4f7tL2tt8EP@AJ@7_O>8c(G"M>hWd^OD=kICd!9)2aNYcKO<=dJ"mE7;;%B,c!)g3$[B\ZT+th0?H>=`j)9OT0:i5>BdC_\[YK7\_!h2$\R5'tQf;_-4)JMU)>qn3jCGJ($shKjm([^kYWUj#5+XW@_*`0O>aF34`$fdd&h^&#VTR/X0+MsWrGEkfSElTp)I?@3K#M:)6@(`(:mG?WAIVIS%;U!e'c3kfC`6WA&Y,^<6ibseL;kSY/a(ZeiXQA;&Y.94hF\F!"O[0Jbl'*D-/uCV55h:kB5Mt(s^Cm9a_XWQdNH2/W;0CX(0TL5)6EtZ&c=ERcS\B_)F5a0C_L2l1W"AS27[$CS8>CP\IC1WH*V=)V6:)B%:q8+/q9U/)QD\m!Y'b#j].=d2u_"4JK[S4_j['DWD>Rhf2og#Y;?dHsgJG;\1pD$pQc:]JQ#,X$Rb+I!"%E+^\YcbW,_54SLd"Ig^r,ug*-L^7h!p-BNCdXN=aCk+?ce1l4B\7UIo]mcF7,*,(gT&B?sp/NWse-ohISCWA2E%oYbQNG;1]9iG!@=1P%82-^!#OKf9N=+lTF+3qld-4JoDR/ME-(T&CHon)LHhP%fT-1VdT1(-Ii@pta\5fV%(S3r*)"5dG)PhXM0j(5_kICF7NJhtY\n<%3<5)O>EY1N!ALn%RV6'I2b_mB'tF@Z@V9@_G93.[-,*k>B`)>]%E$jZR4)%=8:H3O4)0U>TN4,f_TkZ$OI/Icc0i2@RN%9+p7;\=Tl]G/G0h$d6T=,WnFIn]NW3]B&dMMjP@;D#F#Fa\fo;BE1/RSmhZmVAZ]pn-fLp&h]>]t4'-S7n=h=SB6Fdr_++c92UH$$9EU>h8^Q)6i/j:u(G_rY93'5rXl^o7YVSrMKkm=j0[GaoM'(IlcR^C1aok19VWrI=n6]oA$H)Er[F/+@Z;>_/@N2L`r2g^)C)4C-LE<8Ohqp+$ab>q^24_GlHKHCE,m2'IbELoP!"mOs_IZ<,#cc7if[3H<(P_Q=P,XU5NEEeekJYV0$k]3eBpm@;&(k_.QC9.a-)E$aKenTpKUQRq"IN<=nTZPs+Q7j5fZDj_C5EY6Q@YNs7K=9Bi*cg,JVgOA+"hp6n\,oe,f_92(%3%04,cfpH4#D&'ND]>fP5Pg;U'E_%R9fVHd;*i5oJdb@\Y:4S4;PA$Ffb3aDj1`Ph>sj?`!Y?5Jfd\(\>`$IR7N1Bu`_`T*=CHY;oh1p4u2pS`7f,?CsHZ,Xg^@B@^6N',n[6FT_miUoBQ]iJMHf5unD[5G,l6]H*8[f&+[V9,4-#]Is"Ae*0MM1AYLMR,rZed[&SX]\VarT;rq[>ikG,&gCDcl(bKd&#%b`cV6UKlSt5qessM=tekO"p(].\#n@uJ99+&iofP$\6j<*.*qUh/chTZP^/oR&c$-dIn'TnHBoRJN]i,(6J5@al:3YfGG;Le+`g')eh9V_RIRisNoR?kCS]L~>endstream +endobj +43 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2762 +>> +stream +Gb!Sl9lo(1&\[L3oPKjF)8Q`q?'U%ObH=RmCTX`3?@3V&6Y[S@6Xp+A/&+9O#65'l;U"e`LI:frdI4aI3hET\lk5QK:$Q5d+-CoQa7f.nm'0K#UtqDTKlDe3GWRe/&EE);aF!;">WVJ8jj65.)cKelQ=FSObZdW.>SB25X?/%iIA?iVL'clA2k\$%g=uN),8?-_L,u=Sr1p^U'RQV.HM`^Z7s>8Ra/+o>i&`"HM@F+-,$sc&!ro_8E.PAX.O;_hu&1G51@c;UE#Sk"prK!T^m*uTaYHK&+X)]'hZZP&8>[pR"/cFn0iBW8/El4HS>U4>5AP4nle@E`WDmDHSSi(kT[L3Y;cIMsCHd5Pkun+=/).Mj*W;KMY)RMB2Te!Ck\r\KV4N8UZF1muo7EqEMOC\J7B5VeJ(1i'>I?5W.]oIGAK%ln^:9h>iJF\GQ(H9eg21'->f@>=7AqL2$A5G2"qcb?CODA.rAJUNU?6a6)_F*G!MPM+K<'`:kdUUh-a!SK@.k`1RT<+Fa*OFfM!H6JGB`'_m%eYtFdb7!EF!8F7M%kZUi>J's5k0]fBPkqKea^F0Damn03n+-o?C7_B__HImS=j-HE\f/JJ-JHif9Q-0-TYVaVp8_>\oSaIGo#D?`1la#@:G>sJag&p13I^H_>g,M'#Nge[2L"&.,t41AjCts<%"d^t%ZJ[R2aRp!PCDDBJ\hs&TGPYd1iUs5VFE,T0^K=0R')!pMOEg7[0&Kt!e:QhX>/%mhN6bAq*q$Pn*-cBpfL&*_NAKF1=(HPM47CW5\to7#*J/h>jg7^WU5#9.dg^q?Xk4gZ-,n,>(P2E=4#?.13QYWOq-k!-asR8._B-/VU%VtG.mGuf%/E%&("BkLZ#Nik"n1T"ek=Gh`"eKCFcO@`\\VmE`pQm7+HT=#G>(>6N'?2VYr3h7Tc]f6%>,/?[/2)?#S[K)Nu3taq3F`;Ra8#ZpPU6O'!O?#gk99lnit?ndMt)c%+Y&dk)j=gAu)-FiT]uOC_*RpDdoLDX?t)7YSq'"eBBe\td$f%snt=3+>lQkEqAhH=#cdIj0C"]K[U<1L'12Bl!VTk%ha5Kg=Hpf9QM\%T7F?>-lMnq/(B%UCATU(P)Vgg[iG/t%Dmt9G$B_juhHgtOl!1q>0bQi'7X7gep\9jjaos9?76n%[[IJn=JeVSZkMpJ^JkWJ\7=TJZPR(8/8\&1CpJ%VWj*5G.VUBSNkN?7a>KkO1h5S\*DR[Mb+MOG:aNhK\m#2^CVaW=7NK'q*7[^SsRsq\\3BW!Q9ud]2["a>nrN'%sRT/+OMHM5-Isr5DRES`l,q&LMQj&>9cU"1mY5fpq!3po$8B?<6HcMAr@g$<#j4'2uloQslE;D7"WM<+.(ioaR7%QRg:Ai$`Z4SIES6^>G(%smDNGKNe\g&8Ir)PZ39RS_XaQ)$pbuYV&gP8(%Vk8_lIcWOk1b`NRj*$3$AD9k?.%L"L5mp#'YU>b6jU>AW[[P+^+*T58+e\QHPV?Pd!X;kRX#KrG_><-9[jm]c,L7qaMDD,+J;Z\UH7HEm!W<.]**p:Me`mHa/=H&s4NPS*@;PhGR+C\pC!#rX\5asCRR^Oo.dNDRV1WW)N>,Bij0`m'C,=u#nJ^(%XEGG,onI\$BeDE7?2'1Rj:bY\@HspRA[D<\H1$nBLA@#Z0h*,?G@GC@e\O:MdqcJ_n@Qg&GEO"Ld/,X;NA1/R;-o27W0Z`T/_5r?EQ-jh@a!-27m$==2lbmAa"KROGCGtAGETjFI>8Q/La5U5pG]+AN`+>-MY1kaOC1gi2Q1VoFR#/.H+btK>])3N$eeD8f\eK(f%Xr6fS/TFZul"[3POp<~>endstream +endobj +44 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 804 +>> +stream +GatUobAu&c'Sc@-MR*_^NmPbNXC\%RS+Hb!Zt<5r(d;a>(OuI5W7MTL*]BR8*u0.b"#Kl"luYVak1.8.Ue+jm3OY+tO4Spm:A[d@,$oF!qkOMA@&=L?\)77/Ij=*[ngY2I!3CU^TdjikWgbtaQhboa\fnFPPZ$aiB;Z>KA#AO"%oa0_I-U396!C5,'e+H&TmC(R6^!R9""bjBJc9dtf;n'H'n>-?^g(i.%./?Opt!'VEJM2t]=5^:gkaNjfoD4(G"Mi=BJ^.I(6j47teWhAGRSs@k'tnOUOfqJZPV/Y8R.,aKa"ja9Ot%@/dO<_4g%:Z5BZ*gmZBZ*A(ONk.rp-oiC5$@(E$3YWQo?H]2X@;%P.j_t4-kH`D0N+Pd]`XHd.>gg08ORk@IUK(BftUYGW%9=/-nd_\.uld>S&a[IaZgCR&iFp9"7]:Y+\DN*L%.MkHbgG\3NJq"!?&%XUO(e5=e_'$b;T[>l>GLh8YKS>1\aNdgXO&&sS-I^jendstream +endobj +45 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2957 +>> +stream +Gb!SmgN)%>%Xn(Qi6aW%1M$*kDbabSZ^'jpRG%mIV:oHQAsQsX]I;IJhh,g0U23E+Z^R5#aq;m'3,Y*/+s=o>?5TO"#\oYQ2;X6if1D^XUG*,t&VgsPT&U/B_@qeB^R[>jiqfVs-V4&bS2a'q"0[(3HP-:rGi%U*EY8EX()^/[:U$G.0X#_bAq,#cDXnYbLc#<(3&(S$GIc+uSNbcTA=+p;4F/u:=44Vh!:4so^Ve6A2#LVA;hbTdk$/ON:d@22K?AI_CYOIAoJr26jpj'+tI'[Up]?"f/[\&T\k4i76SB-a)MLEeW]efqbES!'l2gRX=+BqOLp8/8f@C^[(8\I)M>b*^1OpHf?E1.l/>P8]^8E]cPqg>c.Lk7q/?C/t8i0*#hZc'cfFBRP$)f4p!HJi0*rH\N8a!(rNkVrlr%sCGqY3>U]-eR/IdJ/UDa(Iu9La^hPG;60PZ1FCRFK8`^qK+6]s^iMl4P-GQn4N/@lqehqAr*kbT\m?;[@fd/aB#fl-oom0G3-M2OmZ8N15&TEh,EEgo!-l&kH6K7T(aT&7[7If>s,:insm!<(.\q4Y&&ga\7u"JZpr1jQ&Ol(&7i8RKfH_.Z6?SPj>?J=n>6Ecr]oP);fsk<6JH2>".c(Hi28*TWf11UfAlD$R2<=h_n;[MdKT3[^9GU/WHY`L]#$9@^1YZ:rDp-d6a.CZD(MhZ9'25&QQhm"boU8*.40mgocu9ta6/+gF6'0Z>ELVn-HV6@FC>Ca2^dQ,H/\7G\=Xtr6H%`cJ8+tRoXitI#p"%8H*s+Z&.)kBHLQ4]HQ9eg(r0&!b\23*:k0hM9fGitf)PrRLgK7Q">VRM!,($DT&.B_4GH#uN8^?s\CE#@R^U0r0Z?>/\)rSWmS1<1pfqETd?WP4RD3$W(B\M:!Al.>JkcLRrV"NS1@f)UCGX&:SYGq]q&dj0gR:9cXYc;&#d_ld8^aT4CrdL"q/kRC"pXoPD._2'_c/%1]fUn$n/t'Ve:fGhfb*-%7^=(=2-A_O@,CjIA0cA#>(NN4JDlln(%2&';=%2\UGMjLNXWB&uGF*JI%]-#ldBU`Z$hYM4QFoN(cE>\0+j[[4%mB6b.t;AE*RF@M888r)6-Btp\O3\kcK_j'ga.,aTpnZK;63fu;bZC-I$Pa<^2[X'h0?W\R+1dti(l*e<&Goc9+CGeg_'`\VOFd&BC!os\8Yh0'%g7%Wdi2)hV+_#gaT)),ahYu0U6D+j8Ki9X`uB?'SM\u.Z#C$LJMVg6n*h>aLfc_Ts-c%@F[Mn6qp@OV_W+h?"DJ")3sorXjThAWKMaRWcOqsi_p1D,*pZe3h-qQn]I/'c>T^Z)nBCfCGfEH(V4#5,qPpCP)(De(2XF>!TUFb"H*NQa^B'tt]V?').uOY)Jl%K'+G`EE=UCK9YkoL_&J?Ou6;B7?U:GjS_=W)iR3(DCCS6-(Z],.Ei;Zb(SK$QiR[CLpSS$_H`U5+'Ne:GuXD\I_pS+^s??6LtCjW=96<5tL4G\\FS]2'0f_Y.d/n(WG5),-DP%Q@lR-+KFAC.AA5BL+hPsH`j,u(2QPi/=28`L_A#>a6WAbL:`"$I&4W4NHog9g@s)\8)fZp1^]p7t=l9uKGh.kX(J)*.>dRQc[Z21_GsB)=\PIY=7XHq`&b+S7A+S*\_P'igd&H!bHET;.Pc_Z5XH%rgdq$k[C,!o(R*G:NL9Gu;&Z]3+UY3]"BKpWA@i`/.J!+T>c!ZA)Q3F#1^Xk[F\?$8QRAKFEIHk-LWT<]+6Ar/=[V6$HJ)LG;%8c#$>UE0bBOL-+mnCP$#tc1l[dZQ=`/&KVl3^.$*(0L)jA!qnhL>YD8UK'g?1Fn6?.JSt+uRFY\<#U_l[)VQ<^puf]hoSd*^]KD8$kkWER#e'/`\a;6MW[CEJ(WBpr!KO23!0*MbBc@Zd2+6d8p3\Wendstream +endobj +46 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 1340 +>> +stream +Gatm:gMZ%0&:Ml+%.`IbUg.4o>mg5?h)L;rP3aLO4rFVCM0>+eUe46nd')n7<9/;5BarQa*%2G4k005L1M/oBLCJaV#2n)Z]XqRe3%W[s&sC'$&f/ZS5>DKLH-R'GN&-k;5WH9uM*\bTTHm<3#-s>DB/0Y4#j!8L',oG?:C,.C-odZ%Eq"CcBn-\:LCF!9e'>-b+tR\"UO,bHN-F0lL"^Y&)2faaP.ItQ!kqu/\t`UH,g@W0%]\B-GVVeOr`Ao?Smhtn#PkVuE%tldA=!`s^<#IF$M2r2;&S\_,mf^8aAC5L[u=lI(5X<<88/Q%`7-"G2X-ih0^gVRqAHZd"1$UV.XRp5MqV]KTmZ@0-Ke:+rGtg&sLZn:W*d*KFB>H#/5sC81"G?JJh3]=T/W5V08lhIA]37:7&@i%HqGT%U)l`Lf38;jV3r&X#J07p]Pi;S]!gH0-[_r'ZK"=n]629J_%QcAUq<$o4UsO+-Wo]PiUPMYlibB4duBZm8b*#3or92gFF'b8M7>+$L\cjh>'&o_l-$._>IW/$MIi$BVNgB4l&:df;Qeg1VSch2RYrk<4eHR+u-%8a._/r&d$A?,7>ZS6Lj!hBXOet]RRh:)dS['!8;iB5DtC4CWU<0)%I`7W'NTG&d,Z#pZq'RZF3PJXn+mq.7ODbNaJO1H`1'!=2>DYh%5gspW'g28V&TID$O>0NRnDN%a'j0)rIeOEDV);Qakr<1g%5~>endstream +endobj +47 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2607 +>> +stream +Gb!ktgN)>a&UjCToV9']3<0-ZR^>\48X?d\3V*UT,bjR&16IW.TU1Bk!b-m`*p_88-4Q:5tD#t>jd:_+_gc$RDWLc9/nq\@NNUIr5:`RSTXNjo..\&chnt72KRS(7V7Eq^HoMDXY39*E5k8&RHm7YN.Gc5>[Ld^0&M/iq05JLhpLiQh"*KH5/-o*G'S4*ZS+04WO66;LJD7D7p'fe^<7PbqMkH_3j%!hY;EpCX$Td,046;qC792bd2SW0eO&Dt'&!7nj0!W8!9\Phq3rqX\`\=.\DoL0\]]Wfl.8gsat$WU)B`K:WmZM'a+NSniV*s4N!%Zr.=1sNIQESf\&-2G&5*/2Tc]1TmTH`qGHl:2i6Q$IZ^VbN-hO.#,*+_b9-WjC?XY+oAh2ao%O=;+W]M!&iZC$Mm5/')M8\^h!r-Fi+MudEX&0]*WuI(MLCOohk>rU](p:Lf,hQKYKce21S`\_o_+9Vo>9=DYht2!554Ad/@F#94`\3$ftP;UgCKtC"C2G"VP5d10:3K-&`WZnf4gG*8h>+i(1bPlV0]i&AL2#b$_X1cg,+&=p/<;4Tb0h6qH?Ph8edQ5*lOKMX_#$Y*H8/eiEhb3(6[sg7c@a/dcD0C@T`t8+_hD]D7pO)S0V%3.^]fq4)$:(<;cOlkFNk3L-7kYdP>og&7h(U5gVq,J1uF>ff$gdO>rVIJY-3[C/`OcmV[u/%DhCU1N[QTa]Z`5oCcb7!_'EfA$!ZZb"B^)BTU3b2kSt+3r;<]'NiX`[g4e%*4*hFZ)1Z._mcYI,`%,pI6_nD7e%f-YC^#U@WXWfg\Q"A]Aq`D`1'G,aa>8#=rXNsW8Ri3d>cm?CuYQ,-n+&i#JU:?:mf"K.G80rj#.bgb\,S9u\R#9MA=8>1#^fa#?dPVAARan5go2(fqI>eYQh];/@IG[J!>*C&\LLHf4YF]poIRs'MBAR;,$ki;BrS7s>L+Vs"]'*;E@W_hZ*A/0nXniNP&N2DB"aE8`+L[kY)5l!'8u05N9W#AG9Y#[3(N^mGjS1ML"(Lb5L[u-:lu8^tRmiI!kQUF>EhBH,F249k?7.G#j5Q.>I[M7up@Kbo$\9QAg?oeW1D^Shmgbss#&8Dd4Pc[qB"<.5AD:k]b_G?s%k<57FZ_U)K\>DR@bRF$3g;qbHgWa]%9c:X$YZl^&kj8E(ZI>oe<5s8f(rj\p8@>41/V&e64p*(QG`3&p/g>=WXsSBd5NB8;;ONNrB&:Q!lkT12KW7^nObl"ZeWEQ^RIsSQ*RF:fLoDuU0*5&hTM7#Ng5[%cV=#p]m]l_O)XYT3)#[4$1V^2/IWdV>22;upa&S\D+oK)TFaFi0WIV,9P2;XCPP,o/5E3_R%bWX_qp>E46T85]Y`)Y=rLm_pTZJ14[SE2Oglq"49Q%&*#)I]5(IX]IgVi6bIb6O-*2bTLejCXH,u..FHu`G&05XSC.s%s1n\^.JI>D#["u.V,rt`W/%1TRfh&\]e?(nKPe+O=[/b*e`dJ6?4U$a'W$o$,fZEV,-3W@;ONATtE\W,5^NkcRlb3k^.07>PYhH3/^ZU\:Oio]DOi62G6ji>:WAC_-&mX8Ve<]*nendstream +endobj +48 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 3022 +>> +stream +Gb!l!=``@V&q8H9kVnQ$&f(K9<:,=hA5F1fJT*,E+b;BQl\Zi`$X6&#QB8h1G-s^4I$I=c`8Z;(&EnhI!S;"[1^l(<%"4%3J0J4@f=(k_9E5k;eSO`g',8pOigkbFP0"QHpr<0XeTc[Ycm:eut8A_SI&8+G49,'*0U^s0W/Dq[(b[>F3IC[#gl.)8iQgjn[hHo&"Nl8cWX.P`Ff2#iN$S6d@kn&!0Gsjk^QLjaZAjA3+W9\>l#j27JSnmZP)1>:BZ!?CL"j#R?7`[uJXV.WtqWHX)L."?7g?fu#!GpukcpH%+tPi"6mPnN)q(LbcgNITSaoB&SBs170r`a:918Bhf@06]_tt"eY'u/atFks2u8u3foqgL(6Q%&Lb-7EjK._@D_1/+brF*67^D,1NkC1eWDP%l4(`M;'cCa7J7nHe]Nid/o1`IN7;#bpfW`(7?o9r79nnn;5#$ZjuI7`W@4>kI+P:T@`6U8^B"aP.*e\eoLGn?KW$T7ariA&HE8l!`bg:N.H$4WQ,Q@Jr`rU1XsU4d)(e?QaqU[?[>?>9[8'7WQ"rgn>bC$_?`1J,En"FS+"Buc$>IL/DX`aY@QR?F"13;=0LEqh!QfBmKaVsr-&.Zm+chON,I%#&^pLss+"+N^ebeC#mt'eE\F@11"!UKsNe]<^"-3RT,r("]2MO@'+-+Cq#i]s1ZcDB`1X753Xpamj5P$qH]5Jf]2c_F,&RLIde>V^93BVr%q@"i$\>2]uU""3jW0G,@EEAZ_::3ON"'@fk($hZuP9O)mp&X1p"Z7!gaf7EtaCfHjDY=?,nEpFKa`Y!]-/1g811;7g(OLI8"A_=.f@'Z+r>rf;bDQ7D/jZnc,a/Q!Y9$bO/R1PC^*O-c$BpsmQFEnu1\kFh[K-%9Y_fQg'dgq_Sr<%`jmJ"'QYB6dJp_QH9FHjsr(R-sf'rB7QK_J7Hdl:&ul>M[08U8]2Sd7G0LbS-f3u%FV_pYPaLU#n<3oqqI!'gBjFlAb96]2u&WBq6oDNNHX6EO'Y"LLOTd"@r4'bpS72Qpg6'FWhfP1J7o"g&04g`.!oFUYAaPlLXl-Y;R$Z-W<]00hsbed]\pZeN.gBIE?@@q9Di=7d\YW"soM%8_Rk-eL6Y>[^.sYB/*P*B5uGG,!e;IK5Ss@gGrpCqOXS<$E&6u:C44Q5bm.nLU(VrA"QM?@N)pUX#ZolRPE3nCC_R>-i+fBagMt\cYdp7j:K&\?ebt>r3Cirffd6D0sD;W*X%sE>_-X;,9imOIt_F57P`eN1<"cKLZF3]a5$fRC$D`ksj@8FPdH;`23a^KpK8c#0.K^HR71L6iYMd+B"[TX(m%[RlWZNT5nW3ZU7h-/I32W0Z>,U#G?f2&=(]~>endstream +endobj +49 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 804 +>> +stream +Gb!;`9lo&3&A@sBm*Wps.%h)=DJnI(S2O*+?E-bTaOm=6JW!@&5JN+e4&/[t1=K0tOUPjrmG#ZK$n0tKGh4O_LD&HN112*E'sNpu:bH-^:4>qDc&.+N5T"-:/qJ!2l\WSC+Xnl2S3\JX_F9bX`X(ZtNY*11V\?oSRRdo6Q#QdlUlt^%SaH"=GR9=)iWZ-63Eq@b1+`,%nR&`l77tE7c_4a2#[1VD$e+F\XINRF]"+9G`>ic.g5L!Zc*685G1-pi^EF/A.`0ValE/\'2I!gs2*<7X)2f0mt+W78i!h5[=a?X!U%b2bYm3LW9.Zrj/jSPLCWMM=a[E7$>4(B_nabgB[2r;7Z_\5$k$Q86J@X0p1s9k^)HQNVsnToGO4194Tju2b*:gA5!>P1bKk8j!,f&?u\50S4h!I8I.f9+A9fb(K#Re*tQ5\o2PfTPkR82e]YDRTe[-JtT6OiP*k0"$-UcWHX=cgM&S%/urQ!Cr?_=@j08u`NtMEmGV7!AshMfl[sD[n1JEojiue.YO5S>2(#K>?7RQO`j6Rg:sEbYcI4^)n?pugO.YZEh7*]D^F7m7;*h=S8%Vf#rVI#q'#.+(0"%R:%TV@(]<4n:KgorG\$5C?AK'BeQlL29@pJd$gUk/S`\-pRisR^dlAY.[XtrcN!$CF-S,~>endstream +endobj +50 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2630 +>> +stream +Gb!Sn>BAQ/'n5n\3,_Z;AVL3RgZa?[[56XD]3/@oIAf1FR"T$e8:gk-VihtG5K%^%eMoEZcO1.%anGOZg>qCVYil01(h\I$[Y@6rO/ACAhZ(o?GAB.Jbb2_OZe>%KFNW6]9gPXTP_PK/JR:Qql[E'XF.8Aa&X<0jHlWg[bq..N?$/u5Mhm_ZZY4OIT!t!KK]A]_bU[IF9>(W[^=1(F-E@&KCSI(?qU;)CHaLjKlr,C*PNK)!HLtr$;I5DDH,g0(Y5EZ.+E)o'd#]Wo5)"\IsF6Juf0+O-ZP(7chaV#jU55!a\mDQqee>=Iqalid,0&?3j16TScZ!J3bBoFRg&@EW!CaLS`'$g$B1N`1%0nfK.7krg#_?XgM[j.bf5i3&2o@#l"3s:#JT3onUl%DM<,+YN<5]GPaO&p;tmL2he1b?AHbK%pAmeXV@GPo,nrjIN-[bL&EESc8D/pnXu&pm):SP^)(CTTqc>,uP,5o^SU.5_ePmY!L2@Sh#gLFdUjIqJB&<=hC[*&F;<91At*m63O`Cm8peb^>Sm(7gQF5$N+5UBBSKA$\DR\K*m\*P^TUDtp([Km3b8cKRS-gl4.fG(*(:ZHk":M%)i0hruh_="/U1`=NEp1W4nHnSHsP>09;/E)@bQA,u@Op\kZ;\tQu[QtX?#dp^h`A^;u4K2GP-%/2UC_AJ&t[P["A4_o:fSD2).cO5&:gFWgG8cKo+7t/D(h?Hk:,'ZBqVF'T)_%V/L.j\LYqI>j58DnafX;mPJGbM(kX:6BUW3Ihj0W.iD_@O(o[D9_WV[^B8+cco3<#t?ahjn9J]%d_&2%"iL(_a=pJce%2*5Atj!3+B/t94d397T@NrCZmbc^&2e7`\&r4HL5SARE;f8(\u?>E``Cbj&EBpt2\5_I!&NQ)LD/0#EG5t/&K+X('L$j9ls2J^*X\(>iNaAV)Nle_pnb0lIXj[KqQaZhKg`on6K=-_.GnnOse-cL&4#EP%&9u/.K:E#RX[Qmil"G70_kdEc6bXuC#&[KuY%X%;3_]<62N`\c"i&+n;a0pCMRfHD]:E$/dkh8.,e%j,GCAj3CFod&&<#f>j?^L>T$'"5`i!m_6(k/j8-+mitR=J>FV:?aB'()_Di\EJsjs'qpaMUb.St:,!0;i+,\1aqangpbYGqKi[3MNsdHO8dHAm\WMm-&9JN3d\9`p4(5HNqcHs"!9'cEWV)_gNsu[ToJ!)>\R8aLW(n%@Q>Ajg0\Mej)u+ck^&1g=i9R@\rj'0o^ah@^YlF(DmOR)d/)G;$n"^*4i$olG:=]r&BGO3E2AI\lR#+'0lqd#"t-XT:r]!ciMeo`cA#5.qcppRp*D9Mnr8,7+!2dQClkbe*?CJmM1PGiX"5Ph;n_hNGRc&!HV<)]^/j&9]\rB5a<>6eL,quqJ`JL8)%+F[Ddj;[H".WqgBPV*e*,H6hqUj>7=RJec_'-i\P3S5IZ`_g;n#?gD0(]SjLmK47/QP"/h-5NS/'L6lt+qu5m*mCPC.[]JoSC.tV1.=1S7@s?P*RL=Ia#J\)^CXuiuPfU,ei3Gi/M>GU@ceqOjYn`a"q1H]'8L$%$Q`)j[%#G'Lm"6fr=sMAb*OkDG*Gj9S#dnm5>`&mcgJ4l:;]$5hA^lR8^b'S]I6]+"Z#8$CHTm8`Z)[n@@M8!RrdlL:1A%@s3q.J[IMdBL$\IYU/>9"%G)X&Nk8@kk:44O)JYip=E3BYKQUT>K`S0+&PZ"FC449H[?nK@S%>SQI?lhCu'WG=J!e=;aRV@A^[N,4oPoE["qt_bI@UjiZRlXHjlCDgKe(c5u=TXf0he7o;6&%JHEHgi-9#I,7qS,ql]LZf2KI8tb2<+ml:@,k/oBqA*l$D7$W@]!;[h^&iIl`[J)uF60!pqTSMP)cdJA$TF'.V=%sb>pEXe+]dPU,Y?1-L0$B#lhYh/ZftG_F=0/hL_"tN@I0m6M28'-b_h64igLK*_!bu6hT-\M;q[\3p+uK~>endstream +endobj +51 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 1547 +>> +stream +Gb!;cgMYb8&:N/3bbH32lb2hSLB=Jc(F\Y"NR[YjJ?U.tc3=uLk!_T7opoAd&g^2-MA?4<_'[-lR@Q?ZAnT28ig9K@kn;q;.GW]7?lZ$O@$4'J5/>uroJ.UILgr&g0[>8(!Q(OV*YkUi-'Z>Va<4"T_P86,J.]pmL_:UAmm_uL<$WH>9\^)=81*sJl>3R=\ke"M_L6sQ:8`:jEZW4>#Os8/@n@t_'N>K4cH/n+S[VXJgmc?`"_B0X6bO5$S&E%3sH+)KX`FjX=$X.)^=1D-j(P?O>n*l4s1(+.L!C/k1UZf@a80YlUj,Pb8>oh7nbJJ6b*kEH5-h&j$.;`)'8/:r\LR)TUo4J"sPKjQ)NMutP*b2,U4UQ3FoVtBL]Osin27m@aq/pu/43i&Ua%KcJIRCQ@/2!>Pc8PT>Q7*'%H*gjqiSMAH0l5@n're)Y`-0Vo'*L/I=V*JtVMB2j%4_.FQRD\j!`M#A,EoTsD'qF%=UA:l@="rp;KPVQj%LJZPLgT1t7:Or@@kq)7_*RNuLkCLR2O&$K9Ge,9l&]J''?/,'FZ@R!AR^GssO,]U_I<&1#qJ2"''&'0_3YQEjgHa0">q4KrYn`a#FA:cWQ:M<1;/.o=R'aHZ-A=('56g([B;$9C0V\QP6p@6.djW>(s8fGY6JcaR$ZAe]#\0bg%h:!+2t:#6,I\BBo6DAsCE@i31J,WQ/Rq"d?tuQ\M*2VT@!(A1^^0Og\5gnQE^-[$/;2dL0@>>]d3QpX*L1XO5dZ*"N2=3/r*`a2>H9Jp5l*Rh!fI>`!No`Srh[Y2!+4e/m@>q"s9cqN]bD0Kendstream +endobj +52 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2232 +>> +stream +Gb!SmgJ['$&:N^lqN9T;Pe$"H2o8cpAQ5[7J,(_UL0!`#?dnJl8PO/lLL&hLn*Q]DW+eeEWF([EFF69DQ#%I0I"XG_Vh;]eD$?9Rh,REEA=.UOL1?`610eO)6n6[-uj=*Fb]*\1?3WanaT[7DkfF>o8^gi[H`SVm//&&_;+juJY!^o),IE?Kb+iANnl,+*fp9e7T6-I=K3IL8ghAp$/#MA/GGA_fWa'mhrVG9>KWl.q75oZ%Rel#Jg>`.en=1)3K>:>kS\B7]bEij/GQ-5_;+&C3cct6f6KGP(ZO*piiTHST#6qeFn6A!2>\A8;@+0@rZ3?#4I^aI,4.31A-$TB,OZK&Di@*>*kA`*aj7OG7?E#1@2,f:dFF2,T^26U.ROZ$=rf;?M/PeMV$NZEo`1fn2qBOcWle#7ZDn.md=a?%bl,m_T!%]`'sQ9"J^g?Ag`hmC"uK(VV<6(g!Z+[E,&I8aZWlLkFb)$A5C$iUB*TGQ!;;[`5d2\Uh[5^*4h'`H\0n2GCW,W*I(:ra*m)mWU8`sYo#F'-#0(+!`S`EMeSSBg?,V6eo(/m*;,'q)766bc(9mM!WiQi^/"1j8o_[7]Ushg1rS;hl3knr[sG9R0O.D5K9BreW($)0/J+-'!t,2PAj)<(!YM`i>Q1=7>_Cj%G7ATUGP%HMW5\s#n64W:V+djM+#?FK!eg62%=;am;VaVogfbjXX?YQCa(H@?'#k?EH)%8iBal4^Fe7.!cNqhRiqT),'>qeJ!>o81n&`X.:(blGd+HI6eYjN-Z&C$o/-"ZKGIhTA[WAn`a)4eA48]`Yi5jn1_1\LCL7nu6Na]E0TD[[X0gF?@AdDf`P7fi,TTt+_qPGjGba7/PgB#AkP(NsP/+^&Ec*LlM%odOB1'L\jKgph`]H/&;aKEg/kgBZTS\QP$9CNH&.]iEf\fi-J%#_/kf1;pg7jaXq8Za/nfka4`>:A`&=8JInge7\rPQqZE[9]L@IiDC\$Y35)lHFEL:80V1brM`"FpOh29gC(fcha+a[TWsi'nHG(k0uK%T>+>SVjRL3#R]U3?n$@.5kP`iL-<)0kkr=KBVBl',ZQ'3Ie[6'<0Mfqn>p5;`R?QFManQIBP#>.;"*>e5'Tm#AHqd*1K*mGrkD$PbMga(,q'kj\Zl2Fi>uKWE9#:nu"G^7uI;[Wi5%Is4LlLQ4%(%PO!`e+=Tl)s0];EG#Ermuno0%oj>%[PoJ3)j.8\$K9(W:H_X+=_IP]pY_*J(&EN%XXZ0fTmsrNAW7Z#4@6[$*-fZ?jiM7oQ'ua>,:HpiQ(%GC.*=uMeRf.2#Mrq=ZXTuhYHe^n<7A2PQ5ZO`G)I^]eendstream +endobj +53 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2425 +>> +stream +Gb!ku8TPh0(;B*9]H`sb\$>Ro)roSMRBg;Bi[b=8WLtS/+k$hTMk$U6j7=>=h/"]<;'$at)0mB]jXhS2$?9JKLYMjX*8nF4]R%bP$WsK]qjn=VGOT3ap$'V/5o^7S4>(ji-K#3/2HL'RM\>0k@E9T_!`)3M#Qa[eO"DV_=2"i0T9:`W>Za]"MPDE#b#;YHC[>^)&(e9]jA?.AYMJC<(b'j[c);cnbKNOmk[T`=PW/"[%XgTQ-7MeK&/FXD*U/Ykd2Y&k09B]S&cu?EBIr@2u$&$)/c!?=t=SORNlIS>$h+#f5sH9O^$aJq5&pM.19-1*S^cW>pE,_?#YNac@9PWND8Jr`-$Tk^3HiH#VR5;Th6mbZ6n]a;.%@FrMSIN&"TAno6(AYCbo(U208k.UFR:)<]IM;RHhUu2?t]BNjr&\YcF*@.7[p=i3gXWV>KT0@M3X\>`j*7s[f0JjL_[S+![]?I)9%$d,:*)Z7a25tLOhG\7A+K>&;[74.8h&M@EWRV:Hg<-0?L#5l7NS.M1e$EbJ*+AhS%JOo3%RkCNgHGr=8N?GCah5[A!W7Ja9/36E"CnC&:saFE*X$s.]*#?7OIYAMWYs]r7fH>M"/\$6je%+`BbXi2i"j6QYh!L^PPdURad:ER:mGfpf;:+m.[G_ALqeoDlO81j.+%9-8W2fU8DgdY>s4RdX%DUhAV8Q4A@DfdV22oMU:_9PtcK?3ZNG//:lPP#bZq@2ZAqoM2@<>>qIEeYXhT0;.W1ASQF4;6Ek-p_QSals:\[S$=tD:K&PNVc:3EZc9XoaF/0b%)HiT;/]H?@sT!14h-X5.qtr^L?---r=*41YVGOTs[U^JK4n?dB_8]t1R.;cRG>"=$oGNO@c\b3D2K)WF>/V^q\Y\G[s*2MgVA#:hm.m?HhY")b?%X>0)+I&@*J.N<3)?$STRr)bAI@"rfGV>=`>ll*6f^k'achtLc^9l=_P)YG,=Rn\'i';_>g@Zl1)mMR&/H$&1F[9LO%ItaUKdSV42n&ftPiphKMkOB7b_>b@L_'qon)?d5jUY?rKFW;`E;f(B9:ar-=EIc`U\QuU"XP91%kS9+V9(lD"a82.)WV#Iqct*&eZG]snS1^9,())-k]d7>O\_^O7fr^ea?2t<3XkIksX4jUe=.Nnu58PC$)u*c#^2Ma<37\:6UMom'>utUo6+`X=?Zb8B`di&*f[<,s:$(-`<4No75!V4qIfZq*61h5IpH;p5HW=kl@&:?Q*M.Q25=aH%dB)-MS*&Q.rBSAN!HMOmUdQe/PNgl6Z7-hoAlad#E(HfT]r)&7`r"QgC;1Wbe#-4]pec4%'"f#'a4OIQh!!SL@YC>$%3m,Wbo`n<6(af~>endstream +endobj +54 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 3011 +>> +stream +Gb"/)gN)%.&q0LUo\1cm@tjtTOEB#:33g/^:#^//c0iJ_b6:PCb`#(H]K"#>rdDDpRjabj[?e-Pl`#^Y&=5l\l%=V#(teU*1Om\[J2^DOIE$eWR,.mc/Jk9+i,j;7jhS18+Q+kSN&+7_?ua8R#76F^6e_s$@,Qa1`I1O4a"3]A!dc?*rV=6u67*j%Y-&%*&]Z=Vr_EHmZ@(fENWsCSeb%YZ?M3qpXs$CEPpI?>LmCG_?<_A.Lj%s1-aZ;"g$Y&uf62%eUZ\3`4s%5"+,0g4O8090bc]4Y=LH>[%=LQR2?SAF$-*RlGF7Kscpp@]>MHgX(1t"+2K+/kg(\MQF>LoDR4g7uCc1.5cZN,u<6i9r$oZ9`3E9dZ3ICePH)`V]*Adln:2GH/>XLJ5P"+S/e59HPrII;CEBg6PWL3@2AT-5n#8=Z+.%=/>l5NQX]$KT/maMR,EFYjDgEKo18$W(,CY3hP_1g:9t5J,aD4:$OqCC-fZHBCq\7B/T4\;]P_TrR*^p6REUZ&(Zb#(]=+s]?,bW]*[_ab0:&$;qXafUD[Eq7,[?V6]TKb1M!>\uAVt$]'d\Tq=:Z[S`N@;PR1nP1/.7G",`Ckm67Obt?V7m*;Q?h-lsugP;9`ofQc`93#F3A-ZpD>@I]==O]m5_'4+lcAAqDDZ:.ZnN4+%"RrZR6/9D>Y0=LfNL@[kU-mi-I:$$?'#*_'[a7_+]_1r2R:Z\)N:i1i9JpqTNZ(;aD;[i<09gMA[IOpF9n)H3@/@0O7%\REHGi10VIu`u6Se)[n;uEh1<_U#Tp72k/#t=n#J3.AhQf&t'Hc3(!9R;%e^Oieq)Q/Rf*.\2X'mb%,UJK][2PNqG7`cK"7OeSV1u/E,1+;mE(="fm*Ac[0b+"U9q74tMY]57WVl!smg6_IYtjaI(aS!uPLj^!chciqB(s08,0//N#h=[72"B@l9&Kid7()34*<]55HK@)[I%/!^:Cc;=;tQ5<'#DWL.-4qX)Abq&e?V4bq_SuN)pB$6&,sSD/J!lH^q5d>hDD5SO5_Q_=!T9Y-l^4$b_+_H+8ugSe^cOi;WAhdQ?n:@$h^V=pFsU8-P&"WaMerNC:3g*EK@^Cm[iF%Y%2OQZhTtEAse-DKXsUE)55sf4rtr0mkJNILuGaf\^EG!HAuqPpFL%-&nVgMm0M2c_CI4OMPE0l6=rfR/Fa5!#3WM;U77<*$lL[odRKRJUQKS?'\%bt]#BTMFb4(D4@n:S0:G??gXF8aY%('I4(HNTbL-<'>F0:^r;87F(EpKQ*W#X%L:qXn=1lla1O%8^:5=l:^!dJbcq_:6:ImP+R9Op0V-T%i7`MS5R:X)Bc.Tk6'pscaH?$.Y]26Bi:W`nYdD+43MXn^DS,38#iHtll&YA(tRVDW#q$TbmfA!Z>[Ed?Jq&"TQ!TtLtfe5Ui-CVM#j/[4X^g&mnXmtb8Al>;%3?tG\r/L>IUs1`)n<+"U.W0hXQ9?!FsH``YkoWRWf@>`a)W]@>XN8^h_rlA"u77D5q!(o-*XJkbfd"PSefGS&^?gq)i(TN/6G$V81?M$Gr:%C&>fmWfRd=P`aO!n.1+"*h=(M]=MOaP#'\uD-R#'R+T)QfI'hAIc22cX&Ud?=-S)Xb%kq/`RImM!&#U.*l]*']Z$s-&W6MlMg)L"CaPNcuj9qDb0uR=sg*3W03(NNI>Z+&^>;QcLj<#]sFo5dO%SS!(?Qb@$B;31_`_Sp=_%T[endstream +endobj +55 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2295 +>> +stream +Gau`U=``=U&:XAWfS@aSktDp64?M!s2g.5r*9U5S(JQbD"Z]7*6KTG(;YRqM6')XhM3J_';eH^f944rAZ+Bua&H"nrJ"m1_04T7sM?7?CSccAP)oe4`0g<-2Z&%H;bQ`t\lF6js%'l@d'\@U2Z$b0"huo(Z4N@V\>(gl3B*an)G[aOBn:6($#AO7)B*Y5F3Gm?XlGpg<>lB37X#7;BT$ktE$6kbd[KM0#.!*5&`:A_F',N?KIsEq9HhHgegG:h(J59ekc5@,K?_obKE01r>=A64lDrO=)KJ=!Db&e]N6lO$QZ7W04'^e"qr2(ciLb,0;RnI-)dHh`ZNZS.j98M%`A>qsEU*ak'>6;E&,]!/G^iFjYfE\*_-Ca,\\OXKVI,"4D^fTJb4jJ:`F_)S9.k=g.IDEp?(4+2F\`\V2H'Uf"%g-"U/O%rqD'n?(\_t@+/h=Ho$3"K9O75_3_6Qm.nUI=N,o,4ZA2=XBj`Rd;IUtTt8m((+kr8C0#e_;k)S!3-7Y2#VMYIA?iF14tCIL_9niDUPWt9!4(AW^RgYV[Uqc^rS>;TNiqS\;^"\mNG3^1leGq]TX3oj^q606mS'e/CQIj?7$!62d274E[e:oSBIu=Z:=.T0Qr'$NY1ZN-kg#4B%+!=9*u&N#Un[9k-]05/ACd$iZ&1/n&"*I/4,^1LpB"Y[-L_kGDG8:nF)\WE=QHUj9Bg]quW4%`N>/R4bXgj+)tqC$58+_;91\QC0[S",m7)^8jGYi&escSU^D;W)G\a/OSo!2^m?)j(-U2-@X,m"ue,1cS5]O8j7D?ok31Ms%X*+qC[9%@$@5-No[\"7VqW?jLD@G\pb_cML#%HrDY?AnKZ>!r3lO:_/@H,HampY;JqA_;[a&7&qCSem3a4it(a1;kTDYp'<.`\=Ad3bm=@J^"=c)Wd8mK!q)lb/;*:Q2@A%>=&>fOsB'VLVL[D&F[tK(VFQ]Rc`@GH&Zt$e\8X)Vpu%JRd"jSHsTk`Bs7OZ@&@K:t-f2;Pr`rKrt:JbI)VRHhD97,Gjr].lS?C:)-r<1?A9QQgB!foHV-o%;X+B/ZK[hsG3I:O-G>3??3.VtpJ]'^jr0"T>=6&$M%g+`8's.kO!rW9]\rJXi>K@8V3Wjd"HL_Of9CPRQXG1DRRdo%,p]EHILSo\[PT)MO)/rN(#T'!p=J?K&E7d/b+5"f65_VWNnJW#FKjpU&$:_*Ge@TbDTUeF_Q!#6RD@[%-mJ!"X(rg[!&!c?V)#^OdF=a'<57YZTf_@Qn.Q8N]p+^6BMD6T=!Tr&'ndrh8uA+*r#)qFpNP?dDQDBc?,2>Wk4CqL+HX(^fU>,3AR8c=+toqZ58VF6a8M]\$VGR(]ArSCS-eLtuot"$aa"l<;=uK^#-_9KcYg>+%[fe\ksfYJdn;1WD[D:Lt.#;uL5Ip6Wid?B=fVNhO`i=3<-tAubR`@&=E)9i!tkV)jO9i`oc0Y=+n]$\uah44D7/mn;r'\pcWUOa0ZAS#7;b1/s`#<#ce@qWY!Pp8"jWCFUK^WpYp*endstream +endobj +56 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2744 +>> +stream +Gb"/)D3*F0')oV[K&>-2>(nUR,o*ol[Rmp;hDWW:YP6"d6-J&;Eg#YM-+OESj)6>[k80aC!mK\lL+"1/E06fDU?_0@KR$FHK3/D2GesP$EIg(U0P(;T.!5@b76k>+&rM8p0b"gb@=fNKaY6MX57riejpqf.1T+;/1)e0-K$[/:>EU8)KF/D,*(2c@JH_LU]t'S=?2sp'[k%+92>V:"@#RG4\(>Q\=#]$1q+!:A^0ep^/coqAO$Mdroe?n(%dj+rFP7M1Cc$HD2jJ1pN0Ck)eS%6_KO3s72I!4;c"+OAm'nKY-K>sLm0pJC0U&1Pafr0BHB3>1NQUccUD(3ErsJ8#>P]$ICH+1;aH%_?Y/E'[eRrD5.KlA>uqA)dS#MmOC5cN]Rhg"l6/\.QF-O*68-YNaU:)UK*WCC5l+s2O2RI,3U7"6I;j[d%-Gjl;]-'k`',WLZr2`6j(9"(pQV*Ohr+9M+6qH&Ool]#Dp=siu%_##htn=%-YTARY:Y&,]nMXULtc[!J`!m+qR0#^EAg3E<=(Dh$L^ZEI-bnYX)R\&U`G],YhV1&J:YG*X$60H3!hflXB3b00[i*_Wd'L>\Djd`IidcHsi>3hQWa'MP;g8Rf*`t1F+5(7iLA%"KpCsL>>r35S'P2JfC"o248=8MItN[F`P]Fd1)*eU-T&DAIS)hE9.l9/q;Cjf7kmDQrV(`jS]-kPOp!rF0Whk$3P".7^\Bct`EJ:l(5O.s`F&4:S=0ZJR\m<7RYP\SGCn(SEpENG5$Y7c_W_;F`2N2tQb&(1(FU=hhkn6HJ\`>e%/7SjeD*s\%Ab-T#Z2$0o\$!n#KQrAPKjM[-Ken*="m_i<$@E93lCX%T@tK-JrCs,'90.7$?^H%=W_89I>2@=Z#LKBD*,m:XdfHCHg/\po<*lo(6,00I9OJN?-#!F,>Fhu4d??1#X\#W"][^Ms5m`h%^gXJ-B]d)V>mV0/qOksRB#ok81lfVa4fZD%.pksiN"2qQ1fFsiR8$#bX'Q!E0X.UTeD:[7!!qQ\W5b5H5Kol,=n8Eq+iD;FD"qeG'gXKoEI]&cOcCWJo%(R@p<71;sOB4]n"-F[8uE`k"8J[5_*cOl_]4]&s;D1Zg\%550HH`;I/AI/Z+j=[(:aIVRJU$PkUpZ$t,DK^0,NXRdMX]=ig0,FXV?Ujn+kVueqb0c!,U[NQ'2>0@Ch"O-Nlil;>^!I[E!P5u]>!oLPenqU)NP,mAqd*rq^#6$,(Kt<%m-;;$>%95J6SGg$hKU_+hHD61_o1-/E%if4=>_#)[:ukdg&mB41)<^Q#Lb^rGj(QUZ!V]f*\EC,+l($k(B2)BBG,Rr67/I4G3R8&5^XR1n3m)7&\mEt_?l9?q%8dq$m$Y)f3`+99HaG;ADWXnot`\!;e:/ll(L9l9HjZ#Y^t&_InN;a1*jLpouIrj!.ANhTr,FY%9q3XPi)dGDt9taJI%!CA*SXQ':&,8gZ3;q=R+pg0p5r0p4qQ/^6+Wh]H)sj7fTm]Bca![C0$"OhUb5nGcU1Nl9mj#lc@Z[8UrU[6n?B-VjYhmKLUd/r%D:E+N&r&83;M4F([]WJCZB"ii\O^JEY.=/6$!?Q#I1Vq$5iOO?S'8ELfRY'4"bKSlA_g?Mt%IpITms'h3O&0@.N4#6`mB>8a1M1T%7&8)W[79!DcKWSHGlN.dE;!9`Tag*0Ol([%E%_1?UZI#d.K)VK6_L7Q9#Fg)17E/sp$("DE_d1XJd/DMg^&>G[XTe;^^DDJ=ckT1%$(m^70sArQ/8"YORr-K9^DV>L]7;O5%7lQTFT~>endstream +endobj +57 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 3055 +>> +stream +Gb"/)=d.Su&q6H[J]C?*9G7D%=7*o,4d5HV=(^O[5,_)-+X%^X8^KRHfrb5CgAlIh)@7>$fXGuQ(=FK*C\3>K7PODl+0>Lf8qd2P5VI%1_?;IA#R=[d(@TVpio8^HkD)Vq!p!dA_^Iqp6-\PdK(%^KpQ?rA-qm!h`*nX_;ibZuTuE&p+2pD66H).naQ*2HiXnC/r85Ss06u)>FOPCBl]sBG)j*_!,U>j_A[N:6Y;3qOVdRQS6DG)M^Uo\:H.+B[5U@VGDqG_qKP'nfPt4jpD^l&c"A)!/[fDI.d@\rb;_La05BrLeVO+4,6$(pp5*?%TS>M-`59*TgorduUE2%Qe[@psC1WL#9i^G\!5SE@93/tbJNSjTJbenbmn/DP9+-#:?LnZ$ad0m1VOW'`s3T0Co`oaO0fUgR6f@).)5ZBCr!=6RrT[IfU^^gZ4I#),BlodMJDNauA[t(!h%Goifhq+%&W^W,bQ!E1J*"b7K`&a&YVJ/A-mk+&=;?,a^s9m'I*/"U1-1#9JT]Fqg-ld,;oMTV^9C#MhKGpGI37]+li-?Zelt0\lcJ9)/GiHh:aue:cgF+>n,#M3JS\E_I^`jX'W(aRY+]LdWCqIm=DEKo*H5`A)0d2I#!-`05fCZq%3+J%GGpF*G=-H1MB2XeHU[.mt\heXH)r_fC;(c4,G^qP+H;@HH]bSYB!KWd!nm:7';$.%O)!UnrYkVcXE))[.'gJl?U;!I?jEZ@[\]fA/_lWl.CkXWoJ+'ip@V?7R"HnB+sVPX7O:-\,,ajB<.:e&\lL]4a=-[8l=Th9)#t=:@`=2&D;l!W+:r+b2bq-.X2X`Ma;s5;$msO6q^CUo&Y,A<;N-t^I,bQ$!>'-/sVHLfTD1Y/87d#BgOH3.LNuO=UV2YkA/Wbh(+/\q1uuWFhHEbZELBfSmhYcNXRe+)^U"5r:Z-D@CBnHRa$-_SbFE[H!AFRW/G1jRW5.mS/8iuq23kOjiBks(U1f;Q$)h>X1gr&GseaH(M8/olEC&Y5_"J5^(F349>im]GY#l)LOXfc:u.G?bB95LW^%fTh+nh.7DDWPD5jR%[49P:N=%Q15_[`ZKoBl)YS_(NXr8307N)u?L'EQu"pLs!_.'59"3K./d)YTR!C)*Q0f=RNdX4EM"8/bS(j->Qe7t(d8b&^(jnoK>p7Opi-4I%U:b@4Qu>bY#jL?]a;dO#BWkFR"RWf/p+U*5qnAB@ke_Okbo8&NM5oL]*LqPf(AZG>n$q4!Hr09A=,;9S[jsSh#RAc0"bd2..N7\3N$k'o!*!i>`8hIo31\@T7tZ3jG52aM4FSObD"<_Xbl&0c0>K2)Iin)X`uIN+q(PCcP7RQ/`\.\E1e4jlmF_LL*sU5>j!;J"!(s\?^PSTC7p>EFf\Ss`>X5s`r$Z>8s/5dc!4a`7$"^`bq#i[_Kat(MFi0JC8]4KHRLQ_VR)\B9nBcJ&^c+ffVQiT"-ARKPAbSX<2k^(pBa,e8gV*m$(ThLi\dtbbh65C7\KF+F""/?&!u)AJqre6UDB8T)Ik/M$$V$B@"RK1:PPWqKp?Dd1sn5^aI%U6;'LMi=X1?j.!SJ,FQ?H?TF:/&3ZDO!D.pq4\G5T^7S3]Z=3_Et*4Vo1fG!.@DTecp,7KY._"(.s1gjhE's.>pLYY&6GTP'\s'[GD#Zc<*sc8_>6p@:cV'*_)6#X,U-18=QE#3;`?W.;o4M:f6&;[PtRd=(D9HO&2r?S(W#hge09JD@ds&*jsT+0EO0ZW=FfOWT8,pbJj*I[lA2_Tg/c'@,MaaW^kY@o,44)WMcGVot&jAZ["R0Q)R8Vea-YK5EV,a@,CFB[?1@3jZF@E,3IQEiC&8nHEJ)Od^e'e_\Ln?XL>&lERCsT6`B.C#%W3#iVcTDSO`((r72'iDY;RRX/[(P]I/"RRi\U]>(E,3%eXmu4h5*Y4jOaT:O6Ai_u?LfUGkh(Zs=Q]Im.XBS!;NH_QK\[#,KI7Cm$`)MX#usgi^u6ZpQ\EZAa6r1E*;qH'=.ATg?[;H7+ee*8qXg32h>A?+hfV5_mNI=31K[AN.J**DYqr@Y0bX'MG#:ch;CIU'b1Xendstream +endobj +58 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 796 +>> +stream +Gatm8gJ6Kg&:O:Sb[ZO[AS65#QcBf'8emQlDP&+Q-?bK50@Y1'pUe&OO?a4+D6.8_=8-=)+5E/5m0SgY_[mq:98O4KO>%DA#a%s'V2\#SEtf28PT'fp(hWhG_U)B4EQF@3UMN&:+!B;!oHbtgTcOTK?L5':6PqQb)C\N_gVgHKA1M`L6^.._#%hRP_FO]>1F@efSY:Scl5%TCEdG^]ulYVcMD$>ipXlFTD6bL[p's&6NE)Msj/4n$-(?[?mVPS5L>4MJ^I\_+midt7I#jpOfART5"D^riN2Qb0F2UPQg[FGcGoFU7cqmdkJLK+3!oZ#fDh0/4Y`lGG/ar'Ns%i&a4X7ki*Ga1@B0(!6\M2DnePm1q^$.105d')l>j<-br+5'Jph0ZVX]eJ9U[:f6"HC?2b8GsQ;iscmkE/>V0#e2,*,!/*294e8H!'5X5']5^3]VfRI)iAj50!d=YZQr;o8S$H2G9C8J1hln"gI5(j)(4s^Rp%`WAgeS0+M?S:6'W5`"eY#RYikTeT&&PZ9q;57X#=1[c)Z9h07endstream +endobj +59 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2779 +>> +stream +Gb!l!>B?Su(4Q"]d%`O"+hE2S8+4C&Q*&/?0"lP!W\,1=D)-W&#jceOJ,C?Z5W@L.DEO`;47UtPC8#^/cDU+Nh&m!@5@XXg$AADm69i+/LetJ4+Q@`3>.m;4X/k-]4<-a$ooV`m$$_CkMQ6&D$$'I5]ng`]JiN75(iU0#%o^KAKg_F!Xum>*(/s;iYpgeKoOC!,:-(CQIR7_obRa7g,L^fj1d-fo%RMa]I>MHp'$='>YSZ:))A_Q5rO\QLc.cShrd9?I]LAH14u5[%nFQ%^<]BLHL/u'_eT\,:URca_d3!t^EW)8N'`1Z*O"+iN=k3r9lFIW$B,6SGQ72BndLa)hjX*W3R:IL+2)ak0irM,(o]0(Vl-IRd$;hljQ2[m#b0!mgV#h4%-X!P]%#tiBhS[ZKO%06E0,hO[S/-tL7(8/q])i@232pP'!_e>>C68KS!B\o))lR"QF`er'VOEThZVW3N#eR7,CnoK@R]7kZd:Ol%&o`Uj-9N2UaPBT0#ZC_U1h3q2#Mn5&iVm0\pbBb19m@H93GrT4qhki4n1^pV4co7cEmI-0Wk48-)e%k@(_Kme+moV&bKdF>%Sd4@"k.WA-[1Rd5:0\:Pl>;h1)'!8I1dZ2Kmj[N8^8(<2$KM\qsAM$ZI5OJrrJW%j9;D7B^!:5'>5ac.mBc1CnEs%S$@(6Y:SaQt8BM"21GL,L9-91brWRZbdf!=*jd'FD[=l9J>Yf8<=&.8L>;D8a(B_@1aImH-+Q\@](ggm6Ld_bT^l$?RU:ESGeSYu[k<=3-MD^#Mj>G;Js+E@XJO4$]LQ)p8Ecqdj>8H9_&`1mA'JUb\h(,S=sY\@TOAZ83H1;C]iL,;fF&-NM!8#\h!U?kdHQ3B&>V;,esI=R8EEY-gK1Ta(PNH[-"R_@:?Y/)RU%"XJEKdih8p3Zt^%`"\KjNg;g%2+O8"?=(G^^nGO]9mH+4!c7bNm>@u'VGhg%R@i)/n@cAdR=NeDG!*K(;T^/A'(mabHp:#d,6`C$ZFOl:d-KqP>'5i:%.XrsTcqmjd1`,i8#"R%r%^'SL-DBT1",8ZdrfQNAo_F3i:O]ZjN/a>g/jb&uJf4$8RoJH%/o+b])iIQ/iFMfn2pqp>(-9SUc$7N.'jD!MIa3Y?Uhrrcs8R98V5,2n(^JDpN;WQM\7KrV(&@bO-E$OpW201#ULjYVORL-QS\P^C5)bm2ZKr>V]NDEa8j/n[-h*E=W:p`rQ4)'JLuMKX*.LP\&7CUhh?@VQ+$X.G+7A:W[M+q*oeI"5qKnf]-ZOq.eC9`C0q?(ItcAJpKTF1dm/h:@;u?uQ#YB,9fIPKWP9Cq:K#hhaArri_5RCRNJ9Pj<[!M&e.If?SqWl0%Wm]eW7SV_q:4q=7Ou"u\Jj6K'q2pIu-Ch,^+Z3>R&G=Ut.E_B/]XJ`!J"?cM;t.nVKAZZa66+e_f5G>b&+_65*&I1p.)G8G/*K8`Z=Il\;e_`Z.L\aMq]BC7:)]7eeUT`+$Qs-Z&g`<:6l,*lLiSKH:rZ=h1koNkOlb"PUslLcKgDh/J!XCYCBV+fL19]euC/e`#U)?tBY)VPIR8rh+e'7sdogrX<>==S&G>=cXu.[fb[SPm!4jf>-PkQ.@FoBGjHT14=ho@5e"1q.^4=_i'o^&m#sa54;?2q`i)@D+9N'$)-4?@M>-;u\E8h:5M9O(J.d5\fAgNkn''&+E[n@K;sGbe(KsQq*YbnsPCfEdXWN,CUmlcpp*fWK6k=qJ\8e+,Q!u)X%9FB'NmH%Lr*ij6f.,00Jr@TIuTn)TU^YQrFo:aj^"B4Pccb$"P@M@+",M;0c*#Y9c`X?DRPOp-S&XRAB+!$PN>\h'r9n^LR,3CKn/iD$?Iot0<->bojB^3c&;h`GH.ZOj4@u=c#*0P+Q,%o'W3)c8YR-ecfCh96Eu@&9dSoX9`mn07KMTrccS&qkWX?sgpJkfaDGRV4]iL=_.Z?jU!3d4*B,=@&/=Q,!'HYs?T%F-.5Dp6K?SG]?#D`_VM]TSb]9]^N7![qlA%&KFTSQ)#:`QJ6a`9\NVO[(2%,cU+;6UE`c1pBLjU*BWiA^rUcA;M9a"NA)@p+U_km0kP((q/%Bi2F2`S+&1:,l?[)S:_:7"2=T%XiAZR+$qHar>n(:@5B<93c'VWm4015er-h4'u_f9J&Hj$k9#6u"GLbI*XYD-k6Q@(6TT#*5[1?,CQPD=7q5;c16pqM99\jIi`]RiYMnc8j+OeCC!c?d!FjbP,WnB#iTU6E.0-;-/\MfC*<1l"WqlY73O.VUX5'cC-3T[CEPT8mQ;d)%62IK$I>7i)f@_+.i$+h'l/"[\haA\%k8nI,fkR#Pp@Hktog'PA$",mFr&6r[#UAKRlS-I!,e*_]Epm5H1is.0~>endstream +endobj +60 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 3061 +>> +stream +Gb!Smfl#S)(4GpYn?LE4.&(kgP6'HV-V2/.m-4cZ.%ii+k_bOd<70]9qWm0lJjQ5@6k:S#?ZgjNcJ!5hrhra;$/'bZBk')c2QH/,hluIRKous`?-uqF^EJOEWbUeO7la%T&_Uu;k+Q1J)IEMrqJGJ!+*B1b>amOUb03e?bO4'Hd7)TA2iZZf6,GbHhhQ.IeAB=5I:/=XW3KF=?ah;Z/gB0[UV>+Vrdqb,Y]WW\mUk)?&EseqL"h\"^.e?,^2EmP'eIUF=lomP#UF+i$l7W:7(ZO8)d>VhgYS^,B*Ojid+j+^4t#p&0TIBP*tMYt0^d"_4<*.lQ4C9+Q:_VA2AFptXdE<.-E.9=[1!-YbZ5DT@@O.eD^n$^Fb?t@UQ6gsWo.g4(3(YGe:JKAXid*>3lU]fBsE5p_]p9au$^u*IN:itpr4qo#,T$)[HYgHq3YKpU@D]SV3i8a!Th6a%\4nbhlmRO3o_atrp\fFFDo[k*.7[nF8]dj>hV/:do[&mD(%T8&i0O@fHqSS$Lo+a;kplSr7akk,srAR:UQ5`lNIM7!)r1K7/(qK$LY79L<$4T)4a_se$'S7$%A"1L>l-A45lQ#o5"1`ql&eAqDiCaaPEB>qE\'^(@$]PnNCPmKTgq"fc`4@PAL:MX#q!F=19],Q6#fCMV#o(\.qj)b;X&t2Wn4)[q09kr/hd4:IP_!?,2oR]mk1fuR0LNeD+,m7Q.cSBA_Z#3Htpt=a2GE$2PO`OTmcLg5"UlR2tB$qZ8H1SF]pOt(Km3&/$Y6QRhmSPYr7[iT0t$is7bc&ficjA`N?)7D".X_B6Rp\XU"r3PN*X[dBk.AMXkPHf!90cZ$F1*:B$?0+LFh2>%GPm"u^:/RAEp6%UTtGe,-i<#INIb0in`9$sAm*Q)4<9a]"L@'U[TR%GJHg415m#`SOQbQYI91:P"6;^e;JKZIgR3IVg@BD+ZKG"hZREg%EmTKu>JVCa@hRO]UO#h.W\SND+[DPTOj3g>)inpZGY,2#XeOG5iq[7bTteDdB6u>aM3I1;u\=9$=CMJZ<^IG^N!M;8_bKG?7R.!I[Eq4-8GmE?9^dE^lsJ7S_-ocUa_o1]Ffd;N-^sODe(._&q5G[.\a]8=nSXF/-dt6Xkpm@D(3;YKFETAL#^K2TB:Ahe,ZHI_-pA9Ea,U#G+N)$>5X*6A1@S+3'e`sq*r`>I>`1"ofe(L,9P1BJ7/n"`==&u+'nEthF=`Rn74RY/27F;3DsOdOQ`/oL,op!NaUPhiCRM>c&RZMrkCa;`7[<+fWY?egPX&&mLp\_6H^cC)LbG`L@#LG-BiR$&esKgGMMgARX&r`rYGRGkVf=U/?MXEu%CR45KF2T=C#KnGBY,k"$Yl6$li!nq[G:0W8"eXQbg%m@L&U-B9sE'eFPJ\r#BYj$\tYoE_]Cp8[:36B@gL`\c;>2Al\3Qd%i5[>d7UC\SORbtTC(We&QGL$F4FmG%2N\b&]GZVjf7JIl+I+mndK0)K1m!$;VWHF;G%Ygl@T\A[MgX$!Tdk#/a-s$Te.ApFQ^hZ]0X,P,lUSmpoPqX_;OVu\U%DF-jsSs;64?C&t/fVm9MKB3h\ZD@ii1EAGW/UQ?s'8$/Y`"9homn#L,@CZMF0_f<6j2gPY5=2AFae?POf)g9Pg[cSEp.]E]D1Ujo.^d*2Dea7ek*Ld.Qf/6+ZZ@;l6a;jJ$sBj!>5A5^S=#u8>:gc)%7[O"BO#)jFo59F@SUu"mM8l^(\/\V4Y`2TW6QhSe("K[M718i(*('!,)i`MkG#i^PM#)X+[oPk)WAOV@S_2p^m0Xt$EgqqBm'k,+(%.0*OFG_4=LH.+!jK93HqNBaFC"X_V$J=WQCQP*U$:-t`D-;BHQ!gcn.oI49gAY=lZ"ZorrqE"_TJ+E0RcqlQ)`Vr=?N7j(MU;]!:3-?J(WD!Cc4HW?5'B9ljSb2X3bdr,/(R6TZ2jPif9rktj]$HG,ct"B@?>nY/WN2KZEn+1g2NZVGSJYQi+MPZ2kWVLGIun!?#0'.M5&%^nZFbGX$p,dDBq_lasrTf4SG4m!o+QDb~>endstream +endobj +61 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 1620 +>> +stream +Gb!Sk>Ar7S'Roe[367:f1^l%3/d:t,[Ea:G?.Qs[P6$6"BMX=.3hi-RrUi8%bu_GiQ3"l9,U+Z-SF9^t,6ej3=oCS,!IgWVeMRHK@C?0u&J&J40V+1E7YJo"(HZk*=p0^Ji"/o,<\,/P5l+_6f?1rP#,N.8U1bU1rNG981$IL>h5\I]_s+/Zft-9&,9p'#'3><,Hi:Sa0rTZU^=PS6g*7fIauCiWf\#,\gYU6-G$Vt\G`M,pGhAYqlJ%t>_4Ci,p9W<2U[!Ct;IZ?@.SJ9a.d,A@PWYZk_@.)p6?tBn4`R9dq2K:ClE396:.hW<*S\hbD9=?:g=jaboC4lEFJ4RAc8l6koF9_r[>ORWfMpSM?_-lZbM[_KAdTNX`\Wn*&LX`LgJ9]*"Q((nIC.%.$9X4H[$sja[QbbbQh7NoGp#n2,U%X_U"?rebQ7=<-9#FG/W'.pPEG!UZiUT`u=VYqV<`Ol+fnHqA```//=9^G;)JmgS!co9t$'#;\\_NDRC0[cl9b(s(3'b(L&-c"pTH>20fJhGL&lZC$i/TX5,;Fo4'ltuF?#X/hJ3.&)Z;C&D?l2nkE(fc"atX>;[,"c?``Ad6fIfeWeXPf>$JHA!HeY+lqCDPn)*,R;WM'O\>,fOZ2VboO7RY&DY5dX,8&`FSmK`Kjh_ohkkk8]%7I(t)Up#3eDdKs(T$[Ef>4;)U>)e;=)\#;f%[?Qcq$EJH^&2uA)&BWll^n&@_&@mmfku7$b]t\-Ba-#gB?em1GdKi=:F8#%VG0OOSKmX$J4mnS`go1?liVGLgnrcBOb"[iDtV_G!*04k!&tO7Xru"$QfBVU"?5/>ba(nl]O6>./pD.M8]r)dpoo7Y4RZVpMB2`b6P<[emeUA%`/frhq&]DC$^uXhNJC;E)D4uPTP2A9pHMM[m2++AgPWTc1k9D`Or1J$DJB=g>U>%?GDFDa"7)8?m)c>0hmUn@>B=1/'r]/r8G8P7'q&M-`=i(CF*k/Dendstream +endobj +62 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2894 +>> +stream +Gb!l!D,]1[')p1[kV&nZ.F?A0hY?49aP@TtP/&DOW1jKACmSo7M$3C]dm!BrK"7WkAKFI>V"-YZj*fl\I"aDMo#'ci!fp:U0)]-jsLsJ`j!AC0%m1_pV@FS'aH[-Q'*.*9q!$]_$O@AqP%f7&TUT;f,0-AM1E-q_RUMD:^2U5*I^)EQUL8utHoqo,aecX5Gq]WQ+CnD#00]hXCQcV?K78q&ph,LtrQ9Lq<8I=!8K^c,q-L'.s8ZK,;c8LG%"!*A0$,U2t]O8U#X^CB,d\8Hr;'LfUPI)bD%QD-j[X_`)?4cp+IFHs:+7=n/Ee!FbZ)LH;?Y9&3?!iYE?_%U<^0@5'&74#P!G:4j$P\__:!8po3$=:sa4F$.Fg4S56(?B*%sO$3J/7=b^9I=HPAR`YJmLVJ?i$AO^"1i@%(?e@a$BL2+MP_l0,XI^e3M)?=\X%$riX9fQlLREl_Z.?@Y$:%f$Ul1,NODIV5\t$bU\V9XY,bX5Xq>aaTu-eOnFT-N6ueXfDCOVFOASC0WW>fRMfr+W@>j`!%'/O8k`ER#>gXZ3^J8:8)Z=gQ)Uro_\`6hBgVMscYr,=>NV\Ob`_l%1nS?6qXmrP#/bs`UeT[hFloDN1mj&dWD`X>a:O&Wo,>peQb'iK7;+IDX]ZC>020@`$X6+@8e)NseZG7:"Z6'61Uteq#*LO.@?.kJTTl\FTiBr!+XgEVD`K)]A>3Z=M7j63drX$udQQ=q&j3OekaLE8\n7KFqCicI/1!QI1[&,P(M;iq^`@fO"3'+IHs)NmrX:F?Oa7'5[o=b,eqN:2NHcaC>RqMp?78@WoJ'g%n[p`AJ?ua;&i1)tp?G7G,[3d/e3+O)j2P3c8QRBS8Er8cu,!g^6O8\ZG(LZ0bcI-^EhQR4:R.M#ZNUrb<(8U-GBnOTHVr>pr+_K]C/-G\nm4qe'WG'aO8\8-*B>4fW+DA*#h%$_QF>Nq\IWX',Me*)'?$S`TdPimARU#?mX-tVbQYG9C>XL^$Re1QrB-r8Q*9jLTLtIOK(>RWmX_Z_Q-GRMT%gMZ.escsUJPpksJK!3i`U.\;8HHF-/bcQNHI=a&:a"FMR$7::q(UE7L>AKjFAn64Z`X"1jg(ZV]YgkVVN%0j4e8CUM:NH8Hc3oWP'L);hGfkNo0sgFO!$-d1Z-m1;AVAIE%s^_A8,J\!>YLDMUP!o(G8f*/E#)tK?::D.Cl2S`;)X+6bS^Gn]5WcZgV)#GStqDTi2/Bo,8QXa/\+/?iYOH>9_lM1iSCMkQHOQj7:&QY\h$HlZ&BUBWIQa'b/S5GE!K!+:1)X1J(>N;'^)ZH-W`b@.r2P(g2Prqd@1,HKkW7U#pb9fUI9oF,Tb\'ALD\f+>lkDPTkI-8B<+^)$fiS_30&:n5/3+R],+d.UnClP$Sk'6<>bJ@aCUBu&1Pd4*$*ShDZagrY@Wm1&AKuW(a>YD\fl_@?K$r//m_j(;XC?Zh.>`n'HR3qR\m5$sYcKO!D?3I7dm]A$4bA#aq#I@8=rb5nm5jX6K[>7N/>d-6`H(K:=h)'NoUJfp9QGL\`"==b-V=uU]6R_WQtg_S-FuB+d88/3QMs&j'b]k6R8R(7*c9M0].6?8RZ.5R&P,^04@>G6h[*-/0e3$;`623W[ro>tCp>rlZ%LbR%,BilaT;1:8YuQfIiC!d(-j`2Wh)I',tXK)ikt>6QDcj)5O&s%DJH$jk$^E#A5Uko2K.+R(C7aJ^:^r_*%hY5BFEntVn9);\Aj:,[Kdjj+a&1$sU@RqhkpS13+uAP05GQl&NXZDpX&!Jf?uCItTHeh?dCYiD,=.n_dOnIdJE;nPLob9Ld=Y0p%W_DXb+":a_r(R!6]3W~>endstream +endobj +63 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 1892 +>> +stream +Gb!SlgMRrh&:N/3$jm,VDCimUpJRXpC?$!WOuA?Np-jKtY:,h'?I[er'D1TP6gj5O9<]'dJ1XnJG=9_q%YqqX(;TGlr-)HKr%run?OIDX-?B`U.@@c%e&ggG&`YoHV#i!>cuB7`6F.M/3%rB59B0-)c8:`AN^4&mAJF/1$hJ!U-;kmr&t$h?""[:e5;HLQo4!"l3'O&QYa";B92'#Ql$@n/'tl8'`h\\NUk5q+V`:o6PP9"9PO[tr5J.rQX&Cu":SUHikM>B@PO[D*0_l!#A7*]$Oe'/Xu:5F5&a(%f8@o2TM*Y(kE6CJ6[HZrjiNL8gCDr*3a`pW8\^[>I7pCVH3nmUkJqtps?+jh=n0[]8r)(Jn<-*2[h-1Cr:IjK[CAVPA=H[5EKqCm[)0rES\(kQ?SE,DM`.)EDd*88SecNA#:Lii1Mp<`H79]^7.IW>7m\kDUX@/IUM&PY;M(cq!/esUF3L=h6>-%E]6Mpma%>,T/(r;1F8_>^(^OmH6Q\-d>lcDI7+r_o5>\!;/`DPZ1Qs%3Q2bUdJ9FIoP<3mL/9g*]SD.,Ga&p[XiG5b5#Ne\U,QO([4.X;cBobJIZHlqFaih2aY4PihSV+L(QQ<2o5XU@u=#(QBjQ72B?bGThN-O!2NeV60*STZeFrghA?NjXAcNpWDpk?-ZU$c&>@L@mLI;-.eZU2o>1jC$kqCKE%$Fa=O7/t.GkRJp(rsScM+*+lbKN1+kQ)J2Kl!-otR^mji@1g$=h\OKM&p)C3)po>7=-f@;AcfP^aX$84Zjp6lSas!.R0`MD.%)VU43CJ<60RX?S7FRaZ.<8kj5^[#?A2TkWfpEKJ]2X`2ha8ZoclTo63KZ7cI\-k65i$qD?TrZO!?Cd[qXh:o)$QS2'Kn`"FRFYRYC$Z1GO3^`-?OjkH:6A>(?O2q";>D#L@q"Q.r=X@!!Kgr$tF"/]-<_>gH[0]H'/h@2SqJ6lE,b~>endstream +endobj +64 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2897 +>> +stream +Gb"/)968iI'#+6EoMM$>)$533c#K8Uh+Di2>FCq4W`62.a[erh!D,@7^O@+%T=-#gNlU"U)Q+3'+OKJ!J))p^(]P'*&i[`l@VGP$,Qfb$>Ougi417USN%#a"A.Ou-jUt=N_@%sGAp[_Eo`>7ob%UlTBI55,!U)A*%1-a;#`qnhpXgJ`;30F@\c#C3sK\i1pSB`6O=2F-E\#m0lG3DErPT>G4OTV(S=I\r>Ak3bWV$Hc)7mtcV?[C+H3IEZi_AoZ[#:7%M\_@Yd/+"=/iNU%,*tT(XfaY&S=43B$+g^dH\t)(-S)Lk^&8+H/\K4@-)p5q=aJO\%OPM\YmB=+oKj0A*8QJKe?l>'*In2?[;[E'f/=r)Nq"_S9H=:t$!c!n;<+q]8&;6Po4LiZCZ=g25#\Y1^j2#+(>:c&+SdE;L[gCU1H^^9.hQ!ueXe5`V-T?'EO=mi?I"8mp&.mA9a%9s4,'G'b>6Bk3I[YV:?K)/6cA/u%HX>ZOmY+so;RVeR2Dt<84(N&<2C;`5Ic/'tm?6`%]pNI7SW66FDi*%sI>e^/]$<1RI6C=ZX&0lH3m3Y*HG^DICCf@rOU3YW[j>(bNf!/W[2Fr@jdpOI?4k7XmSmR24GiWa-fsXV(=dmn]\cbo)mhoGnVWU!Y:r7[fS4$cI4:!?b&/_K>B!';qsb>1pYB\lT@DCK>h0jkH.?IkY!g9&==V/`YaQ[a/B,3!2cIddRV)J`+U;_JZ6pToE`"ai;N%Ve`h@lG<7kO?n!tRes,8uB?j/IQGG'ceNY=M`+^4clOUf*IQ-+oBeZu.+'W##jJn'p"V5KL[0euq=Y-?R/B\9/sZ8e)u3WYnn=FOg'/u;IYg7>#`Pl/LQe'l.t*upgFr:=K/o0"V-Y9[%\+%POk>bRM$^d!1M0f:j/"Y1p?<`Io3q.,oXZ;HE(HX"WdDS_1Id!SMt5,70TkGK^8B,+c)1P*b&X;o]?-gL^bEh6WHCH$s*O-cfA9V>%EI:/f'RZ1d+fnj#tn7GrSRCKkolh^9QMCC&kSp>1:5W`lbA,FA]:i/>hC=*!C4\#GG^2O-bX\0$2?&#G,kn$LEU3o]qbTS"7VO,&2p:no!>!6)PcJ;,YI%C_IW12>.J=8sTIR$X+jLG#P4k#R6"+endstream +endobj +65 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 3241 +>> +stream +Gb"/j>BAQ-&qJm;Mn9Wd^f;PmK+Y&ad/Ed->ntkB+csFYSV88D\o&a$/c>8s5ls@*_jaP^G*MaREc*HBh5*samo#]cN>(RC!&e0).ug:&^!\Y32iKWOp*\%@n*1DU-+9A&ht;D&OQppjpqqM9*:;r6Gj4-#Yi/e\>).Oqo/>o5^S&HKVmD"1GM0'e%n;ZauWn8N,lpJP-TTb5me'fjRC.;a`R*sone4j1>CO@:%mhrLM94MKWZ"6bD,\X?6:>X`F$hQ>:WR$Ec#o_[>g)]8ZJD[>3!/8%4aEl=HQb^a#cE4icN>6aZeql.\nY2M)&PcG6oS_RE;)^.f#'-r)Q-FDIalgc)@tY4jSmQej(V&J/5%_q=.j2WLf8!rhM;c;!/;hmn/C._R7+D+X;D=7R_8/50d4/T/4aVB!fXMKo>I]%?:+ljcI@.V1A*5DJiDem/iXiN]'gs[#Ff'"n/5bJ-2gQVj^lo.^IV!FW]<.S,OaeGdc=o$rGDN]:DI@F(EFG4Jb%.]/6V-\_kfLZK=0.[MF.ThW3(e4![iFNVVS]2q!a4)ua'B*.*?..A^8[2icLU-B@U6<7('9Nrm=HYs=G6j^%3Op?;+->dG#?;KtCh>Y_I;GZV0]iY$T,??7`-\-McG=&_d;]inEK`Ck_M?CbF0_#Va`2o<['_G1\X"=J<>\WT![F^[^l_)dZ>+7]dh'@Cg(`rVKi$/k>9U^Jias/82!WuEbi=;c=GGKV#T:YT>B9M/e/6kHUp_PP!=MbW=9/6"[Z+H_8u;forj,VtHW$eX(j0*c6>Ee]F_CKG/ta*+kHaM]#Z,mS_42c)1SUo)/4jV]G]d,j5st)uH%[Q))\\ViCI,f;\Q:*D\.,;6]0W2IgcsN9bP*N*pO_k,LWAQ[*fG#0%f35j6Alcf2$k/'u>,%=Y5o9'"X\>_cpD\Dg.s!<,hnJ7tL=#kJ!/h-GrLBHFBXqgWk1jo8%fD50']Xfeohq/L6\n.][:_l(NA(ol==3>oRP?;ICbdT`iQ6*dF3"_9jVl*.itaS*0cDa.\Hs69`*q3u9R(C?[Q3W3jq1]gi2sSU/%=6VBc(J[BCq,9bU>Kj/>gc=ZcA&Cib-:CO7<=N=HXrH@o"%6,e,ZTP.MF0)u7,+Nk:%CS(2G>)>G^D.Hg,Y42'EmD`:4WH_8m#K(fZ$-()nDb!Y-d9[f*>9HR-J_3L)hpYXWLrcq9AUe4&8-k/<`'$B!Th^qO8^g:u/E5'oS*.ltG_sgIAZMaAI;@$dR)IaunIcmnWJerFD3d>7!VDNps7c'RMs8@TBB8`(a3V3Hbuba'ihsO3T:HWh&'cLLkJuZVjQtRAZX8."=LD-]afI=\J7p&dOUHF+!;'2g+kn/C.*]VH8>f<)inT::@JJ.&Q(1FH-iqna$HE^a(TAob@N'hVqdc;BFBPX'B,GopS4/Of1p)H;P,8-X8]bRV!%f=+.953Z97h,$YY@qsce:QK\3\khX7%K/fEL]hSg):k!I1BQ'61UK#pd`OJHKKcE#:?]"E!JZ3t\):'0rC]#pel,a956T>gDNK$"'h)]:4L`]+6S]&RNKK\k?1?(N%HIQ,`hT8RC^_@t:FtI6XfglWj(9oAbsV>U$B%b-]`Ebcbb[2>pE:P1fsgEGH@2a>JMC\L"dkY-p#[6P5,l;8&+cddI?4gfRMDRTa%C[42Oq..+Mqml$Cre(-^:p%neXM8+oG=0aCsDm35eXVtl%VZ(D>eUYrQ/"HHAiS?Bs>QA@Z&Gm_!#p].`2@FbdK$=Z%Ojrhh2NM)?]5.=+`b!Kl4m0R:k=']@AM8X`AcL;#ris<4kBFM!5g'3YBY]fqlF+3ro_e[KIS+nu^cW?UC\p$)Jc_Or(AH/::nYC$fIm<]-&[01=Lpo@Y(A84i?7[NJDg[duLLWh+Zh=hBN%h4TL!EiR(h@!?`Zo$?^9e^L*MkcH3)]k(H#maeM*^1rmWq78\o4"c5LS6QTbfIAGinfS`76`_4Wg506nb;_R^4+tkmsD3e"'cB)Y2B&Aft6-_rL\%W;OI-/GDY(tDM9&IMYp='<4_f*G"*\gqBbc($B1@Qr(7`R%A!_>SB!`/fgGh^b'di&8h>]1^T\3Uq\l>.pdZ:-jbPD&HkF-C^ZD_?`@VNMPQ)]g$?$3k0btOFi;"EpWFW1Kl;d0:Ga4hRm5.gEc!7B>Z>cm_-q00*U^Ae=SO7DZ[j89_@h&)_Rdj*(#L1%21S%[':-]"^bH6*c>@$^V.jS7.aj6X86#sK)=Ot>V4"R!mifU.tR^oJ)e-DfkC:)TP7h^+9=HMoqFhQdM-O)(2Ye>qfRJhY0-r?4]?5!5XG)D@uk=ldE9mclhJioK[^>M8Zf-q9lf$\0D*-Jdt)GMT"ha&?r-Y_mCt(:fuBmN3VX!H+eHI~>endstream +endobj +66 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2357 +>> +stream +Gb"/hgN)%.&r,lR'RcsKZFL+agoA'WbW&h[9%H"9G&LWNJga/Z9EGVf3j\GMqZ@N]fs8U9VoFqMY#DS>*WUZ'H:DD[/b:k?MN).m`p\LD/\tJf\=)f5=bNk(9cHfjG8+Vcus*cba)a+R,2h$c9&!%f%5nkZ`pcn#CDhRC4?.dHlmOCub>#q)pU*uo][9C\K:mL,7ra^dYM6do9hmMNP_UtnKM)@^f3"-m_;*'+%fkQ\M'1Q[q&M'!7hO3kP&AtXIj"e]51e`pehXp=03^!.*iJWR=aNLl.pourA@W1pIBC;nW1$C41*+-pb+H,iCnsBS0.rt]M]:m!OSX>*Pm:ZQj9dpW`l2I6HA9ipF#%a5<)-1(\CN2DhbR,nacL2NqK0ai+[s[u2e(_N%,HFiG1Z`0"960oO!jF=*i1;JSJOlAYjO'\2gY5m':AK=>^YRtO3a9ODdr1=KQf&%gF)p4h3Ztno8]2aq)G;cGDo-!UEWP#X9,rXWnjc8ZkRVre=\oG8/LnCBWe/WYW_UH08G8GOJ-q6"o1Ofq"sD`jlFF6=ba$%S=:.GJ3,]Lf#NT_!b7f9]\,cDr588%_qSRR1Dm.dZO6iFKJk$H35paKk%At$:22[$-FV?W.O\"\%ub)lj^m$.#0<#'ZucbFrV/SGkRD%2e)S\@AnpHZGONsBUXdX)B+kjg^"BfI[Kj(&_b^3$He\.%;cE'&f(br5fB:FqbVT.D>bAlIkB`0gb4+jL%/`.+',R0LANne#C@-QNji1MZ?*B%@5L$UWu8)jh5fs2pRbL5he6SS\G@hN9=<.%/7$,CqNMntqG(8MfOi>q]@bh.egF&<)Vmr"?"(DMcOo"(=rZJB*m]2VfA&IhnFSFq:VU#Wo0GP@\C4Bp50B(R4X]/6W66Qmd7!c`q)&-^Ya5k+qX(e>O0:_B@'c%'Rr@e*Lr?7D#ask:O0/P9)a)jn;F^S.^#Y5-:/V5=c,?%Bgf-h6[A[tbhg,43h\A;.m`4BMq-s/[2l[ahARTI02>m=hkoQfFAK2YHV#2_+IOD_#BQ)OBFMBPV"mG'20?#a3p''03)K!=!'$!Xq;Gf$sDZ!6fBQ#LN0s>oXq;0,3BnlQD26O=?I-LlD!k:ScXNjO#2D9s"K^8D*S)u0u9CeI_-i`Yds#C#*X)MWoi.%_2KDOq_Mp\\/p*)'VY2HMr1IHT1k_3H78$tMj+*iD80-:\jS`fnn!/8JedR(CiO$`H>56RG7FSr[8&j?r"\-R;kIi%Km"FJ`nLD+1td6j%ifbM\cj#M>9H;pn)@@.g0mWe5lW!o2*W8Xc>[Hl_tXi$Re(A/Ai;r?l6@CNO_2$Fq*>X1sTmq^e5o/0%&\i5o/fF9Q!`r5EnY1'Suqru!to32,#WmO61UVf&2GH]jJ'jl"2LQ7umrLr/f>K8US@cMXDM8Bk=MTTiYeV+b#(>dK^'fOc(Z1I5bsDQ_cO(om9((lB^5\CmG_fG5!:-+MQnA"9!!hmcU7[W!Vt&",X%-%\Y=1AdrC7lt/OdSU:2o8dRoLEhp5J"'@LCh*9[L3Vm2-"a8@IpCLe]T;UF@5\!1dWo`WP5=R!EI3a9eCWEi4$+endstream +endobj +67 0 obj +<< +/Filter [ /ASCII85Decode /FlateDecode ] /Length 2281 +>> +stream +Gb!$G?#SK;&r,lR/*>9XYh<<21NuUR*q[6^S650DJRCpLj:+Y_8r?6&?f-'n+/3R%N_`lp2IobIIa-0En'"Uk^oqj0o8;c)Jq!\fP4WIn+rP\M/[";XEUr:L-_`Hj6h7$+UGsLEVe1?TUL0/j09'I5;&4G+'#bPV:\[57(7J8gSTln)60=@IApcmN&n^,bh(!3d:W#.SHL+'_IY'#0O"Yn,(L]Q->FTi%Y.']LgMN^o[m;:k-F\*_q['s@ou[u[cAa:q:3PEW+HBk-Td>3PVS*GU^ln/CIX#5p;1J7cCWY(1h:*40Lm=@0SP=@aM.46u60?.#,f1YohUHf8Nh-&OmdnoS90)q\.V&3W]>JmeV0r9O^!4bG$tUZ18=8(.=qB1?Fdkj'Q`g%o3d93)":5:M1UiaCitI`7,5EGed7G*n]B=_#Np"I"Inar$]EW-YXDgX?.3-U6#=;JSAK2`E0^"r%I;Hn@cFY%W7)N$hnJol,,@HLoHT!UFL7k<7DlKK3G\jjK_d8QiZJ=e!7&eQED2"bs!iSrmXh6rFnrQhb,<"K=*@M>?G&KKUIp)bZb]P31%*bZnqc%%Uh(0pW3,L.d#dgDERKAJaJOX3dBjSiC0LTZX-S+1K_NU,/?M\?g.-f_QKik[V)CL;lZs'fqq["Mk-_G2rH6ropsB&Td[C875IlG)T=):gNF$p.VdKcglMDD*STh+&!b0l/Z)ec:&9C\[A8'ZkTb)FN",Ihb045k6d:.dE)p[hWH\SdAk3H1uthLUPO(ABe2[Fl]2GP&:+C9J--2H;)BCoLE5RsI5?e?0NFqSZ0:-suDY$\Rcs$[Pb2'M!P,H%U#rBZ!mN]0'B7qr'Rm$a8LtNDN/b^I@:"mFh2=(Vs>4_\;=C.%dFV-2l^PG2T;8r`jB4r$'r@Ub9V260%;6oLo<=<:Oe(GITdUp(3<=@9KQoC7c7OeCqBb"[X=M$Z*:(`;s;2p7k]=?`YDA_4^ZgTDH&cp<**AKqmh;&r);[MXEoQ4CV\c.'gh$d1:U3_RWk'+iO#.YFCi7\AF8II>&cEM^d[^kc0mL-kVIN.M/2aD1P7.SH)7Om*AEr@1-OB\8q41TmW6/BKu/pG*(8Jp78Z1q&;qnbR[VGLMT$2'H>s5h=s;SP>.W\"U83"EDS(Z%ZIAhUHM0XS.LAp=MP#.)R75oDH'^_,uj_=i1A^r+HNq^>fR]]W.PoF9QA<'Vs]/([)7H]=0uh?^#^hfA?!ddX1"DMcV!1^;#"([+Kh2'l)[N-9aL$@m\MH;ml#6;L3-M0AO:`2NW=0"lauOlT+i!$:R"F6BWa?REq,$E6\F]Mi&#hbl)JXRS#DZ=)FgsE(3dO?ie>.S=d'&4^:At<,Z-tl~>endstream +endobj +xref +0 68 +0000000000 65535 f +0000000061 00000 n +0000000159 00000 n +0000000266 00000 n +0000000378 00000 n +0000001557 00000 n +0000001762 00000 n +0000001877 00000 n +0000002082 00000 n +0000002287 00000 n +0000002492 00000 n +0000002612 00000 n +0000002818 00000 n +0000003024 00000 n +0000003102 00000 n +0000003308 00000 n +0000003414 00000 n +0000003620 00000 n +0000003826 00000 n +0000004032 00000 n +0000004238 00000 n +0000004444 00000 n +0000004650 00000 n +0000004761 00000 n +0000004967 00000 n +0000005173 00000 n +0000005379 00000 n +0000005585 00000 n +0000005791 00000 n +0000005997 00000 n +0000006203 00000 n +0000006409 00000 n +0000006615 00000 n +0000006821 00000 n +0000007027 00000 n +0000007233 00000 n +0000007439 00000 n +0000007645 00000 n +0000007715 00000 n +0000008080 00000 n +0000008332 00000 n +0000010298 00000 n +0000011936 00000 n +0000014918 00000 n +0000017772 00000 n +0000018667 00000 n +0000021716 00000 n +0000023148 00000 n +0000025847 00000 n +0000028961 00000 n +0000029856 00000 n +0000032578 00000 n +0000034217 00000 n +0000036541 00000 n +0000039058 00000 n +0000042161 00000 n +0000044548 00000 n +0000047384 00000 n +0000050531 00000 n +0000051418 00000 n +0000054289 00000 n +0000057442 00000 n +0000059154 00000 n +0000062140 00000 n +0000064124 00000 n +0000067113 00000 n +0000070446 00000 n +0000072895 00000 n +trailer +<< +/ID +[<1067f889993850e52c02a67053a8ee0c><1067f889993850e52c02a67053a8ee0c>] +% ReportLab generated PDF document -- digest (opensource) + +/Info 38 0 R +/Root 37 0 R +/Size 68 +>> +startxref +75268 +%%EOF diff --git a/Nova-Dev-Doc/Planos/dev-documentacao-planos-seeder-complemento.html b/docs/planos/dev-documentacao-planos-seeder-complemento.html similarity index 100% rename from Nova-Dev-Doc/Planos/dev-documentacao-planos-seeder-complemento.html rename to docs/planos/dev-documentacao-planos-seeder-complemento.html diff --git a/Nova-Dev-Doc/Planos/dev-documentacao-planos-seeder-v1.html b/docs/planos/dev-documentacao-planos-seeder-v1.html similarity index 100% rename from Nova-Dev-Doc/Planos/dev-documentacao-planos-seeder-v1.html rename to docs/planos/dev-documentacao-planos-seeder-v1.html diff --git a/spec-v2.docx b/docs/specs/spec-v2.docx similarity index 100% rename from spec-v2.docx rename to docs/specs/spec-v2.docx diff --git a/spec-wizard.docx b/docs/specs/spec-wizard.docx similarity index 100% rename from spec-wizard.docx rename to docs/specs/spec-wizard.docx diff --git a/Nova-Dev-Doc/Subscription Health e Entitlements/Agencia_PSI_Sessao_Subscription_Health_Entitlements_2026-03-01.html b/docs/subscription-health/Agencia_PSI_Sessao_Subscription_Health_Entitlements_2026-03-01.html similarity index 100% rename from Nova-Dev-Doc/Subscription Health e Entitlements/Agencia_PSI_Sessao_Subscription_Health_Entitlements_2026-03-01.html rename to docs/subscription-health/Agencia_PSI_Sessao_Subscription_Health_Entitlements_2026-03-01.html diff --git a/docs/whatsapp.md b/docs/whatsapp.md new file mode 100644 index 0000000..aec5967 --- /dev/null +++ b/docs/whatsapp.md @@ -0,0 +1,243 @@ +# 📱 Disparando WhatsApp Local — AgênciaPsi + +Guia completo para rodar o sistema de lembretes por WhatsApp no ambiente local de desenvolvimento. + +--- + +## 🧱 O que você precisa ter rodando + +| Serviço | Como subir | Porta | +|---|---|---| +| Supabase local | `npx supabase start` | 54321 | +| Evolution API | Docker Desktop | 8080 | + +--- + +## 🚀 Passo 1 — Subir o Supabase local + +Abre o PowerShell na pasta do projeto e roda: + +```powershell +cd D:\leonohama\AgenciaPsi.com.br\Sistema\agenciapsi-primesakai +npx supabase start +``` + +Aguarda aparecer as URLs e credenciais. Confirma que está rodando acessando: +``` +http://127.0.0.1:54323 +``` + +--- + +## 🐳 Passo 2 — Subir a Evolution API + +Abre o Docker Desktop e confirma que está com o status **Engine running**. + +Abre outro PowerShell e roda: + +```powershell +cd D:\leonohama\AgenciaPsi.com.br\Sistema\agenciapsi-primesakai\evolution-api +docker compose up -d +``` + +Confirma que está rodando acessando: +``` +http://localhost:8080 +``` + +Deve retornar: +```json +{"status":200,"message":"Welcome to the Evolution API, it is working!"} +``` + +--- + +## 📱 Passo 3 — Conectar o WhatsApp + +Acessa o painel da Evolution API: +``` +http://localhost:8080/manager +``` + +- Loga com a API key: `minha_chave_123` +- Verifica se a instância `agenciapsi-teste` está com status **Connected** +- Se estiver **Disconnected**, clica na instância → **Get QR Code** → escaneia com o celular + +**Para escanear no celular:** +WhatsApp → ⋮ (três pontinhos) → Aparelhos conectados → Conectar um aparelho + +--- + +## ⚡ Passo 4 — Subir a Edge Function + +Abre outro PowerShell e roda: + +```powershell +cd D:\leonohama\AgenciaPsi.com.br\Sistema\agenciapsi-primesakai +npx supabase functions serve process-notification-queue --no-verify-jwt +``` + +Aguarda aparecer: +``` +- http://127.0.0.1:54321/functions/v1/process-notification-queue +``` + +--- + +## 🗄️ Passo 5 — Popular a fila manualmente + +Acessa o Supabase Studio em `http://127.0.0.1:54323`, vai em **SQL Editor** e roda: + +```sql +-- Popula a fila com sessões das próximas 48h +select populate_notification_queue(); + +-- Verifica o que foi gerado +select id, status, scheduled_at, channel, recipient_address, resolved_vars +from notification_queue +order by created_at desc +limit 10; +``` + +Se precisar corrigir o número do destinatário: + +```sql +update notification_queue +set recipient_address = '5516999999999' -- coloca o número real aqui +where status = 'pendente'; +``` + +Se precisar reenviar um item que falhou: + +```sql +update notification_queue +set status = 'pendente' +where id = 'cole-o-uuid-aqui'; +``` + +--- + +## 📤 Passo 6 — Disparar a fila + +Abre outro PowerShell e roda: + +```powershell +Invoke-WebRequest ` + -Uri "http://127.0.0.1:54321/functions/v1/process-notification-queue" ` + -Method POST ` + -Headers @{"Authorization"="Bearer sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz"} ` + -TimeoutSec 30 ` + | Select-Object -ExpandProperty Content +``` + +**Resposta esperada:** +```json +{"processados":[{"id":"...","status":"enviado"}]} +``` + +--- + +## 🔄 Passo 7 — Simular o cron (disparo automático a cada 5 min) + +Para simular o `pg_cron` localmente, cria um arquivo `cron-local.ps1` na raiz do projeto: + +```powershell +while ($true) { + Write-Host "$(Get-Date) - Populando fila..." + Invoke-WebRequest ` + -Uri "http://127.0.0.1:54321/functions/v1/process-notification-queue" ` + -Method POST ` + -Headers @{"Authorization"="Bearer sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz"} ` + -TimeoutSec 30 ` + | Select-Object -ExpandProperty Content + Write-Host "$(Get-Date) - Aguardando 5 minutos..." + Start-Sleep -Seconds 300 +} +``` + +Roda com: +```powershell +cd D:\leonohama\AgenciaPsi.com.br\Sistema\agenciapsi-primesakai +.\cron-local.ps1 +``` + +--- + +## ✅ Passo 8 — Verificar logs + +No Supabase Studio, roda: + +```sql +-- Ver histórico de envios +select id, status, channel, recipient_address, sent_at, failure_reason +from notification_logs +order by created_at desc +limit 10; + +-- Ver status da fila +select status, count(*) +from notification_queue +group by status; +``` + +--- + +## 🧪 Teste rápido de envio direto (sem fila) + +Para testar se o WhatsApp está funcionando sem passar pela fila: + +```powershell +$body = '{"number":"5516999999999","text":"Teste direto AgênciaPsi!"}' +$headers = @{"apikey"="minha_chave_123"; "Content-Type"="application/json"} +Invoke-WebRequest ` + -Uri "http://localhost:8080/message/sendText/agenciapsi-teste" ` + -Method POST ` + -Headers $headers ` + -Body $body ` + -TimeoutSec 30 ` + | Select-Object -ExpandProperty Content +``` + +--- + +## ⚠️ Problemas comuns + +| Problema | Causa | Solução | +|---|---|---| +| `Function not found` | Terminal na pasta errada | `cd` para a raiz do projeto antes de rodar o `functions serve` | +| `{"count":0}` no QR Code | Bug da versão | Usar imagem `evoapicloud/evolution-api:latest` | +| `Nenhum item na fila` | Item já processado ou com status diferente | Resetar com `update notification_queue set status = 'pendente'` | +| Timeout no envio | Redis não está rodando | Verificar se o container `evolution-redis` está up no Docker | +| `undefined/message/sendText/undefined` | Campos errados nas credenciais | Verificar se `credentials` tem `api_url` e `instance_name` | + +--- + +## 📋 Resumo das credenciais locais + +``` +Supabase URL: http://127.0.0.1:54321 +Supabase Studio: http://127.0.0.1:54323 +Supabase Secret Key: sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz +Evolution API URL: http://localhost:8080 +Evolution API Key: minha_chave_123 +Instância WhatsApp: agenciapsi-teste +``` + +--- + +## 🚀 Quando for para produção + +1. Subir a Evolution API em um VPS (Hostinger, Contabo ~R$30/mês) +2. Atualizar `api_url` em `notification_channels` para a URL do VPS +3. Configurar o `pg_cron` no Supabase cloud: + +```sql +select cron.schedule( + 'populate-notification-queue', + '*/5 * * * *', + $$ select populate_notification_queue(); $$ +); +``` + +4. Configurar o disparo da Edge Function via `pg_net` ou webhook externo +5. Migrar para API Oficial da Meta quando tiver volume de clientes diff --git a/estrutura.txt b/estrutura.txt index b32ffbe..612e623 100644 Binary files a/estrutura.txt and b/estrutura.txt differ diff --git a/Debugs/agenda-terapeuta-debug.txt b/logs/agenda-terapeuta-debug.txt similarity index 100% rename from Debugs/agenda-terapeuta-debug.txt rename to logs/agenda-terapeuta-debug.txt diff --git a/migrations/agenda_eventos_price.sql b/migrations/agenda_eventos_price.sql deleted file mode 100644 index 800cf48..0000000 --- a/migrations/agenda_eventos_price.sql +++ /dev/null @@ -1,8 +0,0 @@ --- migrations/agenda_eventos_price.sql --- Adiciona coluna price à agenda_eventos para registrar o valor da sessão - -ALTER TABLE agenda_eventos - ADD COLUMN IF NOT EXISTS price numeric(10,2); - -COMMENT ON COLUMN agenda_eventos.price IS - 'Valor da sessão em BRL. Preenchido automaticamente pela tabela professional_pricing do profissional.'; diff --git a/migrations/agendador_check_email.sql b/migrations/agendador_check_email.sql deleted file mode 100644 index 0de3715..0000000 --- a/migrations/agendador_check_email.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- agendador_check_email --- Verifica se um e-mail já possui solicitação anterior para este agendador --- SECURITY DEFINER → anon pode chamar sem burlar RLS diretamente --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - -CREATE OR REPLACE FUNCTION public.agendador_check_email( - p_slug text, - p_email text -) -RETURNS boolean -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; -BEGIN - SELECT c.owner_id INTO v_owner_id - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN false; END IF; - - RETURN EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes s - WHERE s.owner_id = v_owner_id - AND lower(s.paciente_email) = lower(trim(p_email)) - LIMIT 1 - ); -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_check_email(text, text) TO anon, authenticated; diff --git a/migrations/agendador_features.sql b/migrations/agendador_features.sql deleted file mode 100644 index 6e1701b..0000000 --- a/migrations/agendador_features.sql +++ /dev/null @@ -1,62 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Feature keys do Agendador Online --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. Inserir as features ────────────────────────────────────────────────── -INSERT INTO public.features (key, name, descricao) -VALUES - ( - 'agendador.online', - 'Agendador Online', - 'Permite que pacientes solicitem agendamentos via link público. Inclui aprovação manual ou automática, controle de horários e notificações.' - ), - ( - 'agendador.link_personalizado', - 'Link Personalizado do Agendador', - 'Permite que o profissional escolha um slug de URL próprio para o agendador (ex: /agendar/dra-ana-silva) em vez de um link gerado automaticamente.' - ) -ON CONFLICT (key) DO UPDATE - SET name = EXCLUDED.name, - descricao = EXCLUDED.descricao; - --- ── 2. Vincular aos planos ────────────────────────────────────────────────── --- ATENÇÃO: ajuste os filtros de plan key/name conforme seus planos reais. --- Exemplo: agendador.online disponível para planos PRO e acima. --- agendador.link_personalizado apenas para planos Elite/Superior. - --- agendador.online → todos os planos com target 'therapist' ou 'clinic' --- (Adapte o WHERE conforme necessário) -INSERT INTO public.plan_features (plan_id, feature_id, enabled) -SELECT - p.id, - f.id, - true -FROM public.plans p -CROSS JOIN public.features f -WHERE f.key = 'agendador.online' - AND p.is_active = true - -- Comente a linha abaixo para liberar para TODOS os planos: - -- AND p.key IN ('pro', 'elite', 'clinic_pro', 'clinic_elite') -ON CONFLICT DO NOTHING; - --- agendador.link_personalizado → apenas planos superiores --- Deixe comentado e adicione manualmente quando definir os planos: --- INSERT INTO public.plan_features (plan_id, feature_id, enabled) --- SELECT p.id, f.id, true --- FROM public.plans p --- CROSS JOIN public.features f --- WHERE f.key = 'agendador.link_personalizado' --- AND p.key IN ('elite', 'clinic_elite', 'pro_plus') --- ON CONFLICT DO NOTHING; - --- ── 3. Verificação ───────────────────────────────────────────────────────── -SELECT - f.key, - f.name, - COUNT(pf.plan_id) AS planos_vinculados -FROM public.features f -LEFT JOIN public.plan_features pf ON pf.feature_id = f.id AND pf.enabled = true -WHERE f.key IN ('agendador.online', 'agendador.link_personalizado') -GROUP BY f.key, f.name -ORDER BY f.key; diff --git a/migrations/agendador_fix_slots.sql b/migrations/agendador_fix_slots.sql deleted file mode 100644 index a9ce990..0000000 --- a/migrations/agendador_fix_slots.sql +++ /dev/null @@ -1,268 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- FIX: agendador_slots_disponiveis + agendador_dias_disponiveis --- Usa agenda_online_slots como fonte de slots --- Cruzamento com: agenda_eventos, recurrence_rules/exceptions, --- agendador_solicitacoes, agenda_bloqueios (feriados/bloqueios) --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - -CREATE OR REPLACE FUNCTION public.agendador_slots_disponiveis( - p_slug text, - p_data date -) -RETURNS TABLE (hora time, disponivel boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_antecedencia int; - v_agora timestamptz; - v_db_dow int; - v_slot time; - v_slot_fim time; - v_slot_ts timestamptz; - v_ocupado boolean; - -- loop de recorrências - v_rule RECORD; - v_rule_start_dow int; - v_first_occ date; - v_day_diff int; - v_ex_type text; -BEGIN - SELECT c.owner_id, c.duracao_sessao_min, c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; - - -- ── Dia inteiro bloqueado? (agenda_bloqueios sem hora) ─────────────────── - -- Se sim, não há nenhum slot disponível — retorna vazio. - IF EXISTS ( - SELECT 1 FROM public.agenda_bloqueios b - WHERE b.owner_id = v_owner_id - AND b.data_inicio <= p_data - AND COALESCE(b.data_fim, p_data) >= p_data - AND b.hora_inicio IS NULL -- bloqueio de dia inteiro - AND ( - (NOT b.recorrente) - OR (b.recorrente AND b.dia_semana = v_db_dow) - ) - ) THEN - RETURN; - END IF; - - FOR v_slot IN - SELECT s.time - FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - ORDER BY s.time - LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - v_ocupado := false; - - -- ── Antecedência mínima ────────────────────────────────────────────────── - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo'; - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- ── Bloqueio de horário específico (agenda_bloqueios com hora) ─────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_bloqueios b - WHERE b.owner_id = v_owner_id - AND b.data_inicio <= p_data - AND COALESCE(b.data_fim, p_data) >= p_data - AND b.hora_inicio IS NOT NULL - AND b.hora_inicio < v_slot_fim - AND b.hora_fim > v_slot - AND ( - (NOT b.recorrente) - OR (b.recorrente AND b.dia_semana = v_db_dow) - ) - ) INTO v_ocupado; - END IF; - - -- ── Eventos avulsos internos (agenda_eventos) ──────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos e - WHERE e.owner_id = v_owner_id - AND e.status::text NOT IN ('cancelado', 'faltou') - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::date = p_data - AND (e.inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (e.fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Recorrências ativas (recurrence_rules) ─────────────────────────────── - IF NOT v_ocupado THEN - FOR v_rule IN - SELECT - r.id, - r.start_date::date AS start_date, - r.end_date::date AS end_date, - r.start_time::time AS start_time, - r.end_time::time AS end_time, - COALESCE(r.interval, 1)::int AS interval - FROM public.recurrence_rules r - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND p_data >= r.start_date::date - AND (r.end_date IS NULL OR p_data <= r.end_date::date) - AND v_db_dow = ANY(r.weekdays) - AND r.start_time::time < v_slot_fim - AND r.end_time::time > v_slot - LOOP - v_rule_start_dow := extract(dow from v_rule.start_date)::int; - v_first_occ := v_rule.start_date - + (((v_db_dow - v_rule_start_dow + 7) % 7))::int; - v_day_diff := (p_data - v_first_occ)::int; - - IF v_day_diff >= 0 AND v_day_diff % (7 * v_rule.interval) = 0 THEN - v_ex_type := NULL; - SELECT ex.type INTO v_ex_type - FROM public.recurrence_exceptions ex - WHERE ex.recurrence_id = v_rule.id - AND ex.original_date = p_data - LIMIT 1; - - IF v_ex_type IS NULL OR v_ex_type NOT IN ( - 'cancel_session', 'patient_missed', - 'therapist_canceled', 'holiday_block', - 'reschedule_session' - ) THEN - v_ocupado := true; - EXIT; - END IF; - END IF; - END LOOP; - END IF; - - -- ── Recorrências remarcadas para este dia ──────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 - FROM public.recurrence_exceptions ex - JOIN public.recurrence_rules r ON r.id = ex.recurrence_id - WHERE r.owner_id = v_owner_id - AND r.status = 'ativo' - AND ex.type = 'reschedule_session' - AND ex.new_date = p_data - AND COALESCE(ex.new_start_time, r.start_time)::time < v_slot_fim - AND COALESCE(ex.new_end_time, r.end_time)::time > v_slot - ) INTO v_ocupado; - END IF; - - -- ── Solicitações públicas pendentes ────────────────────────────────────── - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes sol - WHERE sol.owner_id = v_owner_id - AND sol.status = 'pendente' - AND sol.data_solicitada = p_data - AND sol.hora_solicitada = v_slot - AND (sol.reservado_ate IS NULL OR sol.reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_slots_disponiveis(text, date) TO anon, authenticated; - - --- ── agendador_dias_disponiveis ─────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION public.agendador_dias_disponiveis( - p_slug text, - p_ano int, - p_mes int -) -RETURNS TABLE (data date, tem_slots boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_agora timestamptz; - v_data date; - v_data_inicio date; - v_data_fim date; - v_db_dow int; - v_tem_slot boolean; - v_bloqueado boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - v_db_dow := extract(dow from v_data::timestamp)::int; - - -- ── Dia inteiro bloqueado? (agenda_bloqueios) ───────────────────────── - SELECT EXISTS ( - SELECT 1 FROM public.agenda_bloqueios b - WHERE b.owner_id = v_owner_id - AND b.data_inicio <= v_data - AND COALESCE(b.data_fim, v_data) >= v_data - AND b.hora_inicio IS NULL -- bloqueio de dia inteiro - AND ( - (NOT b.recorrente) - OR (b.recorrente AND b.dia_semana = v_db_dow) - ) - ) INTO v_bloqueado; - - IF v_bloqueado THEN - v_data := v_data + 1; - CONTINUE; - END IF; - - -- ── Tem slots disponíveis no dia? ───────────────────────────────────── - SELECT EXISTS ( - SELECT 1 FROM public.agenda_online_slots s - WHERE s.owner_id = v_owner_id - AND s.weekday = v_db_dow - AND s.enabled = true - AND (v_data::text || ' ' || s.time::text)::timestamp - AT TIME ZONE 'America/Sao_Paulo' - >= v_agora + (v_antecedencia || ' hours')::interval - ) INTO v_tem_slot; - - IF v_tem_slot THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_dias_disponiveis(text, int, int) TO anon, authenticated; diff --git a/migrations/agendador_online.sql b/migrations/agendador_online.sql deleted file mode 100644 index bc9390e..0000000 --- a/migrations/agendador_online.sql +++ /dev/null @@ -1,170 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Agendador Online — tabelas de configuração e solicitações --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. agendador_configuracoes ────────────────────────────────────────────── -CREATE TABLE IF NOT EXISTS "public"."agendador_configuracoes" ( - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - - -- PRO / Ativação - "ativo" boolean DEFAULT false NOT NULL, - "link_slug" "text", - - -- Identidade Visual - "imagem_fundo_url" "text", - "imagem_header_url" "text", - "logomarca_url" "text", - "cor_primaria" "text" DEFAULT '#4b6bff', - - -- Perfil Público - "nome_exibicao" "text", - "endereco" "text", - "botao_como_chegar_ativo" boolean DEFAULT true NOT NULL, - "maps_url" "text", - - -- Fluxo de Agendamento - "modo_aprovacao" "text" DEFAULT 'aprovacao' NOT NULL, - "modalidade" "text" DEFAULT 'presencial' NOT NULL, - "tipos_habilitados" "jsonb" DEFAULT '["primeira","retorno"]'::jsonb NOT NULL, - "duracao_sessao_min" integer DEFAULT 50 NOT NULL, - "antecedencia_minima_horas" integer DEFAULT 24 NOT NULL, - "prazo_resposta_horas" integer DEFAULT 2 NOT NULL, - "reserva_horas" integer DEFAULT 2 NOT NULL, - - -- Pagamento - "pagamento_obrigatorio" boolean DEFAULT false NOT NULL, - "pix_chave" "text", - "pix_countdown_minutos" integer DEFAULT 20 NOT NULL, - - -- Triagem & Conformidade - "triagem_motivo" boolean DEFAULT true NOT NULL, - "triagem_como_conheceu" boolean DEFAULT false NOT NULL, - "verificacao_email" boolean DEFAULT false NOT NULL, - "exigir_aceite_lgpd" boolean DEFAULT true NOT NULL, - - -- Textos - "mensagem_boas_vindas" "text", - "texto_como_se_preparar" "text", - "texto_termos_lgpd" "text", - - -- Timestamps - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone DEFAULT now() NOT NULL, - - CONSTRAINT "agendador_configuracoes_pkey" PRIMARY KEY ("owner_id"), - CONSTRAINT "agendador_configuracoes_owner_fk" - FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_configuracoes_tenant_fk" - FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_configuracoes_modo_check" - CHECK ("modo_aprovacao" = ANY (ARRAY['automatico','aprovacao'])), - CONSTRAINT "agendador_configuracoes_modalidade_check" - CHECK ("modalidade" = ANY (ARRAY['presencial','online','ambos'])), - CONSTRAINT "agendador_configuracoes_duracao_check" - CHECK ("duracao_sessao_min" >= 10 AND "duracao_sessao_min" <= 240), - CONSTRAINT "agendador_configuracoes_antecedencia_check" - CHECK ("antecedencia_minima_horas" >= 0 AND "antecedencia_minima_horas" <= 720), - CONSTRAINT "agendador_configuracoes_reserva_check" - CHECK ("reserva_horas" >= 1 AND "reserva_horas" <= 48), - CONSTRAINT "agendador_configuracoes_pix_countdown_check" - CHECK ("pix_countdown_minutos" >= 5 AND "pix_countdown_minutos" <= 120), - CONSTRAINT "agendador_configuracoes_prazo_check" - CHECK ("prazo_resposta_horas" >= 1 AND "prazo_resposta_horas" <= 72) -); - -ALTER TABLE "public"."agendador_configuracoes" ENABLE ROW LEVEL SECURITY; - -DROP POLICY IF EXISTS "agendador_cfg_select" ON "public"."agendador_configuracoes"; -CREATE POLICY "agendador_cfg_select" ON "public"."agendador_configuracoes" - FOR SELECT USING (auth.uid() = owner_id); - -DROP POLICY IF EXISTS "agendador_cfg_write" ON "public"."agendador_configuracoes"; -CREATE POLICY "agendador_cfg_write" ON "public"."agendador_configuracoes" - USING (auth.uid() = owner_id) - WITH CHECK (auth.uid() = owner_id); - -CREATE INDEX IF NOT EXISTS "agendador_cfg_tenant_idx" - ON "public"."agendador_configuracoes" ("tenant_id"); - --- ── 2. agendador_solicitacoes ─────────────────────────────────────────────── -CREATE TABLE IF NOT EXISTS "public"."agendador_solicitacoes" ( - "id" "uuid" DEFAULT gen_random_uuid() NOT NULL, - "owner_id" "uuid" NOT NULL, - "tenant_id" "uuid", - - -- Dados do paciente - "paciente_nome" "text" NOT NULL, - "paciente_sobrenome" "text", - "paciente_email" "text" NOT NULL, - "paciente_celular" "text", - "paciente_cpf" "text", - - -- Agendamento solicitado - "tipo" "text" NOT NULL, - "modalidade" "text" NOT NULL, - "data_solicitada" date NOT NULL, - "hora_solicitada" time NOT NULL, - - -- Reserva temporária - "reservado_ate" timestamp with time zone, - - -- Triagem - "motivo" "text", - "como_conheceu" "text", - - -- Pagamento - "pix_status" "text" DEFAULT 'pendente', - "pix_pago_em" timestamp with time zone, - - -- Status geral - "status" "text" DEFAULT 'pendente' NOT NULL, - "recusado_motivo" "text", - - -- Autorização - "autorizado_em" timestamp with time zone, - "autorizado_por" "uuid", - - -- Vínculos internos - "user_id" "uuid", - "patient_id" "uuid", - "evento_id" "uuid", - - -- Timestamps - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone DEFAULT now() NOT NULL, - - CONSTRAINT "agendador_solicitacoes_pkey" PRIMARY KEY ("id"), - CONSTRAINT "agendador_sol_owner_fk" - FOREIGN KEY ("owner_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_sol_tenant_fk" - FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE, - CONSTRAINT "agendador_sol_status_check" - CHECK ("status" = ANY (ARRAY['pendente','autorizado','recusado','expirado'])), - CONSTRAINT "agendador_sol_tipo_check" - CHECK ("tipo" = ANY (ARRAY['primeira','retorno','reagendar'])), - CONSTRAINT "agendador_sol_modalidade_check" - CHECK ("modalidade" = ANY (ARRAY['presencial','online'])), - CONSTRAINT "agendador_sol_pix_check" - CHECK ("pix_status" IS NULL OR "pix_status" = ANY (ARRAY['pendente','pago','expirado'])) -); - -ALTER TABLE "public"."agendador_solicitacoes" ENABLE ROW LEVEL SECURITY; - -DROP POLICY IF EXISTS "agendador_sol_owner_select" ON "public"."agendador_solicitacoes"; -CREATE POLICY "agendador_sol_owner_select" ON "public"."agendador_solicitacoes" - FOR SELECT USING (auth.uid() = owner_id); - -DROP POLICY IF EXISTS "agendador_sol_owner_write" ON "public"."agendador_solicitacoes"; -CREATE POLICY "agendador_sol_owner_write" ON "public"."agendador_solicitacoes" - USING (auth.uid() = owner_id) - WITH CHECK (auth.uid() = owner_id); - -CREATE INDEX IF NOT EXISTS "agendador_sol_owner_idx" - ON "public"."agendador_solicitacoes" ("owner_id", "status"); - -CREATE INDEX IF NOT EXISTS "agendador_sol_tenant_idx" - ON "public"."agendador_solicitacoes" ("tenant_id"); - -CREATE INDEX IF NOT EXISTS "agendador_sol_data_idx" - ON "public"."agendador_solicitacoes" ("data_solicitada", "hora_solicitada"); diff --git a/migrations/agendador_pagamento_modo.sql b/migrations/agendador_pagamento_modo.sql deleted file mode 100644 index 683caa0..0000000 --- a/migrations/agendador_pagamento_modo.sql +++ /dev/null @@ -1,20 +0,0 @@ --- migrations/agendador_pagamento_modo.sql --- Adiciona suporte a modo de pagamento no agendador online --- Execute no Supabase SQL Editor - -ALTER TABLE agendador_configuracoes - ADD COLUMN IF NOT EXISTS pagamento_modo text NOT NULL DEFAULT 'sem_pagamento', - ADD COLUMN IF NOT EXISTS pagamento_metodos_visiveis text[] NOT NULL DEFAULT '{}'; - --- Migração de dados existentes: --- quem tinha pagamento_obrigatorio = true → pix_antecipado -UPDATE agendador_configuracoes - SET pagamento_modo = 'pix_antecipado' - WHERE pagamento_obrigatorio = true - AND pagamento_modo = 'sem_pagamento'; - -COMMENT ON COLUMN agendador_configuracoes.pagamento_modo IS - 'sem_pagamento | pagar_na_hora | pix_antecipado'; - -COMMENT ON COLUMN agendador_configuracoes.pagamento_metodos_visiveis IS - 'Métodos exibidos ao paciente quando pagamento_modo = pagar_na_hora. Ex: {pix, deposito, dinheiro, cartao, convenio}'; diff --git a/migrations/agendador_publico.sql b/migrations/agendador_publico.sql deleted file mode 100644 index 4ca29d4..0000000 --- a/migrations/agendador_publico.sql +++ /dev/null @@ -1,219 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Agendador Online — acesso público (anon) + função de slots disponíveis --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. Geração automática de slug ────────────────────────────────────────── --- Cria slug único de 8 chars quando o profissional ativa sem link_personalizado -CREATE OR REPLACE FUNCTION public.agendador_gerar_slug() -RETURNS trigger LANGUAGE plpgsql AS $$ -DECLARE - v_slug text; - v_exists boolean; -BEGIN - -- só gera se ativou e não tem slug ainda - IF NEW.ativo = true AND (NEW.link_slug IS NULL OR NEW.link_slug = '') THEN - LOOP - v_slug := lower(substring(replace(gen_random_uuid()::text, '-', ''), 1, 8)); - SELECT EXISTS ( - SELECT 1 FROM public.agendador_configuracoes - WHERE link_slug = v_slug AND owner_id <> NEW.owner_id - ) INTO v_exists; - EXIT WHEN NOT v_exists; - END LOOP; - NEW.link_slug := v_slug; - END IF; - RETURN NEW; -END; -$$; - -DROP TRIGGER IF EXISTS agendador_slug_trigger ON public.agendador_configuracoes; -CREATE TRIGGER agendador_slug_trigger - BEFORE INSERT OR UPDATE ON public.agendador_configuracoes - FOR EACH ROW EXECUTE FUNCTION public.agendador_gerar_slug(); - --- ── 2. Políticas públicas (anon) ──────────────────────────────────────────── - --- Leitura pública da config pelo slug (só ativo) -DROP POLICY IF EXISTS "agendador_cfg_public_read" ON public.agendador_configuracoes; -CREATE POLICY "agendador_cfg_public_read" ON public.agendador_configuracoes - FOR SELECT TO anon - USING (ativo = true AND link_slug IS NOT NULL); - --- Inserção pública de solicitações (qualquer pessoa pode solicitar) -DROP POLICY IF EXISTS "agendador_sol_public_insert" ON public.agendador_solicitacoes; -CREATE POLICY "agendador_sol_public_insert" ON public.agendador_solicitacoes - FOR INSERT TO anon - WITH CHECK (true); - --- Leitura da própria solicitação (pelo paciente logado) -DROP POLICY IF EXISTS "agendador_sol_patient_read" ON public.agendador_solicitacoes; -CREATE POLICY "agendador_sol_patient_read" ON public.agendador_solicitacoes - FOR SELECT TO authenticated - USING (auth.uid() = user_id OR auth.uid() = owner_id); - --- ── 3. Função: retorna slots disponíveis para uma data ────────────────────── --- Roda como SECURITY DEFINER (acessa agenda_regras e agenda_eventos sem RLS) -CREATE OR REPLACE FUNCTION public.agendador_slots_disponiveis( - p_slug text, - p_data date -) -RETURNS TABLE (hora time, disponivel boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_duracao int; - v_reserva int; - v_antecedencia int; - v_dia_semana int; -- 0=dom..6=sab (JS) → convertemos - v_db_dow int; -- 0=dom..6=sab no Postgres (extract dow) - v_inicio time; - v_fim time; - v_slot time; - v_slot_fim time; - v_agora timestamptz; -BEGIN - -- carrega config do agendador - SELECT - c.owner_id, - c.duracao_sessao_min, - c.reserva_horas, - c.antecedencia_minima_horas - INTO v_owner_id, v_duracao, v_reserva, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN - RETURN; - END IF; - - v_agora := now(); - v_db_dow := extract(dow from p_data::timestamp)::int; -- 0=dom..6=sab - - -- regra semanal para o dia da semana - SELECT hora_inicio, hora_fim - INTO v_inicio, v_fim - FROM public.agenda_regras_semanais - WHERE owner_id = v_owner_id - AND dia_semana = v_db_dow - AND ativo = true - LIMIT 1; - - IF v_inicio IS NULL THEN - RETURN; -- profissional não atende nesse dia - END IF; - - -- itera slots de v_duracao em v_duracao dentro da jornada - v_slot := v_inicio; - WHILE v_slot + (v_duracao || ' minutes')::interval <= v_fim LOOP - v_slot_fim := v_slot + (v_duracao || ' minutes')::interval; - - -- bloco temporário para verificar conflitos - DECLARE - v_ocupado boolean := false; - v_slot_ts timestamptz; - BEGIN - -- antecedência mínima (compara em horário de Brasília) - v_slot_ts := (p_data::text || ' ' || v_slot::text)::timestamp AT TIME ZONE 'America/Sao_Paulo'; - - IF v_slot_ts < v_agora + (v_antecedencia || ' hours')::interval THEN - v_ocupado := true; - END IF; - - -- conflito com eventos existentes na agenda - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agenda_eventos - WHERE owner_id = v_owner_id - AND status::text NOT IN ('cancelado', 'faltou') - AND inicio_em AT TIME ZONE 'America/Sao_Paulo' >= p_data::timestamp - AND inicio_em AT TIME ZONE 'America/Sao_Paulo' < p_data::timestamp + interval '1 day' - AND (inicio_em AT TIME ZONE 'America/Sao_Paulo')::time < v_slot_fim - AND (fim_em AT TIME ZONE 'America/Sao_Paulo')::time > v_slot - ) INTO v_ocupado; - END IF; - - -- conflito com solicitações pendentes (reservadas) - IF NOT v_ocupado THEN - SELECT EXISTS ( - SELECT 1 FROM public.agendador_solicitacoes - WHERE owner_id = v_owner_id - AND status = 'pendente' - AND data_solicitada = p_data - AND hora_solicitada = v_slot - AND (reservado_ate IS NULL OR reservado_ate > v_agora) - ) INTO v_ocupado; - END IF; - - hora := v_slot; - disponivel := NOT v_ocupado; - RETURN NEXT; - END; - - v_slot := v_slot + (v_duracao || ' minutes')::interval; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_slots_disponiveis(text, date) TO anon, authenticated; - --- ── 4. Função: retorna dias com disponibilidade no mês ───────────────────── -CREATE OR REPLACE FUNCTION public.agendador_dias_disponiveis( - p_slug text, - p_ano int, - p_mes int -- 1-12 -) -RETURNS TABLE (data date, tem_slots boolean) -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_owner_id uuid; - v_antecedencia int; - v_data date; - v_data_inicio date; - v_data_fim date; - v_agora timestamptz; - v_db_dow int; - v_tem_regra boolean; -BEGIN - SELECT c.owner_id, c.antecedencia_minima_horas - INTO v_owner_id, v_antecedencia - FROM public.agendador_configuracoes c - WHERE c.link_slug = p_slug AND c.ativo = true - LIMIT 1; - - IF v_owner_id IS NULL THEN RETURN; END IF; - - v_agora := now(); - v_data_inicio := make_date(p_ano, p_mes, 1); - v_data_fim := (v_data_inicio + interval '1 month' - interval '1 day')::date; - - v_data := v_data_inicio; - WHILE v_data <= v_data_fim LOOP - -- não oferece dias no passado ou dentro da antecedência mínima - IF v_data::timestamptz + '23:59:59'::interval > v_agora + (v_antecedencia || ' hours')::interval THEN - v_db_dow := extract(dow from v_data::timestamp)::int; - - SELECT EXISTS ( - SELECT 1 FROM public.agenda_regras_semanais - WHERE owner_id = v_owner_id AND dia_semana = v_db_dow AND ativo = true - ) INTO v_tem_regra; - - IF v_tem_regra THEN - data := v_data; - tem_slots := true; - RETURN NEXT; - END IF; - END IF; - - v_data := v_data + 1; - END LOOP; -END; -$$; - -GRANT EXECUTE ON FUNCTION public.agendador_dias_disponiveis(text, int, int) TO anon, authenticated; diff --git a/migrations/agendador_status_convertido.sql b/migrations/agendador_status_convertido.sql deleted file mode 100644 index cddb978..0000000 --- a/migrations/agendador_status_convertido.sql +++ /dev/null @@ -1,19 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- FIX: adiciona status 'convertido' na constraint de agendador_solicitacoes --- e adiciona coluna motivo_recusa (alias amigável de recusado_motivo) --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - --- 1. Remove o CHECK existente e recria com os novos valores -ALTER TABLE public.agendador_solicitacoes - DROP CONSTRAINT IF EXISTS "agendador_sol_status_check"; - -ALTER TABLE public.agendador_solicitacoes - ADD CONSTRAINT "agendador_sol_status_check" - CHECK (status = ANY (ARRAY[ - 'pendente', - 'autorizado', - 'recusado', - 'expirado', - 'convertido' - ])); diff --git a/migrations/agendador_storage.sql b/migrations/agendador_storage.sql deleted file mode 100644 index 6d82893..0000000 --- a/migrations/agendador_storage.sql +++ /dev/null @@ -1,56 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Storage bucket para imagens do Agendador Online --- Execute no Supabase SQL Editor --- ═══════════════════════════════════════════════════════════════════════════ - --- ── 1. Criar o bucket ────────────────────────────────────────────────────── -INSERT INTO storage.buckets (id, name, public, file_size_limit, allowed_mime_types) -VALUES ( - 'agendador', - 'agendador', - true, -- público (URLs diretas sem assinar) - 5242880, -- 5 MB - ARRAY['image/jpeg','image/png','image/webp','image/gif'] -) -ON CONFLICT (id) DO UPDATE - SET public = true, - file_size_limit = 5242880, - allowed_mime_types = ARRAY['image/jpeg','image/png','image/webp','image/gif']; - --- ── 2. Políticas ─────────────────────────────────────────────────────────── - --- Leitura pública (anon e authenticated) -DROP POLICY IF EXISTS "agendador_storage_public_read" ON storage.objects; -CREATE POLICY "agendador_storage_public_read" - ON storage.objects FOR SELECT - USING (bucket_id = 'agendador'); - --- Upload: apenas o dono da pasta (owner_id é o primeiro segmento do path) -DROP POLICY IF EXISTS "agendador_storage_owner_insert" ON storage.objects; -CREATE POLICY "agendador_storage_owner_insert" - ON storage.objects FOR INSERT - TO authenticated - WITH CHECK ( - bucket_id = 'agendador' - AND (storage.foldername(name))[1] = auth.uid()::text - ); - --- Update/upsert pelo dono -DROP POLICY IF EXISTS "agendador_storage_owner_update" ON storage.objects; -CREATE POLICY "agendador_storage_owner_update" - ON storage.objects FOR UPDATE - TO authenticated - USING ( - bucket_id = 'agendador' - AND (storage.foldername(name))[1] = auth.uid()::text - ); - --- Delete pelo dono -DROP POLICY IF EXISTS "agendador_storage_owner_delete" ON storage.objects; -CREATE POLICY "agendador_storage_owner_delete" - ON storage.objects FOR DELETE - TO authenticated - USING ( - bucket_id = 'agendador' - AND (storage.foldername(name))[1] = auth.uid()::text - ); diff --git a/migrations/payment_settings.sql b/migrations/payment_settings.sql deleted file mode 100644 index b8ee28e..0000000 --- a/migrations/payment_settings.sql +++ /dev/null @@ -1,71 +0,0 @@ --- migrations/payment_settings.sql --- Tabela de configurações de formas de pagamento por terapeuta/owner --- Execute no Supabase SQL Editor - -CREATE TABLE IF NOT EXISTS payment_settings ( - id uuid DEFAULT gen_random_uuid() PRIMARY KEY, - owner_id uuid NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE, - tenant_id uuid REFERENCES tenants(id) ON DELETE CASCADE, - - -- Pix - pix_ativo boolean NOT NULL DEFAULT false, - pix_tipo text NOT NULL DEFAULT 'cpf', -- cpf | cnpj | email | celular | aleatoria - pix_chave text NOT NULL DEFAULT '', - pix_nome_titular text NOT NULL DEFAULT '', - - -- Depósito / TED - deposito_ativo boolean NOT NULL DEFAULT false, - deposito_banco text NOT NULL DEFAULT '', - deposito_agencia text NOT NULL DEFAULT '', - deposito_conta text NOT NULL DEFAULT '', - deposito_tipo_conta text NOT NULL DEFAULT 'corrente', -- corrente | poupanca - deposito_titular text NOT NULL DEFAULT '', - deposito_cpf_cnpj text NOT NULL DEFAULT '', - - -- Dinheiro (espécie) - dinheiro_ativo boolean NOT NULL DEFAULT false, - - -- Cartão (maquininha presencial) - cartao_ativo boolean NOT NULL DEFAULT false, - cartao_instrucao text NOT NULL DEFAULT '', - - -- Plano de saúde / Convênio - convenio_ativo boolean NOT NULL DEFAULT false, - convenio_lista text NOT NULL DEFAULT '', -- texto livre com convênios aceitos - - -- Observações gerais exibidas ao paciente - observacoes_pagamento text NOT NULL DEFAULT '', - - created_at timestamptz DEFAULT now(), - updated_at timestamptz DEFAULT now(), - - CONSTRAINT payment_settings_owner_id_key UNIQUE (owner_id) -); - --- Índice por tenant -CREATE INDEX IF NOT EXISTS payment_settings_tenant_id_idx ON payment_settings(tenant_id); - --- RLS -ALTER TABLE payment_settings ENABLE ROW LEVEL SECURITY; - --- Owner lê e escreve os próprios dados -DROP POLICY IF EXISTS "payment_settings: owner full access" ON payment_settings; -CREATE POLICY "payment_settings: owner full access" - ON payment_settings - FOR ALL - USING (owner_id = auth.uid()) - WITH CHECK (owner_id = auth.uid()); - --- updated_at automático -CREATE OR REPLACE FUNCTION update_payment_settings_updated_at() -RETURNS TRIGGER LANGUAGE plpgsql AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - -DROP TRIGGER IF EXISTS trg_payment_settings_updated_at ON payment_settings; -CREATE TRIGGER trg_payment_settings_updated_at - BEFORE UPDATE ON payment_settings - FOR EACH ROW EXECUTE FUNCTION update_payment_settings_updated_at(); diff --git a/migrations/professional_pricing.sql b/migrations/professional_pricing.sql deleted file mode 100644 index 2892900..0000000 --- a/migrations/professional_pricing.sql +++ /dev/null @@ -1,61 +0,0 @@ --- migrations/professional_pricing.sql --- Fase 1: Precificação — tabela de preços padrão por profissional --- Execute no Supabase SQL Editor - --- ───────────────────────────────────────────────────────────── --- 1. Campo price em agenda_eventos --- ───────────────────────────────────────────────────────────── -ALTER TABLE agenda_eventos - ADD COLUMN IF NOT EXISTS price numeric(10,2); - --- ───────────────────────────────────────────────────────────── --- 2. Tabela de preços por profissional --- Chave: owner_id + determined_commitment_id (NULL = padrão) --- ───────────────────────────────────────────────────────────── -CREATE TABLE IF NOT EXISTS professional_pricing ( - id uuid DEFAULT gen_random_uuid() PRIMARY KEY, - owner_id uuid NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE, - tenant_id uuid NOT NULL, - determined_commitment_id uuid REFERENCES determined_commitments(id) ON DELETE SET NULL, - -- NULL = preço padrão (fallback quando não há match por tipo) - price numeric(10,2) NOT NULL, - notes text, - created_at timestamptz DEFAULT now(), - updated_at timestamptz DEFAULT now(), - - CONSTRAINT professional_pricing_owner_commitment_key - UNIQUE (owner_id, determined_commitment_id) -); - --- Índice por tenant (listagens do admin) -CREATE INDEX IF NOT EXISTS professional_pricing_tenant_idx - ON professional_pricing (tenant_id); - --- ───────────────────────────────────────────────────────────── --- 3. RLS --- ───────────────────────────────────────────────────────────── -ALTER TABLE professional_pricing ENABLE ROW LEVEL SECURITY; - --- Terapeuta lê e escreve seus próprios preços -DROP POLICY IF EXISTS "professional_pricing: owner full access" ON professional_pricing; -CREATE POLICY "professional_pricing: owner full access" - ON professional_pricing - FOR ALL - USING (owner_id = auth.uid()) - WITH CHECK (owner_id = auth.uid()); - --- ───────────────────────────────────────────────────────────── --- 4. updated_at automático --- ───────────────────────────────────────────────────────────── -CREATE OR REPLACE FUNCTION update_professional_pricing_updated_at() -RETURNS TRIGGER LANGUAGE plpgsql AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$; - -DROP TRIGGER IF EXISTS trg_professional_pricing_updated_at ON professional_pricing; -CREATE TRIGGER trg_professional_pricing_updated_at - BEFORE UPDATE ON professional_pricing - FOR EACH ROW EXECUTE FUNCTION update_professional_pricing_updated_at(); diff --git a/migrations/recurrence_rules_price.sql b/migrations/recurrence_rules_price.sql deleted file mode 100644 index a84164a..0000000 --- a/migrations/recurrence_rules_price.sql +++ /dev/null @@ -1,6 +0,0 @@ --- migrations/recurrence_rules_price.sql --- Adiciona campo price em recurrence_rules para herança nas ocorrências virtuais --- Execute no Supabase SQL Editor - -ALTER TABLE recurrence_rules - ADD COLUMN IF NOT EXISTS price numeric(10,2); diff --git a/migrations/remove_session_start_offset.sql b/migrations/remove_session_start_offset.sql deleted file mode 100644 index 1ddddef..0000000 --- a/migrations/remove_session_start_offset.sql +++ /dev/null @@ -1,6 +0,0 @@ --- Migration: remove session_start_offset_min from agenda_configuracoes --- This field is replaced by hora_inicio in agenda_regras_semanais (work schedule per day) --- The first session slot is now derived directly from hora_inicio of the work rule. - -ALTER TABLE public.agenda_configuracoes - DROP COLUMN IF EXISTS session_start_offset_min; diff --git a/migrations/support_sessions.sql b/migrations/support_sessions.sql deleted file mode 100644 index ea75cf7..0000000 --- a/migrations/support_sessions.sql +++ /dev/null @@ -1,235 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Support Sessions — Sessões de suporte técnico SaaS --- ═══════════════════════════════════════════════════════════════════════════ --- Permite que admins SaaS gerem tokens de acesso temporário para debug --- de agendas de terapeutas, sem expor debug para usuários comuns. --- --- SEGURANÇA: --- - RLS: só saas_admin pode criar/listar sessões --- - Token é opaco (gen_random_uuid) — não adivinhável --- - expires_at com TTL máximo de 60 minutos --- - validate_support_session() retorna apenas true/false + tenant_id --- (não expõe dados do admin) --- ═══════════════════════════════════════════════════════════════════════════ - --- ── Tabela ────────────────────────────────────────────────────────────────── - -CREATE TABLE IF NOT EXISTS "public"."support_sessions" ( - "id" uuid DEFAULT gen_random_uuid() NOT NULL, - "tenant_id" uuid NOT NULL, - "admin_id" uuid NOT NULL, - "token" text NOT NULL DEFAULT (replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', '')), - "expires_at" timestamp with time zone NOT NULL - DEFAULT (now() + interval '60 minutes'), - "created_at" timestamp with time zone NOT NULL DEFAULT now(), - - CONSTRAINT "support_sessions_pkey" PRIMARY KEY ("id"), - - CONSTRAINT "support_sessions_tenant_fk" - FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE CASCADE, - - CONSTRAINT "support_sessions_admin_fk" - FOREIGN KEY ("admin_id") REFERENCES "auth"."users"("id") ON DELETE CASCADE, - - CONSTRAINT "support_sessions_token_unique" UNIQUE ("token") -); - --- ── Índices ────────────────────────────────────────────────────────────────── - -CREATE INDEX IF NOT EXISTS "support_sessions_token_idx" - ON "public"."support_sessions" ("token"); - -CREATE INDEX IF NOT EXISTS "support_sessions_tenant_idx" - ON "public"."support_sessions" ("tenant_id"); - -CREATE INDEX IF NOT EXISTS "support_sessions_expires_idx" - ON "public"."support_sessions" ("expires_at"); - --- ── RLS ────────────────────────────────────────────────────────────────────── - -ALTER TABLE "public"."support_sessions" ENABLE ROW LEVEL SECURITY; - --- Somente saas_admin pode ver suas próprias sessões de suporte -DROP POLICY IF EXISTS "support_sessions_saas_select" ON "public"."support_sessions"; -CREATE POLICY "support_sessions_saas_select" - ON "public"."support_sessions" - FOR SELECT - USING ( - auth.uid() = admin_id - AND EXISTS ( - SELECT 1 FROM public.profiles - WHERE id = auth.uid() - AND role = 'saas_admin' - ) - ); - --- Somente saas_admin pode criar sessões de suporte -DROP POLICY IF EXISTS "support_sessions_saas_insert" ON "public"."support_sessions"; -CREATE POLICY "support_sessions_saas_insert" - ON "public"."support_sessions" - FOR INSERT - WITH CHECK ( - auth.uid() = admin_id - AND EXISTS ( - SELECT 1 FROM public.profiles - WHERE id = auth.uid() - AND role = 'saas_admin' - ) - ); - --- Somente saas_admin pode deletar suas próprias sessões -DROP POLICY IF EXISTS "support_sessions_saas_delete" ON "public"."support_sessions"; -CREATE POLICY "support_sessions_saas_delete" - ON "public"."support_sessions" - FOR DELETE - USING ( - auth.uid() = admin_id - AND EXISTS ( - SELECT 1 FROM public.profiles - WHERE id = auth.uid() - AND role = 'saas_admin' - ) - ); - --- ── RPC: create_support_session ─────────────────────────────────────────────── --- Cria uma sessão de suporte para um tenant. --- Apenas saas_admin pode chamar. TTL: 60 minutos (configurável via p_ttl_minutes). --- Retorna: token, expires_at - -DROP FUNCTION IF EXISTS public.create_support_session(uuid, integer); -CREATE OR REPLACE FUNCTION public.create_support_session( - p_tenant_id uuid, - p_ttl_minutes integer DEFAULT 60 -) -RETURNS json -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_admin_id uuid; - v_role text; - v_token text; - v_expires timestamp with time zone; - v_session support_sessions; -BEGIN - -- Verifica autenticação - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - -- Verifica role saas_admin - SELECT role INTO v_role - FROM public.profiles - WHERE id = v_admin_id; - - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado. Somente saas_admin pode criar sessões de suporte.' - USING ERRCODE = 'P0002'; - END IF; - - -- Valida TTL (1 a 120 minutos) - IF p_ttl_minutes < 1 OR p_ttl_minutes > 120 THEN - RAISE EXCEPTION 'TTL inválido. Use entre 1 e 120 minutos.' - USING ERRCODE = 'P0003'; - END IF; - - -- Valida tenant - IF NOT EXISTS (SELECT 1 FROM public.tenants WHERE id = p_tenant_id) THEN - RAISE EXCEPTION 'Tenant não encontrado.' - USING ERRCODE = 'P0004'; - END IF; - - -- Gera token único (64 chars hex, sem pgcrypto) - v_token := replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', ''); - v_expires := now() + (p_ttl_minutes || ' minutes')::interval; - - -- Insere sessão - INSERT INTO public.support_sessions (tenant_id, admin_id, token, expires_at) - VALUES (p_tenant_id, v_admin_id, v_token, v_expires) - RETURNING * INTO v_session; - - RETURN json_build_object( - 'token', v_session.token, - 'expires_at', v_session.expires_at, - 'session_id', v_session.id - ); -END; -$$; - --- ── RPC: validate_support_session ──────────────────────────────────────────── --- Valida um token de suporte. Não requer autenticação (chamada pública). --- Retorna: { valid: bool, tenant_id: uuid|null } --- NUNCA retorna admin_id ou dados internos. - -DROP FUNCTION IF EXISTS public.validate_support_session(text); -CREATE OR REPLACE FUNCTION public.validate_support_session( - p_token text -) -RETURNS json -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_session support_sessions; -BEGIN - IF p_token IS NULL OR length(trim(p_token)) < 32 THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - SELECT * INTO v_session - FROM public.support_sessions - WHERE token = p_token - AND expires_at > now() - LIMIT 1; - - IF NOT FOUND THEN - RETURN json_build_object('valid', false, 'tenant_id', null); - END IF; - - RETURN json_build_object( - 'valid', true, - 'tenant_id', v_session.tenant_id - ); -END; -$$; - --- ── RPC: revoke_support_session ─────────────────────────────────────────────── --- Revoga um token manualmente. Apenas o admin que criou pode revogar. - -DROP FUNCTION IF EXISTS public.revoke_support_session(text); -CREATE OR REPLACE FUNCTION public.revoke_support_session( - p_token text -) -RETURNS boolean -LANGUAGE plpgsql -SECURITY DEFINER -SET search_path = public -AS $$ -DECLARE - v_admin_id uuid; - v_role text; -BEGIN - v_admin_id := auth.uid(); - IF v_admin_id IS NULL THEN - RAISE EXCEPTION 'Não autenticado.' USING ERRCODE = 'P0001'; - END IF; - - SELECT role INTO v_role FROM public.profiles WHERE id = v_admin_id; - IF v_role <> 'saas_admin' THEN - RAISE EXCEPTION 'Acesso negado.' USING ERRCODE = 'P0002'; - END IF; - - DELETE FROM public.support_sessions - WHERE token = p_token - AND admin_id = v_admin_id; - - RETURN FOUND; -END; -$$; - --- ── Cleanup automático (opcional) ──────────────────────────────────────────── --- Sessões expiradas podem ser limpas periodicamente via pg_cron ou edge function. --- DELETE FROM public.support_sessions WHERE expires_at < now(); diff --git a/migrations/unify_patient_id.sql b/migrations/unify_patient_id.sql deleted file mode 100644 index 4f58658..0000000 --- a/migrations/unify_patient_id.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ═══════════════════════════════════════════════════════════════════════════ --- Unifica paciente_id → patient_id em agenda_eventos --- ═══════════════════════════════════════════════════════════════════════════ --- Contexto: --- Campo legado `paciente_id` (texto, sem FK) coexiste com `patient_id` --- (uuid, com FK → patients.id). Eventos antigos têm `paciente_id` preenchido --- mas `patient_id = null`. Esta migration corrige isso e remove a coluna legada. --- --- SEGURANÇA: --- Execute em transação. Verifique os counts antes do COMMIT. --- ═══════════════════════════════════════════════════════════════════════════ - -BEGIN; - --- 1. Copia paciente_id → patient_id onde patient_id ainda é null --- paciente_id já é uuid no banco — sem necessidade de cast ou validação de regex -UPDATE public.agenda_eventos - SET patient_id = paciente_id - WHERE patient_id IS NULL - AND paciente_id IS NOT NULL; - --- 2. Verificação: deve retornar 0 -SELECT COUNT(*) AS "orfaos_restantes" - FROM public.agenda_eventos - WHERE patient_id IS NULL AND paciente_id IS NOT NULL; - --- 3. Remove a coluna legada -ALTER TABLE public.agenda_eventos DROP COLUMN IF EXISTS paciente_id; - --- 4. Remove FK e coluna legada de terapeuta_id se existir equivalente --- (opcional — remova o comentário se quiser limpar terapeuta_id também) --- ALTER TABLE public.agenda_eventos DROP COLUMN IF EXISTS terapeuta_id; - -COMMIT; diff --git a/package-lock.json b/package-lock.json index 872b966..b465ef3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@supabase/supabase-js": "^2.95.3", "chart.js": "3.3.2", "date-fns": "^4.1.0", + "jodit": "^4.11.15", "pinia": "^3.0.4", "primeicons": "^7.0.0", "primevue": "^4.5.4", @@ -3314,6 +3315,11 @@ "jiti": "lib/jiti-cli.mjs" } }, + "node_modules/jodit": { + "version": "4.11.15", + "resolved": "https://registry.npmjs.org/jodit/-/jodit-4.11.15.tgz", + "integrity": "sha512-cT/dlFsK9mCmACb85TB9MmfHXyzsIyZYKY2VO2FLUdO+Xz7wIjBhu06wMCM7nkBdsxpWFGncHEP0KKd4mPx6Ng==" + }, "node_modules/js-yaml": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", @@ -7625,6 +7631,11 @@ "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", "dev": true }, + "jodit": { + "version": "4.11.15", + "resolved": "https://registry.npmjs.org/jodit/-/jodit-4.11.15.tgz", + "integrity": "sha512-cT/dlFsK9mCmACb85TB9MmfHXyzsIyZYKY2VO2FLUdO+Xz7wIjBhu06wMCM7nkBdsxpWFGncHEP0KKd4mPx6Ng==" + }, "js-yaml": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", diff --git a/package.json b/package.json index 24b1043..a4b44d3 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@supabase/supabase-js": "^2.95.3", "chart.js": "3.3.2", "date-fns": "^4.1.0", + "jodit": "^4.11.15", "pinia": "^3.0.4", "primeicons": "^7.0.0", "primevue": "^4.5.4", diff --git a/scripts/simulation/simulateUsage.js b/scripts/simulation/simulateUsage.js index b99a9de..171f765 100644 --- a/scripts/simulation/simulateUsage.js +++ b/scripts/simulation/simulateUsage.js @@ -17,539 +17,545 @@ * 5. Quando terminar, rode simulation-cleanup.sql para limpar */ -import fs from 'fs' -import path from 'path' -import { config } from './simulation.config.js' -import { logInfo, logWarning, logError, getLog } from './simulationLogger.js' +import fs from 'fs'; +import path from 'path'; +import { config } from './simulation.config.js'; +import { logInfo, logWarning, logError, getLog } from './simulationLogger.js'; // ─── Validação ──────────────────────────────────────────────────────────────── if (config.OWNER_ID === 'SEU-OWNER-UUID-AQUI' || config.TENANT_ID === 'SEU-TENANT-UUID-AQUI') { - console.error('\n❌ ERRO: Preencha OWNER_ID e TENANT_ID em scripts/simulation/simulation.config.js\n') - process.exit(1) + console.error('\n❌ ERRO: Preencha OWNER_ID e TENANT_ID em scripts/simulation/simulation.config.js\n'); + process.exit(1); } // ─── Dados brasileiros falsos ───────────────────────────────────────────────── const NOMES = [ - ['Ana', 'Beatriz', 'Carla', 'Daniela', 'Fernanda', 'Gabriela', 'Helena', 'Isabela', - 'Juliana', 'Karen', 'Laura', 'Mariana', 'Natália', 'Olivia', 'Patrícia'], - ['Carlos', 'Daniel', 'Eduardo', 'Felipe', 'Gustavo', 'Henrique', 'Igor', 'João', - 'Lucas', 'Marcos', 'Nelson', 'Otávio', 'Paulo', 'Rafael', 'Sérgio'], -] + ['Ana', 'Beatriz', 'Carla', 'Daniela', 'Fernanda', 'Gabriela', 'Helena', 'Isabela', 'Juliana', 'Karen', 'Laura', 'Mariana', 'Natália', 'Olivia', 'Patrícia'], + ['Carlos', 'Daniel', 'Eduardo', 'Felipe', 'Gustavo', 'Henrique', 'Igor', 'João', 'Lucas', 'Marcos', 'Nelson', 'Otávio', 'Paulo', 'Rafael', 'Sérgio'] +]; -const SOBRENOMES = [ - 'Silva', 'Santos', 'Oliveira', 'Souza', 'Lima', 'Ferreira', 'Rodrigues', - 'Almeida', 'Costa', 'Gomes', 'Martins', 'Pereira', 'Carvalho', 'Rocha', 'Nunes', -] +const SOBRENOMES = ['Silva', 'Santos', 'Oliveira', 'Souza', 'Lima', 'Ferreira', 'Rodrigues', 'Almeida', 'Costa', 'Gomes', 'Martins', 'Pereira', 'Carvalho', 'Rocha', 'Nunes']; -const MODALIDADES = ['presencial', 'online', 'presencial', 'presencial'] // ponderado +const MODALIDADES = ['presencial', 'online', 'presencial', 'presencial']; // ponderado // ─── Utilitários ───────────────────────────────────────────────────────────── -let _rng = 1 +let _rng = 1; -function rng () { - // LCG determinístico para gerar sequência reproduzível - _rng = (_rng * 1664525 + 1013904223) & 0xffffffff - return Math.abs(_rng) / 0x80000000 +function rng() { + // LCG determinístico para gerar sequência reproduzível + _rng = (_rng * 1664525 + 1013904223) & 0xffffffff; + return Math.abs(_rng) / 0x80000000; } -function pick (arr) { return arr[Math.floor(rng() * arr.length)] } - -function uuid () { - // gera UUID v4-like determinístico baseado no nosso rng - const h = () => Math.floor(rng() * 0x10000).toString(16).padStart(4, '0') - return `${h()}${h()}-${h()}-4${h().slice(1)}-${(8 + Math.floor(rng() * 4)).toString(16)}${h().slice(1)}-${h()}${h()}${h()}` +function pick(arr) { + return arr[Math.floor(rng() * arr.length)]; } -function addDays (date, n) { - const d = new Date(date) - d.setDate(d.getDate() + n) - return d +function uuid() { + // gera UUID v4-like determinístico baseado no nosso rng + const h = () => + Math.floor(rng() * 0x10000) + .toString(16) + .padStart(4, '0'); + return `${h()}${h()}-${h()}-4${h().slice(1)}-${(8 + Math.floor(rng() * 4)).toString(16)}${h().slice(1)}-${h()}${h()}${h()}`; } -function toISO (date) { - return date.toISOString().split('T')[0] +function addDays(date, n) { + const d = new Date(date); + d.setDate(d.getDate() + n); + return d; } -function toISODateTime (date, hh, mm) { - return `${toISO(date)}T${String(hh).padStart(2,'0')}:${String(mm).padStart(2,'0')}:00` +function toISO(date) { + return date.toISOString().split('T')[0]; } -function sqlStr (v) { - if (v === null || v === undefined) return 'NULL' - return `'${String(v).replace(/'/g, "''")}'` +function toISODateTime(date, hh, mm) { + return `${toISO(date)}T${String(hh).padStart(2, '0')}:${String(mm).padStart(2, '0')}:00`; } -function weekdayName (n) { - return ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'][n] +function sqlStr(v) { + if (v === null || v === undefined) return 'NULL'; + return `'${String(v).replace(/'/g, "''")}'`; +} + +function weekdayName(n) { + return ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'][n]; } // ─── Gerador de nomes únicos ────────────────────────────────────────────────── -const usedNames = new Set() +const usedNames = new Set(); -function fakeName () { - let attempts = 0 - while (attempts < 50) { - const gender = rng() > 0.5 ? 0 : 1 - const nome = pick(NOMES[gender]) - const sobrenome = pick(SOBRENOMES) - const full = `${nome} ${sobrenome}` - if (!usedNames.has(full)) { - usedNames.add(full) - return full +function fakeName() { + let attempts = 0; + while (attempts < 50) { + const gender = rng() > 0.5 ? 0 : 1; + const nome = pick(NOMES[gender]); + const sobrenome = pick(SOBRENOMES); + const full = `${nome} ${sobrenome}`; + if (!usedNames.has(full)) { + usedNames.add(full); + return full; + } + attempts++; } - attempts++ - } - return `Paciente ${usedNames.size + 1}` + return `Paciente ${usedNames.size + 1}`; } -function fakeCpf () { - const n = () => Math.floor(rng() * 9) + 1 - return `${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}` +function fakeCpf() { + const n = () => Math.floor(rng() * 9) + 1; + return `${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}${n()}`; } -function fakePhone () { - const ddd = [11,21,31,41,51,61,71,81,91][Math.floor(rng() * 9)] - const num = Math.floor(rng() * 900000000) + 900000000 - return `(${ddd}) 9${String(num).slice(1,5)}-${String(num).slice(5,9)}` +function fakePhone() { + const ddd = [11, 21, 31, 41, 51, 61, 71, 81, 91][Math.floor(rng() * 9)]; + const num = Math.floor(rng() * 900000000) + 900000000; + return `(${ddd}) 9${String(num).slice(1, 5)}-${String(num).slice(5, 9)}`; } -function fakeEmail (nome) { - const slug = nome.toLowerCase() - .replace(/\s+/g, '.') - .normalize('NFD').replace(/[\u0300-\u036f]/g, '') - const num = Math.floor(rng() * 99) + 1 - const domains = ['gmail.com','hotmail.com','outlook.com','yahoo.com.br'] - return `${slug}${num}@${pick(domains)}` +function fakeEmail(nome) { + const slug = nome + .toLowerCase() + .replace(/\s+/g, '.') + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, ''); + const num = Math.floor(rng() * 99) + 1; + const domains = ['gmail.com', 'hotmail.com', 'outlook.com', 'yahoo.com.br']; + return `${slug}${num}@${pick(domains)}`; } // ─── Blocos SQL ─────────────────────────────────────────────────────────────── -const seedLines = [] +const seedLines = []; const cleanupIds = { - patients: [], - agendaEventos: [], - recurrenceRules: [], - recurrenceExceptions: [], - agendadorSolicitacoes: [], - agendaConfiguracoes: [], - agendaRegrasSemanais: [], -} + patients: [], + agendaEventos: [], + recurrenceRules: [], + recurrenceExceptions: [], + agendadorSolicitacoes: [], + agendaConfiguracoes: [], + agendaRegrasSemanais: [] +}; -function emit (line) { seedLines.push(line) } +function emit(line) { + seedLines.push(line); +} // ─── Construção da simulação ────────────────────────────────────────────────── -const TODAY = new Date() -TODAY.setHours(0, 0, 0, 0) -const PAST_START = addDays(TODAY, -config.DAYS_BACK) -const FUTURE_END = addDays(TODAY, config.SIMULATION_DAYS) +const TODAY = new Date(); +TODAY.setHours(0, 0, 0, 0); +const PAST_START = addDays(TODAY, -config.DAYS_BACK); +const FUTURE_END = addDays(TODAY, config.SIMULATION_DAYS); -const ownerId = config.OWNER_ID -const tenantId = config.TENANT_ID +const ownerId = config.OWNER_ID; +const tenantId = config.TENANT_ID; -logInfo('Iniciando simulação...') -logInfo(`OWNER_ID: ${ownerId}`) -logInfo(`TENANT_ID: ${tenantId}`) -logInfo(`Período: ${toISO(PAST_START)} → ${toISO(FUTURE_END)}`) +logInfo('Iniciando simulação...'); +logInfo(`OWNER_ID: ${ownerId}`); +logInfo(`TENANT_ID: ${tenantId}`); +logInfo(`Período: ${toISO(PAST_START)} → ${toISO(FUTURE_END)}`); // ─── 1. Pacientes ───────────────────────────────────────────────────────────── -emit('-- ============================================================') -emit('-- SIMULAÇÃO AgenciaPsi — gerado por npm run simulate') -emit(`-- Data: ${new Date().toLocaleString('pt-BR')}`) -emit('-- ============================================================') -emit('') -emit('-- Desabilita triggers para permitir inserts de simulação') -emit('SET session_replication_role = replica;') -emit('') -emit('BEGIN;') -emit('') -emit('-- ─── 1. Pacientes ───────────────────────────────────────────────────────────') -emit('') +emit('-- ============================================================'); +emit('-- SIMULAÇÃO AgenciaPsi — gerado por npm run simulate'); +emit(`-- Data: ${new Date().toLocaleString('pt-BR')}`); +emit('-- ============================================================'); +emit(''); +emit('-- Desabilita triggers para permitir inserts de simulação'); +emit('SET session_replication_role = replica;'); +emit(''); +emit('BEGIN;'); +emit(''); +emit('-- ─── 1. Pacientes ───────────────────────────────────────────────────────────'); +emit(''); -const patients = [] +const patients = []; for (let i = 0; i < config.PATIENTS_COUNT; i++) { - const id = uuid() - const nome = fakeName() - const parts = nome.split(' ') - const email = fakeEmail(nome) - const tel = fakePhone() - const cpf = fakeCpf() + const id = uuid(); + const nome = fakeName(); + const parts = nome.split(' '); + const email = fakeEmail(nome); + const tel = fakePhone(); + const cpf = fakeCpf(); - patients.push({ id, nome_completo: nome, email, telefone: tel }) - cleanupIds.patients.push(id) + patients.push({ id, nome_completo: nome, email, telefone: tel }); + cleanupIds.patients.push(id); - emit(`INSERT INTO patients (id, tenant_id, owner_id, responsible_member_id, nome_completo, email_principal, telefone, cpf, patient_scope, status)`) - emit(` VALUES (${sqlStr(id)}, ${sqlStr(tenantId)}, ${sqlStr(ownerId)},`) - emit(` (SELECT id FROM tenant_members WHERE user_id = ${sqlStr(ownerId)} AND tenant_id = ${sqlStr(tenantId)} LIMIT 1),`) - emit(` ${sqlStr(nome)}, ${sqlStr(email)}, ${sqlStr(tel)}, ${sqlStr(cpf)}, 'clinic', 'Ativo');`) + emit(`INSERT INTO patients (id, tenant_id, owner_id, responsible_member_id, nome_completo, email_principal, telefone, cpf, patient_scope, status)`); + emit(` VALUES (${sqlStr(id)}, ${sqlStr(tenantId)}, ${sqlStr(ownerId)},`); + emit(` (SELECT id FROM tenant_members WHERE user_id = ${sqlStr(ownerId)} AND tenant_id = ${sqlStr(tenantId)} LIMIT 1),`); + emit(` ${sqlStr(nome)}, ${sqlStr(email)}, ${sqlStr(tel)}, ${sqlStr(cpf)}, 'clinic', 'Ativo');`); } -logInfo(`✔ ${patients.length} pacientes criados`) -emit('') +logInfo(`✔ ${patients.length} pacientes criados`); +emit(''); // ─── 2. Configurações de agenda ─────────────────────────────────────────────── -emit('-- ─── 2. Configurações de agenda ─────────────────────────────────────────────') -emit('') +emit('-- ─── 2. Configurações de agenda ─────────────────────────────────────────────'); +emit(''); const pausas = [ - { weekday: 1, start: '12:00', end: '13:00', label: 'Almoço' }, - { weekday: 2, start: '12:00', end: '13:00', label: 'Almoço' }, - { weekday: 3, start: '12:00', end: '13:00', label: 'Almoço' }, - { weekday: 4, start: '12:00', end: '13:00', label: 'Almoço' }, - { weekday: 5, start: '12:00', end: '13:00', label: 'Almoço' }, -] + { weekday: 1, start: '12:00', end: '13:00', label: 'Almoço' }, + { weekday: 2, start: '12:00', end: '13:00', label: 'Almoço' }, + { weekday: 3, start: '12:00', end: '13:00', label: 'Almoço' }, + { weekday: 4, start: '12:00', end: '13:00', label: 'Almoço' }, + { weekday: 5, start: '12:00', end: '13:00', label: 'Almoço' } +]; -emit(`INSERT INTO agenda_configuracoes (owner_id, tenant_id, session_duration_min, session_break_min, pausas_semanais, online_ativo, setup_clinica_concluido)`) -emit(` VALUES (${sqlStr(ownerId)}, ${sqlStr(tenantId)},`) -emit(` ${config.SESSION_DURATION_MIN}, 10, '${JSON.stringify(pausas)}'::jsonb, true, true)`) -emit(` ON CONFLICT (owner_id) DO NOTHING;`) -emit('') +emit(`INSERT INTO agenda_configuracoes (owner_id, tenant_id, session_duration_min, session_break_min, pausas_semanais, online_ativo, setup_clinica_concluido)`); +emit(` VALUES (${sqlStr(ownerId)}, ${sqlStr(tenantId)},`); +emit(` ${config.SESSION_DURATION_MIN}, 10, '${JSON.stringify(pausas)}'::jsonb, true, true)`); +emit(` ON CONFLICT (owner_id) DO NOTHING;`); +emit(''); -logInfo('✔ agenda_configuracoes inserida') +logInfo('✔ agenda_configuracoes inserida'); // ─── 3. Regras semanais de disponibilidade ──────────────────────────────────── -emit('-- ─── 3. Regras semanais ─────────────────────────────────────────────────────') -emit('') +emit('-- ─── 3. Regras semanais ─────────────────────────────────────────────────────'); +emit(''); -const workDays = [1, 2, 3, 4, 5] // seg–sex +const workDays = [1, 2, 3, 4, 5]; // seg–sex for (const dia of workDays) { - const rid = uuid() - cleanupIds.agendaRegrasSemanais.push(rid) - emit(`INSERT INTO agenda_regras_semanais (id, owner_id, tenant_id, dia_semana, hora_inicio, hora_fim, ativo)`) - emit(` VALUES (${sqlStr(rid)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${dia}, '08:00', '18:00', true);`) + const rid = uuid(); + cleanupIds.agendaRegrasSemanais.push(rid); + emit(`INSERT INTO agenda_regras_semanais (id, owner_id, tenant_id, dia_semana, hora_inicio, hora_fim, ativo)`); + emit(` VALUES (${sqlStr(rid)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${dia}, '08:00', '18:00', true);`); } -logInfo(`✔ ${workDays.length} regras semanais inseridas`) -emit('') +logInfo(`✔ ${workDays.length} regras semanais inseridas`); +emit(''); // ─── 4. Eventos avulsos (passado) ───────────────────────────────────────────── -emit('-- ─── 4. Eventos avulsos (passado) ──────────────────────────────────────────') -emit('') +emit('-- ─── 4. Eventos avulsos (passado) ──────────────────────────────────────────'); +emit(''); -const avulsoCount = 3 -const avulsoPatients = patients.slice(0, avulsoCount) -let avulsosCreated = 0 +const avulsoCount = 3; +const avulsoPatients = patients.slice(0, avulsoCount); +let avulsosCreated = 0; // Avulsos usam 13h para não conflitar com séries (9h–12h e 14h–17h) for (const pat of avulsoPatients) { - const daysAgo = Math.floor(rng() * config.DAYS_BACK) + 1 - const date = addDays(TODAY, -daysAgo) - if (date.getDay() === 0 || date.getDay() === 6) continue // pular fds + const daysAgo = Math.floor(rng() * config.DAYS_BACK) + 1; + const date = addDays(TODAY, -daysAgo); + if (date.getDay() === 0 || date.getDay() === 6) continue; // pular fds - const hour = 13 - const startDT = toISODateTime(date, hour, 0) - const endDT = toISODateTime(date, hour, 50) - const evId = uuid() - const modal = pick(MODALIDADES) - const statuses = ['realizado', 'faltou', 'agendado'] - const status = pick(statuses) + const hour = 13; + const startDT = toISODateTime(date, hour, 0); + const endDT = toISODateTime(date, hour, 50); + const evId = uuid(); + const modal = pick(MODALIDADES); + const statuses = ['realizado', 'faltou', 'agendado']; + const status = pick(statuses); - cleanupIds.agendaEventos.push(evId) + cleanupIds.agendaEventos.push(evId); - emit(`INSERT INTO agenda_eventos (id, owner_id, tenant_id, patient_id, tipo, status, inicio_em, fim_em, modalidade, titulo)`) - emit(` VALUES (${sqlStr(evId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(pat.id)},`) - emit(` 'sessao', ${sqlStr(status)}, ${sqlStr(startDT)}, ${sqlStr(endDT)}, ${sqlStr(modal)}, 'Sessão avulsa');`) + emit(`INSERT INTO agenda_eventos (id, owner_id, tenant_id, patient_id, tipo, status, inicio_em, fim_em, modalidade, titulo)`); + emit(` VALUES (${sqlStr(evId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(pat.id)},`); + emit(` 'sessao', ${sqlStr(status)}, ${sqlStr(startDT)}, ${sqlStr(endDT)}, ${sqlStr(modal)}, 'Sessão avulsa');`); - avulsosCreated++ + avulsosCreated++; } -logInfo(`✔ ${avulsosCreated} eventos avulsos criados`) -emit('') +logInfo(`✔ ${avulsosCreated} eventos avulsos criados`); +emit(''); // ─── 5. Séries de recorrência ───────────────────────────────────────────────── -emit('-- ─── 5. Séries de recorrência ───────────────────────────────────────────────') -emit('') +emit('-- ─── 5. Séries de recorrência ───────────────────────────────────────────────'); +emit(''); -const ruleStartDate = addDays(TODAY, -config.DAYS_BACK) -const ruleEndDate = addDays(TODAY, config.SIMULATION_DAYS) +const ruleStartDate = addDays(TODAY, -config.DAYS_BACK); +const ruleEndDate = addDays(TODAY, config.SIMULATION_DAYS); // Distribui pacientes pelas séries (cicla se menos pacientes que séries) -const seriesPatients = patients.slice(0, config.RECURRENCE_RULES_COUNT) -const types = ['weekly', 'weekly', 'weekly', 'biweekly', 'custom_weekdays', 'weekly'] -const wdays = [[1], [2], [4], [1], [1,3], [3]] +const seriesPatients = patients.slice(0, config.RECURRENCE_RULES_COUNT); +const types = ['weekly', 'weekly', 'weekly', 'biweekly', 'custom_weekdays', 'weekly']; +const wdays = [[1], [2], [4], [1], [1, 3], [3]]; // Cada série tem seu próprio horário para evitar sobreposição -const ruleHours = [9, 10, 11, 14, 15, 16] +const ruleHours = [9, 10, 11, 14, 15, 16]; -const recurrenceRules = [] +const recurrenceRules = []; for (let i = 0; i < config.RECURRENCE_RULES_COUNT; i++) { - const pat = seriesPatients[i % seriesPatients.length] - const type = types[i] || 'weekly' - const weekdays = wdays[i] || [1] - const modal = pick(MODALIDADES) - const ruleId = uuid() - const hour = ruleHours[i] || (9 + i) - const startTime = `${String(hour).padStart(2,'0')}:00` - const endTime = `${String(hour).padStart(2,'0')}:50` - const weekdaysArr = `ARRAY[${weekdays.join(',')}]::smallint[]` + const pat = seriesPatients[i % seriesPatients.length]; + const type = types[i] || 'weekly'; + const weekdays = wdays[i] || [1]; + const modal = pick(MODALIDADES); + const ruleId = uuid(); + const hour = ruleHours[i] || 9 + i; + const startTime = `${String(hour).padStart(2, '0')}:00`; + const endTime = `${String(hour).padStart(2, '0')}:50`; + const weekdaysArr = `ARRAY[${weekdays.join(',')}]::smallint[]`; - recurrenceRules.push({ id: ruleId, patient: pat, type, weekdays, start_date: ruleStartDate, modal, hour }) - cleanupIds.recurrenceRules.push(ruleId) + recurrenceRules.push({ id: ruleId, patient: pat, type, weekdays, start_date: ruleStartDate, modal, hour }); + cleanupIds.recurrenceRules.push(ruleId); - emit(`INSERT INTO recurrence_rules (id, owner_id, tenant_id, patient_id, type, weekdays, interval, start_date, end_date, status, start_time, end_time, modalidade)`) - emit(` VALUES (${sqlStr(ruleId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(pat.id)},`) - emit(` ${sqlStr(type)}, ${weekdaysArr}, 1, ${sqlStr(toISO(ruleStartDate))}, ${sqlStr(toISO(ruleEndDate))},`) - emit(` 'ativo', ${sqlStr(startTime)}, ${sqlStr(endTime)}, ${sqlStr(modal)});`) + emit(`INSERT INTO recurrence_rules (id, owner_id, tenant_id, patient_id, type, weekdays, interval, start_date, end_date, status, start_time, end_time, modalidade)`); + emit(` VALUES (${sqlStr(ruleId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(pat.id)},`); + emit(` ${sqlStr(type)}, ${weekdaysArr}, 1, ${sqlStr(toISO(ruleStartDate))}, ${sqlStr(toISO(ruleEndDate))},`); + emit(` 'ativo', ${sqlStr(startTime)}, ${sqlStr(endTime)}, ${sqlStr(modal)});`); } -logInfo(`✔ ${recurrenceRules.length} regras de recorrência criadas`) -emit('') +logInfo(`✔ ${recurrenceRules.length} regras de recorrência criadas`); +emit(''); // ─── 6. Exceções de recorrência (passado) ──────────────────────────────────── -emit('-- ─── 6. Exceções de recorrência ────────────────────────────────────────────') -emit('') +emit('-- ─── 6. Exceções de recorrência ────────────────────────────────────────────'); +emit(''); -let excFaltou = 0, excRemarcado = 0, excCancelado = 0 +let excFaltou = 0, + excRemarcado = 0, + excCancelado = 0; for (const rr of recurrenceRules) { - // Gera datas das ocorrências passadas - const occs = [] - let cur = new Date(rr.start_date) - // avançar para o primeiro dia correto - while (cur <= TODAY) { - const dow = cur.getDay() - if (rr.weekdays.includes(dow)) { - if (cur < TODAY) occs.push(new Date(cur)) + // Gera datas das ocorrências passadas + const occs = []; + let cur = new Date(rr.start_date); + // avançar para o primeiro dia correto + while (cur <= TODAY) { + const dow = cur.getDay(); + if (rr.weekdays.includes(dow)) { + if (cur < TODAY) occs.push(new Date(cur)); + } + cur = addDays(cur, 1); } - cur = addDays(cur, 1) - } - for (const occDate of occs) { - const r = rng() - const dateStr = toISO(occDate) + for (const occDate of occs) { + const r = rng(); + const dateStr = toISO(occDate); - if (r < config.RATE_FALTOU) { - const excId = uuid() - cleanupIds.recurrenceExceptions.push(excId) - emit(`INSERT INTO recurrence_exceptions (id, recurrence_id, tenant_id, original_date, type, new_date)`) - emit(` VALUES (${sqlStr(excId)}, ${sqlStr(rr.id)}, ${sqlStr(tenantId)}, ${sqlStr(dateStr)}, 'patient_missed', NULL);`) - excFaltou++ - } else if (r < config.RATE_FALTOU + config.RATE_REMARCADO) { - const offset = Math.floor(rng() * 4) + 1 - const newDate = addDays(occDate, offset) - // não remarcar para fds - if (newDate.getDay() === 0 || newDate.getDay() === 6) continue - const excId = uuid() - cleanupIds.recurrenceExceptions.push(excId) - emit(`INSERT INTO recurrence_exceptions (id, recurrence_id, tenant_id, original_date, type, new_date)`) - emit(` VALUES (${sqlStr(excId)}, ${sqlStr(rr.id)}, ${sqlStr(tenantId)}, ${sqlStr(dateStr)}, 'reschedule_session', ${sqlStr(toISO(newDate))});`) - excRemarcado++ - } else if (r < config.RATE_FALTOU + config.RATE_REMARCADO + config.RATE_CANCELADO) { - const excId = uuid() - cleanupIds.recurrenceExceptions.push(excId) - emit(`INSERT INTO recurrence_exceptions (id, recurrence_id, tenant_id, original_date, type, new_date)`) - emit(` VALUES (${sqlStr(excId)}, ${sqlStr(rr.id)}, ${sqlStr(tenantId)}, ${sqlStr(dateStr)}, 'cancel_session', NULL);`) - excCancelado++ + if (r < config.RATE_FALTOU) { + const excId = uuid(); + cleanupIds.recurrenceExceptions.push(excId); + emit(`INSERT INTO recurrence_exceptions (id, recurrence_id, tenant_id, original_date, type, new_date)`); + emit(` VALUES (${sqlStr(excId)}, ${sqlStr(rr.id)}, ${sqlStr(tenantId)}, ${sqlStr(dateStr)}, 'patient_missed', NULL);`); + excFaltou++; + } else if (r < config.RATE_FALTOU + config.RATE_REMARCADO) { + const offset = Math.floor(rng() * 4) + 1; + const newDate = addDays(occDate, offset); + // não remarcar para fds + if (newDate.getDay() === 0 || newDate.getDay() === 6) continue; + const excId = uuid(); + cleanupIds.recurrenceExceptions.push(excId); + emit(`INSERT INTO recurrence_exceptions (id, recurrence_id, tenant_id, original_date, type, new_date)`); + emit(` VALUES (${sqlStr(excId)}, ${sqlStr(rr.id)}, ${sqlStr(tenantId)}, ${sqlStr(dateStr)}, 'reschedule_session', ${sqlStr(toISO(newDate))});`); + excRemarcado++; + } else if (r < config.RATE_FALTOU + config.RATE_REMARCADO + config.RATE_CANCELADO) { + const excId = uuid(); + cleanupIds.recurrenceExceptions.push(excId); + emit(`INSERT INTO recurrence_exceptions (id, recurrence_id, tenant_id, original_date, type, new_date)`); + emit(` VALUES (${sqlStr(excId)}, ${sqlStr(rr.id)}, ${sqlStr(tenantId)}, ${sqlStr(dateStr)}, 'cancel_session', NULL);`); + excCancelado++; + } } - } } -logInfo(`✔ Exceções: ${excFaltou} faltou, ${excRemarcado} remarcado, ${excCancelado} cancelado`) -emit('') +logInfo(`✔ Exceções: ${excFaltou} faltou, ${excRemarcado} remarcado, ${excCancelado} cancelado`); +emit(''); // ─── 7. Sessões reais para ocorrências passadas (realizado/faltou) ──────────── -emit('-- ─── 7. Sessões reais (passado — realizado/faltou) ────────────────────────') -emit('') +emit('-- ─── 7. Sessões reais (passado — realizado/faltou) ────────────────────────'); +emit(''); -let realSessionsCreated = 0 +let realSessionsCreated = 0; for (const rr of recurrenceRules) { - let cur2 = new Date(rr.start_date) - while (cur2 < TODAY) { - const dow = cur2.getDay() - if (rr.weekdays.includes(dow)) { - const dateStr = toISO(cur2) - const evId = uuid() - const hh = String(rr.hour).padStart(2, '0') - const startDT = `${dateStr}T${hh}:00:00` - const endDT = `${dateStr}T${hh}:50:00` - // status baseado nas exceções: se há exceção faltou → faltou, else → realizado - // simplificado: 80% realizado, 20% faltou para sessões passadas - const status = rng() < 0.8 ? 'realizado' : 'faltou' + let cur2 = new Date(rr.start_date); + while (cur2 < TODAY) { + const dow = cur2.getDay(); + if (rr.weekdays.includes(dow)) { + const dateStr = toISO(cur2); + const evId = uuid(); + const hh = String(rr.hour).padStart(2, '0'); + const startDT = `${dateStr}T${hh}:00:00`; + const endDT = `${dateStr}T${hh}:50:00`; + // status baseado nas exceções: se há exceção faltou → faltou, else → realizado + // simplificado: 80% realizado, 20% faltou para sessões passadas + const status = rng() < 0.8 ? 'realizado' : 'faltou'; - cleanupIds.agendaEventos.push(evId) + cleanupIds.agendaEventos.push(evId); - emit(`INSERT INTO agenda_eventos (id, owner_id, tenant_id, patient_id, tipo, status, inicio_em, fim_em, modalidade, recurrence_id, recurrence_date)`) - emit(` VALUES (${sqlStr(evId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(rr.patient.id)},`) - emit(` 'sessao', ${sqlStr(status)}, ${sqlStr(startDT)}, ${sqlStr(endDT)}, ${sqlStr(rr.modal)}, ${sqlStr(rr.id)}, ${sqlStr(dateStr)});`) + emit(`INSERT INTO agenda_eventos (id, owner_id, tenant_id, patient_id, tipo, status, inicio_em, fim_em, modalidade, recurrence_id, recurrence_date)`); + emit(` VALUES (${sqlStr(evId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(rr.patient.id)},`); + emit(` 'sessao', ${sqlStr(status)}, ${sqlStr(startDT)}, ${sqlStr(endDT)}, ${sqlStr(rr.modal)}, ${sqlStr(rr.id)}, ${sqlStr(dateStr)});`); - realSessionsCreated++ + realSessionsCreated++; + } + cur2 = addDays(cur2, 1); } - cur2 = addDays(cur2, 1) - } } -logInfo(`✔ ${realSessionsCreated} sessões reais (passado) criadas`) -emit('') +logInfo(`✔ ${realSessionsCreated} sessões reais (passado) criadas`); +emit(''); // ─── 8. Solicitações do Agendador Público ───────────────────────────────────── -emit('-- ─── 8. Agendador Público — solicitações pendentes ─────────────────────────') -emit('') +emit('-- ─── 8. Agendador Público — solicitações pendentes ─────────────────────────'); +emit(''); -const agendadorStatuses = ['pendente', 'pendente', 'pendente', 'autorizado', 'recusado'] +const agendadorStatuses = ['pendente', 'pendente', 'pendente', 'autorizado', 'recusado']; for (let i = 0; i < config.AGENDADOR_REQUESTS_COUNT; i++) { - const nome = fakeName() - const parts2 = nome.split(' ') - const primeiro = parts2[0] - const sobrenome = parts2.slice(1).join(' ') - const email = fakeEmail(nome) - const cel = fakePhone() - const daysAhead = Math.floor(rng() * 14) + 1 - const reqDate = addDays(TODAY, daysAhead) - if (reqDate.getDay() === 0 || reqDate.getDay() === 6) continue - const hour = config.WORK_HOUR_START + Math.floor(rng() * 6) - const hora = `${String(hour).padStart(2,'0')}:00` - const modal = pick(MODALIDADES) - const status = pick(agendadorStatuses) - const solId = uuid() + const nome = fakeName(); + const parts2 = nome.split(' '); + const primeiro = parts2[0]; + const sobrenome = parts2.slice(1).join(' '); + const email = fakeEmail(nome); + const cel = fakePhone(); + const daysAhead = Math.floor(rng() * 14) + 1; + const reqDate = addDays(TODAY, daysAhead); + if (reqDate.getDay() === 0 || reqDate.getDay() === 6) continue; + const hour = config.WORK_HOUR_START + Math.floor(rng() * 6); + const hora = `${String(hour).padStart(2, '0')}:00`; + const modal = pick(MODALIDADES); + const status = pick(agendadorStatuses); + const solId = uuid(); - cleanupIds.agendadorSolicitacoes.push(solId) + cleanupIds.agendadorSolicitacoes.push(solId); - emit(`INSERT INTO agendador_solicitacoes (id, owner_id, tenant_id, paciente_nome, paciente_sobrenome, paciente_email, paciente_celular, tipo, modalidade, data_solicitada, hora_solicitada, status)`) - emit(` VALUES (${sqlStr(solId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(primeiro)}, ${sqlStr(sobrenome)}, ${sqlStr(email)}, ${sqlStr(cel)},`) - emit(` ${sqlStr(pick(['primeira', 'retorno', 'reagendar']))}, ${sqlStr(modal)}, ${sqlStr(toISO(reqDate))}, ${sqlStr(hora)}, ${sqlStr(status)});`) + emit(`INSERT INTO agendador_solicitacoes (id, owner_id, tenant_id, paciente_nome, paciente_sobrenome, paciente_email, paciente_celular, tipo, modalidade, data_solicitada, hora_solicitada, status)`); + emit(` VALUES (${sqlStr(solId)}, ${sqlStr(ownerId)}, ${sqlStr(tenantId)}, ${sqlStr(primeiro)}, ${sqlStr(sobrenome)}, ${sqlStr(email)}, ${sqlStr(cel)},`); + emit(` ${sqlStr(pick(['primeira', 'retorno', 'reagendar']))}, ${sqlStr(modal)}, ${sqlStr(toISO(reqDate))}, ${sqlStr(hora)}, ${sqlStr(status)});`); } -logInfo(`✔ ${config.AGENDADOR_REQUESTS_COUNT} solicitações do agendador criadas`) -emit('') +logInfo(`✔ ${config.AGENDADOR_REQUESTS_COUNT} solicitações do agendador criadas`); +emit(''); // ─── 9. Fechar transação ────────────────────────────────────────────────────── -emit('COMMIT;') -emit('') -emit('-- Restaura comportamento normal dos triggers') -emit('SET session_replication_role = DEFAULT;') -emit('') -emit('-- ─── Fim do seed ────────────────────────────────────────────────────────────') +emit('COMMIT;'); +emit(''); +emit('-- Restaura comportamento normal dos triggers'); +emit('SET session_replication_role = DEFAULT;'); +emit(''); +emit('-- ─── Fim do seed ────────────────────────────────────────────────────────────'); // ─── Gerar SQL de cleanup ──────────────────────────────────────────────────── -function buildCleanupSQL () { - const lines = [] - lines.push('-- ============================================================') - lines.push('-- CLEANUP — remove dados da simulação AgenciaPsi') - lines.push(`-- Data: ${new Date().toLocaleString('pt-BR')}`) - lines.push('-- ============================================================') - lines.push('') - lines.push('SET session_replication_role = replica;') - lines.push('') - lines.push('BEGIN;') - lines.push('') +function buildCleanupSQL() { + const lines = []; + lines.push('-- ============================================================'); + lines.push('-- CLEANUP — remove dados da simulação AgenciaPsi'); + lines.push(`-- Data: ${new Date().toLocaleString('pt-BR')}`); + lines.push('-- ============================================================'); + lines.push(''); + lines.push('SET session_replication_role = replica;'); + lines.push(''); + lines.push('BEGIN;'); + lines.push(''); - function delBlock (table, ids) { - if (ids.length === 0) return - const quoted = ids.map(id => `'${id}'`).join(', ') - lines.push(`DELETE FROM ${table} WHERE id IN (${quoted});`) - } + function delBlock(table, ids) { + if (ids.length === 0) return; + const quoted = ids.map((id) => `'${id}'`).join(', '); + lines.push(`DELETE FROM ${table} WHERE id IN (${quoted});`); + } - delBlock('recurrence_exceptions', cleanupIds.recurrenceExceptions) - lines.push('') - delBlock('agenda_eventos', cleanupIds.agendaEventos) - lines.push('') - delBlock('recurrence_rules', cleanupIds.recurrenceRules) - lines.push('') - delBlock('agendador_solicitacoes', cleanupIds.agendadorSolicitacoes) - lines.push('') - delBlock('agenda_regras_semanais', cleanupIds.agendaRegrasSemanais) - lines.push('') - // agenda_configuracoes: PK é owner_id, não id - lines.push(`-- Descomente se quiser remover também as configurações de agenda:`) - lines.push(`-- DELETE FROM agenda_configuracoes WHERE owner_id = ${sqlStr(ownerId)};`) - lines.push('') - delBlock('patients', cleanupIds.patients) - lines.push('') - lines.push('COMMIT;') - lines.push('') - lines.push('SET session_replication_role = DEFAULT;') - lines.push('') - lines.push('-- ─── Fim do cleanup ─────────────────────────────────────────────────────────') + delBlock('recurrence_exceptions', cleanupIds.recurrenceExceptions); + lines.push(''); + delBlock('agenda_eventos', cleanupIds.agendaEventos); + lines.push(''); + delBlock('recurrence_rules', cleanupIds.recurrenceRules); + lines.push(''); + delBlock('agendador_solicitacoes', cleanupIds.agendadorSolicitacoes); + lines.push(''); + delBlock('agenda_regras_semanais', cleanupIds.agendaRegrasSemanais); + lines.push(''); + // agenda_configuracoes: PK é owner_id, não id + lines.push(`-- Descomente se quiser remover também as configurações de agenda:`); + lines.push(`-- DELETE FROM agenda_configuracoes WHERE owner_id = ${sqlStr(ownerId)};`); + lines.push(''); + delBlock('patients', cleanupIds.patients); + lines.push(''); + lines.push('COMMIT;'); + lines.push(''); + lines.push('SET session_replication_role = DEFAULT;'); + lines.push(''); + lines.push('-- ─── Fim do cleanup ─────────────────────────────────────────────────────────'); - return lines.join('\n') + return lines.join('\n'); } // ─── Relatório ──────────────────────────────────────────────────────────────── -function buildReport () { - const lines = [] - lines.push('============================================================') - lines.push(' RELATÓRIO DE SIMULAÇÃO — AgenciaPsi') - lines.push(` Gerado em: ${new Date().toLocaleString('pt-BR')}`) - lines.push('============================================================') - lines.push('') - lines.push(`OWNER_ID: ${ownerId}`) - lines.push(`TENANT_ID: ${tenantId}`) - lines.push('') - lines.push('─── Dados gerados ─────────────────────────────────────────') - lines.push(` Pacientes: ${patients.length}`) - lines.push(` Séries de recorrência: ${recurrenceRules.length}`) - lines.push(` Sessões reais (passado): ${realSessionsCreated}`) - lines.push(` Eventos avulsos: ${avulsosCreated}`) - lines.push(` Exceções — faltou: ${excFaltou}`) - lines.push(` Exceções — remarcado: ${excRemarcado}`) - lines.push(` Exceções — cancelado: ${excCancelado}`) - lines.push(` Solicitações agendador: ${config.AGENDADOR_REQUESTS_COUNT}`) - lines.push('') - lines.push('─── Pacientes criados ─────────────────────────────────────') - for (const p of patients) { - lines.push(` [${p.id}] ${p.nome_completo} — ${p.email}`) - } - lines.push('') - lines.push('─── Séries de recorrência ─────────────────────────────────') - for (const r of recurrenceRules) { - const dias = r.weekdays.map(d => weekdayName(d)).join(', ') - lines.push(` [${r.id}]`) - lines.push(` Paciente: ${r.patient.nome_completo}`) - lines.push(` Tipo: ${r.type} | Dias: ${dias}`) - lines.push(` Período: ${toISO(r.start_date)} → ${toISO(FUTURE_END)}`) - } - lines.push('') - lines.push('─── Como testar ───────────────────────────────────────────') - lines.push(' 1. Abra o Supabase SQL Editor') - lines.push(' 2. Cole e rode: logs/simulation-seed.sql') - lines.push(' 3. Acesse a agenda — os eventos devem aparecer') - lines.push(' 4. Acesse Pacientes — pacientes simulados aparecem na lista') - lines.push(' 5. Acesse Agendamentos Recebidos — solicitações pendentes') - lines.push(' 6. Quando terminar, rode: logs/simulation-cleanup.sql') - lines.push('') - lines.push('============================================================') +function buildReport() { + const lines = []; + lines.push('============================================================'); + lines.push(' RELATÓRIO DE SIMULAÇÃO — AgenciaPsi'); + lines.push(` Gerado em: ${new Date().toLocaleString('pt-BR')}`); + lines.push('============================================================'); + lines.push(''); + lines.push(`OWNER_ID: ${ownerId}`); + lines.push(`TENANT_ID: ${tenantId}`); + lines.push(''); + lines.push('─── Dados gerados ─────────────────────────────────────────'); + lines.push(` Pacientes: ${patients.length}`); + lines.push(` Séries de recorrência: ${recurrenceRules.length}`); + lines.push(` Sessões reais (passado): ${realSessionsCreated}`); + lines.push(` Eventos avulsos: ${avulsosCreated}`); + lines.push(` Exceções — faltou: ${excFaltou}`); + lines.push(` Exceções — remarcado: ${excRemarcado}`); + lines.push(` Exceções — cancelado: ${excCancelado}`); + lines.push(` Solicitações agendador: ${config.AGENDADOR_REQUESTS_COUNT}`); + lines.push(''); + lines.push('─── Pacientes criados ─────────────────────────────────────'); + for (const p of patients) { + lines.push(` [${p.id}] ${p.nome_completo} — ${p.email}`); + } + lines.push(''); + lines.push('─── Séries de recorrência ─────────────────────────────────'); + for (const r of recurrenceRules) { + const dias = r.weekdays.map((d) => weekdayName(d)).join(', '); + lines.push(` [${r.id}]`); + lines.push(` Paciente: ${r.patient.nome_completo}`); + lines.push(` Tipo: ${r.type} | Dias: ${dias}`); + lines.push(` Período: ${toISO(r.start_date)} → ${toISO(FUTURE_END)}`); + } + lines.push(''); + lines.push('─── Como testar ───────────────────────────────────────────'); + lines.push(' 1. Abra o Supabase SQL Editor'); + lines.push(' 2. Cole e rode: logs/simulation-seed.sql'); + lines.push(' 3. Acesse a agenda — os eventos devem aparecer'); + lines.push(' 4. Acesse Pacientes — pacientes simulados aparecem na lista'); + lines.push(' 5. Acesse Agendamentos Recebidos — solicitações pendentes'); + lines.push(' 6. Quando terminar, rode: logs/simulation-cleanup.sql'); + lines.push(''); + lines.push('============================================================'); - return lines.join('\n') + return lines.join('\n'); } // ─── Salvar arquivos ───────────────────────────────────────────────────────── -const outDir = path.resolve(config.OUTPUT_DIR) -if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true }) +const outDir = path.resolve(config.OUTPUT_DIR); +if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true }); -const seedPath = path.join(outDir, 'simulation-seed.sql') -const cleanupPath = path.join(outDir, 'simulation-cleanup.sql') -const reportPath = path.join(outDir, 'simulation-report.txt') -const logPath = path.join(outDir, 'simulation-log.txt') +const seedPath = path.join(outDir, 'simulation-seed.sql'); +const cleanupPath = path.join(outDir, 'simulation-cleanup.sql'); +const reportPath = path.join(outDir, 'simulation-report.txt'); +const logPath = path.join(outDir, 'simulation-log.txt'); -fs.writeFileSync(seedPath, seedLines.join('\n'), 'utf-8') -fs.writeFileSync(cleanupPath, buildCleanupSQL(), 'utf-8') -fs.writeFileSync(reportPath, buildReport(), 'utf-8') +fs.writeFileSync(seedPath, seedLines.join('\n'), 'utf-8'); +fs.writeFileSync(cleanupPath, buildCleanupSQL(), 'utf-8'); +fs.writeFileSync(reportPath, buildReport(), 'utf-8'); -logInfo(`✔ Seed SQL: ${seedPath}`) -logInfo(`✔ Cleanup SQL: ${cleanupPath}`) -logInfo(`✔ Relatório: ${reportPath}`) +logInfo(`✔ Seed SQL: ${seedPath}`); +logInfo(`✔ Cleanup SQL: ${cleanupPath}`); +logInfo(`✔ Relatório: ${reportPath}`); -fs.writeFileSync(logPath, getLog(), 'utf-8') +fs.writeFileSync(logPath, getLog(), 'utf-8'); -console.log('\n✅ Simulação concluída. Arquivos em logs/') -console.log(' → Rode simulation-seed.sql no Supabase SQL Editor para inserir os dados') -console.log(' → Rode simulation-cleanup.sql quando quiser remover\n') +console.log('\n✅ Simulação concluída. Arquivos em logs/'); +console.log(' → Rode simulation-seed.sql no Supabase SQL Editor para inserir os dados'); +console.log(' → Rode simulation-cleanup.sql quando quiser remover\n'); diff --git a/scripts/simulation/simulation.config.js b/scripts/simulation/simulation.config.js index 0111941..7ae1acd 100644 --- a/scripts/simulation/simulation.config.js +++ b/scripts/simulation/simulation.config.js @@ -11,33 +11,33 @@ */ export const config = { - // ─── OBRIGATÓRIO — preencha com seus valores reais ────────────────────────── - OWNER_ID: 'aaaaaaaa-0002-0002-0002-000000000002', - TENANT_ID: 'bbbbbbbb-0002-0002-0002-000000000002', + // ─── OBRIGATÓRIO — preencha com seus valores reais ────────────────────────── + OWNER_ID: 'aaaaaaaa-0002-0002-0002-000000000002', + TENANT_ID: 'bbbbbbbb-0002-0002-0002-000000000002', - // ─── Configurações de simulação ────────────────────────────────────────────── - SIMULATION_DAYS: 90, // quantos dias para o futuro gerar sessões - DAYS_BACK: 30, // quantos dias no passado (sessões já realizadas) + // ─── Configurações de simulação ────────────────────────────────────────────── + SIMULATION_DAYS: 90, // quantos dias para o futuro gerar sessões + DAYS_BACK: 30, // quantos dias no passado (sessões já realizadas) - // ─── Parâmetros dos pacientes ──────────────────────────────────────────────── - PATIENTS_COUNT: 8, // quantos pacientes criar (patient_scope = 'clinic') + // ─── Parâmetros dos pacientes ──────────────────────────────────────────────── + PATIENTS_COUNT: 8, // quantos pacientes criar (patient_scope = 'clinic') - // ─── Parâmetros das séries de recorrência ──────────────────────────────────── - RECURRENCE_RULES_COUNT: 6, // quantas séries semanais criar + // ─── Parâmetros das séries de recorrência ──────────────────────────────────── + RECURRENCE_RULES_COUNT: 6, // quantas séries semanais criar - // ─── Taxas de exceção (0.0 a 1.0) ──────────────────────────────────────────── - RATE_FALTOU: 0.10, // 10% das sessões passadas → faltou - RATE_REMARCADO: 0.08, // 8% → remarcado para outro dia - RATE_CANCELADO: 0.05, // 5% → cancelado + // ─── Taxas de exceção (0.0 a 1.0) ──────────────────────────────────────────── + RATE_FALTOU: 0.1, // 10% das sessões passadas → faltou + RATE_REMARCADO: 0.08, // 8% → remarcado para outro dia + RATE_CANCELADO: 0.05, // 5% → cancelado - // ─── Agendador público ──────────────────────────────────────────────────────── - AGENDADOR_REQUESTS_COUNT: 5, // solicitações pendentes no agendador público + // ─── Agendador público ──────────────────────────────────────────────────────── + AGENDADOR_REQUESTS_COUNT: 5, // solicitações pendentes no agendador público - // ─── Horário de trabalho ───────────────────────────────────────────────────── - WORK_HOUR_START: 8, // 08:00 - WORK_HOUR_END: 18, // 18:00 - SESSION_DURATION_MIN: 50, // duração padrão em minutos + // ─── Horário de trabalho ───────────────────────────────────────────────────── + WORK_HOUR_START: 8, // 08:00 + WORK_HOUR_END: 18, // 18:00 + SESSION_DURATION_MIN: 50, // duração padrão em minutos - // ─── Saída ──────────────────────────────────────────────────────────────────── - OUTPUT_DIR: 'logs', -} + // ─── Saída ──────────────────────────────────────────────────────────────────── + OUTPUT_DIR: 'logs' +}; diff --git a/scripts/simulation/simulationLogger.js b/scripts/simulation/simulationLogger.js index 8e4ddb7..4b929cc 100644 --- a/scripts/simulation/simulationLogger.js +++ b/scripts/simulation/simulationLogger.js @@ -4,30 +4,30 @@ * Logger simples que imprime no console e acumula linhas para salvar em arquivo. */ -const lines = [] +const lines = []; -function timestamp () { - return new Date().toISOString().replace('T', ' ').substring(0, 19) +function timestamp() { + return new Date().toISOString().replace('T', ' ').substring(0, 19); } -export function logInfo (msg) { - const line = `[INFO] ${timestamp()} ${msg}` - console.log(line) - lines.push(line) +export function logInfo(msg) { + const line = `[INFO] ${timestamp()} ${msg}`; + console.log(line); + lines.push(line); } -export function logWarning (msg) { - const line = `[WARN] ${timestamp()} ${msg}` - console.warn(line) - lines.push(line) +export function logWarning(msg) { + const line = `[WARN] ${timestamp()} ${msg}`; + console.warn(line); + lines.push(line); } -export function logError (msg) { - const line = `[ERROR] ${timestamp()} ${msg}` - console.error(line) - lines.push(line) +export function logError(msg) { + const line = `[ERROR] ${timestamp()} ${msg}`; + console.error(line); + lines.push(line); } -export function getLog () { - return lines.join('\n') +export function getLog() { + return lines.join('\n'); } diff --git a/src/App.vue b/src/App.vue index 60103dc..8835083 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,187 +15,179 @@ |-------------------------------------------------------------------------- --> \ No newline at end of file + + + diff --git a/src/app/bootstrapUserSettings.js b/src/app/bootstrapUserSettings.js index d04fb79..e504536 100644 --- a/src/app/bootstrapUserSettings.js +++ b/src/app/bootstrapUserSettings.js @@ -14,135 +14,141 @@ | © 2026 — Todos os direitos reservados |-------------------------------------------------------------------------- */ -import { supabase } from '@/lib/supabase/client' -import { useLayout } from '@/layout/composables/layout' -import { $t, updatePreset, updateSurfacePalette } from '@primeuix/themes' -import Aura from '@primeuix/themes/aura' -import Lara from '@primeuix/themes/lara' -import Nora from '@primeuix/themes/nora' +import { supabase } from '@/lib/supabase/client'; +import { useLayout } from '@/layout/composables/layout'; +import { $t, updatePreset, updateSurfacePalette } from '@primeuix/themes'; +import Aura from '@primeuix/themes/aura'; +import Lara from '@primeuix/themes/lara'; +import Nora from '@primeuix/themes/nora'; -const presets = { Aura, Lara, Nora } +const presets = { Aura, Lara, Nora }; -function safeEq (a, b) { - return String(a || '').trim() === String(b || '').trim() +function safeEq(a, b) { + return String(a || '').trim() === String(b || '').trim(); } // copia do seu getPresetExt (ou exporta ele do Perfil pra reutilizar) function getPresetExt(primaryColors, layoutConfig) { - const color = primaryColors.find((c) => c.name === layoutConfig.primary) || { name: 'noir', palette: {} } + const color = primaryColors.find((c) => c.name === layoutConfig.primary) || { name: 'noir', palette: {} }; + + if (color.name === 'noir') { + return { + semantic: { + primary: { + 50: '{surface.50}', + 100: '{surface.100}', + 200: '{surface.200}', + 300: '{surface.300}', + 400: '{surface.400}', + 500: '{surface.500}', + 600: '{surface.600}', + 700: '{surface.700}', + 800: '{surface.800}', + 900: '{surface.900}', + 950: '{surface.950}' + }, + colorScheme: { + light: { + primary: { color: '{primary.950}', contrastColor: '#ffffff', hoverColor: '{primary.800}', activeColor: '{primary.700}' }, + highlight: { background: '{primary.950}', focusBackground: '{primary.700}', color: '#ffffff', focusColor: '#ffffff' } + }, + dark: { + primary: { color: '{primary.50}', contrastColor: '{primary.950}', hoverColor: '{primary.200}', activeColor: '{primary.300}' }, + highlight: { background: '{primary.50}', focusBackground: '{primary.300}', color: '{primary.950}', focusColor: '{primary.950}' } + } + } + } + }; + } - if (color.name === 'noir') { return { - semantic: { - primary: { - 50: '{surface.50}', 100: '{surface.100}', 200: '{surface.200}', 300: '{surface.300}', - 400: '{surface.400}', 500: '{surface.500}', 600: '{surface.600}', 700: '{surface.700}', - 800: '{surface.800}', 900: '{surface.900}', 950: '{surface.950}' - }, - colorScheme: { - light: { - primary: { color: '{primary.950}', contrastColor: '#ffffff', hoverColor: '{primary.800}', activeColor: '{primary.700}' }, - highlight: { background: '{primary.950}', focusBackground: '{primary.700}', color: '#ffffff', focusColor: '#ffffff' } - }, - dark: { - primary: { color: '{primary.50}', contrastColor: '{primary.950}', hoverColor: '{primary.200}', activeColor: '{primary.300}' }, - highlight: { background: '{primary.50}', focusBackground: '{primary.300}', color: '{primary.950}', focusColor: '{primary.950}' } - } + semantic: { + primary: color.palette, + colorScheme: { + light: { + primary: { color: '{primary.500}', contrastColor: '#ffffff', hoverColor: '{primary.600}', activeColor: '{primary.700}' }, + highlight: { background: '{primary.50}', focusBackground: '{primary.100}', color: '{primary.700}', focusColor: '{primary.800}' } + }, + dark: { + primary: { color: '{primary.400}', contrastColor: '{surface.900}', hoverColor: '{primary.300}', activeColor: '{primary.200}' }, + highlight: { + background: 'color-mix(in srgb, {primary.400}, transparent 84%)', + focusBackground: 'color-mix(in srgb, {primary.400}, transparent 76%)', + color: 'rgba(255,255,255,.87)', + focusColor: 'rgba(255,255,255,.87)' + } + } + } } - } - } - } - - return { - semantic: { - primary: color.palette, - colorScheme: { - light: { - primary: { color: '{primary.500}', contrastColor: '#ffffff', hoverColor: '{primary.600}', activeColor: '{primary.700}' }, - highlight: { background: '{primary.50}', focusBackground: '{primary.100}', color: '{primary.700}', focusColor: '{primary.800}' } - }, - dark: { - primary: { color: '{primary.400}', contrastColor: '{surface.900}', hoverColor: '{primary.300}', activeColor: '{primary.200}' }, - highlight: { - background: 'color-mix(in srgb, {primary.400}, transparent 84%)', - focusBackground: 'color-mix(in srgb, {primary.400}, transparent 76%)', - color: 'rgba(255,255,255,.87)', - focusColor: 'rgba(255,255,255,.87)' - } - } - } - } - } + }; } export async function bootstrapUserSettings({ - primaryColors = [], // passe a lista do seu Perfil (ou uma versão reduzida) - surfaces = [] // idem + primaryColors = [], // passe a lista do seu Perfil (ou uma versão reduzida) + surfaces = [] // idem } = {}) { - const { layoutConfig, isDarkTheme, toggleDarkMode, changeMenuMode, setVariant } = useLayout() + const { layoutConfig, isDarkTheme, toggleDarkMode, changeMenuMode, setVariant } = useLayout(); - const { data: uRes, error: uErr } = await supabase.auth.getUser() - if (uErr) return - const user = uRes?.user - if (!user) return + const { data: uRes, error: uErr } = await supabase.auth.getUser(); + if (uErr) return; + const user = uRes?.user; + if (!user) return; - const { data: settings, error } = await supabase - .from('user_settings') - .select('theme_mode, preset, primary_color, surface_color, menu_mode, layout_variant') - .eq('user_id', user.id) - .maybeSingle() + const { data: settings, error } = await supabase.from('user_settings').select('theme_mode, preset, primary_color, surface_color, menu_mode, layout_variant').eq('user_id', user.id).maybeSingle(); - if (error || !settings) return + if (error || !settings) return; - // layout variant: respeita a preferência já gravada no localStorage. - // Se localStorage está vazio, só aplica 'rail' do banco (confirma o padrão). - // Nunca aplica 'classic' automaticamente quando não há preferência local — - // dado antigo no banco não deve sobrescrever o padrão do app. - const _lsV = (() => { - try { - const v = localStorage.getItem('layout_variant') - return (v === 'rail' || v === 'classic') ? v : null - } catch { return null } - })() + // layout variant: respeita a preferência já gravada no localStorage. + // Se localStorage está vazio, só aplica 'rail' do banco (confirma o padrão). + // Nunca aplica 'classic' automaticamente quando não há preferência local — + // dado antigo no banco não deve sobrescrever o padrão do app. + const _lsV = (() => { + try { + const v = localStorage.getItem('layout_variant'); + return v === 'rail' || v === 'classic' ? v : null; + } catch { + return null; + } + })(); - if (_lsV !== null) { - // localStorage já tem valor → aplica ele (garante coerência com layoutConfig) - if (_lsV !== (settings.layout_variant ?? _lsV)) setVariant(_lsV) - } else if (settings.layout_variant === 'rail') { - // localStorage vazio + banco tem 'rail' → aplica e grava no localStorage - setVariant('rail') - } - // localStorage vazio + banco tem 'classic' → mantém padrão 'rail' (não aplica) + if (_lsV !== null) { + // localStorage já tem valor → aplica ele (garante coerência com layoutConfig) + if (_lsV !== (settings.layout_variant ?? _lsV)) setVariant(_lsV); + } else if (settings.layout_variant === 'rail') { + // localStorage vazio + banco tem 'rail' → aplica e grava no localStorage + setVariant('rail'); + } + // localStorage vazio + banco tem 'classic' → mantém padrão 'rail' (não aplica) - // menu mode - if (settings.menu_mode && settings.menu_mode !== layoutConfig.menuMode) { - layoutConfig.menuMode = settings.menu_mode - changeMenuMode() - } + // menu mode + if (settings.menu_mode && settings.menu_mode !== layoutConfig.menuMode) { + layoutConfig.menuMode = settings.menu_mode; + changeMenuMode(); + } - // preset - if (settings.preset && settings.preset !== layoutConfig.preset) { - layoutConfig.preset = settings.preset - const presetValue = presets[settings.preset] || presets.Aura - const surfacePalette = surfaces.find(s => s.name === layoutConfig.surface)?.palette - $t().preset(presetValue).preset(getPresetExt(primaryColors, layoutConfig)).surfacePalette(surfacePalette).use({ useDefaultOptions: true }) - } + // preset + if (settings.preset && settings.preset !== layoutConfig.preset) { + layoutConfig.preset = settings.preset; + const presetValue = presets[settings.preset] || presets.Aura; + const surfacePalette = surfaces.find((s) => s.name === layoutConfig.surface)?.palette; + $t().preset(presetValue).preset(getPresetExt(primaryColors, layoutConfig)).surfacePalette(surfacePalette).use({ useDefaultOptions: true }); + } - // colors - if (settings.primary_color && !safeEq(settings.primary_color, layoutConfig.primary)) { - layoutConfig.primary = settings.primary_color - updatePreset(getPresetExt(primaryColors, layoutConfig)) - } + // colors + if (settings.primary_color && !safeEq(settings.primary_color, layoutConfig.primary)) { + layoutConfig.primary = settings.primary_color; + updatePreset(getPresetExt(primaryColors, layoutConfig)); + } - if (settings.surface_color && !safeEq(settings.surface_color, layoutConfig.surface)) { - layoutConfig.surface = settings.surface_color - const surface = surfaces.find(s => s.name === settings.surface_color) - if (surface) updateSurfacePalette(surface.palette) - } + if (settings.surface_color && !safeEq(settings.surface_color, layoutConfig.surface)) { + layoutConfig.surface = settings.surface_color; + const surface = surfaces.find((s) => s.name === settings.surface_color); + if (surface) updateSurfacePalette(surface.palette); + } - // dark/light - if (settings.theme_mode) { - const shouldBeDark = settings.theme_mode === 'dark' - if (shouldBeDark !== isDarkTheme) toggleDarkMode() - } + // dark/light + if (settings.theme_mode) { + const shouldBeDark = settings.theme_mode === 'dark'; + if (shouldBeDark !== isDarkTheme) toggleDarkMode(); + } } diff --git a/src/app/session.js b/src/app/session.js index 4a6928f..5daf054 100644 --- a/src/app/session.js +++ b/src/app/session.js @@ -14,8 +14,8 @@ | © 2026 — Todos os direitos reservados |-------------------------------------------------------------------------- */ -import { ref } from 'vue' -import { supabase } from '@/lib/supabase/client' +import { ref } from 'vue'; +import { supabase } from '@/lib/supabase/client'; /** * ⚠️ IMPORTANTE — ESTABILIDADE DE NAVEGAÇÃO @@ -42,197 +42,189 @@ import { supabase } from '@/lib/supabase/client' * entre sessão, guard e carregamento de tenant/entitlements. */ -export const sessionUser = ref(null) -export const sessionRole = ref(null) -export const sessionIsSaasAdmin = ref(false) +export const sessionUser = ref(null); +export const sessionRole = ref(null); +export const sessionIsSaasAdmin = ref(false); // só no primeiro boot -export const sessionReady = ref(false) +export const sessionReady = ref(false); // refresh leve (troca de aba / refresh token) sem desmontar UI -export const sessionRefreshing = ref(false) +export const sessionRefreshing = ref(false); -let onSignedOutCallback = null -export function setOnSignedOut (cb) { - onSignedOutCallback = typeof cb === 'function' ? cb : null +let onSignedOutCallback = null; +export function setOnSignedOut(cb) { + onSignedOutCallback = typeof cb === 'function' ? cb : null; } // evita init concorrente -let initPromise = null +let initPromise = null; -async function fetchRole (userId) { - const { data, error } = await supabase - .from('profiles') - .select('role') - .eq('id', userId) - .single() +async function fetchRole(userId) { + const { data, error } = await supabase.from('profiles').select('role').eq('id', userId).single(); - if (error) return null - return data?.role || null + if (error) return null; + return data?.role || null; } -async function fetchIsSaasAdmin (userId) { - const { data, error } = await supabase - .from('saas_admins') - .select('user_id') - .eq('user_id', userId) - .maybeSingle() +async function fetchIsSaasAdmin(userId) { + const { data, error } = await supabase.from('saas_admins').select('user_id').eq('user_id', userId).maybeSingle(); - if (error) return false - return !!data + if (error) return false; + return !!data; } /** * Atualiza estado a partir de uma session "confiável" (getSession() ou callback do auth). * ⚠️ NÃO zera user/role durante refresh enquanto existir sessão. */ -async function hydrateFromSession (sess) { - const user = sess?.user || null - if (!user?.id) return false +async function hydrateFromSession(sess) { + const user = sess?.user || null; + if (!user?.id) return false; - const prevUid = sessionUser.value?.id || null - const uid = user.id + const prevUid = sessionUser.value?.id || null; + const uid = user.id; - // ✅ pega primeiro hydrate e troca de usuário - const userChanged = prevUid !== uid + // ✅ pega primeiro hydrate e troca de usuário + const userChanged = prevUid !== uid; - // atualiza user imediatamente (sem flicker) - sessionUser.value = user + // atualiza user imediatamente (sem flicker) + sessionUser.value = user; - // ✅ saas admin: calcula no primeiro hydrate e sempre que trocar de user - // (no primeiro hydrate prevUid é null, então userChanged = true) - if (userChanged) { - sessionIsSaasAdmin.value = await fetchIsSaasAdmin(uid) - } + // ✅ saas admin: calcula no primeiro hydrate e sempre que trocar de user + // (no primeiro hydrate prevUid é null, então userChanged = true) + if (userChanged) { + sessionIsSaasAdmin.value = await fetchIsSaasAdmin(uid); + } - // role: busca se não tem, ou se mudou user - if (!sessionRole.value || userChanged) { - sessionRole.value = await fetchRole(uid) - } + // role: busca se não tem, ou se mudou user + if (!sessionRole.value || userChanged) { + sessionRole.value = await fetchRole(uid); + } - return true + return true; } /** * Boot inicial (pode bloquear UI) ou refresh (não pode derrubar menu). */ -export async function initSession ({ initial = false } = {}) { - if (initPromise) return initPromise +export async function initSession({ initial = false } = {}) { + if (initPromise) return initPromise; - if (initial) sessionReady.value = false - else sessionRefreshing.value = true + if (initial) sessionReady.value = false; + else sessionRefreshing.value = true; + + initPromise = (async () => { + try { + const { data, error } = await supabase.auth.getSession(); + if (error) throw error; + + const sess = data?.session || null; + const ok = await hydrateFromSession(sess); + + // se não tem sessão, zera estado (aqui pode, porque é init/refresh controlado) + if (!ok) { + sessionUser.value = null; + sessionRole.value = null; + sessionIsSaasAdmin.value = false; + } + } catch (e) { + console.warn('[initSession] getSession falhou (tratando como sem sessão):', e); + // não deixa estourar pro router guard + sessionUser.value = null; + sessionRole.value = null; + sessionIsSaasAdmin.value = false; + } + })(); - initPromise = (async () => { try { - const { data, error } = await supabase.auth.getSession() - if (error) throw error - - const sess = data?.session || null - const ok = await hydrateFromSession(sess) - - // se não tem sessão, zera estado (aqui pode, porque é init/refresh controlado) - if (!ok) { - sessionUser.value = null - sessionRole.value = null - sessionIsSaasAdmin.value = false - } - } catch (e) { - console.warn('[initSession] getSession falhou (tratando como sem sessão):', e) - // não deixa estourar pro router guard - sessionUser.value = null - sessionRole.value = null - sessionIsSaasAdmin.value = false + await initPromise; + } finally { + initPromise = null; + if (initial) sessionReady.value = true; + sessionRefreshing.value = false; } - })() - - try { - await initPromise - } finally { - initPromise = null - if (initial) sessionReady.value = true - sessionRefreshing.value = false - } } // refresh leve (troca de aba etc.) -export async function refreshSession () { - // ✅ evita corrida: se já está refreshing/init, não dispara outro - if (sessionRefreshing.value || initPromise) return +export async function refreshSession() { + // ✅ evita corrida: se já está refreshing/init, não dispara outro + if (sessionRefreshing.value || initPromise) return; - const { data, error } = await supabase.auth.getSession() - if (error) return + const { data, error } = await supabase.auth.getSession(); + if (error) return; - const sess = data?.session || null - const uid = sess?.user?.id || null + const sess = data?.session || null; + const uid = sess?.user?.id || null; - // se não tem sessão, não zera aqui (deixa SIGNED_OUT cuidar) - if (!uid) return + // se não tem sessão, não zera aqui (deixa SIGNED_OUT cuidar) + if (!uid) return; - // se já está consistente, não faz nada - if (sessionUser.value?.id === uid && sessionRole.value) return + // se já está consistente, não faz nada + if (sessionUser.value?.id === uid && sessionRole.value) return; - await initSession({ initial: false }) + await initSession({ initial: false }); } // evita múltiplos listeners -let authSubscription = null +let authSubscription = null; -export function listenAuthChanges () { - if (authSubscription) return +export function listenAuthChanges() { + if (authSubscription) return; - const { data } = supabase.auth.onAuthStateChange(async (event, sess) => { - console.log('[AUTH EVENT]', event) + const { data } = supabase.auth.onAuthStateChange(async (event, sess) => { + console.log('[AUTH EVENT]', event); - // ✅ SIGNED_OUT: zera e chama callback - if (event === 'SIGNED_OUT') { - sessionUser.value = null - sessionRole.value = null - sessionIsSaasAdmin.value = false - sessionRefreshing.value = false - sessionReady.value = true - if (onSignedOutCallback) onSignedOutCallback() - return - } + // ✅ SIGNED_OUT: zera e chama callback + if (event === 'SIGNED_OUT') { + sessionUser.value = null; + sessionRole.value = null; + sessionIsSaasAdmin.value = false; + sessionRefreshing.value = false; + sessionReady.value = true; + if (onSignedOutCallback) onSignedOutCallback(); + return; + } - // ✅ se já está consistente, ignora SIGNED_IN redundante - if (event === 'SIGNED_IN') { - const uid = sess?.user?.id || null - if (uid && sessionReady.value && sessionUser.value?.id === uid && sessionRole.value) { - return - } - } + // ✅ se já está consistente, ignora SIGNED_IN redundante + if (event === 'SIGNED_IN') { + const uid = sess?.user?.id || null; + if (uid && sessionReady.value && sessionUser.value?.id === uid && sessionRole.value) { + return; + } + } - // ✅ use a session fornecida no callback - if (sess?.user?.id) { - // evita reentrância - if (sessionRefreshing.value) return + // ✅ use a session fornecida no callback + if (sess?.user?.id) { + // evita reentrância + if (sessionRefreshing.value) return; - sessionRefreshing.value = true - try { - await hydrateFromSession(sess) - sessionReady.value = true - } catch (e) { - console.warn('[auth hydrate error]', e) - } finally { - sessionRefreshing.value = false - } - return - } + sessionRefreshing.value = true; + try { + await hydrateFromSession(sess); + sessionReady.value = true; + } catch (e) { + console.warn('[auth hydrate error]', e); + } finally { + sessionRefreshing.value = false; + } + return; + } - // fallback: refresh leve - try { - await refreshSession() - } catch (e) { - console.error('[refreshSession error]', e) - } - }) + // fallback: refresh leve + try { + await refreshSession(); + } catch (e) { + console.error('[refreshSession error]', e); + } + }); - authSubscription = data?.subscription || null + authSubscription = data?.subscription || null; } -export function stopAuthChanges () { - if (authSubscription) { - authSubscription.unsubscribe() - authSubscription = null - } -} \ No newline at end of file +export function stopAuthChanges() { + if (authSubscription) { + authSubscription.unsubscribe(); + authSubscription = null; + } +} diff --git a/src/assets/layout/_responsive.scss b/src/assets/layout/_responsive.scss index 2db66a5..544bd70 100644 --- a/src/assets/layout/_responsive.scss +++ b/src/assets/layout/_responsive.scss @@ -114,7 +114,8 @@ background-color: var(--maskbg); } - &.layout-mobile-active { + &.layout-mobile-active, + &.layout-overlay-active { .layout-sidebar { transform: translateX(0); } diff --git a/src/assets/styles.scss b/src/assets/styles.scss index f9ede46..f866186 100644 --- a/src/assets/styles.scss +++ b/src/assets/styles.scss @@ -21,215 +21,297 @@ /* ── Design Tokens (Tailwind override) ─ */ :root { - --text-xs: 0.8rem; + --text-xs: 0.8rem; } /* ── Dark mode (opcional) ───────────── */ .app-dark { - --text-xs: 0.82rem; + --text-xs: 0.82rem; } /* ── Responsivo (opcional) ─────────── */ @media (min-width: 768px) { - :root { - --text-xs: 0.85rem; - } + :root { + --text-xs: 0.85rem; + } } /* Highlight pulse (acionado externamente via classe JS) */ @keyframes highlight-pulse { - 0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.7), 0 0 0 0 rgba(99,102,241,0.4); } - 40% { box-shadow: 0 0 0 8px rgba(99,102,241,0.3), 0 0 0 16px rgba(99,102,241,0.1); } - 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0), 0 0 0 0 rgba(99,102,241,0); } + 0% { + box-shadow: + 0 0 0 0 rgba(99, 102, 241, 0.7), + 0 0 0 0 rgba(99, 102, 241, 0.4); + } + 40% { + box-shadow: + 0 0 0 8px rgba(99, 102, 241, 0.3), + 0 0 0 16px rgba(99, 102, 241, 0.1); + } + 100% { + box-shadow: + 0 0 0 0 rgba(99, 102, 241, 0), + 0 0 0 0 rgba(99, 102, 241, 0); + } } .notif-card--highlight { - animation: highlight-pulse 1s ease-out 3; - border-color: rgba(99,102,241,0.6) !important; + animation: highlight-pulse 1s ease-out 3; + border-color: rgba(99, 102, 241, 0.6) !important; } .agenda-altura { - height: calc(90vh - 150px); - overflow-y: auto; + height: calc(90vh - 150px); + overflow-y: auto; } .fade-up-enter-active { - transition: opacity 0.4s ease, transform 0.4s ease; + transition: + opacity 0.4s ease, + transform 0.4s ease; } .fade-up-enter-from { - opacity: 0; - transform: translateY(16px); + opacity: 0; + transform: translateY(16px); } .fade-up-enter-active .anim-child { - transition: opacity 0.45s ease, transform 0.45s ease; - transition-delay: var(--delay, 0ms); + transition: + opacity 0.45s ease, + transform 0.45s ease; + transition-delay: var(--delay, 0ms); } .fade-up-enter-from .anim-child { - opacity: 0; - transform: translateY(16px); + opacity: 0; + transform: translateY(16px); } .menu-enter-from { - opacity: 0; - transform: translateY(4px) scale(1.5); + opacity: 0; + transform: translateY(4px) scale(1.5); } .menu-enter-active { - transition: - opacity 140ms ease, - transform 260ms cubic-bezier(0.16, 1, 0.3, 1); + transition: + opacity 140ms ease, + transform 260ms cubic-bezier(0.16, 1, 0.3, 1); } .menu-enter-to { - opacity: 1; - transform: translateY(0) scale(1); + opacity: 1; + transform: translateY(0) scale(1); } /* ── LoadedPhraseBlock ───────────────── */ .loaded-phrase-block { - border: 2px dashed var(--surface-border); - border-radius: 12px; - padding: 0.875rem 1.125rem; - display: flex; - flex-direction: column; - gap: 0.35rem; - background: color-mix(in srgb, var(--primary-color, #6366f1) 3%, var(--surface-card)); + border: 2px dashed var(--surface-border); + border-radius: 12px; + padding: 0.875rem 1.125rem; + display: flex; + flex-direction: column; + gap: 0.35rem; + background: color-mix(in srgb, var(--primary-color, #6366f1) 3%, var(--surface-card)); } .loaded-phrase-block__header { - display: flex; - align-items: center; - gap: 0.45rem; + display: flex; + align-items: center; + gap: 0.45rem; } .loaded-phrase-block__icon { - font-size: 0.9rem; - color: var(--green-500, #22c55e); + font-size: 0.9rem; + color: var(--green-500, #22c55e); } .loaded-phrase-block__title { - font-size: 0.72rem; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.06em; - color: var(--text-color-secondary); + font-size: 0.72rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--text-color-secondary); } .loaded-phrase-block__text { - font-size: 0.88rem; - color: var(--text-color); - font-style: italic; - line-height: 1.5; - margin: 0; + font-size: 0.88rem; + color: var(--text-color); + font-style: italic; + line-height: 1.5; + margin: 0; } .loaded-phrase-in-enter-active { - transition: opacity 0.5s ease, transform 0.5s ease; + transition: + opacity 0.5s ease, + transform 0.5s ease; } .loaded-phrase-in-enter-from { - opacity: 0; - transform: translateY(10px); + opacity: 0; + transform: translateY(10px); } /* ── Subheader de seção ──────────────────────────────── */ .cfg-subheader { - display: flex; - align-items: center; - gap: 0.65rem; - padding: 0.875rem 1rem; - border-radius: 6px; - border: 1px solid color-mix(in srgb, var(--primary-color, #6366f1) 30%, transparent); - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--primary-color, #6366f1) 12%, var(--surface-card)) 0%, - color-mix(in srgb, var(--primary-color, #6366f1) 4%, var(--surface-card)) 60%, - var(--surface-card) 100% - ); - overflow: hidden; - position: relative; + display: flex; + align-items: center; + gap: 0.65rem; + padding: 0.875rem 1rem; + border-radius: 6px; + border: 1px solid color-mix(in srgb, var(--primary-color, #6366f1) 30%, transparent); + background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color, #6366f1) 12%, var(--surface-card)) 0%, color-mix(in srgb, var(--primary-color, #6366f1) 4%, var(--surface-card)) 60%, var(--surface-card) 100%); + overflow: hidden; + position: relative; } /* Brilho sutil no canto */ .cfg-subheader::before { - content: ''; - position: absolute; - top: -20px; right: -20px; - width: 80px; height: 80px; - border-radius: 50%; - background: color-mix(in srgb, var(--primary-color, #6366f1) 15%, transparent); - filter: blur(20px); - pointer-events: none; + content: ''; + position: absolute; + top: -20px; + right: -20px; + width: 80px; + height: 80px; + border-radius: 50%; + background: color-mix(in srgb, var(--primary-color, #6366f1) 15%, transparent); + filter: blur(20px); + pointer-events: none; } .cfg-subheader__icon { - display: grid; place-items: center; - flex-shrink: 0; - background: color-mix(in srgb, var(--primary-color, #6366f1) 20%, transparent); - color: var(--primary-color, #6366f1); + display: grid; + place-items: center; + flex-shrink: 0; + background: color-mix(in srgb, var(--primary-color, #6366f1) 20%, transparent); + color: var(--primary-color, #6366f1); } .cfg-subheader__title { - font-size: 0.95rem; - font-weight: 700; - color: var(--primary-color, #6366f1); - letter-spacing: -0.01em; + font-size: 0.95rem; + font-weight: 700; + color: var(--primary-color, #6366f1); + letter-spacing: -0.01em; } .cfg-subheader__sub { - font-size: 0.75rem; - color: var(--text-color-secondary); - opacity: 0.85; + font-size: 0.75rem; + color: var(--text-color-secondary); + opacity: 0.85; } .cfg-card__icon-wrap { - border: 1px solid var(--surface-border); - background: var(--surface-ground); - display: grid; - place-items: center; - flex-shrink: 0; + border: 1px solid var(--surface-border); + background: var(--surface-ground); + display: grid; + place-items: center; + flex-shrink: 0; } /* ── Dash cards ───────────────────────────────────── */ .dash-card { - display: flex; flex-direction: column; - background: var(--surface-card); - border: 1px solid var(--surface-border); - overflow: hidden; - transition: box-shadow 0.2s; + display: flex; + flex-direction: column; + background: var(--surface-card); + border: 1px solid var(--surface-border); + overflow: hidden; + transition: box-shadow 0.2s; +} +.dash-card:hover { + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07); } -.dash-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.07); } .dash-card__head { - display: flex; align-items: center; - border-bottom: 1px solid var(--surface-border); - background: var(--surface-ground); + display: flex; + align-items: center; + border-bottom: 1px solid var(--surface-border); + background: var(--surface-ground); } .dash-card__icon { - width: 2.25rem; height: 2.25rem; - border-radius: 8px; - display: grid; place-items: center; - flex-shrink: 0; font-size: 1rem; + width: 2.25rem; + height: 2.25rem; + border-radius: 8px; + display: grid; + place-items: center; + flex-shrink: 0; + font-size: 1rem; +} +.dash-card__sub { + font-size: 0.875rem; + color: var(--text-color-secondary); + margin-top: 1px; } -.dash-card__sub { font-size: 0.875rem; color: var(--text-color-secondary); margin-top: 1px; } .dash-card__badge { - margin-left: auto; flex-shrink: 0; - padding: 2px 10px; border-radius: 999px; - font-size: 0.875rem; font-weight: 700; + margin-left: auto; + flex-shrink: 0; + padding: 2px 10px; + border-radius: 999px; + font-size: 0.875rem; + font-weight: 700; } .dash-card__body { - flex: 1; padding: 0.75rem 1rem; - display: flex; flex-direction: column; gap: 0.625rem; - min-height: 88px; + flex: 1; + padding: 0.75rem 1rem; + display: flex; + flex-direction: column; + gap: 0.625rem; + min-height: 88px; } .dash-card__foot { - padding: 0.625rem 1rem; - border-top: 1px solid var(--surface-border); - font-size: 0.875rem; font-weight: 700; - color: var(--primary-color, #6366f1); - cursor: pointer; transition: background 0.1s; + padding: 0.625rem 1rem; + border-top: 1px solid var(--surface-border); + font-size: 0.875rem; + font-weight: 700; + color: var(--primary-color, #6366f1); + cursor: pointer; + transition: background 0.1s; +} +.dash-card__foot:hover { + background: var(--surface-ground); } -.dash-card__foot:hover { background: var(--surface-ground); } /* ── Dash items (dentro dos cards) ───────────────── */ .dash-item { - display: flex; align-items: center; + display: flex; + align-items: center; } .dash-item__avatar { - width: 2rem; height: 2rem; border-radius: 50%; - flex-shrink: 0; display: grid; place-items: center; - font-size: 0.75rem; font-weight: 700; color: #fff; + width: 2rem; + height: 2rem; + border-radius: 50%; + flex-shrink: 0; + display: grid; + place-items: center; + font-size: 0.75rem; + font-weight: 700; + color: #fff; +} +.dash-item__name { + font-size: 0.9375rem; + font-weight: 600; + color: var(--text-color); +} +.dash-item__sub { + font-size: 0.8125rem; + color: var(--text-color-secondary); + margin-top: 1px; +} +.dash-item__actions { + display: flex; + gap: 0.375rem; + margin-left: auto; + flex-shrink: 0; } -.dash-item__name { font-size: 0.9375rem; font-weight: 600; color: var(--text-color); } -.dash-item__sub { font-size: 0.8125rem; color: var(--text-color-secondary); margin-top: 1px; } -.dash-item__actions { display: flex; gap: 0.375rem; margin-left: auto; flex-shrink: 0; } /* ── Empty state dos cards ────────────────────────── */ .dash-empty { - display: flex; align-items: center; gap: 0.5rem; - font-size: 0.875rem; color: var(--text-color-secondary); - padding: 0.5rem 0; -} \ No newline at end of file + display: flex; + align-items: center; + gap: 0.5rem; + font-size: 0.875rem; + color: var(--text-color-secondary); + padding: 0.5rem 0; +} + +/* ── Tabela ────────────────────────── */ +.p-datatable .p-datatable-table-container { + border-radius: 0; +} + +.p-datatable th { + background: var(--surface-ground) !important; + font-size: 0.82rem; +} + +.p-datatable td { + font-size: 0.85rem; +} + +.p-datatable tr.row-new-highlight td { + background-color: #f0fdf4 !important; +} + +.app-dark .p-datatable tr.row-new-highlight td { + background-color: color-mix(in srgb, var(--primary-color) 20%, transparent) !important; +} diff --git a/src/assets/tailwind.css b/src/assets/tailwind.css index 96b5ffd..ca4cf2f 100644 --- a/src/assets/tailwind.css +++ b/src/assets/tailwind.css @@ -25,7 +25,7 @@ --breakpoint-sm: 576px; --breakpoint-md: 768px; --breakpoint-lg: 992px; - --breakpoint-xl: 1200px; + --breakpoint-xl: 1280px; --breakpoint-2xl: 1920px; } diff --git a/src/components/AjudaDrawer.vue b/src/components/AjudaDrawer.vue index a9541b3..259ba8c 100644 --- a/src/components/AjudaDrawer.vue +++ b/src/components/AjudaDrawer.vue @@ -15,789 +15,880 @@ |-------------------------------------------------------------------------- -->