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

Consider a generic schema migration framework for CryptoStore #3811

Open
richvdh opened this issue Aug 7, 2024 · 2 comments
Open

Consider a generic schema migration framework for CryptoStore #3811

richvdh opened this issue Aug 7, 2024 · 2 comments
Assignees

Comments

@richvdh
Copy link
Member

richvdh commented Aug 7, 2024

Currently, each CryptoStore implementation (IndexedDb and Sqlite) has its own migration system for updating the schema on each update. It has been suggested that we could instead implement a migration system at the CryptoStoreWrapper level which can update the data objects without needing to implement the changes twice.

@richvdh richvdh changed the title Crypto Store wrapper generic migration Consider a generic schema migration system for CryptoStore Aug 7, 2024
@richvdh richvdh transferred this issue from another repository Aug 7, 2024
@richvdh richvdh transferred this issue from another repository Aug 7, 2024
@richvdh richvdh linked a pull request Aug 7, 2024 that will close this issue
1 task
@richvdh richvdh changed the title Consider a generic schema migration system for CryptoStore Consider a generic schema migration framework for CryptoStore Aug 7, 2024
@richvdh
Copy link
Member Author

richvdh commented Aug 7, 2024

My concerns about this are:

  • We would end up adding methods to the CryptoStore trait that would only be used by these migrations.
  • Often, migrations can't be done at the generic level - they require manipulation of indexes, or other changes to the way that data is stored in the specific store implementation; or it's just inefficient to do it at the generic level. And, since migrations need to happen in the right order, this would mean a complex interaction between "generic" migrations and "per-store" migrations.

@BillCarsonFr
Copy link
Member

For context, I am giving a real life example of migration.
For this issue we need to add a new was_previously_verified flag boolean in the OtherUserIdentityData struct.

We have a techincal way to set the initial value of this flag by using serde(default). But this is not suitable for our need because in order to setup this flag I need to access my own identity as well as the identity we need the flag for. So we cannot compute the correct value.

An alternative could be to change the flag form a bool to an Option and set it to None. That way we could lazily migrate the data when we access them. But it feels bad to set something optional just because of migration?

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 a pull request may close this issue.

2 participants