-- Script para corrigir permissões das tabelas browsing_history e session_events
-- Execute como superusuário do PostgreSQL (postgres)

-- Usuário do banco: pointcontrol_user (confirmado)

-- Conceder permissões na tabela browsing_history
GRANT ALL PRIVILEGES ON TABLE browsing_history TO pointcontrol_user;
GRANT USAGE, SELECT ON SEQUENCE browsing_history_id_seq TO pointcontrol_user;

-- Conceder permissões na tabela session_events
GRANT ALL PRIVILEGES ON TABLE session_events TO pointcontrol_user;
GRANT USAGE, SELECT ON SEQUENCE session_events_id_seq TO pointcontrol_user;

-- Verificar permissões (opcional)
SELECT grantee, privilege_type 
FROM information_schema.role_table_grants 
WHERE table_name = 'browsing_history';

SELECT grantee, privilege_type 
FROM information_schema.role_table_grants 
WHERE table_name = 'session_events';

