Skip to content
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

Handle old migrations with 32-bit identity seed values #25589

Closed
ajcvickers opened this issue Aug 19, 2021 · 0 comments · Fixed by #25857
Closed

Handle old migrations with 32-bit identity seed values #25589

ajcvickers opened this issue Aug 19, 2021 · 0 comments · Fixed by #25857
Labels
area-migrations-seeding area-sqlserver closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@ajcvickers
Copy link
Member

From reported #24840 (comment) by @schuettecarsten

When using "Add-Migration" in Package Manager Console, I still get an exception:

System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.Nullable`1[System.Int64]'.
   at Microsoft.EntityFrameworkCore.SqlServerPropertyExtensions.GetIdentitySeed(IReadOnlyProperty property, StoreObjectIdentifier& storeObject) in Microsoft.EntityFrameworkCore.SqlServer.dll:token 0x6000160+0x22
   at Microsoft.EntityFrameworkCore.SqlServer.Metadata.Internal.SqlServerAnnotationProvider.For(IColumn column, Boolean designTime)+MoveNext() in Microsoft.EntityFrameworkCore.SqlServer.dll:token 0x6000494+0xe3
   at Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase.AddAnnotations(AnnotatableBase annotatable, IEnumerable`1 annotations) in Microsoft.EntityFrameworkCore.dll:token 0x6001a0f+0x23
[...]

Okay, this was caused by my existing migrations. I had to replace all .HasAnnotation("SqlServer:IdentitySeed", 1) with .HasAnnotation("SqlServer:IdentitySeed", 1L). It would be great if efcore could handle existing migrations from previous versions.

@ajcvickers ajcvickers added this to the 6.0.0 milestone Aug 20, 2021
AndriySvyryd added a commit that referenced this issue Sep 3, 2021
@AndriySvyryd AndriySvyryd removed their assignment Sep 3, 2021
@AndriySvyryd AndriySvyryd added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Sep 3, 2021
AndriySvyryd added a commit that referenced this issue Sep 3, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0, 6.0.0-rc2 Sep 4, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0-rc2, 6.0.0 Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-migrations-seeding area-sqlserver closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants