Fix schema for foreign keys, bit nasty