Skip to content

Comments

refactor: move db queries into the owner service#4801

Draft
chronark wants to merge 3 commits intomainfrom
move-db-queries
Draft

refactor: move db queries into the owner service#4801
chronark wants to merge 3 commits intomainfrom
move-db-queries

Conversation

@chronark
Copy link
Collaborator

@chronark chronark commented Jan 21, 2026

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?

@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dashboard Ready Ready Preview, Comment Jan 21, 2026 8:41am
engineering Ready Ready Preview, Comment Jan 21, 2026 8:41am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this, it's from a previous PR, jj is hard lol

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant