FEAT UPDATE: Updated Utils to use new database. Changed route arguments. Added unfollow feature
This commit is contained in:
@@ -10,7 +10,7 @@ CREATE TABLE stream_tags
|
||||
(
|
||||
stream_id INTEGER NOT NULL,
|
||||
tag_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (stream_id) REFERENCES streams(stream_id),
|
||||
FOREIGN KEY (stream_id) REFERENCES streams(stream_id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (tag_id) REFERENCES tags(tag_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
@@ -58,13 +58,4 @@ CREATE TABLE followed_categories
|
||||
PRIMARY KEY (user_id, category_id),
|
||||
FOREIGN KEY(user_id) REFERENCES users(user_id) ON DELETE CASCADE,
|
||||
FOREIGN KEY(category_id) REFERENCES categories(category_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
SELECT s.stream_id, s.title, u.username, s.num_viewers, c.category_name
|
||||
FROM streams AS s
|
||||
JOIN users AS u ON u.user_id = s.user_id
|
||||
JOIN categories AS c ON s.category_id = c.category_id
|
||||
JOIN followed_categories AS f ON s.category_id = c.category_id
|
||||
WHERE f.user_id = ?
|
||||
ORDER BY s.num_viewers DESC
|
||||
LIMIT 25;
|
||||
);
|
||||
Reference in New Issue
Block a user