[migration/3.21] Add missing foreign keys when upgrading [applied]