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 settings.db before migrations #1848

Merged
merged 3 commits into from
Nov 24, 2023
Merged

Conversation

AdwaitSalankar
Copy link
Contributor

Description

Creates a backup copy of settings.db before migrations

Related Issue

Fixes #1641

How Has This Been Tested?

Tested by creating a copy on init_db()

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@real-yfprojects
Copy link
Collaborator

Thank you very much. This is a useful addition! You can ignore the MacOS tests failing, however the lint workflow should pass. You can use pre-commit for that as our contribution docs describe. After installing it, you can run pre-commit --all-files to also format changes already committed.

@AdwaitSalankar
Copy link
Contributor Author

@real-yfprojects I have made the changes.

@m3nu
Copy link
Contributor

m3nu commented Nov 23, 2023

Minor idea: How about we add the SCHEMA version to the backup, so we have one backup per migration?

@AdwaitSalankar
Copy link
Contributor Author

@m3nu Does this name look good?
settings_v22.db.bak

@m3nu
Copy link
Contributor

m3nu commented Nov 23, 2023

Yes. Looks good and we'll have a backup of each migration.

@AdwaitSalankar
Copy link
Contributor Author

@m3nu I have made the changes

@m3nu
Copy link
Contributor

m3nu commented Nov 24, 2023

We could maybe drop the .bak extension and keep .db since the name will be different.

And how about adding the datetime (2023-12-06-142501) too? If this feature is for devs, I may do the same migration multiple times.

@AdwaitSalankar
Copy link
Contributor Author

Understood. I have added the datetime.
Now the backup file name will look like settings_v22_2023-11-24-191809.db

@m3nu
Copy link
Contributor

m3nu commented Nov 24, 2023

Looks good to me.

@CouldBeThis
Copy link

Hi thanks for teaching Vorta how to back itself up! I just made use of it. :) And I made some quick documentation of how to restore in #1895. Just based on what I read in other threads; hopefully on the right track.

It's probably too late to change it now but would just like to say that including something like bak in the filename would actually be more helpful to me as end user. Because then I could know it was a backup. With a filename like settings_v20_2024-01-13-195827.db I would never guess.

@m3nu
Copy link
Contributor

m3nu commented Jan 14, 2024

Yeah, we could call it settings-backup-xxx.db. I wouldn't change the file extension, since the type of file is still the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create backup of db before migrations.
4 participants