fix migrations with custom foreign keys