What is the correct way to apply document migrations?

@Gin-Quin Gin Quin
Sun, 16 Nov 2025 18:41:50 +0000

For those who might be interested, this is the system I’ve been using:

1. Data loaded from IndexedDB

2. Every document has a “version” field. If the local document version is up-to-date, use it already. If not, wait for server data

3. Data loaded from remote server

4. Apply migration if needed

This ensures fast loading from IndexedDB, as well as preventing data loss due to migration (we wait until the data is received from server).

This is not perfect though, because if the user does some work offline, the risk I mentioned in my first post still applies. The only real solution would be to have migrations built-in.