learn-request-queue/db/30-votes.sql

8 lines
245 B
SQL

CREATE TABLE votes (
requestUrl varchar NOT NULL,
userId int NOT NULL,
PRIMARY KEY (requestUrl,userId),
FOREIGN KEY (requestUrl) REFERENCES requests(url) ON DELETE CASCADE,
FOREIGN KEY (userId) REFERENCES users(userId) ON DELETE CASCADE
);