Question

I have used it as a fix for a few things but I feel as though I will never truly comprehend the issues until I understand what setup:upgrade is doing w/ the files behind the scenes. I've gone through A LOT of the docs on the magento website but none of them really answer what this command does, only specific situations to use it in combination with other commands.

Here is what I am curious about:
What does setup:upgrade do?
What are some scenarios where a person would use it?
Are there any circumstances in which someone should not use it?

Please explain this as thoroughly as possible.

Thank you.

Was it helpful?

Solution

setup:upgrade is used whenever you have installed a new module on your system. When you run this, Magento checks the setup_module table and it compares each module's schema_version and data_version against modules existing on your site. If any of the modules have a greater version number than the one on record in the setup_module table, the appropriate install script is run.

So the easiest way to understand it: any time you install a new module on your site, run it.

Other than that, I'm not sure what kind of 'fixes' you were able to use it for. Im guessing that there were modules that weren't installed on your site and after you ran it they became installed. If you were a user of Magento 1, you are likely used to modules installing automatically upon the first page load after they get added to your system, but Magento 2 does not work that way.

Thats it in a nutshell.

OTHER TIPS

Setup:upgrade is used to install a new module in the eCommerce store. When you run upgrade command then the module related information gets stored in the data base table. To have a look, go to phpmyadmin -> search your database name -> Search "setup_module" Table. You will be able to see module information such as Module Name, schema_version, data_version. I think I have resolved your query. For any other assistance, please let me know.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top