budget-view-finance/supabase/migrations/20250615213618-924d725f-5d4e-44fc-8be2-159091a91e2b.sql
2025-06-15 21:36:27 +00:00

28 lines
853 B
SQL

-- Criação da tabela para registrar notificações de Webhook do Mercado Pago
create table public.pagamentos_mercadopago (
id uuid not null default gen_random_uuid() primary key,
raw_body jsonb not null,
event_type text not null,
event_id text,
payer_email text,
user_id uuid,
status text,
created_at timestamp with time zone not null default now()
);
-- Habilita Row Level Security
alter table public.pagamentos_mercadopago enable row level security;
-- Política de insert para funções autenticadas
create policy "Allow insert for authenticated functions" on public.pagamentos_mercadopago
for insert
to authenticated
with check (true);
-- Política de select para usuários autenticados
create policy "Allow select for authenticated users" on public.pagamentos_mercadopago
for select
to authenticated
using (true);