mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 15:34:17 +01:00
fix: deleting series could fail with foreign key error
This commit is contained in:
parent
5199ddf799
commit
97b53e5c96
3 changed files with 6 additions and 0 deletions
|
|
@ -18,5 +18,6 @@ interface ReadProgressRepository {
|
|||
fun deleteByBookId(bookId: String)
|
||||
fun deleteByBookIds(bookIds: Collection<String>)
|
||||
fun deleteByBookIdsAndUserId(bookIds: Collection<String>, userId: String)
|
||||
fun deleteBySeriesIds(seriesIds: Collection<String>)
|
||||
fun deleteAll()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ class SeriesLifecycle(
|
|||
val books = bookRepository.findAllBySeriesIds(seriesIds)
|
||||
bookLifecycle.deleteMany(books)
|
||||
|
||||
readProgressRepository.deleteBySeriesIds(seriesIds)
|
||||
collectionRepository.removeSeriesFromAll(seriesIds)
|
||||
thumbnailsSeriesRepository.deleteBySeriesIds(seriesIds)
|
||||
seriesMetadataRepository.delete(seriesIds)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ class ReadProgressDao(
|
|||
}
|
||||
}
|
||||
|
||||
override fun deleteBySeriesIds(seriesIds: Collection<String>) {
|
||||
dsl.deleteFrom(rs).where(rs.SERIES_ID.`in`(seriesIds)).execute()
|
||||
}
|
||||
|
||||
override fun deleteByBookIdsAndUserId(bookIds: Collection<String>, userId: String) {
|
||||
dsl.transaction { config ->
|
||||
config.dsl().deleteFrom(r).where(r.BOOK_ID.`in`(bookIds)).and(r.USER_ID.eq(userId)).execute()
|
||||
|
|
|
|||
Loading…
Reference in a new issue