File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed
app/code/Magento/SalesRule Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2016 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \SalesRule \Setup ;
8
+
9
+ use Magento \Framework \Setup \UpgradeSchemaInterface ;
10
+ use Magento \Framework \Setup \ModuleContextInterface ;
11
+ use Magento \Framework \Setup \SchemaSetupInterface ;
12
+ use Magento \Framework \DB \Ddl \Table ;
13
+
14
+ /**
15
+ * Upgrade the SalesRule module DB scheme
16
+ */
17
+ class UpgradeSchema implements UpgradeSchemaInterface
18
+ {
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function upgrade (SchemaSetupInterface $ setup , ModuleContextInterface $ context )
23
+ {
24
+ $ setup ->startSetup ();
25
+
26
+ if (version_compare ($ context ->getVersion (), '2.0.1 ' , '< ' )) {
27
+ $ this ->addDefaultValueForDiscountStep ($ setup );
28
+ }
29
+
30
+ $ setup ->endSetup ();
31
+ }
32
+
33
+ /**
34
+ * Add default value of 0 for the discount step column
35
+ * @param SchemaSetupInterface $setup
36
+ * @return void
37
+ */
38
+ private function addDefaultValueForDiscountStep (SchemaSetupInterface $ setup )
39
+ {
40
+ $ connection = $ setup ->getConnection ();
41
+ $ connection ->modifyColumn (
42
+ $ setup ->getTable ('salesrule ' ),
43
+ 'discount_step ' ,
44
+ [
45
+ 'type ' => Table::TYPE_INTEGER ,
46
+ 'unsigned ' => true ,
47
+ 'nullable ' => false ,
48
+ 'default ' => '0 ' ,
49
+ 'comment ' => 'Discount Step ' ,
50
+ ]
51
+ );
52
+ }
53
+ }
Original file line number Diff line number Diff line change 6
6
*/
7
7
-->
8
8
<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
9
- <module name =" Magento_SalesRule" setup_version =" 2.0.0 " >
9
+ <module name =" Magento_SalesRule" setup_version =" 2.0.1 " >
10
10
<sequence >
11
11
<module name =" Magento_Rule" />
12
12
<module name =" Magento_Catalog" />
You can’t perform that action at this time.
0 commit comments