-- Migration: Track processed RSS items to prevent re-posting after they are deleted by retention policy
CREATE TABLE IF NOT EXISTS rss_processed_items (
    id INT AUTO_INCREMENT PRIMARY KEY,
    channel_id INT NOT NULL,
    rss_guid VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    UNIQUE KEY idx_channel_guid (channel_id, rss_guid),
    FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE
);
