-- Migration: Add RSS support for announcement channels
CREATE TABLE IF NOT EXISTS channel_rss_feeds (
    id INT AUTO_INCREMENT PRIMARY KEY,
    channel_id INT NOT NULL,
    url VARCHAR(255) NOT NULL,
    last_fetched_at TIMESTAMP NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE
);

ALTER TABLE messages ADD COLUMN IF NOT EXISTS rss_guid VARCHAR(255) NULL;
CREATE INDEX IF NOT EXISTS idx_rss_guid ON messages(rss_guid);
