title: Delete/Remove a foreign key with Entity Framework
body: <p>We have various tables in our system that have a foreign key referencing to an id from the same table. This was added via entity framework a while back using the following code in our configuration files:</p>
  
  <pre><code>this.HasRequired(e =&gt; e.Pay)
      .WithMany()
      .HasForeignKey(wcc =&gt; e.PayId)
      .WillCascadeOnDelete(true);
  </code></pre>
  
  <p>Note some are defined with HasOptional rather than HasRequired.</p>
  
  <p>Is there a way to remove these foreign keys? I've tried the following:</p>
  
  <pre><code>this.HasRequired(e =&gt; e.Pay)
      .WithMany();
  </code></pre>
  
  <p>but this does not generate any code when creating a new migration, then I tried to remove the entire code provided above, and again, it did not generate any code when creating a migration.</p>
  
  <p>Is there a way to remove an existing foreign key from the specific table(s)? I still need the field but I don't want it to be a foreign key.</p>
  
  <p>Thanks.</p>