-- ============================================
-- TEMPLATE-SAAS: Portfolio Schema
-- Version: 1.0.0
-- Module: SAAS-019
-- ============================================

-- Create schema
CREATE SCHEMA IF NOT EXISTS portfolio;

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

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