I am looking to upgrade an extension - for now I have been updating extensions by disabling - then uninstalling the old extension - and then installing and enabling the new extension. While that has worked for the most part, when I was going to upgrade Mosaico, I was worried if by using my typical method - I would lose all the templates I created. With that being said - is there a better way to upgrade the extension - and if I do what I typically do, will I lose any data?
Its a bad idea of upgrading as uninstall and install new version of extension. You can upgrade the extension either one of the following two ways:
If the extension is listed under CiviCRM extension page with auto-download as true then under CiviCRM extension page of your site you should be able to see an option for updating the extension(if option not available than make sure you have Resource URL set for extension correctly, CURL, WGET, ZIP extension installed on server).
You can also upgrade the extension manually by replacing the extension folder/files and then visit CiviCRM extension page in your site and click on refresh button. If the new extension requires db changes than you will be prompted with an option on top right of the browser to run db upgrade. Run the upgrade and its ready for use.
CiviCRM stores extension settings in civicrm_setting and civicrm_managed table. But some extension have their own install code to store data in various table, uninstalling the extension will lead to loss of such data as incase of mosaico extension. It is recommended to follow upgrade pattern for upgrading any extension.
Note: Always take backup of db and files before performing upgrade.
based on this https://docs.civicrm.org/sysadmin/en/latest/customize/extensions/#upgrading-extensions you are correct that an uninstall will remove any data related to that extension.
That url also has instructions for how to upgrade extensions via the admin GUI. I usually prefer command line solutions but for Civi extensions I always use the GUI.
Extensions can store data in a bunch of different places, but looking at an old copy of the extension I have accessible, in the sql directory in the mosaico extension, the install file creates two tables civicrm_mosaico_msg_template and civicrm_mosaico_template and the uninstall file deletes those tables.
Agreed with first answer. Also, extension data normally stores in civicrm_extension. You can find information 'is_active' 0 or 1 whether it is inactive or active.