11
11
use Magento \Framework \Setup \ModuleContextInterface ;
12
12
use Magento \Framework \Setup \SchemaSetupInterface ;
13
13
use Magento \Framework \Setup \UpgradeSchemaInterface ;
14
+ use Magento \Framework \DB \Ddl \Table ;
14
15
15
16
/**
16
17
* Upgrade the Catalog module DB scheme
@@ -57,7 +58,13 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
57
58
$ setup ->getConnection ()->modifyColumn (
58
59
$ setup ->getTable ($ table ),
59
60
'customer_group_id ' ,
60
- ['type ' => 'integer ' , 'nullable ' => false ]
61
+ [
62
+ 'type ' => Table::TYPE_INTEGER ,
63
+ 'nullable ' => false ,
64
+ 'unsigned ' => true ,
65
+ 'default ' => '0 ' ,
66
+ 'comment ' => 'Customer Group ID ' ,
67
+ ]
61
68
);
62
69
}
63
70
$ this ->recreateCatalogCategoryProductIndexTmpTable ($ setup );
@@ -80,6 +87,37 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
80
87
'catalog_category_product_index_replica '
81
88
);
82
89
}
90
+
91
+ if (version_compare ($ context ->getVersion (), '2.2.2 ' , '< ' )) {
92
+ $ tables = [
93
+ 'catalog_product_entity_tier_price ' ,
94
+ 'catalog_product_index_price_cfg_opt_agr_idx ' ,
95
+ 'catalog_product_index_price_cfg_opt_agr_tmp ' ,
96
+ 'catalog_product_index_price_cfg_opt_idx ' ,
97
+ 'catalog_product_index_price_cfg_opt_tmp ' ,
98
+ 'catalog_product_index_price_final_idx ' ,
99
+ 'catalog_product_index_price_final_tmp ' ,
100
+ 'catalog_product_index_price_idx ' ,
101
+ 'catalog_product_index_price_opt_agr_idx ' ,
102
+ 'catalog_product_index_price_opt_agr_tmp ' ,
103
+ 'catalog_product_index_price_opt_idx ' ,
104
+ 'catalog_product_index_price_opt_tmp ' ,
105
+ 'catalog_product_index_price_tmp ' ,
106
+ ];
107
+ foreach ($ tables as $ table ) {
108
+ $ setup ->getConnection ()->modifyColumn (
109
+ $ setup ->getTable ($ table ),
110
+ 'customer_group_id ' ,
111
+ [
112
+ 'type ' => Table::TYPE_INTEGER ,
113
+ 'nullable ' => false ,
114
+ 'unsigned ' => true ,
115
+ 'default ' => '0 ' ,
116
+ 'comment ' => 'Customer Group ID ' ,
117
+ ]
118
+ );
119
+ }
120
+ }
83
121
$ setup ->endSetup ();
84
122
}
85
123
0 commit comments