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).
Symptom
Every ORDER BY change is classed unsafe/recreate (internal/loader/hcl/diff.go:263-266). ClickHouse supports
ALTER TABLE ... MODIFY ORDER BYin 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).