Skip to content

How to update the structure in a safe way #12

Description

@samlinux

I have structure like this:

type License = {
license : Text;
active : Bool;
};
stable let map = Map.new<Nat, License>();

After some time I would like to add a further property to the License type: e.g. status:

type License = {
license : Text;
active : Bool;
status:Bool;
};

During the update process I receive a warning, what is fine.

Stable interface compatibility check failed for canister 'backend'.
Upgrade will either FAIL or LOSE some stable variable data.

But, If I install the update, my data is lost and the query call failed.

Error: Failed query call.
Caused by: Failed query call.
The replica returned a replica error: reject code CanisterError, reject message IC0503: Canister bkyz2-fmaaa-aaaaa-qaaaq-cai trapped explicitly: unreachable, error code Some("IC0503")

So how can I handle this situation ?

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