ali
ali

Reputation: 557

Ionic 3: Migrate data from localStorage to indexedDB on app update

I am creating a hybrid application using Ionic 3. Earlier i was using localStorage to store auth token and other data. Due to performance issues and storage limit, now i am using ionic storage to store data on devices.

Now I have to release latest version of application in stores and I want to move data from localStorage to ionic storage so that users won't face any issue. If I'll now migrate my data then new app will check token using ionic storage but my data is in localStorage.

Upvotes: 1

Views: 473

Answers (1)

BRass
BRass

Reputation: 3838

We actually just did something similar in our app. We adjusted our app to use our new storage, and added a fallback to check the old storage if we found nothing in our preferred storage. If the fallback did find data in the old storage, then we moved it to the new storage (so that it would be found on the first try the next go-round).

It was a little clumsy, but not bad. Then in our next release we removed the fallback check since the majority of our users would have moved their storage from old to new by that time.

Upvotes: 1

Related Questions