sqldelight
sqldelight copied to clipboard
Wrong sqlite generation when removing a column
SQLDelight Version
2.0.0
IDE Version
IntelliJ 2023.2
Dialect
SQLite
Describe the Bug
Having this table:
CREATE TABLE target (
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
created INTEGER AS Instant,
updated INTEGER AS Instant,
coacheeId TEXT NOT NULL,
cancelledAt INTEGER AS Instant,
cancelledReason INTEGER AS Int,
creatorCoachId TEXT
);
and removing 1 the last column, the plugin generates:
CREATE TABLE tmp_target (id TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL, created INTEGER, updated INTEGER, coacheeId TEXT NOT NULL, cancelledAt INTEGER, cancelledReason INTEGER);
INSERT INTO tmp_target (id, name, created, updated, coacheeId, cancelledAt, cancelledReason) SELECT (id, name, created, updated, coacheeId, cancelledAt, cancelledReason) FROM target;
DROP TABLE target;
ALTER TABLE tmp_target RENAME TO target;
which isn't valid though as you can't have ( & ) around the SELECT part of the query.
Stacktrace
No response