Add title column to chapters

This commit is contained in:
Hubert Van De Walle 2020-04-20 00:11:47 +02:00
parent 0335c1eb08
commit 142b94722e
3 changed files with 4 additions and 0 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE `Chapters`
ADD COLUMN `title` varchar(50);

View File

@ -7,6 +7,7 @@ interface Chapter : Entity<Chapter> {
val id: Int
var number: Int
var title: String
var content: String
var note: Note
}

View File

@ -11,6 +11,7 @@ object Chapters : Table<Chapter>("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
}