From 7b7b9ff54ea59fefdd542b4e08bf97434e8843d7 Mon Sep 17 00:00:00 2001 From: SolsWebdesign Date: Tue, 16 May 2017 21:03:33 +0200 Subject: [PATCH 1/3] magento/magento2#7279 Bill-to Name and Ship-to Name trancated to 20 characters in backend Compared the lengths of firstname, middlename and lastname of table "quote_address" with those of "quote" (255, 40 and 255 resp.) and of "sales_order_address" (255, 255 and 255) and with sales_order (128, 128 and 128) and choose to go with 255, 40 and 255 since these are used in "quote" as well and these are the values I know from Magento 1.9 as well. The other values are a bit inconsistent. Tested. --- .../Magento/Quote/Setup/UpgradeSchema.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app/code/Magento/Quote/Setup/UpgradeSchema.php b/app/code/Magento/Quote/Setup/UpgradeSchema.php index deaef9c8a18c6..74333524497e1 100644 --- a/app/code/Magento/Quote/Setup/UpgradeSchema.php +++ b/app/code/Magento/Quote/Setup/UpgradeSchema.php @@ -46,6 +46,43 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con ] ); } + + if (version_compare($context->getVersion(), '2.0.2', '<')) { + $setup->getConnection(self::$connectionName)->changeColumn( + $setup->getTable('quote_address', self::$connectionName), + 'firstname', + 'firstname', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => 255, + 'comment' => 'Firstname' + ] + ); + } + if (version_compare($context->getVersion(), '2.0.2', '<')) { + $setup->getConnection(self::$connectionName)->changeColumn( + $setup->getTable('quote_address', self::$connectionName), + 'middlename', + 'middlename', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => 40, + 'comment' => 'Middlename' + ] + ); + } + if (version_compare($context->getVersion(), '2.0.2', '<')) { + $setup->getConnection(self::$connectionName)->changeColumn( + $setup->getTable('quote_address', self::$connectionName), + 'lastname', + 'lastname', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => 255, + 'comment' => 'Lastname' + ] + ); + } //drop foreign key for single DB case if (version_compare($context->getVersion(), '2.0.3', '<') && $setup->tableExists($setup->getTable('quote_item')) From 03da56ee61cd6d0e5cb529b2a1b6c5902eec0ce3 Mon Sep 17 00:00:00 2001 From: SolsWebdesign Date: Mon, 22 May 2017 08:17:19 +0200 Subject: [PATCH 2/3] magento/magento2#7279 Bill-to Name and Ship-to Name trancated to 20 characters in backend Compared the lengths of firstname, middlename and lastname of table "quote_address" with those of "quote" (255, 40 and 255 resp.) and of "sales_order_address" (255, 255 and 255) and with sales_order (128, 128 and 128) and choose to go with 255, 40 and 255 since these are used in "quote" as well and these are the values I know from Magento 1.9 as well. The other values are a bit inconsistent. Tested. Updated setup version of the Quote module to 2.0.5, moved all updates into a single if statement. --- .../Magento/Quote/Setup/UpgradeSchema.php | 25 ++++++++----------- app/code/Magento/Quote/etc/module.xml | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Quote/Setup/UpgradeSchema.php b/app/code/Magento/Quote/Setup/UpgradeSchema.php index 74333524497e1..b218ece780794 100644 --- a/app/code/Magento/Quote/Setup/UpgradeSchema.php +++ b/app/code/Magento/Quote/Setup/UpgradeSchema.php @@ -46,8 +46,16 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con ] ); } - - if (version_compare($context->getVersion(), '2.0.2', '<')) { + //drop foreign key for single DB case + if (version_compare($context->getVersion(), '2.0.3', '<') + && $setup->tableExists($setup->getTable('quote_item')) + ) { + $setup->getConnection()->dropForeignKey( + $setup->getTable('quote_item'), + $setup->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id') + ); + } + if (version_compare($context->getVersion(), '2.0.5', '<')) { $setup->getConnection(self::$connectionName)->changeColumn( $setup->getTable('quote_address', self::$connectionName), 'firstname', @@ -58,8 +66,6 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con 'comment' => 'Firstname' ] ); - } - if (version_compare($context->getVersion(), '2.0.2', '<')) { $setup->getConnection(self::$connectionName)->changeColumn( $setup->getTable('quote_address', self::$connectionName), 'middlename', @@ -70,8 +76,6 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con 'comment' => 'Middlename' ] ); - } - if (version_compare($context->getVersion(), '2.0.2', '<')) { $setup->getConnection(self::$connectionName)->changeColumn( $setup->getTable('quote_address', self::$connectionName), 'lastname', @@ -83,15 +87,6 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con ] ); } - //drop foreign key for single DB case - if (version_compare($context->getVersion(), '2.0.3', '<') - && $setup->tableExists($setup->getTable('quote_item')) - ) { - $setup->getConnection()->dropForeignKey( - $setup->getTable('quote_item'), - $setup->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id') - ); - } $setup->endSetup(); } } diff --git a/app/code/Magento/Quote/etc/module.xml b/app/code/Magento/Quote/etc/module.xml index f706b31daf21a..d0c52f9a713b6 100644 --- a/app/code/Magento/Quote/etc/module.xml +++ b/app/code/Magento/Quote/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + From b84e648e3e663ff9185f02fa0217ebf355e3c7a3 Mon Sep 17 00:00:00 2001 From: Joe Constant Date: Wed, 21 Jun 2017 09:17:48 -0600 Subject: [PATCH 3/3] Change version numbers to be lower This allows for other changes that are in develop to be potentially backported at a later date --- app/code/Magento/Quote/Setup/UpgradeSchema.php | 2 +- app/code/Magento/Quote/etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Quote/Setup/UpgradeSchema.php b/app/code/Magento/Quote/Setup/UpgradeSchema.php index b218ece780794..b4a730142b7a7 100644 --- a/app/code/Magento/Quote/Setup/UpgradeSchema.php +++ b/app/code/Magento/Quote/Setup/UpgradeSchema.php @@ -55,7 +55,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id') ); } - if (version_compare($context->getVersion(), '2.0.5', '<')) { + if (version_compare($context->getVersion(), '2.0.4', '<')) { $setup->getConnection(self::$connectionName)->changeColumn( $setup->getTable('quote_address', self::$connectionName), 'firstname', diff --git a/app/code/Magento/Quote/etc/module.xml b/app/code/Magento/Quote/etc/module.xml index d0c52f9a713b6..337117181e444 100644 --- a/app/code/Magento/Quote/etc/module.xml +++ b/app/code/Magento/Quote/etc/module.xml @@ -6,6 +6,6 @@ */ --> - +