-
Notifications
You must be signed in to change notification settings - Fork 0
Add database schema versioning and migrations #124
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
Conversation
WalkthroughAdds a migration system in keep-core (schema versioning, migration runners, compatibility checks), surfaces migration APIs through Storage/Backend, extends error types, and adds CLI commands to run/report migrations (including hidden-volume handling) with tests and Argon2 parameter validations. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (keep-cli)
participant Storage as Storage API
participant Backend as RedbBackend
participant DB as Redb Database
CLI->>Storage: cmd_migrate(path, hidden)
alt hidden == false
Storage->>Backend: open(path)
Backend->>DB: open DB / initialize_schema()
DB-->>Backend: DB handle
Backend->>Backend: check_compatibility()
Backend->>Backend: needs_migration()
alt migrations needed
Backend->>Backend: run_migrations()
Backend->>DB: apply migration steps
DB-->>Backend: updated schema version
Backend->>Storage: return MigrationResult
else no migrations
Backend->>Storage: return MigrationResult (no-op)
end
Storage->>CLI: print result/status
else hidden == true
CLI->>Storage: open hidden storage
Storage->>Storage: unlock hidden volume (prompt)
Storage->>CLI: report hidden-volume status (migrations not run)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6e1bdad to
cf4f9af
Compare
cf4f9af to
9624d18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@keep-cli/src/main.rs`:
- Around line 543-555: The migrate path never receives the parsed hidden flag;
update the signature of dispatch_migrate to accept a hidden: bool and thread
that flag from the caller where Commands::Migrate is matched, then update
dispatch_migrate to forward hidden into commands::migrate::cmd_migrate and
cmd_migrate_status; inside those functions change the vault-opening logic to
follow the vault.rs/audit.rs pattern: if hidden use HiddenStorage and call
get_hidden_password(), otherwise use the standard storage and get_password(),
ensuring the correct store/password are used when hidden=true.
20b242b to
c2adc3b
Compare
Summary
keep migrateandkeep migrate statuscommandsTest plan
Summary by CodeRabbit
New Features
Security Improvements
Tests
✏️ Tip: You can customize this high-level summary in your review settings.