Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EntityFramework DropIndex ommits Schema while generating migration script

Piotr LewandowskiJun 1 2022 — edited Jun 1 2022

I have a problem with generating migration script from existing migration files, via command line, either Script-Migration or dotnet ef migrations script.
The migration file contains the following:

      migrationBuilder.DropIndex(
        name: "IX_CAR_CAR_ID",
        schema: "AUTO",
        table: "CARS",
        column: "CAR_ID");

The generated SQL script contains SQL that fails during database update.
Expected result:
SQL script should contain schema in the drop index command:

DROP INDEX "AUTO"."IX_CAR_CAR_ID"

Actual result:
SQL script does not contain schema in the drop index command:

DROP INDEX "IX_CAR_CAR_ID"

I have fixed that by manual modification of the migration file, so instead of migrationBuilder.DropIndex, I use

migrationBuilder.Sql("DROP INDEX \"AUTO\".\"IX_CAR_CAR_ID\""). 

Well, that solves the problem for me, but does not remove the cause.
I have tried the same with MsSQL server and the result is valid:

DROP INDEX [IX_CAR_CAR_ID] ON [AUTO].[CARS];

so, I assume it might be Oracle only related issue.
Using:
Microsoft.EntityFrameworkCore version 5.0.17
Oracle.EntityFrameworkCore version 5.21.61
My question: does anybony know whether this is a bug in one of the Oracle packages?

This post has been answered by Alex Keh-Oracle on Apr 15 2025
Jump to Answer
Comments
Post Details
Added on Jun 1 2022
4 comments
518 views