-- V016: Add COPPA compliance fields to users table
-- COPPA (Children's Online Privacy Protection Act) requires:
-- 1. Users under 13 cannot create accounts
-- 2. Users 13-17 require parental consent (for apps collecting personal data)
-- 3. Must track consent date and verify age

-- Add date of birth field
ALTER TABLE users
ADD COLUMN date_of_birth DATE;

-- Add COPPA consent tracking fields
ALTER TABLE users
ADD COLUMN coppa_consent_given BOOLEAN DEFAULT FALSE,
ADD COLUMN coppa_consent_date TIMESTAMP,
ADD COLUMN parental_email VARCHAR(255);

-- Comments
COMMENT ON COLUMN users.date_of_birth IS 'User date of birth for COPPA age verification (required for compliance)';
COMMENT ON COLUMN users.coppa_consent_given IS 'Whether parental consent has been given for users 13-17';
COMMENT ON COLUMN users.coppa_consent_date IS 'Timestamp when parental consent was granted';
COMMENT ON COLUMN users.parental_email IS 'Parent/guardian email for users 13-17 requiring consent';
