_.address.street + _.address.city → _.address.fullAddress -> this is done
_.address.street + _.origin.country → _.address.fullAddress -> This gets complex since now we have to extract values from multiple nested source paths, combine to targeted nested path, remove the nested source fields, and rebuilthe whole structure immutability.
So if the parent is not the same, it gracefully errors out.
DynamicMigration is Pure ADT and can be inspected structurally, but it cannot be fully serialize/deserialize it due to existential types in SchemaExpr. SchemaExpr[DynamicValue, ?], not sure how to deal with this.
Best effort has been made to reverse.
| Migration Action | Reverse Operation | Reversibility Status & Notes |
|---|---|---|
| Rename | Rename (flipped) | Lossless ✅ Perfect reversion. |
| RenameCase | RenameCase (flipped) | Lossless ✅ Perfect reversion. |
| AddField | DropField | Lossless ✅ Can cleanly remove the added field. |
| DropField | AddField (default) | Lossy ⚠️ Original value is lost; the reverse uses a default value. |
| Optionalize | Mandate | Lossless ✅ Can unwrap Some perfectly. |
| Mandate (Some) | Optionalize | Lossless ✅ Can wrap back to Optional. |
| Mandate (None) | Optionalize | Lossy ⚠️ Ambiguous; don’t know if the original was None or Some(default). |
| TransformValue (Add/Sub/Mul/Div/Not) | Inverse Math | Lossless ✅ Perfect arithmetic inverse. |
| TransformValue (String case) | Opposite Case | Lossy ⚠️ Loses original casing information. |
| TransformValue (others) | Same Transform | Not Possible 🚫 Returns identity (no effective reverse). |
| ChangeType | Reverse Converter | Lossy ⚠️ Potential overflow or precision loss. |
| Join (StringConcat pattern) | Split | Lossy ⚠️ Works only if data perfectly matches the pattern. |
| Join (other) | Split (combiner as-is) | Lossy / Fails 🚫 May fail at runtime. |
| Split (StringSplit, 2 targets) | Join | Lossy ⚠️ Works only for 2-part splits. |
| Split (other) | Join (identity) | Lossy 🚫 Returns field0 only; other data lost. |
| TransformElements (Keys/Values) | Inverse Transform | Depends entirely on the specific transform logic. |
| TransformCase | Reversed Actions | Depends entirely on the nested actions involved. |
/claim #519 /closes #519
Ajay RV
@Nanashi-lab
ZIO
@ZIO