BS-10420, add missing foreing key + tests