From 4ff9e5ae2ec61d3811e648780ee2c8565a6c5a48 Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Sun, 12 Apr 2020 17:45:12 +0200 Subject: [PATCH] Add Notes table in flyway migration --- api/resources/db/migration/V2__Create_note_table.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 api/resources/db/migration/V2__Create_note_table.sql 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