lilypuchi
05/14/2022, 6:07 AM0.sqm
CREATE TABLE IF NOT EXISTS entry(
...
);
1.sqm
PRAGMA foreign_keys=off;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS entry_temp(
...
key INTEGER,
FOREIGN KEY(key) REFERENCES ...
);
INSERT INTO entry_temp (...) SELECT * FROM entry;
DROP TABLE entry;
ALTER TABLE entry_temp RENAME TO entry;
COMMIT;
PRAGMA foreign_keys=on;
But upon running generateCommonMainDBInterface
task I get an error for with the following stacktrace.
> A failure occurred while executing com.squareup.sqldelight.gradle.SqlDelightTask$GenerateInterfaces
> Failed to compile SqlInsertStmtImpl(INSERT_STMT): [] :
INSERT INTO entry(...)
VALUES (?, ?, ?, ...)
java.lang.IllegalStateException: Cannot get reference table for psi type class sqldelight.com.alecstrong.sql.psi.core.psi.impl.SqlNewTableNameImpl
This INSERT
statement is written in the .sq
file and is syntactically correct.
However if I don’t rename the table and use entry_temp
as it is (with necessary changes in .sq
file as well), the task runs successfully.
Am I missing something here? blob thinking fasteygraber
05/15/2022, 2:06 AM