ProductOpener::ProductSchemaChanges - convert product data between different schema versions
ProductOpener::ProductSchemaChanges is used to convert product data between different schema versions.
It can convert older product data (e.g. from old revisions of products) to the current schema version.
And for API backward compatibility, it can also convert the current product data to older schema versions.
Starting from March 2024, we will now include a new field in the product data called "schema_version", which will be an integer, starting at 1001.
The schema version will be incremented by 1 each time we make a change to the product data schema.
Products without a schema_version field will be considered to be at a schema version under 1000
We will keep a list of functions that can convert product data between different schema versions.
Convert product data between different schema versions.
Change in normalization of leading 0s.
2024/12/12 -
2012/03/14
- Remove the ingredients_hierarchy field, which was a duplicate of the ingredients_tags field - Taxonomize brands
The images object is restructured to separate uploaded images from selected images
The nutrition schema is updated to allow storing several nutrition sets
Set the per unit depending on the given product quantity unit, the serving quantity unit and on the fact that the created set is per 100g or per serving
The nutrition schema is updated to allow storing several nutrition input sets. To downgrade, we use only the aggregated set to generate the nutriments field.
This means that for some products, we will return less information in the downgraded version, as we will return only as sold data or prepared data, but not both as was possible in the 1002 version.
NOTE: this function used to be in Food.pm and it was used for the old nutrition data schema in the "nutriments" field.
It has been moved to this module as it is now needed only for schema upggrades.
--
Check if the product has nutrition data for the given type ("" or "_prepared").
NOTE: this function used to be in Food.pm and it was used for the old nutrition data schema in the "nutriments" field.
It has been moved to this module as it is now needed only for schema downgrades.
--
Input nutrition data is indicated per 100g or per serving. This function computes the nutrition data for the other quantity (per serving or per 100g) if we know the serving quantity.