Feature/update to exposed v0.57.0 (#1150)

* Update to exposed-migrations v3.5.0

* Update to kotlin-logging v7.0.0

* Update to exposed v0.46.0

* Update to exposed v0.47.0

* Update to exposed v0.55.0

* Update to exposed v0.56.0

* Update to exposed v0.57.0
This commit is contained in:
schroda
2024-12-08 05:49:11 +01:00
committed by GitHub
parent f926714544
commit 1d541a30ae
87 changed files with 463 additions and 359 deletions

View File

@@ -10,19 +10,18 @@ package suwayomi.tachidesk.manga.impl.backup.proto
import android.app.Application
import android.content.Context
import eu.kanade.tachiyomi.source.model.UpdateStrategy
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
import mu.KotlinLogging
import okio.Buffer
import okio.Sink
import okio.buffer
import okio.gzip
import org.jetbrains.exposed.sql.Query
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.manga.impl.CategoryManga
@@ -175,7 +174,7 @@ object ProtoBackupExport : ProtoBackupBase() {
fun createBackup(flags: BackupFlags): InputStream {
// Create root object
val databaseManga = transaction { MangaTable.select { MangaTable.inLibrary eq true } }
val databaseManga = transaction { MangaTable.selectAll().where { MangaTable.inLibrary eq true } }
val backup: Backup =
transaction {
@@ -224,7 +223,8 @@ object ProtoBackupExport : ProtoBackupBase() {
val chapters =
transaction {
ChapterTable
.select { ChapterTable.manga eq mangaId }
.selectAll()
.where { ChapterTable.manga eq mangaId }
.orderBy(ChapterTable.sourceOrder to SortOrder.DESC)
.map {
ChapterTable.toDataClass(it)
@@ -306,7 +306,7 @@ object ProtoBackupExport : ProtoBackupBase() {
.map { it[MangaTable.sourceReference] }
.distinct()
.map {
val sourceRow = SourceTable.select { SourceTable.id eq it }.firstOrNull()
val sourceRow = SourceTable.selectAll().where { SourceTable.id eq it }.firstOrNull()
BackupSource(
sourceRow?.get(SourceTable.name) ?: "",
it,

View File

@@ -7,6 +7,7 @@ package suwayomi.tachidesk.manga.impl.backup.proto
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
@@ -17,7 +18,6 @@ import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import mu.KotlinLogging
import okio.buffer
import okio.gzip
import okio.source
@@ -25,7 +25,7 @@ import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.insertAndGetId
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.graphql.types.toStatus
@@ -183,7 +183,8 @@ object ProtoBackupImport : ProtoBackupBase() {
backup.backupCategories.associate {
val dbCategory =
CategoryTable
.select { CategoryTable.name eq it.name }
.selectAll()
.where { CategoryTable.name eq it.name }
.firstOrNull()
val categoryId =
dbCategory?.let { categoryResultRow ->
@@ -275,7 +276,8 @@ object ProtoBackupImport : ProtoBackupBase() {
val dbManga =
transaction {
MangaTable
.select { (MangaTable.url eq manga.url) and (MangaTable.sourceReference eq manga.source) }
.selectAll()
.where { (MangaTable.url eq manga.url) and (MangaTable.sourceReference eq manga.source) }
.firstOrNull()
}
@@ -362,7 +364,7 @@ object ProtoBackupImport : ProtoBackupBase() {
// merge chapter data
val chaptersLength = chapters.size
val dbChapters = ChapterTable.select { ChapterTable.manga eq mangaId }
val dbChapters = ChapterTable.selectAll().where { ChapterTable.manga eq mangaId }
chapters.forEach { chapter ->
val dbChapter = dbChapters.find { it[ChapterTable.url] == chapter.url }

View File

@@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import okio.buffer
import okio.gzip
import okio.source
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.manga.impl.backup.proto.models.Backup
import suwayomi.tachidesk.manga.impl.track.tracker.TrackerManager
@@ -36,7 +36,7 @@ object ProtoBackupValidator {
val missingSources =
transaction {
sources.filter { SourceTable.select { SourceTable.id eq it.key }.firstOrNull() == null }
sources.filter { SourceTable.selectAll().where { SourceTable.id eq it.key }.firstOrNull() == null }
}
val trackers =