wallet/sql: add SQL build foundation - #1287
Open
Roasbeef wants to merge 2 commits into
Open
Conversation
In this commit, we add sqlc to the repository tool image and wire deterministic generation into the Makefile and CI. This gives each schema PR a mechanical check that the generated Go query surface matches the SQL checked into the tree. Extracted-from: e0666e0 Extracted-from: b6fbbb6 Extracted-from: 66cc4be Extracted-from: bd468f6
In this commit, we add the first SQLite + PostgreSQL schema slice for the port-first wallet. The block table uses the chain height as its natural key, keeps the backend-specific byte types explicit, and generates the same query surface for both backends. This lands only SQL assets and generated accessors. It does not route the wallet through a new store or change any public wallet API. Extracted-from: f6e0258 Extracted-from: 3d67ecd Extracted-from: e773de5 Extracted-from: 69e459b Extracted-from: 594bb0d Co-authored-by: Gustavo Stingelin <gustavo.stingelin@outlook.com> Co-authored-by: yyforyongyu <yong2452@gmail.com>
This was referenced Jul 11, 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.
In this PR, we add the SQL build foundation without routing any wallet operation through a new store or changing a public interface.
The source-history and attribution inventory lives separately in draft PR #1286. This PR is the first concrete cut and is based directly on
master.The change adds pinned sqlc tooling, generated-code checks, and the first SQLite and PostgreSQL schema slice for block metadata. The generated packages remain internal to the wallet, and both dialects use the same query contract.
This is the first Stage 1 PR in the port-first stack. It is intentionally limited to build support and block schema so later schema reviews can be evaluated independently from runtime and control-flow changes.
Verification:
make sqlc-checkgo test ./wallet/internal/sql/...wallet.Interface,waddrmgr,wtxmgr, or loader control flow