Taitava / obsidian-shellcommands

Execute system commands via hotkeys or command palette in Obsidian (https://obsidian.md). Some automated events are also supported, and execution via URI links.
GNU General Public License v3.0
351 stars 11 forks source link

Backup data.json settings file before any migrations #83

Closed Taitava closed 2 years ago

Taitava commented 2 years ago

0.7.0 is going to bring some new migrations to the data.json settings file. To be on the safe side, I think that SC could make a copy of data.json before it writes the newly structured settings over it during version upgrades.

If a user then notices some kind of incorrect values in their settings, or lost settings, they can first downgrade the plugin (download an older version manually from GitHub - maybe I should write an instruction) and then rename a backup settings file back to data.json manually.


Additions 2021-10-31:

Backing up only works if the vault uses .obsidian as its config folder name. So it works in most vaults but might have issues in other vaults. I'm trying to fix this later, I've asked help in this Obsidian forum thread. Edit 2021-11-02: Fixed.

Backup file naming logic:

So, the first version number in the backup file name tells which version that particular backup settings file happens to be. You can also open the file in a text editor and look for a line "settings_version": at the top of the file, it should be the same version number. Just note that that line can only be found if your SC is of version 0.7.0 or higher (so not yet).

A note about the versions in settings files: The settings file versioning uses the SC plugin's version number, with the exception that if a version of SC does not introduce any structural changes to the settings file, the settings file's version number will not be changed. So, you might be running e.g. SC version 0.7.1 (I'm not sure if that version will exist), but your settings file might be of version 0.7.0, because patch changes (x.y.0 --> x.y.1) do not usually introduce changes to settings (except SC 0.1.1 did...).

Taitava commented 2 years ago

Done. I've added more information to the opening comment of this issue.

Taitava commented 2 years ago

Done & released.