Browse Source

Added primary-colum to page_tag, formatted sql queries

master
Gisle Aune 7 years ago
parent
commit
eb8c8642b5
  1. 5
      tables.sql

5
tables.sql

@ -45,10 +45,11 @@ CREATE TABLE tag (
CREATE TABLE page_tag ( CREATE TABLE page_tag (
`page_id` CHAR(16) NOT NULL, `page_id` CHAR(16) NOT NULL,
`tag_id` CHAR(16) NOT NULL, `tag_id` CHAR(16) NOT NULL,
`primary` BOOLEAN NOT NULL,
PRIMARY KEY (`page_id`, `tag_id`), PRIMARY KEY (`page_id`, `tag_id`),
FOREIGN KEY (`page_id`) REFERENCES page(`id`) ON DELETE CASCADE, FOREIGN KEY (`page_id`) REFERENCES page(`id`) ON DELETE CASCADE,
FOREIGN KEY (`tag_id`) REFERENCES tag(`id`) ON DELETE CASCADE
FOREIGN KEY (`tag_id`) REFERENCES tag(`id`) ON DELETE CASCADE
); );
CREATE TABLE page_unread ( CREATE TABLE page_unread (
@ -57,5 +58,5 @@ CREATE TABLE page_unread (
PRIMARY KEY (`page_id`, `user_id`), PRIMARY KEY (`page_id`, `user_id`),
FOREIGN KEY (`page_id`) REFERENCES page(`id`) ON DELETE CASCADE, FOREIGN KEY (`page_id`) REFERENCES page(`id`) ON DELETE CASCADE,
FOREIGN KEY (`user_id`) REFERENCES user(`id`) ON DELETE CASCADE
FOREIGN KEY (`user_id`) REFERENCES user(`id`) ON DELETE CASCADE
); );
Loading…
Cancel
Save