Skip to content

Commit

Permalink
Merge pull request #657 from Nosto/hotfix/4.0.5
Browse files Browse the repository at this point in the history
Hotfix/4.0.5 - Add createProductCacheTable call to UpgradeSchema
  • Loading branch information
supercid authored Feb 28, 2020
2 parents b262d7c + 770026c commit 704fdcb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

# 4.0.5
* Fix an issue where product cache table was not created during upgrade

# 4.0.4
* Store cached Nosto product data as a base64 encoded string in database to avoid problems with character sets and collations
* Alter the type of cached product to be longtext to allow saving large product data sets
Expand Down
24 changes: 23 additions & 1 deletion Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,37 @@

namespace Nosto\Tagging\Setup;

use Exception;
use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Nosto\Tagging\Api\Data\CustomerInterface;
use Nosto\Tagging\Logger\Logger;
use Nosto\Tagging\Model\Product\Cache;
use Nosto\Tagging\Model\ResourceModel\Customer;
use Nosto\Tagging\Model\ResourceModel\Product\Cache as CacheResource;
use Zend_Db_Exception;

class UpgradeSchema extends Core implements UpgradeSchemaInterface
{
const PRODUCT_QUEUE_TABLE = 'nosto_tagging_product_queue';

/** @var Logger $loger */
private $loger;

/**
* UpgradeSchema constructor.
* @param Logger $loger
*/
public function __construct(Logger $loger)
{
$this->loger = $loger;
}

/**
* {@inheritdoc}
* @throws Zend_Db_Exception
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
Expand All @@ -59,10 +75,16 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
if (version_compare($fromVersion, '2.1.0', '<')) {
$this->addRestoreCartHash($setup);
}
if (version_compare($fromVersion, '4.0.0', '<=')) {
try {
$this->createProductCacheTable($setup);
} catch (Exception $e) {
$this->loger->exception($e);
}
}
if (version_compare($fromVersion, '4.0.3', '<=')) {
$this->productCacheDataToLongtext($setup);
}

$setup->endSetup();
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nosto/module-nostotagging",
"description": "Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.",
"type": "magento2-module",
"version": "4.0.4",
"version": "4.0.5",
"require-dev": {
"php": ">=7.1.0",
"phan/phan": "0.8.8",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
<!--suppress XmlUnboundNsPrefix -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Nosto_Tagging" setup_version="4.0.4"/>
<module name="Nosto_Tagging" setup_version="4.0.5"/>
</config>

0 comments on commit 704fdcb

Please sign in to comment.