wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.94k stars 1.31k forks source link

discuss SQLite database migration to Room #9291

Open tech-mint opened 5 years ago

tech-mint commented 5 years ago

Room benefits:

Room is an ORM, Object Relational Mapping library. In other words, Room will map our database objects to Java objects. Room provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite.

Difference between SQLite and Room persistence library:-

In case of SQLite, There is no compile time verification of raw SQLite queries. But in Room there is SQL validation at compile time. As your schema changes, you need to update the affected SQL queries manually. Room solves this problem. You need to use lots of boilerplate code to convert between SQL queries and Java data objects. But, Room maps our database objects to Java Object without boilerplate code. Room is built to work with LiveData and RxJava for data observation, while SQLite does not.

I opened this issue to understand if there is a need for database migration to Google official ORM:

we highly recommend using Room instead of SQLite https://developer.android.com/training/data-storage/room/

designsimply commented 5 years ago

Thank you for raising this issue @tech-mint ! The question of using the Room DB in FluxC comes up from time to time and no decision to switch has been made as of yet. Do you have experience with migration to Room that you can comment on by chance?

stale[bot] commented 4 years ago

This issue has been marked as stale because:

Please comment with an update if you believe this issue is still valid or if it can be closed. This issue will also be reviewed for validity and priority (cc @designsimply).