Skip to content

fix(db): add manual migration from 38 to 37 to prevent data loss on downgrade#14

Open
kairosci wants to merge 6 commits into
mainfrom
fix/downgrade-migration
Open

fix(db): add manual migration from 38 to 37 to prevent data loss on downgrade#14
kairosci wants to merge 6 commits into
mainfrom
fix/downgrade-migration

Conversation

@kairosci
Copy link
Copy Markdown
Owner

@kairosci kairosci commented Jun 1, 2026

Problem

Users testing PRs or branches containing a database schema bump to version 38 (such as PR 3807) experience a fatal IllegalStateException when returning to main or downgrading to version 37. Room crashes because it requires a downgrade migration path that doesn't exist. Using destructive migration fallback on downgrade is not an option as it results in total user data loss.

Cause

When Room database is upgraded to version 38, returning to an older build running database version 37 triggers a downgrade path. Since no downgrade migration was provided in main, Room throws an exception: A migration from 38 to 37 was required but not found.

Solution

  • Added a manual downgrade migration MIGRATION_38_37 inside MusicDatabase.kt.
  • The migration safely drops the ArtistPageCache table (added in 38) and gracefully reverts the artist table structure to its schema at version 37 by reconstructing the table.
  • Removed destructive migration fallback on downgrade to guarantee no user data is wiped when downgrading.

Testing

  • Verified MusicDatabase.kt compiles successfully and the SQL matches the Room schema for version 37 exactly.
  • Ran ./gradlew :app:assembleFossDebug to ensure ksp verification passes.

Related Issues

kairosci added 6 commits June 1, 2026 19:32
…uto-playlists to fix NPE on Liked Music and Sounds from Shorts (MetrolistGroup#3856)
…trolistGroup#3793)

* feat(ui): add automatic tablet UI scaling with density adaptation

Fix icons, menu, text and everything being too small on tablets/phablets
by auto-scaling Compose density based on screen width class.
Also show NavigationRail on tablets in portrait mode.

* fix(ui): use container width for tablet detection to support multi-window
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