<div dir="ltr"><div><div><div><div>Hi,<br></div>I didn't had so much luck with this question. The question was:<br></div>-> "How to avoid keeping old data formats in your code?"<br>Indeed those old data formats are often needed for retro-compatibility with previous versions of your software.<br><br></div>Say you have a data structure that is serialized in a file, and then you add a field in a later version. You are obliged to keep both versions of the data structure if you want to be able to read both versions of the file. Potentially, if you update very often your structure between releases, you are obliged to keep N versions of the data structure in your code.<br></div>See the exemple at: <a href="http://acid-state.seize.it/safecopy">http://acid-state.seize.it/safecopy</a><br><div><br><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 30, 2014 at 1:04 PM, Corentin Dupont <span dir="ltr"><<a href="mailto:corentin.dupont@gmail.com" target="_blank">corentin.dupont@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Hi the list,<br></div><div></div><div>I have some question relative to data migration.<br><br></div>Say you have a software in version A which save data in a file with format FA. Later, you update your software to version B, with data format FB.<br></div>Now, if you want your version B of the software to be able to read data saved by version A, you're obliged to include FA in version B, together with some functions to translate from FA to FB.<br><br></div>This is what I don't find elegant: you're obliged to keep old code (data formats) in your software.<br></div>-> do you know of any way to avoid keeping old data formats (for retro-compatiblilty) in your code?<br><br></div><div>In practice I use acid-state with safecopy:<br><a href="http://acid-state.seize.it/safecopy" target="_blank">http://acid-state.seize.it/safecopy</a><br></div><div>In this example you can see the problem: the author is obliged to keep old code (data structures) to maintain compatibility. Even worth, you might be obliged to suffix your data structure with a version number:<br><span style="font-family:arial,helvetica,sans-serif"><br></span><pre><span style="font-family:arial,helvetica,sans-serif"><code><span>data</span> MyType_V1 <span>=</span> </code><code>MyType_V1</code><code><span></span> <span>Int</span>
<span>data</span> </code><code><code>MyType_V2</code> <span>=</span> </code><code><code>MyType_V2</code> <span>Integer</span></code></span></pre></div><div><br></div>Instead, I'm thinking of a process using GIT, or Cabal as a back-end.<br></div>The idea would be to have an additional program (or library) specialized in the data migration of your main software. It would extract both version A and B from the repo, and then would compile an application capable of handling migrations from FA to FB.<br><br></div>Does something like this exists (even outside of Haskell)?<br><br></div>Cheers,<br>Corentin<br></div>
</blockquote></div><br></div></div></div></div></div></div></div>