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

Add format-breaking migration system #252

Open
Tracked by #251
ecton opened this issue May 10, 2022 · 1 comment
Open
Tracked by #251

Add format-breaking migration system #252

ecton opened this issue May 10, 2022 · 1 comment
Labels
collections Issues impacting collections or views enhancement New feature or request

Comments

@ecton
Copy link
Member

ecton commented May 10, 2022

With #225, any collections that are storing a Header or Revision will have an invalid Header/Revision upon upgrade. These types of upgrades will be rare, but a user shouldn't be able to update their Cargo.toml and have the database break without you first being alerted.

The basic idea I have is to introduce an internal version number representing major format changes. StorageConfiguration can have a new property: allow_storage_version. Users will receive an error upon opening a storage if the database needs to be updated and allow_storage_version is less than the current version number.

We should also consider adding an optional way for a Schema and Collections to opt-in to these checks on initialization as well. This would allow authors of plugins to add sanity checks on major upgrades. If we go this far, we should give a way for a user to override the compatibility so that an under-maintained Schema doesn't block upgrading if they take the burden of testing and validating it themselves.

The last principle I want to have is these migrations should generate a manifest that can be referenced in the future. For example, the upgrade manifest for #225 would be able to provide a map of old Revision to new Revision for each collection. This would allow users to still recover even if they bypassed all of the aforementioned safeguards.

@ecton ecton added this to the v0.5.0 milestone May 10, 2022
@ecton ecton added enhancement New feature or request collections Issues impacting collections or views labels May 10, 2022
@zamazan4ik
Copy link

Also, please document somewhere things like "how to upgrade and downgrade database between versions" and maybe some notes regarding policies about forward and backward compatiblity guarantees

@ecton ecton modified the milestones: v0.5.0, Performance Refactor Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Issues impacting collections or views enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants