If you’re storing long-lived term data (versus caching, etc where old versions can be discarded) here are two approaches that can help:
- explicit migration when changing the underlying struct. You’d write a one-off task to load each term, adjust its structure, then save it back
- explicit versioning in the data. Add a
versionfield to the struct with a default value. Bump it every time you add/remove fields. The code that saysbinary_to_termwill need to checkversionand handle converting the old shape into the new shape
IMO the motivation to pick one versus the other is how often “old” data is read; if it’s used constantly then updating it once in a batch will be faster (the first approach) - but if it’s mostly historical and only read occasionally then doing it on-demand (the second approach) will avoid doing computations that might never be used.


















