easyblocks icon indicating copy to clipboard operation
easyblocks copied to clipboard

Feature: Document migrations

Open timoconnellaus opened this issue 8 months ago • 1 comments

The issue: The schema in the definitions might change but there isn't a standard way to deal with keeping the document in line with updates to the schema.

The idea is to add a migrate function and version field to the NoCodeComponentDefinition object. The migrate function would be called (probably when reading a document from the backend) and would run migrations in order based on the current version of the definition and the version of the data that is stored in the document to bring the document up to the latest version.

This would allow for document schemas to change over time with the developer able to implement migration steps that automatically deal with the documents as they are read instead of having to build a bulk migration process that is run on deployment.

Some examples of when this would be utilised:

  • renaming a field
  • moving a few fields (e.g. select fields) into a widget that has them all combined into one object
  • changing the type of the field e.g. number to select

timoconnellaus avatar May 26 '24 10:05 timoconnellaus