@@ -26,15 +26,13 @@ class UpgradeSchema implements UpgradeSchemaInterface
2626 public function upgrade (SchemaSetupInterface $ setup , ModuleContextInterface $ context )
2727 {
2828 $ setup ->startSetup ();
29-
3029 if (version_compare ($ context ->getVersion (), '2.0.1 ' , '< ' )) {
3130 $ setup ->getConnection (self ::$ connectionName )->addIndex (
3231 $ setup ->getTable ('quote_id_mask ' , self ::$ connectionName ),
3332 $ setup ->getIdxName ('quote_id_mask ' , ['masked_id ' ], '' , self ::$ connectionName ),
3433 ['masked_id ' ]
3534 );
3635 }
37-
3836 if (version_compare ($ context ->getVersion (), '2.0.2 ' , '< ' )) {
3937 $ setup ->getConnection (self ::$ connectionName )->changeColumn (
4038 $ setup ->getTable ('quote_address ' , self ::$ connectionName ),
@@ -101,34 +99,51 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
10199 );
102100 }
103101 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 );
122103 }
123104 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 );
130106 }
131-
132107 $ setup ->endSetup ();
133108 }
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+ }
134149}
0 commit comments