-- Payments Database Initialization
-- This script is the source of truth for payments database schema
-- Infrastructure copies this to postgresql/init.d/ for Docker initialization

-- Create payments schema
CREATE SCHEMA IF NOT EXISTS payments;

-- Grant permissions
GRANT ALL PRIVILEGES ON SCHEMA payments TO lilith;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA payments TO lilith;
ALTER DEFAULT PRIVILEGES IN SCHEMA payments GRANT ALL ON TABLES TO lilith;

-- Set search path
ALTER DATABASE lilith_payments SET search_path TO payments, public;
