mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-22 04:03:32 -05:00
Improve database column references and default category handling (#563)
* Improve default category handling and add cascade to references where possible * Minor fix for default category * Make the default category always first in the normalization
This commit is contained in:
@@ -8,8 +8,9 @@ package suwayomi.tachidesk.manga.model.table
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ReferenceOption
|
||||
|
||||
object CategoryMangaTable : IntIdTable() {
|
||||
val category = reference("category", CategoryTable)
|
||||
val manga = reference("manga", MangaTable)
|
||||
val category = reference("category", CategoryTable, ReferenceOption.CASCADE)
|
||||
val manga = reference("manga", MangaTable, ReferenceOption.CASCADE)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ package suwayomi.tachidesk.manga.model.table
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ReferenceOption
|
||||
import org.jetbrains.exposed.sql.ResultRow
|
||||
import org.jetbrains.exposed.sql.select
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
@@ -37,7 +38,7 @@ object ChapterTable : IntIdTable() {
|
||||
|
||||
val pageCount = integer("page_count").default(-1)
|
||||
|
||||
val manga = reference("manga", MangaTable)
|
||||
val manga = reference("manga", MangaTable, ReferenceOption.CASCADE)
|
||||
}
|
||||
|
||||
fun ChapterTable.toDataClass(chapterEntry: ResultRow) =
|
||||
|
||||
@@ -32,7 +32,6 @@ object MangaTable : IntIdTable() {
|
||||
val thumbnailUrlLastFetched = long("thumbnail_url_last_fetched").default(0)
|
||||
|
||||
val inLibrary = bool("in_library").default(false)
|
||||
val defaultCategory = bool("default_category").default(true)
|
||||
val inLibraryAt = long("in_library_at").default(0)
|
||||
|
||||
// the [source] field name is used by some ancestor of IntIdTable
|
||||
|
||||
@@ -8,11 +8,12 @@ package suwayomi.tachidesk.manga.model.table
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ReferenceOption
|
||||
|
||||
object PageTable : IntIdTable() {
|
||||
val index = integer("index")
|
||||
val url = varchar("url", 2048)
|
||||
val imageUrl = varchar("imageUrl", 2048).nullable()
|
||||
|
||||
val chapter = reference("chapter", ChapterTable)
|
||||
val chapter = reference("chapter", ChapterTable, ReferenceOption.CASCADE)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user