From e18479ee141e1663b5e4c74ed716de9390948b5d Mon Sep 17 00:00:00 2001 From: SolsWebdesign Date: Tue, 16 May 2017 21:03:33 +0200 Subject: [PATCH 1/2] 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 689bfde90dbd4..f8ddb099dbf38 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 3140cdf0bbb813fcdfb420c9292d9095d44a7443 Mon Sep 17 00:00:00 2001 From: SolsWebdesign Date: Mon, 22 May 2017 08:17:19 +0200 Subject: [PATCH 2/2] 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 f8ddb099dbf38..1cd6557b9641b 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 122cd3a287a93..a2ecbdccceeeb 100644 --- a/app/code/Magento/Quote/etc/module.xml +++ b/app/code/Magento/Quote/etc/module.xml @@ -6,6 +6,6 @@ */ --> - +