🐛 Fix issues on deleting library which is in use by deleted files

This commit is contained in:
Andrey Antukh 2022-09-05 13:17:01 +02:00 committed by Andrés Moya
parent 11018581ed
commit ce7eed5ea0
3 changed files with 21 additions and 22 deletions

View file

@ -488,11 +488,12 @@
;; --- Query: Files that use this File library
(def ^:private sql:library-using-files
"SELECT f.id,
"SELECT f.id,
f.name
FROM file_library_rel AS flr
INNER JOIN file AS f ON f.id = flr.file_id
WHERE flr.library_file_id = ?;")
FROM file_library_rel AS flr
JOIN file AS f ON (f.id = flr.file_id)
WHERE flr.library_file_id = ?
AND (f.deleted_at IS NULL OR f.deleted_at > now())")
(s/def ::library-using-files
(s/keys :req-un [::profile-id ::file-id]))