Page 1 of 1

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

Posted: Tue 03 Jul 2018 14:26
by davidpriceaiglife
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?

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

Posted: Thu 05 Jul 2018 15:08
by Shalex
Thank you for your report. We will investigate the issue and notify you about the result.

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

Posted: Thu 20 Sep 2018 15:15
by Shalex
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.

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

Posted: Thu 25 Oct 2018 18:15
by Shalex
The bug with removing an empty __EFMigrationsHistory table by EnsureDeleted() in EF Core is fixed: viewtopic.php?f=1&t=37913.