UPDATE: Added VOD table and moved is_live to the users table

This commit is contained in:
2025-02-05 13:48:42 +00:00
parent a7bbc75f3a
commit 4c79c80f3d
4 changed files with 32 additions and 10 deletions

View File

@@ -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
);