How to use preupgrade and postupgrade to upgrade HashMap to Trie

Note this:

So the preupgrade function you’ve just installed didn’t run on that install, but it’s now in the canister and will run when you next upgrade.

(Presumably you’ve already been copying the HashMap to stable storage alongside the code you’ve shown here).