title: Get Empty SQL file for specific migration in Entity Framework Core C#
body: <p>I am using visual studio, EF Core</p>
  <p>I want to take my project and publish it to production I understand that Migrations Is not a good way to work with on a production I think the best way to update my database it is to make a Migration on the developing version and create a SQL out of it and execute the SQL on the production</p>
  <p>I have open this question : <code>https://stackoverflow.com/questions/66966860/get-sql-file-for-specific-migration-in-entity-framework-core-c-sharp</code></p>
  <p>But some of the scripts return empty I have no idea why...</p>
  <p>for example :</p>
  <p>I have the next file :  <code>20210314131832_RemoveCitizenShip2.cs</code>
  with the next code :</p>
  <pre><code>using Microsoft.EntityFrameworkCore.Migrations;
  
      namespace CertificateSystem.DB.DB.Migrations
      {
          public partial class RemoveCitizenShip2 : Migration
          {
              protected override void Up(MigrationBuilder migrationBuilder)
              {
                  migrationBuilder.DropColumn(
                      name: &quot;CitizenShip&quot;,
                      schema: &quot;CertificateSystem&quot;,
                      table: &quot;CommercialEntity&quot;);
              }
      
              protected override void Down(MigrationBuilder migrationBuilder)
              {
                  migrationBuilder.AddColumn&lt;int&gt;(
                      name: &quot;CitizenShip&quot;,
                      schema: &quot;CertificateSystem&quot;,
                      table: &quot;CommercialEntity&quot;,
                      nullable: true);
              }
          }
      }
  </code></pre>
  <p>execute : Script-Migration 20210314131832_RemoveCitizenShip2 just work fine</p>
  <p>and return the next SQL Script :</p>
  <pre><code>ALTER TABLE [CertificateSystem].[CommercialEntity] ADD [CitizenShip] int NULL;
  
  GO
  
  INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
  VALUES (N'20210314132027_AddBackCitizenShip2', N'2.2.4-servicing-10062');
  
  GO
  
  DECLARE @var0 sysname;
  SELECT @var0 = [d].[name]
  FROM [sys].[default_constraints] [d]
  INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
  WHERE ([d].[parent_object_id] = OBJECT_ID(N'[CertificateSystem].[CommercialEntity]') AND [c].[name] = N'CitizenShip');
  IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [CertificateSystem].[CommercialEntity] DROP CONSTRAINT [' + @var0 + '];');
  ALTER TABLE [CertificateSystem].[CommercialEntity] DROP COLUMN [CitizenShip];
  
  GO
  
  INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
  VALUES (N'20210314142045_RemoveCitizenShip3', N'2.2.4-servicing-10062');
  
  GO
  </code></pre>
  <p>I also have the next file : 20210406095255_ChangeUidToInt.cs</p>
  <p>with the code:</p>
  <pre><code>using System;
  using Microsoft.EntityFrameworkCore.Metadata;
  using Microsoft.EntityFrameworkCore.Migrations;
  
  namespace OnlineShvaConnection.DB.Db.Migrations
  {
      public partial class ChangeUidToInt : Migration
      {
          protected override void Up(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.AlterColumn&lt;long&gt;(
                  name: &quot;Id&quot;,
                  schema: &quot;OnlineShvaConnection&quot;,
                  table: &quot;LogMessages&quot;,
                  nullable: false,
                  oldClrType: typeof(Guid))
                  .Annotation(&quot;SqlServer:ValueGenerationStrategy&quot;, SqlServerValueGenerationStrategy.IdentityColumn);
          }
  
          protected override void Down(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.AlterColumn&lt;Guid&gt;(
                  name: &quot;Id&quot;,
                  schema: &quot;OnlineShvaConnection&quot;,
                  table: &quot;LogMessages&quot;,
                  nullable: false,
                  oldClrType: typeof(long))
                  .OldAnnotation(&quot;SqlServer:ValueGenerationStrategy&quot;, SqlServerValueGenerationStrategy.IdentityColumn);
          }
      }
  }
  </code></pre>
  <p>and it return a empty SQL file on the next command line :</p>
  <p>Script-Migration 20210406095255_ChangeUidToInt</p>
  <p>I have no idea why it can happen...</p>