Skip to content

Go up/down non-destructively #9

@flip111

Description

@flip111

Would it be possible to add to the library something like this

-- Simple version, up/down grade is blocked when there are losses
data Up
  = Up (a -> b)
  | UpLoss (a -> b) -- Don't care about the removed data

data Down
  = Down (b -> a)
  | DownLoss -- Operation is blocked, need to take a different database backup in that point of time

With matching functions

up :: 
upReversible :: -- no data loss. Return `Nothing` or some other error indication when `UpLoss` was encountered
down :: -- Can only run when there is no `DownLoss` in the chain

Or a more advanced version that produces data dump files of removed data (think patch files). JSON used in the example but the type can be polymorphic

data Up
  = Up (a -> b)
  | UpLoss (a -> (b, JSON)) -- Returns removed data

data Down
  = Down (b -> a)
  | DownLoss (b -> JSON -> a) -- Takes removed data (need to load this yourself from previously dumped patch file on disk)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions