From old versions and old hosting.
"Local storage" data is only tied to a given hostname. So moving whole data to new hostnames isn't all too pleasant.
I didn't bake in versioning from the start. Or least I don't remember how or if I did it before it was all too late. In short, identifying the version of the persistent store is not straightforward. Converting between them is also somewhat interesting.
- A simple JS script replaces the old PWA.
- If no data is present it redirects immediately to the new host.
- Otherwise it identifies the version and converts it appropriately.
- It then submits form data to the new hosting.
- The migration script on the new hosting dumps this into the local store.
- A redirect/refresh into to the (new) PWA root hydrates the data into the app.
- ???
- profit.
git add remote production app@fieldassistant.app:migration
git push production master
- Fix SW hijacking the migration script
- Some notes about migration behaviour for users