What Magento setup:upgrade Actually Does (In Depth)
On the surface setup:upgrade just “applies updates.” Underneath it is an ordered pipeline that reconciles your database with your code. Here is exactly what runs, in what order, and which tables it writes.