fix(db): implement manual migration for Android >=15 combatibility#565
Open
AlexKaridas wants to merge 1 commit into
Open
fix(db): implement manual migration for Android >=15 combatibility#565AlexKaridas wants to merge 1 commit into
AlexKaridas wants to merge 1 commit into
Conversation
Author
|
I tested this implementation and it seems that the #564 is resolved after these changes, hopefully nothing else was affected. |
|
What are we waiting for? |
|
seriously when is this gonna get merged i need my music |
I don't think the maintainers care about their users, I switched back to opentune. |
|
i think ill just compile this branch and hope that my phone wont reject this because its not signed by the creator |
Let me know how it goes! |
Author
|
I have been using this version since i built it , and it works fine btw |
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.
Title: Refactor: Consolidate Database Migrations (v28-34) and Improve Schema Safety
Overview
This PR introduces a comprehensive cleanup and fortification of our Room database migration logic. The primary goal is to consolidate recent migrations, standardize how we handle default values, and introduce reusable helpers to make future schema changes safer and less verbose.
Key Changes
Consolidated Migrations (v28 to v34)
Added a single, unified MIGRATION_28_34 to replace the individual auto-migrations for these versions in the @database annotation.
This consolidated migration handles adding columns, creating tables, and repairing default values, providing a cleaner and more predictable upgrade path.
Updated AppModule to use InternalDatabase.newInstance to ensure the new migration logic is applied correctly.
New Safety Helpers (safeAddColumn & fixSchema)
The Problem: Legacy migrations relied heavily on repetitive try/catch blocks and manual column existence checks, increasing the risk of human error.
The Solution: Introduced safeAddColumn and fixSchema helper functions.
Impact: Older migration specs (e.g., v21->v22, v23->v24) were refactored to use these helpers. This drastically reduces boilerplate, improves readability, and prevents migration crashes caused by duplicate columns.
Standardized Boolean Defaults
Standardized the default values for boolean columns in entity data classes (SongEntity, AlbumEntity, PlaylistEntity).
Switched from using .toString() on booleans to explicit string literals ("true"/"false"), ensuring strict consistency with Room and SQLite expectations.
Updated the 34.json schema file to reflect the new identity hash and these standardized setup queries.
Reviewer Notes
AI Assistance: Please note that AI tools were used to assist in generating parts of this refactoring and migration logic. Extra scrutiny during review is highly appreciated to ensure the schema changes and consolidated steps perfectly align with our specific database requirements.
To review the core logic changes, I recommend starting with the new safeAddColumn helper and the consolidated MIGRATION_28_34 implementation.
Note: The delegate property visibility in MusicDatabase was changed from private to internal to facilitate this new instantiation logic.