-- Add religion column to profiles with PH-common defaults
ALTER TABLE profiles ADD COLUMN IF NOT EXISTS religion text NOT NULL DEFAULT 'catholic';

-- Add tracking consent column
ALTER TABLE profiles ADD COLUMN IF NOT EXISTS allow_tracking boolean NOT NULL DEFAULT false;

-- Seed Ramadan mode setting
INSERT INTO app_settings (key, value)
VALUES ('ramadan_mode', '{"enabled": false, "auto_detect": true}'::jsonb)
ON CONFLICT (key) DO NOTHING;

-- RLS: all authenticated users can read religion; users can update their own;
-- admins can update anyone's religion.
-- (Existing profile RLS already allows select; we only need to ensure update
-- policies cover the new columns.)
