Fix/kobo library snapshot (#2051)

* Fix Kobo snapshot ownership and clean existing rows

* Add Kobo snapshot ownership and clean existing rows test.
This commit is contained in:
Doug Coffin
2026-01-01 01:00:29 -07:00
committed by GitHub
parent 52329e659c
commit 60524ee8a6
3 changed files with 164 additions and 1 deletions
@@ -0,0 +1,8 @@
DELETE ksb
FROM kobo_library_snapshot_book ksb
JOIN kobo_library_snapshot ks ON ks.id = ksb.snapshot_id
LEFT JOIN book b ON b.id = ksb.book_id
LEFT JOIN user_library_mapping ulm
ON ulm.library_id = b.library_id
AND ulm.user_id = ks.user_id
WHERE ulm.user_id IS NULL;