-- ============================================
-- TEMPLATE-SAAS: WhatsApp Schema
-- Version: 1.0.0
-- ============================================

-- Create schema
CREATE SCHEMA IF NOT EXISTS whatsapp;

-- Grant permissions
GRANT USAGE ON SCHEMA whatsapp TO template_saas_app;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA whatsapp TO template_saas_app;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA whatsapp TO template_saas_app;

-- Default privileges for future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA whatsapp
  GRANT ALL PRIVILEGES ON TABLES TO template_saas_app;
ALTER DEFAULT PRIVILEGES IN SCHEMA whatsapp
  GRANT ALL PRIVILEGES ON SEQUENCES TO template_saas_app;
