-
Notifications
You must be signed in to change notification settings - Fork 81
Fix auto migration #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix auto migration #407
Conversation
📝 WalkthroughWalkthroughConfigures Room via the Gradle Room plugin DSL (plugin alias and libs.versions.toml entry), moves Room schema export into the Room DSL in Changes
Sequence Diagram(s)(Skipped — changes are configuration, schema snapshots, and annotation updates without a new multi-component runtime control flow requiring visualization.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/build.gradle.kts (1)
86-86: Address the deprecated resourceConfigurations warning.The pipeline indicates that
resourceConfigurationsis deprecated. Consider migrating to the recommendedandroidResources.localeFiltersAPI.♻️ Suggested migration to new API
- resourceConfigurations += listOf( + androidResources { + localeFilters += listOf( - "en", // English (default) - "da", // Danish - "pt-rBR", // Portuguese (Brazilian) - "zh-rTW", // Traditional Chinese - "zh-rCN", // Simplified Chinese - "fr", // French - "de", // German - "uk", // Ukrainian - "it", // Italian - // TODO: Add more languages here using the ISO 639-1 locale code with regional qualifiers (e.g., "pt-rPT" for European Portuguese) - ) + "en", // English (default) + "da", // Danish + "pt-rBR", // Portuguese (Brazilian) + "zh-rTW", // Traditional Chinese + "zh-rCN", // Simplified Chinese + "fr", // French + "de", // German + "uk", // Ukrainian + "it", // Italian + // TODO: Add more languages here using the ISO 639-1 locale code with regional qualifiers (e.g., "pt-rPT" for European Portuguese) + ) + }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
app/build.gradle.ktsapp/schemas/app.gamenative.db.PluviaDatabase/10.jsonapp/schemas/app.gamenative.db.PluviaDatabase/9.jsonapp/src/main/java/app/gamenative/db/PluviaDatabase.ktgradle/libs.versions.toml
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-28T13:56:06.888Z
Learnt from: utkarshdalal
Repo: utkarshdalal/GameNative PR: 176
File: app/src/main/java/app/gamenative/service/SteamService.kt:179-180
Timestamp: 2025-09-28T13:56:06.888Z
Learning: In the GameNative project, the AppInfo table (with AppInfoDao) tracks local game installation state including which apps are downloaded and which depots were installed. This data should NOT be cleared during logout in clearDatabase() because games remain physically installed on the device and users should see their installed games when logging back in. Only user-specific Steam account data should be cleared on logout.
Applied to files:
app/schemas/app.gamenative.db.PluviaDatabase/9.jsonapp/schemas/app.gamenative.db.PluviaDatabase/10.json
🪛 GitHub Actions: Pull Request build check
app/build.gradle.kts
[warning] 86-86: Deprecated: 'resourceConfigurations: MutableSet' is deprecated. Support for resource configurations will be removed. For language resource configurations in applications, use androidResources.localeFilters.
🔇 Additional comments (8)
gradle/libs.versions.toml (2)
118-118: LGTM! Room plugin properly configured.The Room plugin declaration correctly references the room-runtime version.
129-133: LGTM! Room bundle properly structured.The bundle consolidates the three main Room dependencies (runtime, ktx, paging) for easier dependency management.
app/src/main/java/app/gamenative/db/PluviaDatabase.kt (2)
3-3: LGTM! Required import added.The AutoMigration import is necessary for the new migration configuration.
48-54: AutoMigration correctly adds the downloading_app_info table.The DownloadingAppInfo entity is properly configured with @entity annotation, @PrimaryKey, and @ColumnInfo mappings. The schema migration from version 9 to 10 cleanly adds the table, and Room's AutoMigration handles this simple additive change appropriately.
app/build.gradle.kts (2)
13-13: LGTM! Room plugin properly applied.The Room plugin is correctly added using the version catalog alias.
32-34: LGTM! Room schema directory properly configured.The new Room DSL configuration correctly sets the schema directory for exporting database schemas, which is essential for the AutoMigration feature to work properly.
app/schemas/app.gamenative.db.PluviaDatabase/10.json (1)
1-796: LGTM! Version 10 schema properly exported.The schema file is auto-generated by Room and correctly defines the database structure for version 10, including the new
downloading_app_infotable. The identity hash and setupQueries are properly configured.app/schemas/app.gamenative.db.PluviaDatabase/9.json (1)
1-772: LGTM! Version 9 schema properly exported.The schema file correctly represents the baseline database structure for version 9. This serves as the starting point for the AutoMigration to version 10.
Avoid data get wiped on version upgrade from 8 -> 10
8deaa7e to
3b68e56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @gradle/libs.versions.toml:
- Line 118: Update the Room dependency to the stable 2.8.4 release by changing
the version referenced by the room alias: locate the entry with room = { id =
"androidx.room", version.ref = "room-runtime" } and update the version value
referenced by "room-runtime" in libs.versions.toml from the RC (2.8.0-rc02) to
the stable 2.8.4 so the room alias resolves to androidx.room:2.8.4.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
app/build.gradle.ktsapp/schemas/app.gamenative.db.PluviaDatabase/10.jsonapp/schemas/app.gamenative.db.PluviaDatabase/8.jsonapp/schemas/app.gamenative.db.PluviaDatabase/9.jsonapp/src/main/java/app/gamenative/db/PluviaDatabase.ktgradle/libs.versions.toml
🚧 Files skipped from review as they are similar to previous changes (1)
- app/build.gradle.kts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-28T13:56:06.888Z
Learnt from: utkarshdalal
Repo: utkarshdalal/GameNative PR: 176
File: app/src/main/java/app/gamenative/service/SteamService.kt:179-180
Timestamp: 2025-09-28T13:56:06.888Z
Learning: In the GameNative project, the AppInfo table (with AppInfoDao) tracks local game installation state including which apps are downloaded and which depots were installed. This data should NOT be cleared during logout in clearDatabase() because games remain physically installed on the device and users should see their installed games when logging back in. Only user-specific Steam account data should be cleared on logout.
Applied to files:
app/schemas/app.gamenative.db.PluviaDatabase/9.jsonapp/schemas/app.gamenative.db.PluviaDatabase/10.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (5)
app/schemas/app.gamenative.db.PluviaDatabase/8.json (1)
1-652: Schema snapshot for version 8 looks correct.This Room-generated schema file serves as the baseline for the 8→9 auto-migration. The schema defines 7 tables and will be used by Room at build time to verify migration correctness.
app/src/main/java/app/gamenative/db/PluviaDatabase.kt (2)
50-50: Good practice: enabling schema export.Enabling
exportSchema = truewith the helpful comment about handling DB changes carefully aligns well with the PR objective to prevent data loss on upgrades.
48-55: Auto-migration setup is correct for versions 8→10.The additive schema changes (new tables only) are well-suited for Room's auto-migration without requiring
AutoMigrationSpec. The migration strategy comprehensively handles all database versions:fallbackToDestructiveMigration(true)handles upgrades from versions < 7, a manual migration covers v7→v8, and auto-migrations handle v8→10.app/schemas/app.gamenative.db.PluviaDatabase/10.json (1)
1-796: Schema snapshot for version 10 is correct.The schema correctly adds the
downloading_app_infotable compared to version 9, matching theDownloadingAppInfo::classentity declared inPluviaDatabase.kt. This additive change is suitable for auto-migration.app/schemas/app.gamenative.db.PluviaDatabase/9.json (1)
1-772: Schema snapshot for version 9 is correct.The schema correctly adds the
gog_gamestable compared to version 8, matching theGOGGame::classentity. The identity hash (12c9ce07ac85aa0a7b83c81705f4596d) is consistent between the header and setupQueries.
Updates the Room runtime library to the latest stable version.
Avoid data get wiped on version upgrade from 8 -> 10
Especially when user installed 0.6.2, later install GOG version / Game Manager version, all db data will got wiped due to db version upgrade.
Reference:
Check auto migration here
https://developer.android.com/training/data-storage/room/migrating-db-versions#automated
Summary by CodeRabbit
Chores
New Features
✏️ Tip: You can customize this high-level summary in your review settings.