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!

Oracle.ManagedDataAccess.EntityFramework 12.2.1100 Index names / migrations

Christian RatzenhoferMay 25 2018 — edited May 28 2018

Today I started adding my indices to my code-first definition of the schema. While doing so I found out that all named indices never get removed when rolling back migrations.

The problem results from the fact, that the SQL generator in Oracle.ManagedDataAccess.EntityFramework ignores the actual supplied index name, but instead builds a new index name made up of IX_TABLENAME_COLUMN_COLUMN_... which then gets truncated to IX_TABLENAMEPART_SOMEDIGITS when the generated name is > 30 chars.

For the way back though visual studio creates a "Down" migration that only feeds in the custom name and no columns so the generated sql is "drop index "SCHEMA"."IX_TABLENAME_" which ofc doesn't exist.

The whole problem can be worked around by manualy editing the migration code and replacing the DropIndex call with a call that instead defines the columns, but that breaks my expectation that I can name the index with the IndexAttribute name property.

My actual question would be where or how do I file a bug for this?

Below a sample of the workaround for people that find the question:

A migration like this:

public partial class MIGRATIONNAME : DbMigration

{

    public override void Up() {

        CreateIndex("SCHEMA.BIGTABLE", new[] { "COLUMN1", "COLUMN2" }, name: "CUSTOMINDEXNAME");

    }

 

    public override void Down() {

        DropIndex("SCHEMA.BIGTABLE", "SCHEMA.CUSTOMINDEXNAME");

    }

}

Needs to be altered to this form:

public partial class MIGRATIONNAME : DbMigration

{

    public override void Up() {

        CreateIndex("SCHEMA.BIGTABLE", new[] { "COLUMN1", "COLUMN2" }, name: "CUSTOMINDEXNAME");

    }

 

    public override void Down() {

        DropIndex("SCHEMA.BIGTABLE", new[] { "COLUMN1", "COLUMN2" });

    }

}

This post has been answered by Alex Keh-Oracle on May 25 2018
Jump to Answer

Comments

Manu.
Answer

Dear,

What do you mean by as required? Please post the sample screenshot of the outputs in Toad and in LOV.

Manu.

Marked as Answer by user5345 · Sep 27 2020
user5345

Sir got it. thanks

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 25 2018
Added on May 25 2018
2 comments
476 views