Upgrade the ProductLabelStorage module
Edit on GitHubUpgrading from version 1.* to version 2.*
Version 2.* of the ProductLabelStorage
module changes the storage data structure to maintain relations of product labels to stores.
Estimated migration time: 1 hour.
To upgrade to the new version of the module, do the following:
- Upgrade the
ProductLabelStorage
module to a new version:
composer require spryker/product-label-storage:"^2.0.0" --update-with-dependencies
-
Prepare the project for changes:
- Remove synchronization behavior setup from the
spy_product_label_dictionary_storage
table on the project level insrc/Pyz/Zed/ProductLabelStorage/Persistence/Propel/Schema/spy_product_label_storage.schema.xml
- Add the configuration on the project level in
src/Pyz/Zed/ProductLabelStorage/ProductLabelStorageConfig.php
:
<?php namespace Pyz\Zed\ProductLabelStorage; use Pyz\Zed\Synchronization\SynchronizationConfig; use Spryker\Shared\Publisher\PublisherConfig; use Spryker\Zed\ProductLabelStorage\ProductLabelStorageConfig as SprykerProductLabelStorageConfig; class ProductLabelStorageConfig extends SprykerProductLabelStorageConfig { /** * @return string|null */ public function getProductAbstractLabelSynchronizationPoolName(): ?string { return SynchronizationConfig::DEFAULT_SYNCHRONIZATION_POOL_NAME; } /** * @return string|null */ public function getProductLabelDictionarySynchronizationPoolName(): ?string { return SynchronizationConfig::DEFAULT_SYNCHRONIZATION_POOL_NAME; } /** * @return string|null */ public function getProductAbstractLabelEventQueueName(): ?string { return PublisherConfig::PUBLISH_QUEUE; } /** * @return string|null */ public function getProductLabelDictionaryEventQueueName(): ?string { return PublisherConfig::PUBLISH_QUEUE; } }
- Update the database schema and the generated data transfer classes:
console propel:install console transfer:generate
- Stop the scheduler:
console scheduler:suspend
- Remove synchronization behavior setup from the
-
Remove the deprecated plugins from:
- Pyz\Zed\Event\EventDependencyProvider
Spryker\Zed\ProductLabelStorage\Communication\Plugin\Event\Subscriber\ProductLabelStorageEventSubscriber
- Pyz\Zed\EventBehavior\EventBehaviorDependencyProvider
Spryker\Zed\ProductLabelStorage\Communication\Plugin\Event\ProductAbstractLabelEventResourceQueryContainerPlugin Spryker\Zed\ProductLabelStorage\Communication\Plugin\Event\ProductLabelDictionaryEventResourceQueryContainerPlugin
- Pyz/Zed/Synchronization/SynchronizationDependencyProvider
Spryker\Zed\ProductLabelStorage\Communication\Plugin\Synchronization\ProductAbstractLabelSynchronizationDataPlugin Spryker\Zed\ProductLabelStorage\Communication\Plugin\Synchronization\ProductLabelDictionarySynchronizationDataPlugin
-
Add the new plugins to:
- Pyz\Zed\Publisher\PublisherDependencyProvider
<?php namespace Pyz\Zed\Publisher; ... use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Publisher\ProductAbstractLabel\ProductAbstractLabelWritePublisherPlugin as ProductAbstractLabelStorageWritePublisherPlugin; use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Publisher\ProductAbstractLabelPublisherTriggerPlugin; use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Publisher\ProductLabelDictionary\ProductLabelDictionaryDeletePublisherPlugin as ProductLabelDictionaryStorageDeletePublisherPlugin; use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Publisher\ProductLabelDictionary\ProductLabelDictionaryWritePublisherPlugin as ProductLabelDictionaryStorageWritePublisherPlugin; use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Publisher\ProductLabelDictionaryPublisherTriggerPlugin; use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Publisher\ProductLabelProductAbstract\ProductLabelProductAbstractWritePublisherPlugin as ProductLabelProductAbstractStorageWritePublisherPlugin; ... use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider; class PublisherDependencyProvider extends SprykerPublisherDependencyProvider { /** * @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface[] */ protected function getPublisherPlugins(): array { return array_merge( ... $this->getProductLabelStoragePlugins(), ... ); } /** * @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherTriggerPluginInterface[] */ protected function getPublisherTriggerPlugins(): array { return [ ... new ProductAbstractLabelPublisherTriggerPlugin(), new ProductLabelDictionaryPublisherTriggerPlugin(), ... ]; } /** * @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface[] */ protected function getProductLabelStoragePlugins(): array { return [ new ProductAbstractLabelStorageWritePublisherPlugin(), new ProductLabelProductAbstractStorageWritePublisherPlugin(), new ProductLabelDictionaryStorageWritePublisherPlugin(), new ProductLabelDictionaryStorageDeletePublisherPlugin(), ]; } }
- Pyz\Zed\Synchronization\SynchronizationDependencyProvider
<?php namespace Pyz\Zed\Synchronization; ... use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Synchronization\ProductAbstractLabelSynchronizationDataRepositoryPlugin; use Spryker\Zed\ProductLabelStorage\Communication\Plugin\Synchronization\ProductLabelDictionarySynchronizationDataRepositoryPlugin; ... use Spryker\Zed\Synchronization\SynchronizationDependencyProvider as SprykerSynchronizationDependencyProvider; class SynchronizationDependencyProvider extends SprykerSynchronizationDependencyProvider { /** * @return \Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataPluginInterface[] */ protected function getSynchronizationDataPlugins(): array { return [ ... new ProductAbstractLabelSynchronizationDataRepositoryPlugin(), new ProductLabelDictionarySynchronizationDataRepositoryPlugin(), ... ]; } }
-
Refill storage:
- Truncate the
spy_product_label_dictionary_storage
database table:
TRUNCATE TABLE spy_product_label_dictionary_storage;
- Start the scheduler:
console scheduler:resume
- Remove all the stored data:
console sync:data product_label_dictionary
- Trigger the product label events to create new dictionary data:
console publish:trigger-events -r product_label_dictionary -i=all
- Sync all the dictionary data to the storage:
console sync:data product_label_dictionary
- Truncate the
Thank you!
For submitting the form