Closed Eunovo closed 4 years ago
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.
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 https://github.com/aerogear/offix/issues/817
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