fix: avoid double db migration for sqlite #3244
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Avoiding double db migration when both Store and Legacy Store are mounted and sqlite is used.
When both store protocols are mounted, two db migrations are performed: one according to Legacy Store's migration definition and then other according to the newer Store. At the end, we end up having the DB schema set by the newer store.
However, in sqlite the schemas of Store and Legacy Store are different (Legacy Store has a
storedAt
field).Therefore, Legacy Store can't work properly with Store's schema.Given that Legacy Store is planned to be deprecated and removed soon, instead of creating new migrations and making significant changes in the legacy archive driver to stop using the
storedAt
field, I'm introducing a pretty dirty workaround so we make sure that we don't get to a point of using a db with an incompatible schema.The idea is to remove this piece of code as soon as we remove sqlite's Legacy Store. If the plan is to support Legacy Store for a long time, then this workaround is terrible and we should adapt sqlite's Legacy Store to stop using the
storedAt
field, the same way it's done in Postgres' Legacy Store.However, if the plan is to remove Legacy Store soon, then this dirty workaround will spare us from lots of unnecessary work.
Changes
Issue
#3236