ah got it. Yeah ofc in a key-value store you have to implement that from scratch.
Btw if you ever need a SQLITE package for nostr events, I wrote this
It provides bare bone tables, but in the constructor you are free to add other schemas, or triggers, and you can even change or modify the default Query builder to take advantage of new tables, indices and so on.
GitHub
GitHub - pippellia-btc/nastro: A collection of plug&play and configurable databases for nostr
A collection of plug&play and configurable databases for nostr - pippellia-btc/nastro