mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-02 02:14:36 -05:00
Fix Postgres Backups (#2113)
* Fix Postgres Backups * Changelog * Import * More accurate changelog
This commit is contained in:
@@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
- (**API**) Fix GraphQL `Filter` `notAll` and `notAny` being inversed
|
- (**API**) Fix GraphQL `Filter` `notAll` and `notAny` being inversed
|
||||||
- (**API**) Fix GraphQL `Filter` causing an UnsupportedOperationException when passing an empty list as a `Any` filter value
|
- (**API**) Fix GraphQL `Filter` causing an UnsupportedOperationException when passing an empty list as a `Any` filter value
|
||||||
- (**Build**) Fix CURL failing silently in builds
|
- (**Build**) Fix CURL failing silently in builds
|
||||||
|
- (**Backup/Database**) Fix backup creation slowdown when mapping chapters
|
||||||
|
|
||||||
## [v2.2.2100] + [WebUI: v20260508.01] - 2026-05-08
|
## [v2.2.2100] + [WebUI: v20260508.01] - 2026-05-08
|
||||||
|
|
||||||
|
|||||||
@@ -148,13 +148,11 @@ object ProtoBackupExport : ProtoBackupBase() {
|
|||||||
|
|
||||||
fun createBackup(flags: BackupFlags): InputStream {
|
fun createBackup(flags: BackupFlags): InputStream {
|
||||||
// Create root object
|
// Create root object
|
||||||
|
|
||||||
val backupMangas = BackupMangaHandler.backup(flags)
|
|
||||||
|
|
||||||
val backup: Backup =
|
val backup: Backup =
|
||||||
transaction {
|
transaction {
|
||||||
|
val backupMangas = BackupMangaHandler.backup(flags)
|
||||||
Backup(
|
Backup(
|
||||||
BackupMangaHandler.backup(flags),
|
backupMangas,
|
||||||
BackupCategoryHandler.backup(flags),
|
BackupCategoryHandler.backup(flags),
|
||||||
BackupSourceHandler.backup(backupMangas, flags),
|
BackupSourceHandler.backup(backupMangas, flags),
|
||||||
BackupGlobalMetaHandler.backup(flags),
|
BackupGlobalMetaHandler.backup(flags),
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import suwayomi.tachidesk.manga.model.dataclass.TrackRecordDataClass
|
|||||||
import suwayomi.tachidesk.manga.model.table.ChapterTable
|
import suwayomi.tachidesk.manga.model.table.ChapterTable
|
||||||
import suwayomi.tachidesk.manga.model.table.MangaStatus
|
import suwayomi.tachidesk.manga.model.table.MangaStatus
|
||||||
import suwayomi.tachidesk.manga.model.table.MangaTable
|
import suwayomi.tachidesk.manga.model.table.MangaTable
|
||||||
import suwayomi.tachidesk.manga.model.table.toDataClass
|
|
||||||
import suwayomi.tachidesk.server.database.dbTransaction
|
import suwayomi.tachidesk.server.database.dbTransaction
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
@@ -92,31 +91,31 @@ object BackupMangaHandler {
|
|||||||
.selectAll()
|
.selectAll()
|
||||||
.where { ChapterTable.manga eq mangaId }
|
.where { ChapterTable.manga eq mangaId }
|
||||||
.orderBy(ChapterTable.sourceOrder to SortOrder.DESC)
|
.orderBy(ChapterTable.sourceOrder to SortOrder.DESC)
|
||||||
.map {
|
.toList()
|
||||||
ChapterTable.toDataClass(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.includeChapters) {
|
if (flags.includeChapters) {
|
||||||
val chapterToMeta = Chapter.getChaptersMetaMaps(chapters.map { it.id })
|
val chapterToMeta =
|
||||||
|
Chapter.getChaptersMetaMaps(chapters.map { it[ChapterTable.id].value })
|
||||||
|
|
||||||
backupManga.chapters =
|
backupManga.chapters =
|
||||||
chapters.map {
|
chapters.map {
|
||||||
BackupChapter(
|
BackupChapter(
|
||||||
it.url,
|
url = it[ChapterTable.url],
|
||||||
it.name,
|
name = it[ChapterTable.name],
|
||||||
it.scanlator,
|
scanlator = it[ChapterTable.scanlator],
|
||||||
it.read,
|
read = it[ChapterTable.isRead],
|
||||||
it.bookmarked,
|
bookmark = it[ChapterTable.isBookmarked],
|
||||||
it.lastPageRead,
|
lastPageRead = it[ChapterTable.lastPageRead],
|
||||||
it.fetchedAt.seconds.inWholeMilliseconds,
|
dateFetch = it[ChapterTable.fetchedAt].seconds.inWholeMilliseconds,
|
||||||
it.uploadDate,
|
dateUpload = it[ChapterTable.date_upload],
|
||||||
it.chapterNumber,
|
chapterNumber = it[ChapterTable.chapter_number],
|
||||||
chapters.size - it.index,
|
sourceOrder = chapters.size - it[ChapterTable.sourceOrder],
|
||||||
it.lastModifiedAt,
|
lastModifiedAt = it[ChapterTable.lastModifiedAt],
|
||||||
it.version,
|
version = it[ChapterTable.version],
|
||||||
).apply {
|
).apply {
|
||||||
if (flags.includeClientData) {
|
if (flags.includeClientData) {
|
||||||
this.meta = chapterToMeta[it.id] ?: emptyMap()
|
this.meta = chapterToMeta[it[ChapterTable.id].value] ?: emptyMap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,10 +123,10 @@ object BackupMangaHandler {
|
|||||||
if (flags.includeHistory) {
|
if (flags.includeHistory) {
|
||||||
backupManga.history =
|
backupManga.history =
|
||||||
chapters.mapNotNull {
|
chapters.mapNotNull {
|
||||||
if (it.lastReadAt > 0) {
|
if (it[ChapterTable.lastReadAt] > 0) {
|
||||||
BackupHistory(
|
BackupHistory(
|
||||||
url = it.url,
|
url = it[ChapterTable.url],
|
||||||
lastRead = it.lastReadAt.seconds.inWholeMilliseconds,
|
lastRead = it[ChapterTable.lastReadAt].seconds.inWholeMilliseconds,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|||||||
Reference in New Issue
Block a user