fix(db): add manual migration from 38 to 37 to prevent data loss on downgrade#14
Open
kairosci wants to merge 6 commits into
Open
fix(db): add manual migration from 38 to 37 to prevent data loss on downgrade#14kairosci wants to merge 6 commits into
kairosci wants to merge 6 commits into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users testing PRs or branches containing a database schema bump to version 38 (such as PR 3807) experience a fatal
IllegalStateExceptionwhen returning tomainor 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
MIGRATION_38_37insideMusicDatabase.kt.ArtistPageCachetable (added in 38) and gracefully reverts theartisttable structure to its schema at version 37 by reconstructing the table.Testing
MusicDatabase.ktcompiles successfully and the SQL matches the Room schema for version 37 exactly../gradlew :app:assembleFossDebugto ensurekspverification passes.Related Issues