-
Notifications
You must be signed in to change notification settings - Fork 55
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
Mint, wallet: move migration into into new()
, create backup before migration
#517
base: main
Are you sure you want to change the base?
Conversation
b3828cb
to
16654b1
Compare
I've actually thought about going the other way with this and changing the redb to be in line with the sql one and force migrate to be called explicitly. My reasoning for this is it gives the user better control over db changes and allows them to create a backup before calling migrate. The other way we could handle this is create a backup before the migration, but do think we want to encourage or force a db backup before a migration. related: #400 |
Agree. If we give control to the caller over when to call A simpler and more robust way is IMO to encapsulate this in the DB initialization:
Then we can offer the methods
What do you think? |
Yes, you're right we should do it in the the DB initialization and create backups then. For the wallet especially I don't think we should create a backup each time as it uses more storage then is really needed but we can check if a migration is needed and back up then. For the mint a configurable number of backups should be fine. |
16654b1
to
5fcd888
Compare
73e2963
to
b917eea
Compare
0f55037
to
90d853c
Compare
f3dc20b
to
5bc3b87
Compare
new()
, create DB backup before migration
new()
, create DB backup before migrationnew()
, create backup before migration
5bc3b87
to
39216ea
Compare
The PR is ready for review. As I found no way to tell in advance (e.g. before |
Description
This PR removes the need to call
migrate()
when initializing a wallet or a mint.Notes to the reviewers
backups_to_keep
valuenew()
methods were simplified by extracting migration code tomigrate()
cdk-sqlite/src/error.rs
Suggested CHANGELOG Updates
CHANGED
migrate()
backups_to_keep
ADDED
REMOVED
FIXED
Checklist
just final-check
before committing