Skip to main content

upgrade

Function upgrade 

Source
pub fn upgrade(
    snapshot: Vec<StateUpdateKind>,
) -> Vec<MigrationAction<StateUpdateKind, StateUpdateKind>>
Expand description

Adds the ephemeral_owner_session field to items, backfilling it as None. Existing records all describe durable items, temporary items were never written to the catalog before this field existed.

Item records gained a new field, so their stored JSON is no longer readable as the v91 type and every such record is rewritten. All other records are unchanged and pass through untouched.

NOTE: The explicit rewrite matters even though serde would default the missing field to None on read. A later edit to an item retracts the record by writing its v91 encoding (with ephemeral_owner_session: None) at diff -1. Without the backfill, the stored record lacks the field, so the retraction doesn’t match it and the collection is left with negative multiplicity.