I have this in the Aeotec Multisensor6 driver I've been maintaining:
private dbCleanUp() {
unschedule()
state.remove("version")
state.remove("sensorTemp")
}
It's just a 'placeholder' method that isn't used. I used it for EXACTLY the same purpose, getting rid of states from a previous driver. I copy paste the needed lines into updated() then click save preferences then go back and remove the lines from updated()