Migrate existing dets content

I have an application that stores some of its state in a dets file.

The shape of the data is going to change in a later version. What are solutions to properly handle the migration ?

I understand Ecto would be used if the data was stored in a relational database, however here I’m only story a “plain-old-struct”.

Is there any standard solution here ?

What I’ve always done in ETS/DETS/Mnesia is to just add a ‘version’ field to the record and pass the record through a function to migrate it on each access. It’s a simple cheap check if nothing to do. :slight_smile:

1 Like