Add Chapters table

This commit is contained in:
2020-04-19 17:37:27 +02:00
parent e0ffbad105
commit 0dd4886846
3 changed files with 36 additions and 5 deletions
@@ -1,9 +1,13 @@
CREATE TABLE `Tags`
CREATE TABLE `Chapters`
(
`id` int PRIMARY KEY AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`note_id` int NOT NULL
`number` int NOT NULL,
`content` text NOT NULL,
`note_id` int NOT NULL
);
ALTER TABLE `Tags`
ADD FOREIGN KEY (`note_id`) REFERENCES `Notes` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `Chapters`
ADD FOREIGN KEY (`note_id`) REFERENCES `Notes` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `Notes`
DROP COLUMN `content`;