-
-
Notifications
You must be signed in to change notification settings - Fork 12
Use native SQLite ALTER TABLE RENAME COLUMN #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…OLUMN Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
|
@copilot and what about DropColumn? is this not also natively supported? |
|
@copilot and droptable and dd column? seems all to be now supprted. |
Yes, SQLite 3.35.0+ added native Native DROP COLUMN cannot drop:
Current RecreateTable provides:
The existing tests expect these behaviors (e.g., dropping PK columns, auto-removing FKs). Switching to native DROP COLUMN would require either:
For now, I kept RecreateTable for DROP COLUMN to maintain compatibility. RenameColumn was straightforward since SQLite's native command handles all references automatically. |
You're right! Looking at the code:
Native ADD COLUMN has been in SQLite since 3.1.3 (2005) with only minor limitations (can't add PK/UNIQUE columns). The current tests add simple nullable columns, which work fine with native support. I'll update AddColumn to use the native command. |
…support Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
SQLite 3.25.0+ supports
ALTER TABLE ... RENAME COLUMNnatively. The codebase was using a workaround that recreated the entire table.Changes
Removed SQLiteTransformationProvider.RenameColumn override (82 lines)
ALTER TABLE table RENAME COLUMN old TO newRemoveColumn unchanged
DROP COLUMN(3.35.0+) cannot drop PRIMARY KEY, UNIQUE, or foreign key-referenced columnsAddColumn unchanged
ADD COLUMN(3.1.3+) cannot add PRIMARY KEY or UNIQUE columnsRemoveTable (DropTable) - No changes needed
DROP TABLEcommand (no SQLite override exists)Example
All 134 SQLite tests pass.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.