Fix table definition to allow for correct foreign keys