Describe the bug
Scaffold an existing table that has an index with a name which differs from the default index name EF Core would use. The resulting DbContext will contain the appropriate calls to HasIndex to use the existing names. Then create a new migration. The calls to HasIndex will be missing the original names in the migration and snapshot file. Subsequent migrations will try to sp_rename from the default index name to the existing index name. Because the default index name does not exist in the database, the migration fails.
Expected behavior
Add matching calls to HasIndex with the existing database names to the snapshot file like C# does.
Describe the bug Scaffold an existing table that has an index with a name which differs from the default index name EF Core would use. The resulting
DbContext
will contain the appropriate calls toHasIndex
to use the existing names. Then create a new migration. The calls toHasIndex
will be missing the original names in the migration and snapshot file. Subsequent migrations will try tosp_rename
from the default index name to the existing index name. Because the default index name does not exist in the database, the migration fails.Expected behavior Add matching calls to
HasIndex
with the existing database names to the snapshot file like C# does.