fix: rename 'commit' column to 'commit_hash' in federation schema#202
Open
y405 wants to merge 1 commit intoSimplyLiz:mainfrom
Open
fix: rename 'commit' column to 'commit_hash' in federation schema#202y405 wants to merge 1 commit intoSimplyLiz:mainfrom
y405 wants to merge 1 commit intoSimplyLiz:mainfrom
Conversation
'commit' is a SQLite reserved keyword (COMMIT TRANSACTION). The modernc.org/sqlite driver enforces this strictly, causing 'ckb federation create' to fail with: SQL logic error: near "commit": syntax error (1) This blocks all federation functionality on affected platforms. Fix: rename the column to 'commit_hash' in: - remote_repos table schema (line 252) - remote_repos migration (line 382) - UpsertRemoteRepo INSERT (line 670) - GetRemoteRepos SELECT (line 681) - GetAllRemoteRepos SELECT (line 712) The Go struct field 'Commit' is unchanged — Scan() uses positional binding, not column name mapping. Fixes SimplyLiz#201
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.
Summary
ckb federation createfails on all platforms becausecommitis used as an unquoted column name in theremote_repostable schema.COMMITis a SQLite reserved keyword, and themodernc.org/sqlitedriver enforces this strictly.Error
Fix
Rename the column from
committocommit_hashin all 5 occurrences:remote_reposCREATE TABLEcommit TEXT→commit_hash TEXTremote_reposmigrationcommit TEXT→commit_hash TEXTUpsertRemoteRepoINSERTGetRemoteReposSELECTGetAllRemoteReposSELECTThe Go struct field
CachedRemoteRepo.Commitis unchanged —rows.Scan()uses positional binding, not column name mapping, so the field name is decoupled from the SQL column name.Testing
remote_repos.commitdirectlychurn_commits_30dandtx.Commit()(transaction commit) are unaffected — different tokensImpact
This is a blocking bug — federation is completely unusable without this fix. No workaround exists since schema initialization is the entry point for all federation operations.
Fixes #201