-- ============================================================================
-- MIGRATION: Add acknowledged tracking to likes
-- ============================================================================
-- Run this migration to track when users have viewed received likes
-- Date: 2025-12-17
-- ============================================================================

-- Add acknowledged_at column to likes table if it doesn't exist
ALTER TABLE likes ADD COLUMN IF NOT EXISTS acknowledged_at TIMESTAMP DEFAULT NULL;

-- Create index on acknowledged_at for faster queries
CREATE INDEX IF NOT EXISTS idx_likes_acknowledged_at ON likes(acknowledged_at);

-- ============================================================================
-- VERIFICATION QUERIES (Run these to verify the changes)
-- ============================================================================
-- Check if acknowledged_at column exists:
-- SELECT column_name, data_type FROM information_schema.columns 
-- WHERE table_name='likes' AND column_name='acknowledged_at';

-- Count acknowledged vs unacknowledged likes:
-- SELECT 
--   COUNT(*) as total_likes,
--   COUNT(CASE WHEN acknowledged_at IS NOT NULL THEN 1 END) as acknowledged_likes,
--   COUNT(CASE WHEN acknowledged_at IS NULL THEN 1 END) as new_likes
-- FROM likes;
