How to upgrade a canister using `skip_pre_upgrade = ture` flag?

What access ways do we have,
and any practical examples ?

Anyone knows about this please ?

Guess i have to do it myself by look into the ic source code

Until we get that in dfx I think the easiest way is via Motoko where you can do it like this:

  type Management = actor {
    install_code : ({
      mode : {
        #install;
        #reinstall;
        #upgrade : { skip_pre_upgrade : Bool };
      };
      canister_id : Principal;
      wasm_module : Blob;
      arg : Blob;
    }) -> async ();
  };

  public func doStuff() : async Nat {
    let IC0 : Management = actor ("aaaaa-aa");
    let a = await IC0.install_code(...);
    ...
  };


  

I will try motoko immediately . I never think there is a motoko way. thanks!

Oh and to get a wasm into your canister my preferred way is to use ic-repl where you can call functions with file("custom.wasm") which makes it send the file as a blob so you don’t have to deal with converting to blob encoding yourself

aha. very handy small tool. thanks for warm tip