refactor: move db queries into the owner service#4801
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Comment |
chronark
commented
Jan 21, 2026
Collaborator
Author
There was a problem hiding this comment.
Ignore this, it's from a previous PR, jj is hard lol
chronark
commented
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's an idea, I am not sure yet if we want it, but instead of telling you what I had in mind, I just show you.
Our /pkg/db/queries are getting out of hand, it's hard to keep track and easy to reuse/update queries you shouldn't be updating. For example you might need just one more field returned, but other services might not, so they're now also loading data, they shouldn't load at all.
What if instead we moved the sql queries to each service and run a local generator?
The main schema would still be in /pkg/db (though I would rename that to /pkg/mysql to deduplicate the name). And each service (only sentinel in this demo) would just generate what it needs from that.
I think it's cleaner, and also helps with bazel caching, cause a change to the db doesn't nuke 90% of our cache.
Wdyt?