Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup data.json settings file before any migrations #83

Closed
Taitava opened this issue Oct 22, 2021 · 2 comments
Closed

Backup data.json settings file before any migrations #83

Taitava opened this issue Oct 22, 2021 · 2 comments
Labels
enhancement New feature or improving change
Milestone

Comments

@Taitava
Copy link
Owner

Taitava commented Oct 22, 2021

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:

  • data-backup-version-0.x-before-upgrading-to-0.7.0.json: Here 0.x means that the original settings file is from SC version 0.0.0 - 0.6.0. It's marked 0.x because before 0.7.0 the settings files do not have version information available. And the later version number, 0.7.0 in this case, tells before which upgrade this backup file was created.
  • data-backup-version-0.7.0-before-upgrading-to-0.8.0.json: This is how the versioning will be in future updates. Here 0.7.0 is the original settings file's version, and 0.8.0 tells before which upgrade this backup was taken.
  • (If a backup files already exists with the same name, a new backup file will have -2 (or -3 etc.) added to its name.)

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 Taitava added the enhancement New feature or improving change label Oct 22, 2021
@Taitava Taitava added this to the 0.7.0 milestone Oct 22, 2021
@Taitava
Copy link
Owner Author

Taitava commented Oct 31, 2021

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

@Taitava
Copy link
Owner Author

Taitava commented Nov 25, 2021

Done & released.

@Taitava Taitava closed this as completed Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improving change
Projects
None yet
Development

No branches or pull requests

1 participant