
/* 
    Server Channels
*/
CREATE TABLE IF NOT EXISTS 'server_channels' (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    channel_id INTEGER NOT NULL,
    news_category_id INTEGER NOT NULL,
    active INTEGER NOT NULL,
    FOREIGN KEY (news_category_id) REFERENCES 'news_categories' (id)
        ON DELETE CASCADE
);


/* 
    News Articles
*/
CREATE TABLE IF NOT EXISTS 'news_articles' (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    url TEXT NOT NULL,
    server_channel_id INTEGER NOT NULL,
    FOREIGN KEY (server_channel_id) REFERENCES 'server_channels' (id)
        ON DELETE CASCADE
);


/* 
    News Categories
*/
CREATE TABLE IF NOT EXISTS 'news_categories' (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT UNIQUE NOT NULL
);
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('all');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('world');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('uk');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('north_america');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('entertainment');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('business');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('tech');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('science');
INSERT OR IGNORE INTO 'news_categories' (name) VALUES ('top_stories');
