Skip to content

fix: Prevent OOM, actually prune the database#2012

Merged
nikclayton merged 1 commit intopachli:mainfrom
nikclayton:prune-properly
Dec 5, 2025
Merged

fix: Prevent OOM, actually prune the database#2012
nikclayton merged 1 commit intopachli:mainfrom
nikclayton:prune-properly

Conversation

@nikclayton
Copy link
Copy Markdown
Contributor

onPostMigrate(db: SupportSQLiteDatabase) is not called if Room is configured with a driver (see https://developer.android.com/reference/androidx/room/migration/AutoMigrationSpec#onPostMigrate(androidx.sqlite.db.SupportSQLiteDatabase)).

So the previous code wasn't running, the database wasn't being pruned, and users were seeing OOM crashes.

Fix this by overriding the version that takes SQLiteConnection. This requires a new database version because users may already have installed a version with the no-op migration.

`onPostMigrate(db: SupportSQLiteDatabase)` **is not called** if Room
is configured with a driver (see https://developer.android.com/reference/androidx/room/migration/AutoMigrationSpec#onPostMigrate(androidx.sqlite.db.SupportSQLiteDatabase)).

So the previous code wasn't running, the database wasn't being pruned,
and users were seeing OOM crashes.

Fix this by overriding the version that takes `SQLiteConnection`. This
requires a new database version because users may already have installed
a version with the no-op migration.
@nikclayton nikclayton changed the title fix: Actually prune the database fix: Prevent OOM, actually prune the database Dec 5, 2025
@nikclayton nikclayton merged commit 8f38fb7 into pachli:main Dec 5, 2025
27 checks passed
@nikclayton nikclayton deleted the prune-properly branch December 5, 2025 12:05
nikclayton added a commit to nikclayton/pachli-android that referenced this pull request Dec 5, 2025
`onPostMigrate(db: SupportSQLiteDatabase)` **is not called** if Room is
configured with a driver (see
https://developer.android.com/reference/androidx/room/migration/AutoMigrationSpec#onPostMigrate(androidx.sqlite.db.SupportSQLiteDatabase)).

So the previous code wasn't running, the database wasn't being pruned,
and users were seeing OOM crashes.

Fix this by overriding the version that takes `SQLiteConnection`. This
requires a new database version because users may already have installed
a version with the no-op migration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant