-- PostgreSQL Extensions for Custom PHP Framework
-- Auto-loaded during database initialization

-- UUID Support
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

-- Performance Monitoring
CREATE EXTENSION IF NOT EXISTS "pg_stat_statements";

-- Full-Text Search (German + English)
CREATE EXTENSION IF NOT EXISTS "unaccent";

-- Fuzzy String Matching (for search features)
CREATE EXTENSION IF NOT EXISTS "pg_trgm";

-- Case-insensitive text type
CREATE EXTENSION IF NOT EXISTS "citext";

-- JSON Functions (additional to built-in JSONB)
-- Uncomment if needed:
-- CREATE EXTENSION IF NOT EXISTS "jsonb_plperl";

-- Cryptographic functions
CREATE EXTENSION IF NOT EXISTS "pgcrypto";

-- Framework-specific Schema
CREATE SCHEMA IF NOT EXISTS framework;

COMMENT ON SCHEMA framework IS 'Custom PHP Framework internal tables and functions';

-- Grant permissions
GRANT USAGE ON SCHEMA framework TO PUBLIC;
-- GRANT CREATE ON SCHEMA framework TO postgres;  -- Will be set via environment
