This commit is contained in:
2020-04-19 22:58:50 +02:00
parent e4d8bffe71
commit 51cb7d9a33
7 changed files with 63 additions and 9 deletions
+1
View File
@@ -12,4 +12,5 @@ object Chapters : Table<Chapter>("Chapters") {
val number by int("number").bindTo { it.number }
val content by text("content").bindTo { it.content }
val noteId by int("note_id").references(Notes) { it.note }
val note get() = noteId.referenceTable as Notes
}
+3 -2
View File
@@ -6,6 +6,7 @@ import me.liuwj.ktorm.schema.*
object Notes : Table<Note>("Notes") {
val id by int("id").primaryKey().bindTo { it.id }
val title by varchar("title").bindTo { it.title }
val user by int("user_id").references(Users) { it.user }
val updatedAt by datetime("last_viewed").bindTo { it.updatedAt }
val userId by int("user_id").references(Users) { it.user }
val updatedAt by datetime("updated_at").bindTo { it.updatedAt }
val user get() = userId.referenceTable as Users
}
+1
View File
@@ -9,4 +9,5 @@ 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
}