From 542426c347c39037cc18861f0e59a4a4cccbd59b Mon Sep 17 00:00:00 2001 From: Jay Williams Date: Thu, 12 Aug 2021 10:57:53 -0500 Subject: [PATCH] Fix cross_border_type DB schema upgrade --- Setup/UpgradeSchema.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php index af4557c8..68a5490f 100644 --- a/Setup/UpgradeSchema.php +++ b/Setup/UpgradeSchema.php @@ -380,17 +380,22 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con // TODO: Consolidate with initial table creation above if (version_compare($context->getVersion(), '2.0.3', '<')) { - $setup->getConnection()->changeColumn( - $setup->getTable('avatax_cross_border_class'), - 'cross_border_type', - 'cross_border_type_id', - [ - 'type' => 'integer', - 'unsigned' => true, - 'nullable' => true, - 'length' => 11, - ] - ); + if ($setup->getConnection()->tableColumnExists( + 'avatax_cross_border_class', + 'cross_border_type' + )) { + $setup->getConnection()->changeColumn( + $setup->getTable('avatax_cross_border_class'), + 'cross_border_type', + 'cross_border_type_id', + [ + 'type' => 'integer', + 'unsigned' => true, + 'nullable' => true, + 'length' => 11, + ] + ); + } } if (version_compare($context->getVersion(), '2.0.4', '<')) {