The columns are not removed when uninstalling the module #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Preconditions
Tested on this versions:
1. Magento 2.4.6-p1
2. Magento 2.4.6-p2
3. Module-version 1.2.5
Description
Upon installation of the module, three columns—gift_skus, gift_skus_discount, and gift_sku_qty—are added to the "salesrule" table. Additionally, the column is_gifts is introduced in the "quote_item" table. However, during the uninstallation of the module, these columns are not automatically deleted from the database, which could potentially lead to issues.
Steps to Reproduce
1: In the clean magento shop install the Magesuite-FreeGift module (composer require "creativestyle/magesuite-free-gift" ^1.0.0
and run the php bin/magento s:d:c && php bin/magento s:up)
2: After installing this module three column are added in ‘salesrule’ table the columns are gift_sku, gift_sku_discount, and
gift_sku_qty and in ‘quote_item’ Table the column is_gift is added
3: After try to uninsatll the module from shop using the below command one by one:
a-> php bin/magento module:disable MageSuite_FreeGift
b->php bin/magento s:up
c->php bin/magento module:enable MageSuite_FreeGift
d->php bin/magento module:uninstall -r MageSuite_FreeGift
e->php bin/magento s:up
4: After uninstalling the module check the “salesrule” and ”quote_item” table and the column that generate when we install the
module are not removed from these table when we uninstall the module. In the screenshot below you can see that after
uninstalling the module the columns(gift_sku, gift_sku_discount, and gift_sku_) are still in ‘salesrule’ table
Actual Result
When uninstalling the module the column are not removed from database
Expected Result
When we uninstall the module the column should be removed from database
Reason
In the module, only InstallSchema.php and UpgradeSchema.php files have been created. These files add the column when the module is installed, but there is no file to remove these columns when uninstalling the module