From 142b94722e7a3d769ae50122ac8296b1af529a1c Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Mon, 20 Apr 2020 00:11:47 +0200 Subject: [PATCH] Add title column to chapters --- api/resources/db/migration/V6__Update_chapter_table.sql | 2 ++ api/src/entities/Chapter.kt | 1 + api/src/tables/Chapters.kt | 1 + 3 files changed, 4 insertions(+) create mode 100644 api/resources/db/migration/V6__Update_chapter_table.sql diff --git a/api/resources/db/migration/V6__Update_chapter_table.sql b/api/resources/db/migration/V6__Update_chapter_table.sql new file mode 100644 index 0000000..1478385 --- /dev/null +++ b/api/resources/db/migration/V6__Update_chapter_table.sql @@ -0,0 +1,2 @@ +ALTER TABLE `Chapters` + ADD COLUMN `title` varchar(50); diff --git a/api/src/entities/Chapter.kt b/api/src/entities/Chapter.kt index 6ca869d..0498139 100644 --- a/api/src/entities/Chapter.kt +++ b/api/src/entities/Chapter.kt @@ -7,6 +7,7 @@ interface Chapter : Entity { val id: Int var number: Int + var title: String var content: String var note: Note } \ No newline at end of file diff --git a/api/src/tables/Chapters.kt b/api/src/tables/Chapters.kt index a8d7c8f..4651fda 100644 --- a/api/src/tables/Chapters.kt +++ b/api/src/tables/Chapters.kt @@ -11,6 +11,7 @@ object Chapters : Table("Chapters") { val id by int("id").primaryKey().bindTo { it.id } val number by int("number").bindTo { it.number } val content by text("content").bindTo { it.content } + val title by varchar("title").bindTo { it.title } val noteId by int("note_id").references(Notes) { it.note } val note get() = noteId.referenceTable as Notes } \ No newline at end of file