[EFCore2.1] EnsureDeleted does not delete the [__EFMigrationsHistory] table

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
davidpriceaiglife
Posts: 1
Joined: Tue 03 Jul 2018 14:13

[EFCore2.1] EnsureDeleted does not delete the [__EFMigrationsHistory] table

Post by davidpriceaiglife » Tue 03 Jul 2018 14:26

I'm attempting to script out the deletion, migration and seeding of my code first context - calling:

Code: Select all

dbContext.Database.EnsureDeleted()
This deletes any tables that were created as part of the migration, but the [__EFMigrationsHistory] table remains. When calling:

Code: Select all

dbContext.Database.Migrate()
It naturally fails with the following:

Code: Select all

Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (1ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
      CREATE TABLE "__EFMigrationsHistory" (
        "MigrationId" NVARCHAR2(150) NOT NULL,
        "ProductVersion" NVARCHAR2(32) NOT NULL,
        PRIMARY KEY ("MigrationId")
      )
Devart.Data.Oracle.OracleException (0x80004005): ORA-00955: name is already used by an existing object
Is there something I'm doing wrong?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: [EFCore2.1] EnsureDeleted does not delete the [__EFMigrationsHistory] table

Post by Shalex » Thu 05 Jul 2018 15:08

Thank you for your report. We will investigate the issue and notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: [EFCore2.1] EnsureDeleted does not delete the [__EFMigrationsHistory] table

Post by Shalex » Thu 20 Sep 2018 15:15

The bug with throwing an error by context.Database.Migrate(), when the __EFMigrationsHistory table already exists but tables being mapped by model classes are not created yet, in EF Core 2 is fixed: viewtopic.php?f=1&t=37715.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: [EFCore2.1] EnsureDeleted does not delete the [__EFMigrationsHistory] table

Post by Shalex » Thu 25 Oct 2018 18:15

The bug with removing an empty __EFMigrationsHistory table by EnsureDeleted() in EF Core is fixed: viewtopic.php?f=1&t=37913.

Post Reply