Update tables
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package be.vandewalleh.tables
|
||||
|
||||
import be.vandewalleh.entities.Chapter
|
||||
import be.vandewalleh.extensions.uuidBinary
|
||||
import me.liuwj.ktorm.schema.*
|
||||
|
||||
object Chapters : Table<Chapter>("Chapters") {
|
||||
@@ -8,6 +9,6 @@ object Chapters : Table<Chapter>("Chapters") {
|
||||
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
|
||||
val noteUuid by uuidBinary("note_uuid").references(Notes) { it.note }
|
||||
val note get() = noteUuid.referenceTable as Notes
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package be.vandewalleh.tables
|
||||
|
||||
import be.vandewalleh.entities.Note
|
||||
import be.vandewalleh.extensions.uuidBinary
|
||||
import me.liuwj.ktorm.schema.*
|
||||
|
||||
object Notes : Table<Note>("Notes") {
|
||||
val id by int("id").primaryKey().bindTo { it.id }
|
||||
val uuid by uuidBinary("uuid").primaryKey().bindTo { it.uuid }
|
||||
val title by varchar("title").bindTo { it.title }
|
||||
val userId by int("user_id").references(Users) { it.user }
|
||||
val updatedAt by datetime("updated_at").bindTo { it.updatedAt }
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package be.vandewalleh.tables
|
||||
|
||||
import be.vandewalleh.entities.Tag
|
||||
import be.vandewalleh.extensions.uuidBinary
|
||||
import me.liuwj.ktorm.schema.*
|
||||
|
||||
object Tags : Table<Tag>("Tags") {
|
||||
val id by int("id").primaryKey().bindTo { it.id }
|
||||
val name by varchar("name").bindTo { it.name }
|
||||
val noteId by int("note_id").references(Notes) { it.note }
|
||||
val note get() = noteId.referenceTable as Notes
|
||||
val noteUuid by uuidBinary("note_uuid").references(Notes) { it.note }
|
||||
val note get() = noteUuid.referenceTable as Notes
|
||||
}
|
||||
Reference in New Issue
Block a user