Upgrade the Touch module
Edit on GitHubUpgrading from version 3.* to version 4.*
- Update/install
spryker/touchto at least 4.0.0 version. - Install the new database columns by running
vendor/bin/console propel:diff. Propel should generate a migration file with the changes. - Run
vendor/bin/console propel:migrateto apply the database changes. - Generate ORM models by running
vendor/bin/console propel:model:build. This command will updatespy_touch_storage, andspy_touch_searchclasses to have the newly createdfk_storecolumns and their relations. - Populate
fk_storerecords respectively tospy_touch_storage.key, andspy_touch_search.key.
Example migrations
- If you have a single Store,
spy_storecontains 1 row which represents your active store. Use itsspy_store.id_storevalue to update touch records. In our current example the store ID is considered: 1.
UPDATE spy_touch_storage SET fk_store = 1;
UPDATE spy_touch_search SET fk_store = 1;
```
2. If you have multiple Stores already, you will need to create a query which updates the `fk_store` values based on the records' key (if it contains the store information).
<br>Example update when the key has the following structure: `{STORE_NAME}.{LOCALE_NAME}.{ENTITY_NAME}.{ENTITY_ID}`.
```sql
MySql:
UPDATE spy_touch_storage JOIN spy_store SET spy_touch_storage.fk_store = spy_store.id_store
WHERE LOWER(spy_store.name) = LOWER(SUBSTR(`key`, 1, LOCATE(`key`, '.') - 1));
UPDATE spy_touch_search JOIN spy_store SET spy_touch_search.fk_store = spy_store.id_store
WHERE LOWER(spy_store.name) = LOWER(SUBSTR(`key`, 1, LOCATE(`key`, '.') - 1));
PostgreSql:
UPDATE spy_touch_storage SET fk_store = spy_store.id_store
FROM spy_store WHERE LOWER(spy_store.name) = LOWER(SUBSTR(key, 1, STRPOS(key, '.') - 1));
UPDATE spy_touch_search SET fk_store = spy_store.id_store
ROM spy_store WHERE LOWER(spy_store.name) = LOWER(SUBSTR(key, 1, STRPOS(key, '.') - 1));
-
The following deprecated methods were removed, check your code if you have custom calls or dependencies:
TouchFacadeInterface::bulkTouchActive()TouchFacadeInterface::bulkTouchInactive()TouchFacadeInterface::bulkTouchDeleted()TouchQueryContainerInterface::queryTouchEntries()TouchInterface::bulkUpdateTouchRecords()
You can find additional details on the Touch module release page.
-
The following methods have internal changes, check if you have customized them:
TouchQueryContainer::queryTouchDeleteStorageAndSearch()TouchRecord::removeTouchEntriesMarkedAsDeleted()
You can find additional details on the Touch module release page.
8. Note: Module requires PHP 7.1 from now on.
9. After these steps, your Touch module supports multi-store entities.
Thank you!
For submitting the form