title: Migration states to make a column nullable but update-database generate sql with NOT NULL for this
body: <p>I am using EF core with MVC. I just changed a column(of type int) from non nullable(int) to nullable(int?). The column was used as a foreign key.</p>
  <p>like</p>
  <pre><code> [Column(&quot;TRIPCHARGES&quot;)]
   [ForeignKey(&quot;TripCharges&quot;)]
   int? TripChargesId { get; set; }
  </code></pre>
  <p>and created the migration(using add-migration) as follows.</p>
  <pre><code>using Microsoft.EntityFrameworkCore.Migrations;
  
  namespace RailRoad.DataPersistenct.EFCore.Migrations
  {
      public partial class MadeTripsRecordTripChargesIdnullable : Migration
      {
          protected override void Up(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.DropForeignKey(
                  name: &quot;FK_TRIPSRECORD_TRIPCHARGES_TRIPCHARGES&quot;,
                  table: &quot;TRIPSRECORD&quot;);
  
              migrationBuilder.AlterColumn&lt;int&gt;(
                  name: &quot;TRIPCHARGES&quot;,
                  table: &quot;TRIPSRECORD&quot;,
                  nullable: true,
                  oldClrType: typeof(int),
                  oldType: &quot;int&quot;);
  
              migrationBuilder.AddForeignKey(
                  name: &quot;FK_TRIPSRECORD_TRIPCHARGES_TRIPCHARGES&quot;,
                  table: &quot;TRIPSRECORD&quot;,
                  column: &quot;TRIPCHARGES&quot;,
                  principalTable: &quot;TRIPCHARGES&quot;,
                  principalColumn: &quot;TRIPCHARGES_ID&quot;,
                  onDelete: ReferentialAction.Restrict);
          }
  
          protected override void Down(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.DropForeignKey(
                  name: &quot;FK_TRIPSRECORD_TRIPCHARGES_TRIPCHARGES&quot;,
                  table: &quot;TRIPSRECORD&quot;);
  
              migrationBuilder.AlterColumn&lt;int&gt;(
                  name: &quot;TRIPCHARGES&quot;,
                  table: &quot;TRIPSRECORD&quot;,
                  type: &quot;int&quot;,
                  nullable: false,
                  oldClrType: typeof(int),
                  oldNullable: true);
  
              migrationBuilder.AddForeignKey(
                  name: &quot;FK_TRIPSRECORD_TRIPCHARGES_TRIPCHARGES&quot;,
                  table: &quot;TRIPSRECORD&quot;,
                  column: &quot;TRIPCHARGES&quot;,
                  principalTable: &quot;TRIPCHARGES&quot;,
                  principalColumn: &quot;TRIPCHARGES_ID&quot;,
                  onDelete: ReferentialAction.Cascade);
          }
      }
  }
  </code></pre>
  <p>But when I ran the command <code>update-database -v</code></p>
  <p>I saw the following sql got executed:</p>
  <pre><code>Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
  ALTER TABLE TRIPSRECORD MODIFY `TRIPCHARGES` int NOT NULL;
  Executed DbCommand (1,209ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
  ALTER TABLE TRIPSRECORD MODIFY `TRIPCHARGES` int NOT NULL;
  Creating DbCommand for 'ExecuteNonQuery'.
  </code></pre>
  <p>Also I checked the database column definition for the table and the column was still having the not null constraint.</p>
  <p>I don't know what is wrong here, please help.
  Thanks in advance. :)</p>