View Single Post
Old 05-28-2020, 02:36 PM   #7
heretique
Junior Member
heretique began at the beginning.
 
Posts: 5
Karma: 10
Join Date: May 2020
Device: None
I don't want to store binary data into the sqlite db, just paths to where the attachment is added inside the book folder.

The solution you proposed sounds simpler but it has its limitations because you will be able to store only one file of a particular type as attachment (if you have two zip files you can't attach them both, or at least that's my understanding).

With the solution I propose, you store as many attachments as you like for a book, the attachments metadata (path, book_id, description) is stored in the attachments table and the actual attachments can be store inside the book folder or in a sub folder.

There may be some downsides that I don't see, but this solution actually keeps the attachments pretty loosely connected with the books just by id and doesn't affect existing code, maybe except UI part and cleanup code needed when someone moves a book or deletes it, in that case it needs to check and move and/or delete the attachments as well.
heretique is offline   Reply With Quote