-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed as not planned
Labels
Description
Bug description
Migration suffixes "s" for column name and index name;
I have a Far class mapped to "Far" table.
Far table has a column of int "BooId" as FK to Boo.Id and BooId was indexed with name of "IX_Fars_BooId".
I have changed Far class to drop BooId and produce migrations to get a migration class as below:
// Up()
migrationBuilder.DropIndex(
name: "IX_Fars_BooIds", // "s" was suffixed
table: "Fars");
migrationBuilder.DropColumn(
name: "BooIds", // "s" was suffixed.
table: "Fars");
// Down() has the same namings
As a result, db update failed, until I remove the suffixed "s" in four places.(two in Up() and two in Down())
ef cli tool version is 9.0.4
Your code
// the before code
class Boo
{
public int Id { get; protected set; }
public ICollection<Far> Fars { get; } = [];
}
class Far
{
public int Id { get; protected set; }
public int? BooId { get; set; }
}
// after code
class Boo
{
public int Id { get; protected set; }
// public ICollection<Far> Fars { get; } = [];
}
class Far
{
public int Id { get; protected set; }
// public int? BooId { get; set; }
}
Stack traces
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such index: IX_Fars_BooIds'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
...
Verbose output
EF Core version
9.0.3
Database provider
Microsoft.EntityFrameworkCore.Sqlite (9.0.3)
Target framework
No response
Operating system
Windows10
IDE
No response