Store documents as BLOB instead of Base64 (TEXT) in SQLite
#332
Replies: 1 comment
-
|
Thanks for the detailed and well-reasoned proposal — you nailed both the trade-off and the fix. This shipped in v0.86.0. 🎉 What changed: local document files (and calendar attachments) are now stored as raw binary Benefits, as you predicted: ~25 % less disk for locally stored documents, and the Base64 encode-on-write / decode-on-read steps are gone. One honest nuance: the JSON API boundary still transports files as a Base64 data URL (JSON can't carry raw binary), so an incoming upload is still decoded once — but at-rest storage and the whole download path are now binary end-to-end. Migration: fully automatic on first start (schema migration v67), converted row-by-row to keep RAM bounded on small devices like a Raspberry Pi. It's idempotent, and WebDAV/DMS-backed documents are untouched. No manual action required. Release notes: https://github.com/ulsklyc/yuvomi/releases/tag/v0.86.0 Closing as resolved — thanks again for the excellent suggestion! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently took a look at how family documents are stored. Currently, uploaded files (like PDFs or images) are stored directly inside the SQLite database as Base64-encoded strings in a
TEXTcolumn (content_data).I completely understand and appreciate the benefits of this design:
oikos.db).While storing files in a database is generally not considered standard best practice, it makes a lot of sense for a self-hosted family planner due to the sheer simplicity of portability.
The Issue with Base64
However, storing binaries as Base64 text introduces notable overhead:
My Proposal
If files are to remain in the database, migrating the storage format to native binary BLOBs (
BLOB= Binary Large Object) in SQLite would be highly beneficial:What do you think? Would you be open to a migration of the
content_datacolumn toBLOB?Best regards!
Beta Was this translation helpful? Give feedback.
All reactions