by Tim Hunt.
Upgrades do not remove custom DB fields. They may remove standard fields that used to have a purpose in Moodle, but no longer do.
What custom fields had been added?