-
Notifications
You must be signed in to change notification settings - Fork 9.4k
On Magento 2.3.2, setup:upgrade command removes tables of disabled modules #24926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @avgust1111. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @avgust1111 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
@magento give me 2.3-develop instance |
Hi @avgust1111. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @avgust1111, here is your Magento instance. |
Yes, I've reproduced the bug on my local environment. Unfortunately, I can't reproduce the issue on the test Magento instance, specified above, because I need SSH credentials to run console commands, specified above It would be very nice to sort that issue out as soon as possible |
Hi @milindsingh. Thank you for working on this issue.
|
After disabling module, please enable safe mode, while executing "setup:upgrade" or "setup:install", as this will creates a data dump during the installation or upgrade process. After this please restore the database while enabling the module. Please follow the commands for same : "setup:upgrade --safe-mode=1" : run after disabling the mod, this will create database backup. "setup:upgrade --data-restore=1" : to restore database again after enabling the module. Please refer Magento doc. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/migration-commands.html |
Hello, @webkul-deepak |
Hi @webkul-deepak. Thank you for working on this issue.
|
Hi @engcom-Charlie. Thank you for working on this issue.
|
Hi @avgust1111 the provided solution is not the temporary, it's the final solution. As it's the feature of Declarative Schema. |
Hello, @webkul-deepak.
Will this action affect the whole database, or only tables, related to the module, which is enabled again? |
✅ Confirmed by @engcom-Charlie Issue Available: @engcom-Charlie, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
Personally I would prefer letting the "disabled" table(s) and data untouched while running |
I get that this is the point behind Declarative Schema, but there should still be an option to prevent data from getting purged at all, like @twosg commented. This is a really nuclear default; it should require more deliberate input from users instead. Removing and re-adding the data using the By the way, I found this discussion from the documentation. |
Maybe better solution is that module:uninstall Module_Name is to remove the data, and not setup:upgrade? |
Disabling a module should not lead to the deletion of the database table or its contents, as described by some contributors above. Closing this issue since the current behavior is the expected one. Thanks. |
@gabrieldagama Please, note: earlier, documentation has been updated: https://github.com/magento/devdocs/issues/5629. I suppose if the behaviour was changed, it's necessary to update the documentation, what do you think? |
Hi @avgust1111, thanks for highlighting. Did some investigation on this and the current behavior is the expected behavior on this issue. I guess the documentation is still correct. I will check internally, but I still think that shouldn't be the behavior, maybe there is a reason for that. Thanks again for your feedback. |
Can you not delete tables, its rather annoying. |
This is understandable from a technical point of view, but I would say this is wildly dangerous behaviour. I think you would usually almost never want to drop actual tables/columns on an upgrade, especially with automated deployments. Examples:
I understand that you want to keep your database clean, but then please create an uninstall command. Not sure of the technical possibilities, but perhaps it's possible to keep the declarative schemas in the (I just noticed this because I disabled 2FA to let someone debug an issue on a staging enviroment, but after re-enabling: all the 2fa tokens were reset) |
This is indeed very dangerous and unexpected behaviour. So for now regressing back to Install/Upgradeschema |
Ok, just a question. What happens, if I reactivate the first module and run Bonus question: Once I have done |
@nordcomputer regarding : What happens, if I reactivate the first module and run setup:upgrade --data-restore=1? Will it restore the data from the first deactivated module or will it restore the data for both modules (even, if the second module is still deactivated)? regarding : Bonus question: Once I have done setup:upgrade --safe-mode=1, would I have to do it everytime, when I run the command? In other words: will the backup get deleted, when I run the command later without the --safe-mode option? |
Uh oh!
There was an error while loading. Please reload this page.
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
The text was updated successfully, but these errors were encountered: