title: EF7 generates wrong migrations with SQLite
body: <p>I try to use ASP.Net 5 with Entity Framework 7 and SQLite, and I found a strange behavior of migrator.</p>
  
  <p>I taked a Visual Studio 2015 and created a new project with template "ASP.NET 5 Template Web Application". </p>
  
  <p>After that I removed dependecy</p>
  
  <pre><code>"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final"
  </code></pre>
  
  <p>And added two dependencies and than called restore packages.</p>
  
  <pre><code>"EntityFramework.Sqlite": "7.0.0-rc1-final",
  "Microsoft.Data.Sqlite": "1.0.0-rc1-final"
  </code></pre>
  
  <p>Like that</p>
  
  <pre><code>"dependencies": {
  "EntityFramework.Commands": "7.0.0-rc1-final",
  "EntityFramework.Sqlite": "7.0.0-rc1-final",
  "Microsoft.Data.Sqlite": "1.0.0-rc1-final",
  "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
  "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
  "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
  "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
  "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
  "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
  "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
  "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
  "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
  "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
  "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
  "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
  "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
  "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
  "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
  "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
  "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
  }
  </code></pre>
  
  <p>Next I went to Startup.cs and changed function ConfigurationServices like that</p>
  
  <pre><code> public void ConfigureServices(IServiceCollection services)
      {
          // Add framework services.
          var dbFilePath =     Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "test.db");
          services.AddEntityFramework()
           .AddSqlite()
           .AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
               options.UseSqlite("Filename=" + dbFilePath));
          System.Console.WriteLine("Use DB file:" + dbFilePath);
  
          services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;()
              .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;()
              .AddDefaultTokenProviders();
  
          services.AddMvc();
  
          // Add application services.
          services.AddTransient&lt;IEmailSender, AuthMessageSender&gt;();
          services.AddTransient&lt;ISmsSender, AuthMessageSender&gt;();
          services.AddInstance&lt;IConfigurationRoot&gt;(Configuration);
      }
  </code></pre>
  
  <p>Then I removed all files from folder "Migrations" and built the solution.
  All been ready to creating migrations.
  I ran git bash on project folder and inter a next commands:</p>
  
  <pre><code>blush@BLUSH /d/dev/testMVC
  $ dnx ef migrations add firstMigration
  Use DB file:D:\dev\testMVC\test.db
  Done. To undo this action, use 'ef migrations remove'
  </code></pre>
  
  <p>and </p>
  
  <pre><code>$ dnx ef database update
  Use DB file:D:\dev\testMVC\test.db
  Applying migration '20160304130532_firstMigration'.
  Done.
  </code></pre>
  
  <p>OK, I saw a database file and files in folder "Migrations" which looks like well. 
  And I guess that the next generated migration will be empty without changes a object model.
  I tried to do it and enter a next command: </p>
  
  <pre><code>$ dnx ef migrations add testMigration
  Use DB file:D:\dev\testMVC\test.db
  Done. To undo this action, use 'ef migrations remove'
  </code></pre>
  
  <p>I went to see a generated migration class and I saw this code:</p>
  
  <pre><code> protected override void Up(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim&lt;string&gt;_IdentityRole_RoleId", table: "AspNetRoleClaims");
              migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim&lt;string&gt;_ApplicationUser_UserId", table: "AspNetUserClaims");
              migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin&lt;string&gt;_ApplicationUser_UserId", table: "AspNetUserLogins");
              migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole&lt;string&gt;_IdentityRole_RoleId", table: "AspNetUserRoles");
              migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole&lt;string&gt;_ApplicationUser_UserId", table: "AspNetUserRoles");
              migrationBuilder.AddForeignKey(
                  name: "FK_IdentityRoleClaim&lt;string&gt;_IdentityRole_RoleId",
                  table: "AspNetRoleClaims",
                  column: "RoleId",
                  principalTable: "AspNetRoles",
                  principalColumn: "Id",
                  onDelete: ReferentialAction.Cascade);
              migrationBuilder.AddForeignKey(
                  name: "FK_IdentityUserClaim&lt;string&gt;_ApplicationUser_UserId",
                  table: "AspNetUserClaims",
                  column: "UserId",
                  principalTable: "AspNetUsers",
                  principalColumn: "Id",
                  onDelete: ReferentialAction.Cascade);
              migrationBuilder.AddForeignKey(
                  name: "FK_IdentityUserLogin&lt;string&gt;_ApplicationUser_UserId",
                  table: "AspNetUserLogins",
                  column: "UserId",
                  principalTable: "AspNetUsers",
                  principalColumn: "Id",
                  onDelete: ReferentialAction.Cascade);
              migrationBuilder.AddForeignKey(
                  name: "FK_IdentityUserRole&lt;string&gt;_IdentityRole_RoleId",
                  table: "AspNetUserRoles",
                  column: "RoleId",
                  principalTable: "AspNetRoles",
                  principalColumn: "Id",
                  onDelete: ReferentialAction.Cascade);
              migrationBuilder.AddForeignKey(
                  name: "FK_IdentityUserRole&lt;string&gt;_ApplicationUser_UserId",
                  table: "AspNetUserRoles",
                  column: "UserId",
                  principalTable: "AspNetUsers",
                  principalColumn: "Id",
                  onDelete: ReferentialAction.Cascade);
          }
  
          protected override void Down(MigrationBuilder migrationBuilder)
          {
         ... 
         }
  </code></pre>
  
  <p>If I tries to apply this migration, catch the next error message:</p>
  
  <pre><code>$ dnx ef database update
  Use DB file:D:\dev\testMVC\test.db
  Applying migration '20160304133144_testMigration'.
  System.NotSupportedException: SQLite cannot support this migration operation.
     в Microsoft.Data.Entity.Migrations.SqliteMigrationsSqlGenerator.Generate(Drop
  ForeignKeyOperation operation, IModel model, RelationalCommandListBuilder builde
  r)
     в Microsoft.Data.Entity.Migrations.MigrationsSqlGenerator.&lt;&gt;c.&lt;.cctor&gt;b__50_1
  0(MigrationsSqlGenerator g, MigrationOperation o, IModel m, RelationalCommandLis
  tBuilder b)
     в Microsoft.Data.Entity.Migrations.MigrationsSqlGenerator.Generate(MigrationO
  peration operation, IModel model, RelationalCommandListBuilder builder)
     в Microsoft.Data.Entity.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyL
  ist`1 operations, IModel model)
     в Microsoft.Data.Entity.Migrations.SqliteMigrationsSqlGenerator.Generate(IRea
  dOnlyList`1 operations, IModel model)
     в Microsoft.Data.Entity.Migrations.Internal.Migrator.GenerateUpSql(Migration
  migration)
     в Microsoft.Data.Entity.Migrations.Internal.Migrator.&lt;&gt;c__DisplayClass12_4.&lt;G
  etMigrationCommands&gt;b__10()
     в Microsoft.Data.Entity.Migrations.Internal.Migrator.Migrate(String targetMig
  ration)
     в Microsoft.Data.Entity.Design.MigrationsOperations.UpdateDatabase(String tar
  getMigration, String contextType)
     в Microsoft.Data.Entity.Commands.Program.Executor.&lt;&gt;c__DisplayClass7_0.&lt;Updat
  eDatabase&gt;b__0()
     в Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
  SQLite cannot support this migration operation.
  </code></pre>
  
  <p>And that a question: what I shall to do to fix this issue?</p>