🔧 Database Migration: Add source_url Field

⚠️ Important: This script will modify your database structure. Please backup your database before proceeding!

📋 Migration Preview

This migration will:

💡 What this enables:
Android app users will be able to click news items and read the full original content in an in-app WebView.

🗂️ SQL Commands to Execute

-- Add source_url column
ALTER TABLE `news_items` 
ADD COLUMN `source_url` varchar(1000) DEFAULT NULL 
AFTER `image_url`;

-- Add performance index
ALTER TABLE `news_items` 
ADD KEY `idx_source_url` (`source_url`(255));

-- Update existing RSS items
UPDATE news_items ni 
SET source_url = (
    SELECT rfi.link FROM rss_feed_items rfi 
    INNER JOIN rss_feeds rf ON rfi.feed_id = rf.id 
    WHERE rfi.title = ni.title AND rf.name = ni.source 
    LIMIT 1
)
WHERE ni.source IN (SELECT name FROM rss_feeds)
AND ni.source_url IS NULL;

🗑️ Security Notice: Please delete this file after running the migration!

Migration Script v1.1.0 - Telugu News Backend