[TM-276] Safe UStore migrations (declarative approach)
Description
This MR implements a prototype of type-safe UStore migration using a declarative approach.
It means that for each field of new UStore version you supply a way to create that field from old storage.
Columnars magic is used to use the same UStore template datatype for UStore initializer (in mkUStore
function) and migration specification. Unnecessary fields will be removed automatically.
This MR also contains a bunch of helpers which can be useful in other cases, for migration stuff please see only [TM-276] Add migration
commit.
Also see an alternative approach in !50 (merged).
TODO: remove fields automatically (this requires some copy-paste from !50 (merged) which I will do if that MR gets closed).
Related issue(s)
https://issues.serokell.io/issue/TM-276
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.