diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index aaf10bb..771e22c 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -371,6 +371,39 @@ export type Database = { } Relationships: [] } + pagamentos_mercadopago: { + Row: { + created_at: string + event_id: string | null + event_type: string + id: string + payer_email: string | null + raw_body: Json + status: string | null + user_id: string | null + } + Insert: { + created_at?: string + event_id?: string | null + event_type: string + id?: string + payer_email?: string | null + raw_body: Json + status?: string | null + user_id?: string | null + } + Update: { + created_at?: string + event_id?: string | null + event_type?: string + id?: string + payer_email?: string | null + raw_body?: Json + status?: string | null + user_id?: string | null + } + Relationships: [] + } perfis_usuario: { Row: { aniversario: string | null diff --git a/supabase/migrations/20250615213618-924d725f-5d4e-44fc-8be2-159091a91e2b.sql b/supabase/migrations/20250615213618-924d725f-5d4e-44fc-8be2-159091a91e2b.sql new file mode 100644 index 0000000..c3be82e --- /dev/null +++ b/supabase/migrations/20250615213618-924d725f-5d4e-44fc-8be2-159091a91e2b.sql @@ -0,0 +1,27 @@ + +-- 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);