Execute no Supabase → SQL Editor:
CREATE TABLE IF NOT EXISTS clientes (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
nome text NOT NULL, cnpj text, telefone text,
email text, produto text, operadora text,
premio numeric DEFAULT 0, vigencia_inicio date,
vigencia_fim date, status text DEFAULT 'Ativo',
responsavel text, observacoes text,
created_at timestamptz DEFAULT now()
);
CREATE TABLE IF NOT EXISTS notas (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
titulo text NOT NULL, conteudo text,
tags text[], prioridade text DEFAULT 'media',
cliente_id uuid, created_at timestamptz DEFAULT now()
);
CREATE TABLE IF NOT EXISTS eventos (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
titulo text NOT NULL, data_inicio timestamptz,
tipo text, descricao text, cliente_id uuid,
created_at timestamptz DEFAULT now()
);
CREATE TABLE IF NOT EXISTS pipeline (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
empresa text NOT NULL, produto text, operadora text,
vidas integer DEFAULT 0, valor_estimado numeric DEFAULT 0,
estagio text DEFAULT 'Prospecção', responsavel text,
data_prev date, created_at timestamptz DEFAULT now()
);
CREATE TABLE IF NOT EXISTS financeiro (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
descricao text NOT NULL, tipo text, categoria text,
favorecido text, valor numeric DEFAULT 0,
vencimento date, status text DEFAULT 'Pendente',
observacoes text, cliente_id uuid,
created_at timestamptz DEFAULT now()
);
CREATE TABLE IF NOT EXISTS comissoes (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
parceiro text NOT NULL, parceiro_id uuid,
cliente_ref text, produto text, tipo text,
percentual numeric DEFAULT 0, valor numeric DEFAULT 0,
vencimento date, status text DEFAULT 'Pendente',
observacoes text, created_at timestamptz DEFAULT now()
);
CREATE TABLE IF NOT EXISTS recibos (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
numero text, favorecido text, cpf_cnpj text,
descricao text, valor numeric DEFAULT 0,
forma_pagamento text, referencia text,
data_emissao date, created_at timestamptz DEFAULT now()
);