Repository navigation
Fix schema SQL index output - #265
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes git pkgs schema --format sql output so index definitions are emitted as valid SQLite DDL, aligning the SQL schema output with what SQLite actually stores in sqlite_master.sql.
Changes:
- Query
sqlite_masterfor(name, sql)and retain index DDL internally for SQL output. - Emit executable
CREATE INDEX/CREATE UNIQUE INDEXstatements (with statement termination) in SQL format output. - Add regression assertions ensuring SQL output no longer contains
(...)placeholders and includes expected index columns.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/schema.go | Reads index DDL from sqlite_master.sql and prints real index DDL in SQL schema output. |
| cmd/database_test.go | Adds regression coverage verifying SQL schema output contains real index columns and no placeholder (...). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
andrew
approved these changes
Jul 8, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
Verified locally: schema --format sql now emits real index DDL, JSON output unchanged, full suite + lint clean. Thanks!
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.
Fixes #259
Summary
Fixes
git pkgs schema --format sqlso index definitions use real SQLite DDL instead of placeholder column lists like(...).Changes
sqlite_master.sqlCREATE INDEX/CREATE UNIQUE INDEXstatements in SQL outputTesting
go test ./cmd -run TestSchemaCommandGIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1 go test ./...go tool golangci-lint run ./...