diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php index 3594165..2a10ac5 100755 --- a/Setup/UpgradeSchema.php +++ b/Setup/UpgradeSchema.php @@ -205,82 +205,86 @@ protected function addExtraWidthSlideField(SchemaSetupInterface $setup) ); } + protected function addExtraImageField(SchemaSetupInterface $setup) { - $setup->getConnection()->changeColumn( - $setup->getTable('scandiweb_slider_slide'), - 'image', - 'desktop_image', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'nullable' => true, - 'comment' => 'Desktop Image location', - 'after' => 'title' - ] - ); + // Added only one columnName check, because it is impossible for others to not update if one was updated! + if ($setup->getConnection()->tableColumnExists('scandiweb_slider_slide', 'image')) { + $setup->getConnection()->changeColumn( + $setup->getTable('scandiweb_slider_slide'), + 'image', + 'desktop_image', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'nullable' => true, + 'comment' => 'Desktop Image location', + 'after' => 'title' + ] + ); - $setup->getConnection()->changeColumn( - $setup->getTable('scandiweb_slider_slide'), - 'image_2', - 'desktop_image_2', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'nullable' => true, - 'comment' => 'Desktop Image 2 location', - 'after' => 'embed_code' - ] - ); + $setup->getConnection()->changeColumn( + $setup->getTable('scandiweb_slider_slide'), + 'image_2', + 'desktop_image_2', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'nullable' => true, + 'comment' => 'Desktop Image 2 location', + 'after' => 'embed_code' + ] + ); - $setup->getConnection()->changeColumn( - $setup->getTable('scandiweb_slider_slide'), - 'image_3', - 'desktop_image_3', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'nullable' => true, - 'comment' => 'Desktop Image 3 location', - 'after' => 'slide_text_position_2' - ] - ); + $setup->getConnection()->changeColumn( + $setup->getTable('scandiweb_slider_slide'), + 'image_3', + 'desktop_image_3', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'nullable' => true, + 'comment' => 'Desktop Image 3 location', + 'after' => 'slide_text_position_2' + ] + ); - $setup->getConnection()->addColumn( - $setup->getTable('scandiweb_slider_slide'), - 'mobile_image', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'nullable' => true, - 'comment' => 'Mobile Image location', - 'after' => 'desktop_image' - ] - ); + $setup->getConnection()->addColumn( + $setup->getTable('scandiweb_slider_slide'), + 'mobile_image', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'nullable' => true, + 'comment' => 'Mobile Image location', + 'after' => 'desktop_image' + ] + ); - $setup->getConnection()->addColumn( - $setup->getTable('scandiweb_slider_slide'), - 'mobile_image_2', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'nullable' => true, - 'comment' => 'Mobile Image 2 location', - 'after' => 'desktop_image_2' - ] - ); + $setup->getConnection()->addColumn( + $setup->getTable('scandiweb_slider_slide'), + 'mobile_image_2', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'nullable' => true, + 'comment' => 'Mobile Image 2 location', + 'after' => 'desktop_image_2' + ] + ); - $setup->getConnection()->addColumn( - $setup->getTable('scandiweb_slider_slide'), - 'mobile_image_3', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'nullable' => true, - 'comment' => 'Mobile Image 3 location', - 'after' => 'desktop_image_3' - ] - ); + $setup->getConnection()->addColumn( + $setup->getTable('scandiweb_slider_slide'), + 'mobile_image_3', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'nullable' => true, + 'comment' => 'Mobile Image 3 location', + 'after' => 'desktop_image_3' + ] + ); + } } /** diff --git a/etc/module.xml b/etc/module.xml index e5b57b1..d1259ec 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -11,7 +11,7 @@ --> - +