-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Replaced greenDAO with androidx.room #506
Draft
JaniruTEC
wants to merge
127
commits into
develop
Choose a base branch
from
feature/dao-migration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
Replaced greenDAO dependency with androidx.room Introduced database version 13
Introduced database version 14
The method was a delegate to the "DaoSession#clear" method provided by greenDAO. Analysis of the generated code indicates that room doesn't cache results internally. Therefore clearing the cache to evict stale entries is unnecessary. See: https://web.archive.org/web/20230806043911/https://greenrobot.org/greendao/documentation/sessions/
This comment was marked as resolved.
This comment was marked as resolved.
Without this change room will create the app db itself on installation without running the migrations.
Unified the implementation of "testInsert" with the implemention of all tests contained in "MappingSupportSQLiteStatementTest" by first augmenting and moving the implementation of "testSingleNewBoundStatement" to a new method "testSingleCompiledStatement" and then using that method in "testInsert": > Previous control flows: >> "testNewBoundStatementX" -> ("testConsecutiveNewBoundStatements" ->) "testConsecutiveNewBoundStatements" -> "testSingleNewBoundStatement" -> *Verifications* >> "testInsert" -> *Verifications* > New control flows: >> "testNewBoundStatementX" -> ("testConsecutiveNewBoundStatements" ->) "testConsecutiveNewBoundStatements" -> "testSingleNewBoundStatement" -> "testSingleCompiledStatement" -> *Verifications* >> "testInsert" -> "testSingleInsert" -> "testSingleCompiledStatement" -> *Verifications* Removed extensions methods for "ContentValues" defined in "MappingSupportSQLiteDatabaseTest.kt" and replaced usages with calls to corresponding extension methods for "Iterable<Any?>?" defined in "MappingSupportSQLiteDatabaseTest.kt" *This commit is related to issue #529 [1]* [1] #529
Removed TODOs Added delegating method with closing logic and default arguments
Added room-grade-plugin to build Moved appropriate configuration to room-grade-plugin
Added logic to delete templates after use Improved template verification Changed binding type of templates from singleton to single-use Changed type of exposed binding to "InputStream" Updated "TemplateDatabaseContextTest", "CorruptedDatabaseTest", "CreateDatabaseTest" and "UpgradeDatabaseTest"
Refactored database configuration in "CreateDatabaseTest" and "UpgradeDatabaseTest" to follow standard laid out by production logic/other tests
Refactored "CreateDatabaseTest" and "UpgradeDatabaseTest" to close databases following the standard laid out by production logic/other tests
Moved WAL initialization from the "onConfigure" methods (via "applyDefaultConfiguration") of the database configurations to the corresponding instances of "SupportSQLiteOpenHelper" Updated extension method "applyDefaultConfiguration" for "SupportSQLiteDatabase" defined in "CryptomatorDatabase.kt" to no longer configure WAL but verify that it has been set properly in the corresponding "SupportSQLiteOpenHelper" *This commit is related to issue #529 [1]* [1] #529
Added "@VisibleForTesting" to "MappingSupportSQLiteQuery" and changed its visibility to internal *This commit is related to issue #529 [1]* [1] #529
Added missing fields defined by upstream v13 to "CloudEntity", "VaultEntity" and "AutoMigration14To15" Added room-generated database schema for v15 as "15.json" Moved "Upgrade12To13" and made it runnable Replaced calls in "Upgrade12To13" with matching "pre15"-calls Added "Upgrade12To13" to migration path in "DatabaseModule" -- About this commit, as well as 4aa1c90 and c9a0d3d: A new database version (13) introduced in the upstream by ac5f3ff/#547 [1] (merged into develop by 7a37c03) needs to be merged into the "feature/dao-migration"-branch used for working on #506 [2]. 4aa1c90 prepared the merge by bumping the versions defined by "feature/dao-migration" from 13 (l12-v1-r2-13) and 14 (l12-v2-r3-14) to 14 (l13-v1-r1-14) and 15 (l13-v2-r1-15). l13-v1-r1-14 supersedes l12-v1-r2-13 and l13-v2-r1-15 supersedes l12-v2-r3-14 by applying the changes introduced by the upstream v13. The relation between l13-v1-r1-14 and l13-v2-r1-15 is the same as between l12-v1-r2-13 and l12-v2-r3-14, i.e. the changes introduced by the upstream v13 are handled according to the semantics defined by that relation. 4aa1c90 deleted "13.json" (was l12-v1-r2-13) and replaced the content of "14.json" (was l12-v2-r3-14) with l13-v1-r1-14, which is the version that supersedes l12-v1-r2-13. It therefore changes the migration path from [...] -> v12 -> v13 (l12-v1-r2-13) -> v14 (l12-v2-r3-14) to [...] -> v12 -> [Not yet merged upstream v13] -> v14 (l13-v1-r1-14) -> v15 (l13-v2-r1-15). c9a0d3d merged the upstream v13 (c970438) into 4aa1c90 and made the migration path continuous again: [...] -> v12 -> upstream v13 -> v14 (l13-v1-r1-14) -> v15 (l13-v2-r1-15) This commit finishes this merge for the production source. It adds "15.json" with l13-v2-r1-15 as its content, which is the version that supersedes l12-v2-r3-14. Therefore "13.json" (l12-v1-r2-13) and "14.json" (l12-v2-r3-14) are superseded by "14.json" (l13-v1-r1-14) and "15.json" (l13-v2-r1-15) respectively. It also applies l13-v2-r1-15 to "CloudEntity" and "VaultEntity", as well as "AutoMigration14To15". [1] #547 [2] #506 Version definitions: l12-v1-r2-13: e1bd29a l12-v2-r3-14: 23887b4 l13-v1-r1-14: 9536283 l13-v2-r1-15: 074c77d
Uncommented the tests Removed outdated calls to "Upgrade0To1" Replaced calls to removed method "applyTo" with calls to "migrate"
Replaced raw arrays and consecutive invocations of migrations with usages of "MigrationContainer"
Moved initialization/property for "MigrationContainer" from "testOpenVersion0Database" to "setup"/class body Cleaned up "testOpenVersion0Database"
Replaced "openHelperFactory" property with method
Added "assertOrder" to simplify orders that contain multiple calls to the same assertion
Fixed "testOpenVersion0DatabaseVerifyStreamAccessed": "CorruptedDatabaseTest.kt:103" calls "RoomDatabase.compileStatement", which contains two calls to "writableDatabase" that were not previously accounted for. Fixed "testOpenDatabaseWithRecovery": The assertion in "CorruptedDatabaseTest.kt:129" is called by "PatchedCallback.onCreate" in "DatabaseOpenHelperFactory.kt:61", which is called by "FrameworkSQLiteOpenHelper.OpenHelper.innerGetDatabase". "PatchedCallback.onCreate" then calls "DatabaseCallback.onCreate", which then throws the "UnsupportedOperationException" ("DatabaseModule.kt:137") expected by the assertion in "CorruptedDatabaseTest.kt:123". However, it was not previously taken into account that "FrameworkSQLiteOpenHelper.OpenHelper.innerGetDatabase" discards the first thrown exception and tries again, which results in a second call to "PatchedCallback.onCreate" and therefore a second call to the assertion in "CorruptedDatabaseTest.kt:129" before the assertion in "CorruptedDatabaseTest.kt:123" is reached.
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.
Summary by CodeRabbit
New Features
improveddata integrity.Enhancements
Improved database operation efficiency by utilizing Kotlin's type alias and constructor-based entity creation.Enhanced database schema with the addition of entities for Cloud, Update Check, and Vault.Bug Fixes
Refactor
Documentation
Chores