Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Automatically upgrading local databse to support new version of Datasync #686

Closed
Eunovo opened this issue Jul 31, 2020 · 3 comments
Closed

Comments

@Eunovo
Copy link
Collaborator

Eunovo commented Jul 31, 2020

Feature Request

Is your feature request related to a problem? Please describe.
Apart from user models, Offix-Datasync create other stores for metadata and other non-api related features. We currently allow users to initiate a schema upgrade by incrementing a schema version param when their schema have changed but what about store changes due to changes in Datasync's internal workings? How do we update the local DB without using the user's schema version? We have already experienced this problem ourselves during development of Offix-Datasync as the sample app fails every time we upgrade Offix-Datasync.

Possible Solutions I have considered

  • Cloning local DB on Offix-Datasync version change. We could store Offix-Datasync version in local DB and when Offix-Datasync has been upgraded we recreate user DB with the new stores required for the new Offix-Datasync to function. Note how we don't increment the DB version(Indexeddb specific) because the user uses this version.
    One disadvantage here is memory. The cloning operation could be expensive if the user DB is large.

  • Another solution is to manage the schema version ourselves. This way, we can increment the DB schema version without any consequences because the user does not use the schema version. This also means we have to detect user changes to schema and upgrade DB by incrementing schema version.

None of the approaches seems to be particularly simple but the second one could be more difficult.
cc @wtrocki @kingsleyzissou

@wtrocki
Copy link
Contributor

wtrocki commented Jul 31, 2020

Another solution is to manage the schema version ourselves.

I do not have answer for this, but I have started adding this for metadata store.

@wtrocki
Copy link
Contributor

wtrocki commented Aug 18, 2020

See also #733

@wtrocki
Copy link
Contributor

wtrocki commented Sep 4, 2020

Automatic update requires us to track the new fields in the CLI. which is possible however if field is required we not going to provide default values. CLosing this one in fav of
#817

@wtrocki wtrocki closed this as completed Sep 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants