Fixed bug in foreign-key handling in MigrateCredential