Re:Ask HN: How do you do slow migration with zero downtime?
by edweis on Sunday April 02, 2023 @06:47AM
(#35409178)
Indeed sometime migration can be avoided. Sometime it can't (like we need to encrypt all customer sensitive data for compliance).
Having field versions is interesting, very much like our "4-step migration" but lightweight.
For example using a schema version field in a record, so that you can read v5, initialise "new_field" with the default value in the model, and write back as v6 if needed? (With an occasional update of everything so you can cleanup the code)
Or maybe create new tables for the new data and do a periodic merge as needed?
Hard to say without knowing more, but my first instinct here would be to ask if there's any other approach possible which doesn't require the migrations in the first place.