diff --git a/web_server/database/app.db b/web_server/database/app.db index ce14124..ed438fe 100644 Binary files a/web_server/database/app.db and b/web_server/database/app.db differ diff --git a/web_server/database/streaming.sql b/web_server/database/streaming.sql index 33a17c5..358ce1b 100644 --- a/web_server/database/streaming.sql +++ b/web_server/database/streaming.sql @@ -41,11 +41,24 @@ CREATE TABLE streams stream_id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, title TEXT NOT NULL, - start_time DATETIME NOT NULL, + datetime DATETIME NOT NULL, num_viewers INTEGER NOT NULL DEFAULT 0, - isLive BOOLEAN NOT NULL DEFAULT 0, - vod_id INTEGER, - category_id NOT NULL, + category_id INTEGER NOT NULL, FOREIGN KEY (category_id) REFERENCES categories(category_id) ON DELETE CASCADE, FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE +); + +DROP TABLE IF EXISTS vods; +CREATE TABLE vods +( + vod_id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + title TEXT NOT NULL, + datetime DATETIME NOT NULL, + category_id INTEGER, + length INTEGER NOT NULL, + views INTEGER NOT NULL DEFAULT 0, + + FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE, + FOREIGN KEY (category_id) REFERENCES categories(category_id) ON DELETE CASCADE ); \ No newline at end of file diff --git a/web_server/database/testing_data.sql b/web_server/database/testing_data.sql index 8d5185e..445bed3 100644 --- a/web_server/database/testing_data.sql +++ b/web_server/database/testing_data.sql @@ -51,12 +51,20 @@ INSERT INTO categories (category_name) VALUES ('Sports'); -- Sample Data for streams -INSERT INTO streams (user_id, title, start_time, num_viewers, isLive, vod_id, category_id) VALUES -(1, 'Epic Gaming Session', '2025-01-25 18:00:00', 150, 1, NULL, 1), -(2, 'Live Music Jam', '2025-01-25 20:00:00', 350, 1, NULL, 2), -(3, 'Sketching Live', '2025-01-24 15:00:00', 80, 0, 201, 3), -(4, 'Math Made Easy', '2025-01-23 10:00:00', 400, 0, 202, 4), -(5, 'Sports Highlights', '2025-01-25 12:00:00', 500, 1, NULL, 5); +INSERT INTO streams (user_id, title, datetime, num_viewers, category_id) VALUES +(1, 'Epic Gaming Session', '2025-01-25 18:00:00', 150, 1), +(2, 'Live Music Jam', '2025-01-25 20:00:00', 350, 2), +(3, 'Sketching Live', '2025-01-24 15:00:00', 80, 3), +(4, 'Math Made Easy', '2025-01-23 10:00:00', 400, 4), +(5, 'Sports Highlights', '2025-01-25 12:00:00', 500, 5); + +-- Sample Data for vods +INSERT INTO vods (user_id, title, datetime, category_id, length, views) VALUES +(1, 'Epic Gaming Session', '2025-01-23 18:00:00', 1, 120, 500), +(2, 'Live Music Jam', '2025-01-21 20:00:00', 2, 180, 800), +(3, 'Sketching Live', '2025-01-22 15:00:00', 3, 90, 300), +(4, 'Math Made Easy', '2025-01-21 10:00:00', 4, 150, 600), +(5, 'Sports Highlights', '2025-01-19 12:00:00', 5, 210, 700); -- Sample Data for tags INSERT INTO tags(tag_name) VALUES diff --git a/web_server/database/users.sql b/web_server/database/users.sql index 954bc93..25b699b 100644 --- a/web_server/database/users.sql +++ b/web_server/database/users.sql @@ -8,6 +8,7 @@ CREATE TABLE users num_followers INTEGER NOT NULL, stream_key VARCHAR(60) NOT NULL, is_partnered BOOLEAN NOT NULL DEFAULT 0, + is_live BOOLEAN NOT NULL DEFAULT 0, bio VARCHAR(1024), current_stream_title VARCHAR(100),