IcecatNV / magento-extension

MIT License
2 stars 9 forks source link

Module uninstall issue #15

Open bhavyamodi29 opened 10 months ago

bhavyamodi29 commented 10 months ago

Preconditions

Magento Version : 2.4.6-p2 Module Version : 2.0.0

Description

Whenever you try to uninstall the IceCat module, it gives you an error, as shown in "Screenshot - 1" , and you cannot uninstall the module. Also, whenever you disable the IceCat module and run the setup:upgrade command, five out of six tables in the database, generated through the "db_schema.xml" file by this module, get deleted. However, the remaining table named "icecat_queue_schedule"' in the database didn't get deleted, as shown in "Screenshot - 2".

Screenshot - 1

2023-11-22_17-21

Screenshot - 2

2023-11-22_17-12

Steps To Reproduce

  1. Get the clone of Magento Shop .
  2. Install the “ IceCat ” module. After that run the setup:upgrade command . (e.g. composer require icecat/magento2-extension after that php bin/magento setup:upgrade)
  3. Disable the module, and after that, run the setup:upgrade command. (e.g. php bin/magento module:disable Icecat_DataFeed after that php bin/magento setup:upgrade)
  4. After that , open the database and search just "icecat" and the table named “icecat_queue_schedule” will appear there. As you can see in the "Screenshot - 2".
  5. After enabling the above module try to uninstall the module , then the error occurs and the module cannot be uninstalled. As you can see in the "Screenshot - 1". (e.g. php bin/magento module:enable Icecat_DataFeed after that php bin/magento module:uninstall -r Icecat_DataFeed)

    Expected Result

    The module should get uninstalled , and all the tables should get deleted after disabling the module.

    Actual Result

    The module didn't get uninstalled , and one out of six tables didn't get deleted after disabling the module.

Reason

As I have checked in this file "icecat/magento2-extension/Setup/Patch/Data/CreateProductAttribute.php" , there is unnecessarily commented the whole line no. 220 to 224 . Due to this, the data of the connection variable wasn't received ahead as its previous part was commented. Also this part [ $this->categoryRepository->deleteByIdentifier($categoryId); ] is placed at the wrong place in the line no. 244 . As you can see in the "Screenshot - 3" . As a result , it throws an error while uninstalling this module . Also , I have I checked in this file "icecat/magento2-extension/etc/db_schema_whitelist.json" , there is missing part regarding "icecat_queue_schedule" table. So for that reason this table didn't get deleted.

Screenshot - 3

2023-11-22_18-49