-- ============================================
-- TEMPLATE-SAAS: Sales Schema
-- Version: 1.0.0
-- Module: SAAS-018
-- ============================================

-- Create schema
CREATE SCHEMA IF NOT EXISTS sales;

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

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