Skip to content

Commit

Permalink
version check not required
Browse files Browse the repository at this point in the history
  • Loading branch information
taehyunlim committed Jan 7, 2022
1 parent a966171 commit 978f0bd
Showing 1 changed file with 12 additions and 30 deletions.
42 changes: 12 additions & 30 deletions Setup/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,18 @@ public function uninstall(SchemaSetupInterface $schemaSetup, ModuleContextInterf

/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->setup]);

if (version_compare($context->getVersion(), '0.4.2', '<')) {
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp');
}

if (version_compare($context->getVersion(), '0.4.3', '<')) {
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_type');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_priority');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_type');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_priority');
}

if (version_compare($context->getVersion(), '1.0.2', '<')) {
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_start_date');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_end_date');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_start_date');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_end_date');
}

if (version_compare($context->getVersion(), '1.0.3', '<')) {
$eavSetup->removeAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'affirm_category_promo_id',
);
$eavSetup->removeAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'affirm_product_promo_id',
);
}
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_type');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_priority');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_type');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_priority');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_start_date');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_mfp_end_date');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_start_date');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_mfp_end_date');
$eavSetup->removeAttribute(Category::ENTITY, 'affirm_category_promo_id');
$eavSetup->removeAttribute(Product::ENTITY, 'affirm_product_promo_id');

// Drop tables
$schemaSetup->startSetup();
Expand Down

0 comments on commit 978f0bd

Please sign in to comment.