-- Add lastReadAt column to chat_group_members for tracking unread group messages
ALTER TABLE chat_group_members
ADD COLUMN IF NOT EXISTS last_read_at TIMESTAMP DEFAULT NOW() NOT NULL;

-- Update existing records to have current timestamp as lastReadAt
UPDATE chat_group_members
SET last_read_at = NOW()
WHERE last_read_at IS NULL;
