-- Analytics Database Initialization -- This script is the source of truth for analytics database schema -- Infrastructure copies this to postgresql/init.d/ for Docker initialization -- Enable required extensions CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; CREATE EXTENSION IF NOT EXISTS pg_stat_statements; -- Create analytics schema CREATE SCHEMA IF NOT EXISTS analytics; -- Grant permissions GRANT ALL PRIVILEGES ON SCHEMA analytics TO lilith; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA analytics TO lilith; ALTER DEFAULT PRIVILEGES IN SCHEMA analytics GRANT ALL ON TABLES TO lilith; -- Set search path ALTER DATABASE lilith_analytics SET search_path TO analytics, public;