Skip to content
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
wants to merge 82 commits into
base: develop
Choose a base branch
from
Draft

Conversation

JaniruTEC
Copy link
Contributor

@JaniruTEC JaniruTEC commented Oct 18, 2023

Summary by CodeRabbit

  • New Features

    • Introduced Room library for enhanced database management.
    • Added new tests for database creation, access, and migrations.
    • Implemented automatic and manual database migrations for improved data integrity.
    • Added new data access objects (DAOs) for Cloud, Update Check, and Vault entities.
  • 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.
    • Streamlined database access in repository implementations with dependency injection.
  • Bug Fixes

    • Fixed issues related to database migrations and entity mapping for a more stable user experience.
  • Refactor

    • Transitioned from GreenDao to Room for database operations, resulting in cleaner and more maintainable code.
    • Refined database migration logic to use Room's built-in migration features.
  • Documentation

    • Updated internal comments to reflect changes in database handling and migration processes.
  • Chores

    • Updated build configurations to include necessary Room library dependencies.

Replaced greenDAO dependency with androidx.room
Introduced database version 13
Introduced database version 14
@JaniruTEC JaniruTEC marked this pull request as draft October 18, 2023 13:52
@CLAassistant

This comment was marked as resolved.

*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
Room is designed to choose the journal mode itself if none is specified.
greenDAO's journal mode ("TRUNCATE") will stay for now because the journal mode has influence on the behavior caused by issue #529 [1] and because changing the journal mode complicates the migration further.
This can still be changed later.

*This commit is related to issue #529 [1]*

[1] #529
Replaced particular implementation of "fix" with call to freshly introduced, user-supplied mapping function (and added "RandomUUIDSQLMappingFunction" as new mapping function with that particular implementation)
Replaced "fixCompile" with direct instantiation of "CacheControlledSupportSQLiteStatement"
Updated static elements to be inner members of "CacheControlledSupportSQLiteDatabase" (and removed now unnecessary properties)
Changed computation logic of "sql" property in "CacheControlledSupportSQLiteQuery"

*This commit is related to issue #529 [1]*

[1] #529
Renamed package "org.cryptomator.data.db.cachecontrol" to "org.cryptomator.data.db.sqlmapping"
Renamed "CacheControlledSupportSQLiteDatabase.kt" to "MappingSupportSQLiteDatabase.kt"
Moved contents to new location

*This commit is related to issue #529 [1]*

[1] #529
Renamed class "CacheControlledSupportSQLiteDatabase" to "MappingSupportSQLiteDatabase"
Renamed class "CacheControlledSupportSQLiteOpenHelper" to "MappingSupportSQLiteOpenHelper"
Renamed class "CacheControlledSupportSQLiteOpenHelperFactory" to "MappingSupportSQLiteOpenHelperFactory"
Renamed inner class "CacheControlledSupportSQLiteStatement" to "MappingSupportSQLiteStatement"
Renamed inner class "CacheControlledSupportSQLiteQuery" to "MappingSupportSQLiteQuery"
Renamed method "fix" to "map" in "MappingSupportSQLiteDatabase"
Renamed method "fixWhereClause" to "mapWhereClause" in "MappingSupportSQLiteDatabase"
Renamed property "identifiers" to "mappedQueries" in "MappingSupportSQLiteQuery"
Renamed extension method "SupportSQLiteOpenHelper.Factory.asCacheControlled" to "SupportSQLiteOpenHelper.Factory.asMapped" in "MappingSupportSQLiteDatabase.kt"

*This commit is related to issue #529 [1]*

[1] #529
Moved "RandomUUIDSQLMappingFunction" from "MappingSupportSQLiteDatabase.kt" to new file "SQLiteCacheControl.kt"
Added extension function "SupportSQLiteOpenHelper.Factory.asCacheControlled" in "SQLiteCacheControl.kt" as wrapper for "asMapped" with "RandomUUIDSQLMappingFunction" as mapping function
Removed "RandomUUIDSQLMappingFunction" as default mapping function from extension function "SupportSQLiteOpenHelper.Factory.asMapped" in "MappingSupportSQLiteDatabase.kt"
Replaced call to "asMapped" with call to "asCacheControlled" in "DatabaseModule"

*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
See: c13b12f

*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
Calling "requery" on a cursor may cause the driver to re-use queries, which is unwanted behavior.

*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
Also moved compat method for "ContentValues.isEmpty"

*This commit is related to issue #529 [1]*

[1] #529
*This commit is related to issue #529 [1]*

[1] #529
This also makes the class compatible with "MappingSupportSQLiteDatabase"

*This commit is related to issue #529 [1]*

[1] #529
This also makes the test method compatible with "MappingSupportSQLiteDatabase"
Also added "assertIsUUID"

*This commit is related to issue #529 [1]*

[1] #529
See: b3449f0
Also See: c13b12f

*This commit is related to issue #529 [1]*

[1] #529
Added "ValueExtractor<T>" as type alias for "(T) -> Any?"
Changed argument declarations of "pseudo equality" methods and underlying implementations
Added "ValueExtractor<T>" as type declaration for existing value extractor sets

*This commit is related to issue #529 [1]*

[1] #529
Also added workaround for tests

*This commit is related to issue #529 [1]*

[1] #529
Changed "insert" to directly compile the mapped sql instead of creating a "MappingSupportSQLiteStatement"
Added check if the database is open to "compileStatement"

*This commit is related to issue #529 [1]*

[1] #529
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.

None yet

2 participants