9 lines
333 B
SQL
9 lines
333 B
SQL
|
|
CREATE TABLE IF NOT EXISTS video_history (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
username VARCHAR(255) NOT NULL,
|
|
video_id UUID NOT NULL,
|
|
timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
FOREIGN KEY (username) REFERENCES users (username) ON DELETE CASCADE,
|
|
FOREIGN KEY (video_id) REFERENCES videos (id) ON DELETE CASCADE
|
|
);
|