TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Local-First Data Migrations

3 pointsby threepointoneover 2 years ago

1 comment

thrufloover 2 years ago
Migrations are a really hard problem for local-first, because (as the article says):<p>a. clients can be running old code that can’t handle the new schema b. clients can write data locally using an old schema that you want to merge into the new schema<p>This solution is interesting - note the schema version for all writes and move writes made against an old schema earlier in the order of operations than the new schema migration.<p>Whether this works is quite dependent on the consistency model and merge semantics. The Cambria [0] approach is to use transformation functions (or “lenses”) to transform the local writes when applied to a backend or node with the new schema.<p>In either case, you still need an emergency mode that drops writes (loses data) if you can’t handle the transformations or reconcile the merge. For example, if the schemas have moved on too much or you’ve truncated your log so you can’t merge in very old writes.<p>[0] <a href="https:&#x2F;&#x2F;www.inkandswitch.com&#x2F;cambria&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.inkandswitch.com&#x2F;cambria&#x2F;</a>