Skip to content

Substate schema versioning #1516

@sdbondi

Description

@sdbondi

Problem

Any updates to the schema of a substate are breaking.
The database may update the schema internally, using the normal methods, but this must
change must never result in a different state hash for the substate.

Proposal 1

Add version enums to all substates. These versions are never "upgraded" but remain at the version
at creation time. Any new substates will default to the latest version (for e.g, an V1 substate is downed, then upped as V2).

Pros:

  • Flexibility to change and improve substates schema
  • Substates can "lazily" upgrade as needed

Cons:

  • Versions must be forever maintained
  • Extra layer of indirection within the SubstateValue type (code complexity)

Considerations:

  • Substates should always be upgradable between schemas. e.g. if adding a field, it must always have a correct default (Option<NewField> etc)
  • Substates are not downgradable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions