10 lines
333 B
MySQL
10 lines
333 B
MySQL
|
|
||
|
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
|
||
|
);
|