-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Setup Room database #10977
Setup Room database #10977
Conversation
c636d05
to
d461d13
Compare
@tobiasKaminsky @AndyScherzinger this is still in an early stage, but I'd appreciate any input on the approach and your opinion about this in general |
57998c3
to
894db8c
Compare
Approach looks good to me and super happy to see this change being kicked off 👍 |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #10977 +/- ##
============================================
- Coverage 31.31% 30.98% -0.34%
+ Complexity 3282 3269 -13
============================================
Files 544 558 +14
Lines 41016 41505 +489
Branches 5681 5709 +28
============================================
+ Hits 12846 12859 +13
- Misses 26269 26724 +455
- Partials 1901 1922 +21
|
bab0a98
to
5498d62
Compare
@tobiasKaminsky @AndyScherzinger this is now ready for review. I still have to test migrations from 3.18-3.20, but since it's working from 3.10, I'd say it's a safe bet it will work for newer versions. I would also encourage smoketesting if possible. That being said, 3.10 is a semi-random point I chose for cutoff, as it's from January 2019, so almost 3 years old. Do you have any other idea of a "safe" point to test back to? Maybe 3.0? |
Tested back to 3.3.0, which is the oldest 3.x version I can find an APK for. |
I am only partially on duty this and next week, so it's unlikely that find the time to test drive this or next week 😔 |
Finally set the cutoff to 2.0 and dropped earlier migrations. 2.0 is the oldest that doesn't break (upgrade from 1.x to current 3.22 is broken too, not just in this PR). |
9fa34e1
to
798930a
Compare
2.0 is more than enough 👏 |
Awesome! |
/rebase |
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
See added comment for explanation Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Needed to enable auto-upgrades later Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
…projectionMap Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
They both have unused columns that were not removed in previous migrations, and this makes Room unhappy Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Migration from such old app versions is broken anyway, not only in the database, but also in sharedprefs Additionally, configure destructive migration for unsupported versions in Room Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
798930a
to
f049603
Compare
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/10977.apk |
blue-Light-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/10977-Screenshot-blue-Light-10-39 |
The point of this PR is to set up Room as a DB client, even if we are still using the FileContentProvider as an accessor for now.
After this is merged:
This is the first step in the recommended way to migrate an app to Room incrementally, when a full migration is not possible immediately.
After this is finalized and merged, it will be possible to write DAOs (and Repositories) for the introduced entities and progressively stop using the ContentProviders as a way to access the DB internally. It should also be possible to use Room's auto-migrations for future DB upgrades.
Resources:
https://developer.android.com/training/data-storage/room/sqlite-room-migration#incremental
https://medium.com/androiddevelopers/incrementally-migrate-from-sqlite-to-room-66c2f655b377
- added new migrations
[ ] TypeConverters for boolean <-> int etc?out of scope. let's get room working first