Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented Oct 7, 2025

Part of: WOOMOB-1339

Description

This PR updates our attribute schemas to support both Global and Local attributes.

Global attributes are defined independently, and can be reused across products/variations with a many to many relationship. Local attributes are defined per-product or variation, and have a one to many relationship.

We model this with two different tables, but it would make it more difficult to deal with the attributes as we'd need two relationships from the product/variation to its attributes.

Instead, I've opted to mirror the API approach. id remains, as an auto-generated integer, but now the attribute tables include a remoteAttributeID. Global attributes have a positive integer ID, while local attributes have the ID 0.

This approach means the data is denormalised.

Steps to reproduce

This can't be properly tested in the app yet, as the database isn't used in the POS UI.

You can put breakpoints in the POSCatalogPersistenceService.replaceAllCatalogData(_:siteID:) function and check that they are created, or find the SQLite database file from your simulator and open it with a tool like SQLPro... but mostly, just checking that it logs the expected number of products/variations being synced should be enough. We'll see any issues soon enough when it's in the UI, anyway.

You can get the database file for a running simulator by:

  1. run xcrun simctl get_app_container booted com.automattic.woocommerce data in the terminal
  2. Cmd-G in Finder and paste the path
  3. Open Documents
  4. You should see woo-local.sqlite

Screenshots

Screenshot of saved data including both local and remote attributes
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@joshheald joshheald added this to the 23.5 milestone Oct 7, 2025
@joshheald joshheald added type: task An internally driven task. feature: POS status: feature-flagged Behind a feature flag. Milestone is not strongly held. labels Oct 7, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 7, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16219-68f79cd
Version23.4
Bundle IDcom.automattic.alpha.woocommerce
Commit68f79cd
Installation URL1rp6rt29kqnjg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@joshheald joshheald requested a review from jaclync October 7, 2025 15:15
@joshheald joshheald marked this pull request as ready for review October 7, 2025 15:15
Copy link
Contributor

@jaclync jaclync left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :shipit: TIL about accessing simulator data with xcrun simctl get_app_container booted com.automattic.woocommerce data. Tested with DataGrip and the remote attribute ID column is set with zero and non-zero values.

@joshheald joshheald merged commit 1d87c2e into trunk Oct 8, 2025
14 checks passed
@joshheald joshheald deleted the woomob-1339-schema-global-attribute-support branch October 8, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS status: feature-flagged Behind a feature flag. Milestone is not strongly held. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants