title: Npgsql.PostgresException (0x80004005): 23503: insert or update on table "Deals" violates foreign key constraint "FK_Deals_AirlineCodes_AirlineCodesId"
body: <p>I am working .net core 3.1 project with postgresql.</p>
  <p>I have two tables Deals and AirlineCodes</p>
  <p>I tried to add a new column (for add AirlineCodes ) into Deals table.</p>
  <p>I tried with below codes.</p>
  <p>Deal.cs</p>
  <pre><code> public int AirlineId { get; set; }
  
   public Airline Airline { get; set; }
  </code></pre>
  <p>Airline.cs</p>
  <pre><code>public class Airline
      {
          [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
          public int Id { get; private set; }
          public string AirlineCode { get; set; }
          public string AirlineFullName { get; set; }
      }
  </code></pre>
  <p>DbContext.cs</p>
  <pre><code> public DbSet&lt;Airline&gt; AirlineCodes { get; set; }
   public DbSet&lt;Deal&gt; Deals { get; set; }
  </code></pre>
  <p>And I get this error</p>
  <pre><code>fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
        Failed executing DbCommand (322ms) [Parameters=[], CommandType='Text', CommandTimeout='300']
        ALTER TABLE &quot;Deals&quot; ADD CONSTRAINT &quot;FK_Deals_AirlineCodes_AirlineCodesId&quot; FOREIGN KEY (&quot;AirlineCodesId&quot;) REFERENCES &quot;AirlineCodes&quot; (&quot;Id&quot;) ON DELETE CASCADE;
  Failed executing DbCommand (322ms) [Parameters=[], CommandType='Text', CommandTimeout='300']
  ALTER TABLE &quot;Deals&quot; ADD CONSTRAINT &quot;FK_Deals_AirlineCodes_AirlineCodesId&quot; FOREIGN KEY (&quot;AirlineCodesId&quot;) REFERENCES &quot;AirlineCodes&quot; (&quot;Id&quot;) ON DELETE CASCADE;
  Npgsql.PostgresException (0x80004005): 23503: insert or update on table &quot;Deals&quot; violates foreign key constraint &quot;FK_Deals_AirlineCodes_AirlineCodesId&quot;
  </code></pre>
  <p>Why this error occur?</p>
  <p>Does anyone know the solution? Help me to create a new column with AirlineId into DealsTable.</p>