-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- Programming language: C#
- OS: windows
- Language runtime version: 8
- Package version: 3.8.0
Steps to reproduce
- Use a nullable property that maps to DATE, e.g. SpannerDate? or DateOnly?
- Create first migration
- Attempt to remove migration or generate new migration
- This errors
Example is this command in Google.Cloud.EntityFrameworkCore.Spanner.IntegrationTests:
dotnet ef migrations add test --context TestMigrationDbContext --output-dir MigrationTests/Migrations The above errors with:
\Google.Cloud.EntityFrameworkCore.Spanner.IntegrationTests> dotnet ef migrations add AddOrderedIndex --context TestMigrationDbContext --output-dir MigrationTests/Migrations
Build started...
Build succeeded.
System.InvalidOperationException: No coercion operator is defined between types 'System.Nullable`1[System.DateTime]' and 'Google.Cloud.EntityFrameworkCore.Spanner.Storage.SpannerDate'.
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ValueComparerExtensions.ToNullableComparer(ValueComparer valueComparer, Type clrType)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.GetKeyValueComparer()
at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.GetProviderValueComparer()
at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.Microsoft.EntityFrameworkCore.Metadata.IProperty.GetProviderValueComparer()
at Microsoft.EntityFrameworkCore.Metadata.Internal.ColumnBase`1.Microsoft.EntityFrameworkCore.Metadata.IColumnBase.get_ProviderValueComparer()
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.Diff(IColumn source, IColumn target, DiffContext diffContext)+MoveNext()
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.DiffCollection[T](IEnumerable`1 sources, IEnumerable`1 targets, DiffContext diffContext, Func`4 diff, Func`3 add, Func`3 remove, Func`4[] predicates)+MoveNext()
at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.Diff(ITable source, ITable target, DiffContext diffContext)+MoveNext()
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.DiffCollection[T](IEnumerable`1 sources, IEnumerable`1 targets, DiffContext diffContext, Func`4 diff, Func`3 add, Func`3 remove, Func`4[] predicates)+MoveNext()
at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.Sort(IEnumerable`1 operations, DiffContext diffContext)
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.GetDifferences(IRelationalModel source, IRelationalModel target)
at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.ScaffoldMigration(String migrationName, String rootNamespace, String subNamespace, String language)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType, String namespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType, String namespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
No coercion operator is defined between types 'System.Nullable`1[System.DateTime]' and 'Google.Cloud.EntityFrameworkCore.Spanner.Storage.SpannerDate'.
This means migrations are stuck since the snapshot has a type of DateTime? mapped to a DATE field which causes this problem, breaking any changes going in.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.