User::Account.server(database: "tmp/test.sqlite").first.
folders_dataset.offset(1).first
notes.
map(&:attachments).flatten.
find { |el| el.is_a?(User::ObjectTypes::EmbeddedPublicJpeg) &&
el.height > 700 &&
el.summary[/animal/i] }.
media_filepath
=> "Accounts//Media/F669B83A-0C47-408E-9645-015737F3B11F/Pasted Graphic.jpg"
Apple Notes' database structure is a fascinating product story. Notes started as a simple note-taking application that stored its content as raw HTML in a few simple tables. However, as the product grew and needed more features like collaboration, they had to make changes and add new columns and tables. They also implemented two flavors of CRDT-like algorithms that evolved over time: one for plaintext chunks and the other one for embedded objects like tables. On top of that, every change that Apple makes must be backward compatible to support legacy devices and systems; but backward-compatibility was not always possible and users had to go through “Migrate your Notes” steps, but it is again a product story.I wish that one day, someone from the development team would write an article about it.
[0] https://devlog.notespub.com/2022/08/site-generator-for-apple...