-- ON DELETE -> CASCADE

ALTER TABLE `Notes`
    DROP CONSTRAINT `Notes_ibfk_1`;

ALTER TABLE `Notes`
    ADD FOREIGN KEY (`user_id`) REFERENCES `Users` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT;

ALTER TABLE `Chapters`
    DROP CONSTRAINT `Chapters_ibfk_1`;

ALTER TABLE `Chapters`
    ADD FOREIGN KEY (`note_id`) REFERENCES `Notes` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT;

ALTER TABLE `Tags`
    DROP CONSTRAINT `Tags_ibfk_1`;

ALTER TABLE `Tags`
    ADD FOREIGN KEY (`note_id`) REFERENCES `Notes` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT;