-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeded geometry is re-updated when scaffolding new migration [NetTopologySuite] #27374
Comments
Obviously, after posting, I think I found the answer. By looking at the difference in Up() and Down() of the 2nd migration, I spotted a difference in precision (4 vs 5 decimals). The Up() values were identical to the 1st migration's inserted data, so I'm assuming our snapshot has an outdated precision stored. If that is correct, then fixing our snapshot should resolve our problem. |
It seems related to configuring a non-default precision in Testing different precisionsAs in the example in the original post, we initialize NetTopologySuite as part of creating seed data. // Initialize default spatial data parameters: https://github.com/NetTopologySuite/NetTopologySuite/wiki/GettingStarted
var services = new NtsGeometryServices(
NetTopologySuite.Geometries.Implementation.CoordinateArraySequenceFactory.Instance,
new PrecisionModel(1e4), // 4 decimal places (65.1234).
srid: SridValues.Wgs84_4326, // SRID 4326 refers to WGS 84 coordinate system.
GeometryOverlay.NG, // Use the next-gen overlay.
new CoordinateEqualityComparer()); // Default comparer.
NtsGeometryServices.Instance = services; Default precision of Floating ✅By passing Symptom 1: A second migration does NOT update old seed data. ✅ The only issue with this solution is that we would like to seed data with a given precision. Examples of seed data in scaffolded migration scripts
Precision with scale 1e4 ❌If Symptom 1: A second empty migration re-updates all old seed data. ❌
Precision with scale 1e3 ❌Similar to 1e4, but with 1 less precision as expected. Symptom 1: A second empty migration re-updates all old seed data. ❌
|
@bricelam Looks like maybe the model snapshot should always use full precision. |
Seeded geometry is re-updated when scaffolding new migration [NetTopologySuite]
Probably a configuration error, but I am not sure how to debug it and could not find any examples on seeding geometry.
The geometry is seeded as expected, but every time we scaffold a new migration the same identical values are re-updated. Would expect to only include these in a single migration unless the values change.
Seems relevant: #18729
Code first model:
Geometry seed values:
1st scaffolded migration:
2nd scaffolded migration:
1st scaffolded SQL:
2nd scaffolded SQL script:
Include provider and version information
EF Core version: 6.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: 6.0
Operating system: Win 11, Mac
IDE: Rider 2021.3.3
The text was updated successfully, but these errors were encountered: