Refactor: Use modern Room migration API#1407
Merged
cortinico merged 2 commits intoJun 29, 2025
Merged
Conversation
Replaces the deprecated fallbackToDestructiveMigration() call with the new overloaded method. This aligns with Room 2.7.2+ recommendations and removes deprecation warnings.
cortinico
requested changes
Jun 28, 2025
| fun create(applicationContext: Context): ChuckerDatabase { | ||
| return Room.databaseBuilder(applicationContext, ChuckerDatabase::class.java, DB_NAME) | ||
| .fallbackToDestructiveMigration() | ||
| .fallbackToDestructiveMigration(dropAllTables = false) |
Member
There was a problem hiding this comment.
Suggested change
| .fallbackToDestructiveMigration(dropAllTables = false) | |
| .fallbackToDestructiveMigration(dropAllTables = true) |
as this will keep the existing behaviour
Contributor
Author
There was a problem hiding this comment.
Thanks for the feedback! Sorry, I had focused on making it a direct replacement for the old behavior and with that I might have misunderstood the documentation a bit. I've updated the PR to use dropAllTables = true as you suggested.
cortinico
approved these changes
Jun 29, 2025
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.
Replaces the deprecated fallbackToDestructiveMigration() call with the new overloaded method. This aligns with Room 2.7.2+ recommendations and removes deprecation warnings.
📷 Screenshots
No visual changes. This is a code-only refactoring.
📄 Context
While exploring the codebase, I noticed that the
fallbackToDestructiveMigration()method inChuckerDatabase.ktis marked as deprecated in recent versions of AndroidX Room (doc). The official documentation recommends switching to the new overloaded method (doc).📝 Changes
Replaced the call to .fallbackToDestructiveMigration() with .fallbackToDestructiveMigration(dropAllTables = false)
📎 Related PR
None.
🚫 Breaking
No breaking changes.
🛠️ How to test
Application continues to build and run correctly
⏱️ Next steps
None.