title: EF5 Code First The ALTER TABLE statement conflicted with the FOREIGN KEY constraint
body: <p>I found several questions on here relating to this but I'm not quite there. I'm trying to add a second UserProfile property to the already existing CourseRegistration class. When I try to perform the migration I get "The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.CourseRegistrations_dbo.UserProfile_InstructorId" </p>
  
  <p>I thought I could solve it with some fluent configuration but it had no effect. Based on what I've read I think the issue is that there is existing data that won't allow this. </p>
  
  <p>Question 1: I don't completely understand what it's complaining about and would like to understand it better if anyone could shed some light. 
  Question 2: Is there any workaround other than dropping the table or removing the data? I don't mind doing that this time, but I'm sure there are situations where that's not an option.  </p>
  
  <pre><code>[Table("UserProfile")]
  public class UserProfile
  {
      [Key]
      [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
      public int UserId { get; set; }
      public string UserName { get; set; }
  }
  
  public class CourseRegistration
  {
      [Key]
      public int RegistrationId { get; set; }
      public int UserId { get; set; }
      public int? InstructorId { get; set; }
  
      public virtual UserProfile user { get; set; }
      public virtual UserProfile Instructor { get; set; }
  }
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>joel</p>