yireo / magento2-replace-all

Meta-package to replace all optional Magento 2 modules
129 stars 33 forks source link

Uninstall vs replace after module was already installed and enabled #17

Closed magenx closed 4 years ago

magenx commented 4 years ago

i was into this issue some time, and it looks like if the module was already installed and has a lot of database data, simply removing it with composer leaves broken records in database. all the tables are in place. also if it was enabled it leads to some more consequenses.

introduced in magento docs module:uninstall command feels like correct way, but this command is broken too. it only removes module registration record, but keeps many broken tables with module data. also hangs at: Removing code from Magento codebase:

sorry but this approach is not good database cluttering must be avoided.

jissereitsma commented 4 years ago

Thanks for posting. But I don't consider this a complaint or issue with this repository, but simply with Magento in general. There are numerous things to say about the module:uninstall command but the worst thing is not the broken tables - actually the command is trying to prevent this from happening. Instead, the worst thing about it is that it is not fitting into deployment at all, because it suggests to run the command, manually modifying the composer JSON and lock file, while deployment best practices tell to never touch anything manually in production.

Database cluttering is an issue in Magento. Therefore, with any module that you remove, any database change you make, you should beware that sometimes manual cleaning is needed. But that does not mean that replacing composer packages using these replacements is a bad idea. It just points out that you should either deploy a minimal installation (using these replacements) from the very start, or that you remove packages from an existing installation with extreme care.

I'll close this issue, because it is not related to the replacement of composer packages, but actually to a problem with broken tables, not necessarily caused by this open source repository, but by implementing this maybe too late.