-
Notifications
You must be signed in to change notification settings - Fork 17
[PM-22589] Implement basic db migrations for indexeddb #410
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
base: main
Are you sure you want to change the base?
Conversation
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #410 +/- ##
==========================================
- Coverage 76.52% 76.51% -0.02%
==========================================
Files 269 270 +1
Lines 25312 25359 +47
==========================================
+ Hits 19371 19403 +32
- Misses 5941 5956 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b67679a
to
dd0f274
Compare
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-12612 ## 📔 Objective A continuation of #213, this PR implements some simple SDK managed data store based on SQLite (on non-wasm) and IndexedDB (on wasm). Both databases are wrapped in a `Database` trait and conditionally compiled based on platform. Then from each database we can get multiple `Repository` implementations that can be used to read and write data persistently. Each repository is mapped to a separate table in SQLite and Object Store in IndexedDb. Some limitations of the current system: - The database currently needs to be initialized as a separate step to both the SdkClient and the client-managed repositories, I feel like ideally we can do that as part of Client initialization, but that would require us to make initialization async. I've left that for the future. - Currently we don't have any indexes beyond the main key, but both sqlite and indexeddb support adding more. - The current structure doesn't have any migration capabilities, which are required for indexeddb to create the object stores, this PR temporarily adds version numbers to the `register_repository_item` calls, just to get something working, but note that this is removed in #410 and replaced with a better migration system. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Andreas Coroiu <[email protected]>
# Conflicts: # crates/bitwarden-state/src/sdk_managed/indexed_db.rs
dd0f274
to
6e65633
Compare
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-22589
📔 Objective
Builds on top of #301 to add some basic state migration support for SDK-managed state. This is needed for IndexedDB as we can only run migrations there on version upgrades.
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes