diff --git a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs index 966c69e..a2fb363 100644 --- a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs +++ b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs @@ -735,14 +735,11 @@ namespace Microsoft.EntityFrameworkCore.Migrations { var storeType = operation.ColumnType; - if (IsIdentity(operation)) + if (IsIdentity(operation) && + (storeType == null || Dependencies.TypeMappingSource.FindMapping(storeType) is JetIntTypeMapping)) { // This column represents the actual identity. - if (storeType != null && - Dependencies.TypeMappingSource.FindMapping(storeType) is JetIntTypeMapping) - { - storeType = "counter"; - } + storeType = "counter"; } else if (storeType != null && IsExplicitIdentityColumnType(storeType)) diff --git a/test/EFCore.Jet.Tests/JetMigrationTest.cs b/test/EFCore.Jet.Tests/JetMigrationTest.cs index b8ad6cf..225cf8c 100644 --- a/test/EFCore.Jet.Tests/JetMigrationTest.cs +++ b/test/EFCore.Jet.Tests/JetMigrationTest.cs @@ -36,7 +36,7 @@ namespace EntityFrameworkCore.Jet AssertSql( $@"CREATE TABLE `Cookie` ( - `CookieId` integer NOT NULL, + `CookieId` counter NOT NULL, `Name` longchar NULL, `BestServedBefore` datetime NOT NULL DEFAULT #2021-12-31#, CONSTRAINT `PK_Cookie` PRIMARY KEY (`CookieId`)