Fixing migrations for foreign keys