Skip to content

Refactor: Use modern Room migration API#1407

Merged
cortinico merged 2 commits into
ChuckerTeam:mainfrom
SurajBichkunde39:refactor/update-destructive-migration
Jun 29, 2025
Merged

Refactor: Use modern Room migration API#1407
cortinico merged 2 commits into
ChuckerTeam:mainfrom
SurajBichkunde39:refactor/update-destructive-migration

Conversation

@SurajBichkunde39

Copy link
Copy Markdown
Contributor

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 in ChuckerDatabase.kt is 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.

Replaces the deprecated fallbackToDestructiveMigration() call with the new overloaded method. This aligns with Room 2.7.2+ recommendations and removes deprecation warnings.
@SurajBichkunde39 SurajBichkunde39 requested a review from a team as a code owner June 28, 2025 16:22
fun create(applicationContext: Context): ChuckerDatabase {
return Room.databaseBuilder(applicationContext, ChuckerDatabase::class.java, DB_NAME)
.fallbackToDestructiveMigration()
.fallbackToDestructiveMigration(dropAllTables = false)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.fallbackToDestructiveMigration(dropAllTables = false)
.fallbackToDestructiveMigration(dropAllTables = true)

as this will keep the existing behaviour

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 cortinico enabled auto-merge (squash) June 29, 2025 09:26
@cortinico cortinico merged commit be8c178 into ChuckerTeam:main Jun 29, 2025
7 checks passed
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.

2 participants