mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
Fix `ALTER TABLE ... RENAME COLUMN` for table-level `UNIQUE` and `PRIMARY KEY` constraints whose column expression includes `COLLATE`. Constraint expressions are now rewritten recursively, so collated column references are renamed instead of rejected as unexpected expressions. Adds SQLite conformance coverage for both table-level `UNIQUE` and `PRIMARY KEY` collations. Fixes #8764. SQLite accepts these renames; Turso previously returned `Unexpected expression in UNIQUE/PRIMARY KEY constraint` and left the schema unchanged. AI was used to inspect the repository and issue, reproduce the reported SQL behavior, implement the focused Rust and SQL-test changes, and run the validation commands. The patch was reviewed against the existing `rename_identifiers` helper and repository contribution guidance. ## Testing - `cargo +stable fmt --all -- --check` - SQL conformance `alter_table.sqltest`: 218 passed - Focused SQL conformance tests for table-level UNIQUE and PRIMARY KEY with COLLATE: 1 passed each - `cargo +stable test -p turso_core --lib rename_column`: 3 passed - Focused .NET aggregate helper test: 1 passed; 20 direct vstest repetitions passed after native SDK setup Reviewed-by: Mikaël Francoeur (@LeMikaelF) Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #8838