-
Notifications
You must be signed in to change notification settings - Fork 133
[WellSQL Migration] Migrate WCGlobalAttributeModel
to Room
#14464
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
base: trunk
Are you sure you want to change the base?
Conversation
FYI: Similarly to this 364c18d change, which completely removed everything 'WCAttributeTermModel', this related 'termsId' column/code is also unnecessary and can be safely removed from its associated 'WCGlobalAttributeModel' table.
FYI: This is done in preparation to the subsequent WellSQL to Room table migration.
FYI: This is done in preparation to the subsequent WellSQL to Room table migration.
FYI: This change includes but is not limited to the: - Entity Introduction - DAO Introduction (With Test) - WCAndroidDatabase Migration - Code Adjustments (Mapper, Store) - Test Adjustments (Mapper, Store)
PS: It is quite hard to make sense of all those chained scope function calls.
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
PR Comment: https://github.com/woocommerce/woocommerce-android/pull/ 14464#discussion_r2273455708
PR Comment: https://github.com/woocommerce/woocommerce-android/pull/ 14464#discussion_r2273455708
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #14464 +/- ##
============================================
+ Coverage 38.01% 38.08% +0.06%
+ Complexity 9229 9228 -1
============================================
Files 1993 1993
Lines 112506 112311 -195
Branches 14843 14809 -34
============================================
- Hits 42771 42770 -1
+ Misses 65839 65644 -195
- Partials 3896 3897 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the WCGlobalAttributeModel
from WellSQL to Room database as part of a broader effort to modernize the data persistence layer. The migration involves converting the model to a Room entity, creating a new DAO for database operations, updating the store to use Room instead of WellSQL utilities, and cleaning up unused attribute-related functionality.
Key Changes:
- Migrates
WCGlobalAttributeModel
from WellSQL to Room with new entity structure - Removes unused attribute CRUD operations and related test files
- Updates database version and adds migration to drop old WellSQL table
Reviewed Changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
WellSqlConfig.kt |
Increments database version and adds migration to drop WCGlobalAttributeModel table |
WCGlobalAttributeModel.kt |
Converts from WellSQL model to Room entity with updated field types |
GlobalAttributesDao.kt |
New Room DAO for global attributes database operations |
WCGlobalAttributeStore.kt |
Updated to use Room DAO instead of WellSQL utilities |
WCAndroidDatabase.kt |
Adds new entity and DAO to Room database configuration |
Various test files | Removes unused test fixtures and updates existing tests for Room migration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...lugin/src/main/kotlin/org/wordpress/android/fluxc/model/attribute/WCGlobalAttributeMapper.kt
Show resolved
Hide resolved
libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/store/WCGlobalAttributeStore.kt
Show resolved
Hide resolved
I swear @malinajirka, with Wojtek AFK from tomorrow, I just used |
Haha 🤣 , no worries at all. I'm adding it to my todo list, but since I was AFK yesterday, there is quite a lot there. I'll review it by the end of tomorrow the latest. |
🤣
I bet @malinajirka , hoping all is good! 🫂
This is not urgent, not at all, please review it when you get some extra space to breath... 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ParaskP7! Great job, I've reviewed the code and tested the changes.
I've encountered a small issue one time, but it's very likely unrelated to these changes and I haven't been able to reproduce it since. When I created a new variable product and added 3 attributes, the generate variations
button would tell me there are no attributes to generate the combinations from. However, when I left that screen and entered it again, I could generate them without issues. I tried to replicate it multiple times without success.
I believe this is good to merge . Leaving it open in case the above steps would give you some idea.
Closes: AINFRA-552
Relates To: #14453
Description
This PR migrates
WCGlobalAttributeModel
from WellSQL to Room database.FYI: This is a follow-up to #14453 and the removal of
WCAttributeTermModel
. This follow-up also removes thetermsId
column from theWCGlobalAttributeModel
table before the actual migration starts (6e07007).I now have a hypothesis about whether this
WCAttributeTermModel
table, thetermsId
column from theWCGlobalAttributeModel
table, and all the unnecessary logic within the corresponding Store/Rest/SQL classes (which btw, now got removed: 2f1b0e7). My hypothesis is, as part of this FluxC#1803 PR, especially after seeing this commit, Thomaz made all attribute related CRUD operations available no matter if there were to be used (or not). Most probably the plan was to use them at some point, but, that never actually happened. Thus, all this logic ended-up being unused, and at best only used within FluxC's example app.Testing information
Products
screen.Variable product
or change aPhysical product
to aVariable product
.Add variations
to navigate to theAdd attribute
screen.Color
orSize
) and see the list of option of that attribute.NEXT
twice, then press theGENERATE VARIATION
button and selectGenerate all variations
, following byOK
when the dialog appears.Add variations
again to navigate to theVariations
screen where you'll see the variations you added.SAVE
button to have these changes apply to the product.EXTRA
You might also want to add a new attribute on your store and see that everything is working as expected. To do so, follow the below instructions:
wp-admin
.Products
section, and within it, click on theAttributes
sub-section.Material
with thethe-material-of-the-product
slug.Configure terms
for that newly added attributed on that table, and then add a few terms for that attribute, following the instructions. For example, you could add a new term namedCotton
with thecotton-product-material
slug, etc. Add a few of those.Images/gif
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.