You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API 30 increases the SQLite version from 3.22.0 to 3.28.0. This breaks migrations when renaming a table which is referenced by a View, because ALTER_TABLE now updates Views. So this common code:
DROP TABLE Foo;
ALTER TABLE NewFoo RENAME TO Foo;
attempts to reference a table named Foo immediately after it was deleted and immediately before NewFoo is renamed to Foo.
It generates stack traces like this one (lifted from the article):
Caused by: android.database.sqlite.SQLiteException: error in view activityRecipient: no such table: main.instrumentLinkingConfig (code 1 SQLITE_ERROR)
at android.database.sqlite.SQLiteConnection.nativeExecute(SQLiteConnection.java:-2)
at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:707)
at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:621)
at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:46)
at com.squareup.sqldelight.android.AndroidPreparedStatement.execute(AndroidSqliteDriver.kt:2)
at com.squareup.sqldelight.android.AndroidSqliteDriver$execute$2.invoke(AndroidSqliteDriver.kt:2)
at com.squareup.sqldelight.android.AndroidSqliteDriver.execute(AndroidSqliteDriver.kt:4)
at com.squareup.sqldelight.android.AndroidSqliteDriver.execute(AndroidSqliteDriver.kt:10)
at com.squareup.scannerview.R$layout.execute$default(Unknown:1)
at com.squareup.cash.db.db.CashDatabaseImpl$Schema.migrate(CashDatabaseImpl.kt:819)
The simplest solution seems to be adding PRAGMA legacy_alter_table=ON once at the beginning of any migration which includes a table rename.
The text was updated successfully, but these errors were encountered:
API 30 increases the SQLite version from 3.22.0 to 3.28.0. This breaks migrations when renaming a table which is referenced by a
View
, becauseALTER_TABLE
now updatesView
s. So this common code:attempts to reference a table named
Foo
immediately after it was deleted and immediately beforeNewFoo
is renamed toFoo
.Alec Strong wrote a nice little article on it: https://www.alecstrong.com/2020/07/sqlite-sdk-30/
It generates stack traces like this one (lifted from the article):
The simplest solution seems to be adding
PRAGMA legacy_alter_table=ON
once at the beginning of any migration which includes a table rename.The text was updated successfully, but these errors were encountered: