dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.73k stars 3.18k forks source link

Sqlite migrations: table rebuild with spatial column errors out #28384

Closed d79ima closed 2 years ago

d79ima commented 2 years ago

Description I am using EF Core 6.0,6 targeting SQLite. I have a simple table with a few columns, including a GEOMETRY column for which i am using NetTopologySuite 6.0.6 to match EF Core version. If i create a migration where i drop one of the regular (non-Geometry) columns, and try to create a database, will get an error with the following message: Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'table ef_temp_MyTableName has no column named MyGeometryColumnName'.

If i perform the same drop column migration on a table that has no Geometry columns, then it has no problems.

System Configuration

TestEFCoreFeatures.zip

d79ima commented 2 years ago

I have raised the same issue on NetTopologySuite github site just in case as I am not sure which team is responsible: https://github.com/NetTopologySuite/NetTopologySuite/issues/622

d79ima commented 2 years ago

For now workaround is to remove the Geometry column together with the other column that actually needs to be dropped in the same migration, then create a second migration to add the Geometry column back in

ajcvickers commented 2 years ago

Note from triage: cannot find any duplicate.

bricelam commented 2 years ago

Duplicate of #25116