While setting up new module and after running php bin/magento setup:upgrade it started to clean cache and file and deleted all front end css and adminhtml css and all visual files. How Can I prevent this happen again as I need to make that module working?
[user@server html]$ php bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
/chroot/home/user/rootdir/html/generated/code/Composer
/chroot/home/user/rootdir/html/generated/code/Ebizmarts
/chroot/home/user/rootdir/html/generated/code/Magento
/chroot/home/user/rootdir/html/generated/code/Symfony
/chroot/home/user/rootdir/html/generated/code/Wyomind
The directory '/chroot/home/user/rootdir/html/generated/metadata/' doesn't
exist - skipping cleanup
/chroot/home/user/rootdir/html/pub/static/_po_compressor
/chroot/home/user/rootdir/html/pub/static/adminhtml
/chroot/home/user/rootdir/html/pub/static/deployed_version.txt
/chroot/home/user/rootdir/html/pub/static/frontend
/chroot/home/user/rootdir/html/var/view_preprocessed/pub
dotancohen
1,1306 silver badges21 bronze badges
1 Answer 1
You can use --keep-generated flag like
magento setup:upgrade --keep-generated
It will not remove static files and change only database schema and data if any.
check link for more
answered Sep 25, 2018 at 6:50
Ramkishan Suthar
4,0426 gold badges36 silver badges56 bronze badges
-
1What I misunderstood, that I should regenerate static files after doin gthat right? Its not that I want to keep generated, I just want to follow correct procedure which woul dbe to delete all in pub/static, and then regenerate them with setup:static-content:deploy, woul dthat be right procedure?SPL– SPL2018年09月25日 06:54:22 +00:00Commented Sep 25, 2018 at 6:54
-
If you are in developer mode then you don't need to run deploy command if you have right permissions on files & folders. If you are on production then you don't need to run deploy unless you have changes in static files. --keep-generated flag mainly effective when you are on production mode and you don't want to run static content deploy as it forces some downtime. Let me know if you still have any confusion on this.Ramkishan Suthar– Ramkishan Suthar2018年09月25日 08:50:34 +00:00Commented Sep 25, 2018 at 8:50
-
I understand now, only user kee generated when no impact on static files. Otherwise what is better environmet for module instal production or development?SPL– SPL2018年09月25日 12:04:13 +00:00Commented Sep 25, 2018 at 12:04
-
Generally what we did is that develop our project on local machine and after that deploy whole code on production server and then put this instance on production mode. If there is need to install a module after this you can use module enable command then run upgrade if it required with --keep-generated as I said earlier it will generate files in generated folder for this module only and won't clear all static files and generated files.Ramkishan Suthar– Ramkishan Suthar2018年09月25日 12:18:29 +00:00Commented Sep 25, 2018 at 12:18
default