@@ -26,15 +26,13 @@ class UpgradeSchema implements UpgradeSchemaInterface
26
26
public function upgrade (SchemaSetupInterface $ setup , ModuleContextInterface $ context )
27
27
{
28
28
$ setup ->startSetup ();
29
-
30
29
if (version_compare ($ context ->getVersion (), '2.0.1 ' , '< ' )) {
31
30
$ setup ->getConnection (self ::$ connectionName )->addIndex (
32
31
$ setup ->getTable ('quote_id_mask ' , self ::$ connectionName ),
33
32
$ setup ->getIdxName ('quote_id_mask ' , ['masked_id ' ], '' , self ::$ connectionName ),
34
33
['masked_id ' ]
35
34
);
36
35
}
37
-
38
36
if (version_compare ($ context ->getVersion (), '2.0.2 ' , '< ' )) {
39
37
$ setup ->getConnection (self ::$ connectionName )->changeColumn (
40
38
$ setup ->getTable ('quote_address ' , self ::$ connectionName ),
@@ -101,34 +99,51 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
101
99
);
102
100
}
103
101
if (version_compare ($ context ->getVersion (), '2.0.7 ' , '< ' )) {
104
- $ connection = $ setup ->getConnection (self ::$ connectionName );
105
- $ connection ->modifyColumn (
106
- $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
107
- 'telephone ' ,
108
- ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
109
- )->modifyColumn (
110
- $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
111
- 'fax ' ,
112
- ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
113
- )->modifyColumn (
114
- $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
115
- 'region ' ,
116
- ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
117
- )->modifyColumn (
118
- $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
119
- 'city ' ,
120
- ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
121
- );
102
+ $ this ->expandQuoteAddressFields ($ setup );
122
103
}
123
104
if (version_compare ($ context ->getVersion (), '2.0.8 ' , '< ' )) {
124
- $ connection = $ setup ->getConnection (self ::$ connectionName );
125
- $ connection ->modifyColumn (
126
- $ setup ->getTable ('quote ' , self ::$ connectionName ),
127
- 'remote_ip ' ,
128
- ['type ' => Table::TYPE_TEXT , 'length ' => 45 ]
129
- );
105
+ $ this ->expandRemoteIpField ($ setup );
130
106
}
131
-
132
107
$ setup ->endSetup ();
133
108
}
109
+
110
+ /**
111
+ * @param SchemaSetupInterface $setup
112
+ * @return void
113
+ */
114
+ private function expandRemoteIpField (SchemaSetupInterface $ setup )
115
+ {
116
+ $ connection = $ setup ->getConnection (self ::$ connectionName );
117
+ $ connection ->modifyColumn (
118
+ $ setup ->getTable ('quote ' , self ::$ connectionName ),
119
+ 'remote_ip ' ,
120
+ ['type ' => Table::TYPE_TEXT , 'length ' => 45 ]
121
+ );
122
+ }
123
+
124
+ /**
125
+ * @param SchemaSetupInterface $setup
126
+ * @return void
127
+ */
128
+ private function expandQuoteAddressFields (SchemaSetupInterface $ setup )
129
+ {
130
+ $ connection = $ setup ->getConnection (self ::$ connectionName );
131
+ $ connection ->modifyColumn (
132
+ $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
133
+ 'telephone ' ,
134
+ ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
135
+ )->modifyColumn (
136
+ $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
137
+ 'fax ' ,
138
+ ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
139
+ )->modifyColumn (
140
+ $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
141
+ 'region ' ,
142
+ ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
143
+ )->modifyColumn (
144
+ $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
145
+ 'city ' ,
146
+ ['type ' => Table::TYPE_TEXT , 'length ' => 255 ]
147
+ );
148
+ }
134
149
}
0 commit comments