title: EF-Core: Table "name" already exists - when trying to update database
body: <p>ASP Core 3.1 - API. I'm using the latest version of Entity Framework Core.</p>
  <p>I have created a table <code>ToDoItem</code> and a <code>ToDoItemContext</code>. After creating the initial migration, and running <code>update-database</code>. I now have that table in my database. I now added a new model called: <code>ToDoItemDescription</code>.</p>
  <p>When I try to update the database after creating a new migration, I get the error:</p>
  <blockquote>
  <p>Table 'todoitems' already exists</p>
  </blockquote>
  <p>Further details: I have two contexts, and this is the command I ran:</p>
  <pre><code>update-database -context todoitemscontext
  </code></pre>
  <p>I also tried:</p>
  <pre><code>update-database -context todoitemscontext -migration AddDescription
  </code></pre>
  <p>Here is my full code:</p>
  <p>Models:</p>
  <pre><code>public class TodoItem : IEntity 
  {
      public long Id { get; set; }
      public string Name { get; set; }
      bool IsComplete { get; set; }
  }
  
  public class ToDoItemDescription 
  {
      public int id { get; set; }
      public string Description { get; set; }
      //public int ToDoItemId { get; set; }
      public TodoItem TodoItem { get; set; }
  }
  </code></pre>
  <p>Context:</p>
  <pre><code>public class TodoItemsContext : DbContext 
  {
     public TodoItemsContext(DbContextOptions&lt;TodoItemsContext&gt; options) : base(options) { }
  
     public DbSet&lt;TodoItem&gt; TodoItems { get; set; }
     public DbSet&lt;ToDoItemDescription&gt; TodoItemsDescription { get; set; }
  }
  </code></pre>
  <p>Migrations:</p>
  <pre><code>[DbContext(typeof(TodoItemsContext))]
  partial class TodoItemsContextModelSnapshot : ModelSnapshot 
  {
      protected override void BuildModel(ModelBuilder modelBuilder) {
      #pragma warning disable 612, 618
      modelBuilder
          .HasAnnotation(&quot;ProductVersion&quot;, &quot;3.1.9&quot;)
          .HasAnnotation(&quot;Relational:MaxIdentifierLength&quot;, 64);
      modelBuilder.Entity(&quot;project.Models.ToDoItemDescription&quot;, b =&gt; {
          b.Property&lt;int&gt;(&quot;id&quot;)
          .ValueGeneratedOnAdd()
          .HasColumnType(&quot;int&quot;);
          b.Property&lt;string&gt;(&quot;Description&quot;)
          .HasColumnType(&quot;longtext CHARACTER SET utf8mb4&quot;);
          b.Property&lt;long?&gt;(&quot;TodoItemId&quot;)
          .HasColumnType(&quot;bigint&quot;);
          b.HasKey(&quot;id&quot;);
          b.HasIndex(&quot;TodoItemId&quot;);
          b.ToTable(&quot;TodoItemsDescription&quot;);
      });
  
      modelBuilder.Entity(&quot;project.Models.TodoItem&quot;, b =&gt; {
          b.Property&lt;long&gt;(&quot;Id&quot;)
          .ValueGeneratedOnAdd()
          .HasColumnType(&quot;bigint&quot;);
          b.Property&lt;bool&gt;(&quot;IsComplete&quot;)
          .HasColumnType(&quot;tinyint(1)&quot;);
          b.Property&lt;string&gt;(&quot;Name&quot;)
          .HasColumnType(&quot;longtext CHARACTER SET utf8mb4&quot;);
          b.HasKey(&quot;Id&quot;);
          b.ToTable(&quot;TodoItems&quot;);
      });
      modelBuilder.Entity(&quot;project.Models.ToDoItemDescription&quot;, b =&gt;
      {
      b.HasOne(&quot;project.Models.TodoItem&quot;, &quot;TodoItem&quot;)
          .WithMany()
          .HasForeignKey(&quot;TodoItemId&quot;);
      });
  #pragma warning restore 612, 618
  }
  
  public partial class TodoItems_Initial : Migration
  {
          protected override void Up(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.CreateTable(
                  name: &quot;TodoItems&quot;,
                  columns: table =&gt; new
                  {
                      Id = table.Column&lt;long&gt;(nullable: false)
                          .Annotation(&quot;MySql:ValueGenerationStrategy&quot;, MySqlValueGenerationStrategy.IdentityColumn),
                      Name = table.Column&lt;string&gt;(nullable: true),
                      IsComplete = table.Column&lt;bool&gt;(nullable: false)
                  },
                  constraints: table =&gt;
                  {
                      table.PrimaryKey(&quot;PK_TodoItems&quot;, x =&gt; x.Id);
                  });
          }
  
          protected override void Down(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.DropTable(
                  name: &quot;TodoItems&quot;);
          }
      }
  
  public partial class AddDescription : Migration
  {
          protected override void Up(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.CreateTable(
                  name: &quot;TodoItemsDescription&quot;,
                  columns: table =&gt; new
                  {
                      id = table.Column&lt;int&gt;(nullable: false)
                          .Annotation(&quot;MySql:ValueGenerationStrategy&quot;, MySqlValueGenerationStrategy.IdentityColumn),
                      Description = table.Column&lt;string&gt;(nullable: true),
                      TodoItemId = table.Column&lt;long&gt;(nullable: true)
                  },
                  constraints: table =&gt;
                  {
                      table.PrimaryKey(&quot;PK_TodoItemsDescription&quot;, x =&gt; x.id);
                      table.ForeignKey(
                          name: &quot;FK_TodoItemsDescription_TodoItems_TodoItemId&quot;,
                          column: x =&gt; x.TodoItemId,
                          principalTable: &quot;TodoItems&quot;,
                          principalColumn: &quot;Id&quot;,
                          onDelete: ReferentialAction.Restrict);
                  });
  
              migrationBuilder.CreateIndex(
                  name: &quot;IX_TodoItemsDescription_TodoItemId&quot;,
                  table: &quot;TodoItemsDescription&quot;,
                  column: &quot;TodoItemId&quot;);
          }
  
          protected override void Down(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.DropTable(
                  name: &quot;TodoItemsDescription&quot;);
          }
  }
  </code></pre>
  <p>Thank you.</p>