SqliteSchemaMigration
class SqliteSchemaMigration
Non-destructive schema migration shared by every SQLite DB in the SDK (#306, #309).
Until 26.10.2 every SDK DB used (int) LibraryInfo.VERSION_CODE as its version and dropped all its tables in onUpgrade/onDowngrade, so every SDK update (and every rollback) wiped them: the unsent upload queue and map cache (#306), the user's favourites and recently viewed places, location-marketing campaign state, property metadata, diagnostics and map overlays (#309).
The fix, per DB: the version is a constant LEGACY_VERSION_CODE_CEILING + revision that changes only when a table's CREATE SQL changes, and onUpgrade/onDowngrade call reconcileColumns for each table (rows kept) and then onCreate (CREATE TABLE IF NOT EXISTS for any table that was missing).
Types
Link copied to clipboard
enum Result
Outcome of reconcileColumns.
Properties
Functions
Link copied to clipboard
open fun reconcileColumns(@NonNull db: SQLiteDatabase, @NonNull createSql: String, @Nullable indexSql: String): SqliteSchemaMigration.Result
Bring an existing table's columns in line with
createSql while keeping its rows.