diff/sqlgen: support extend-only MODIFY ORDER BY instead of always unsafe/recreate
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 15
- Forks
- 2
- Avg merge
- 1h 1m
- Merged PRs (30d)
- 27
Description
Symptom
Every ORDER BY change is classed unsafe/recreate (internal/loader/hcl/diff.go:263-266). ClickHouse supports ALTER TABLE ... MODIFY ORDER BY in place when the change is extend-only (appending new columns that were just added in the same ALTER).
Impact
A common, safe evolution (add a column and extend the sorting key with it) is reported as "requires recreating the table" and produces no runnable DDL.
Fix direction
Detect the extend-only case (new ORDER BY = old ORDER BY + newly-added columns) and emit ADD COLUMN ..., MODIFY ORDER BY (...) in one ALTER; keep the unsafe/recreate classification for everything else.
Found in the 2026-07-02 deep-dive audit (docs/plans/2026-07-02-deep-dive-improvement-areas.md, B5).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in internal/loader/hcl/diff.go:263-266 and trace how ORDER BY changes are classified and rendered into migration DDL. Verify the extend-only case produces one ALTER with the added columns and MODIFY ORDER BY, while other ORDER BY changes remain marked unsafe/recreate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100