Foreign keys in messages now delete when parent key is deleted

This commit is contained in:
shockrah
2020-11-01 22:33:25 -08:00
parent 41c28cc845
commit 543feef330
4 changed files with 13 additions and 14 deletions

View File

@@ -4,8 +4,6 @@ CREATE TABLE IF NOT EXISTS `messages`(
`time` BIGINT NOT NULL,
`content` VARCHAR(2048) NOT NULL,
`author_id` BIGINT UNSIGNED NOT NULL,
`channel_name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`author_id`) REFERENCES members(`id`),
FOREIGN KEY (`channel_name`) REFERENCES channels(`name`)
FOREIGN KEY (`author_id`) REFERENCES members(`id`) ON DELETE CASCADE
);