Custom field disappear after bench update

I was on v11.1.x and i ran bench update yesterday. The custom field i added to purchase and sales invoices disappeared after update but was intact in db.
Later on i had to create the custom field again in ERPNext. Luckily there was no data loss as the field was not removed from db.

Is there any way to retain these custom fields even after update?

Coming back on this post because I am experiencing the same issue with the latest v12.

Anyone has any idea ?