diff --git a/api/resources/db/migration/V2__Create_note_table.sql b/api/resources/db/migration/V2__Create_note_table.sql new file mode 100644 index 0000000..4904664 --- /dev/null +++ b/api/resources/db/migration/V2__Create_note_table.sql @@ -0,0 +1,11 @@ +CREATE TABLE `Notes` +( + `id` int PRIMARY KEY AUTO_INCREMENT, + `title` varchar(50) NOT NULL, + `content` text NOT NULL, + `user_id` int NOT NULL, + `last_viewed` datetime +); + +ALTER TABLE `Notes` + ADD FOREIGN KEY (`user_id`) REFERENCES `Users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; \ No newline at end of file