Skip to content

Commit 491978c

Browse files
Merge pull request #144 from dotnetprojects/add-primary-key
Remove netstandard2.0;net40;
2 parents b87ec7a + e81bba5 commit 491978c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Migrator/DotNetProjects.Migrator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net40;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0</TargetFrameworks>
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
<AssemblyName>DotNetProjects.Migrator</AssemblyName>
77
<RootNamespace>DotNetProjects.Migrator</RootNamespace>

src/Migrator/Providers/Impl/Oracle/OracleTransformationProvider.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,11 +891,14 @@ public override void AddTable(string name, params IDbField[] fields)
891891
{
892892
var identityColumn = columns.First(x => x.ColumnProperty.HasFlag(ColumnProperty.Identity) && x.ColumnProperty.HasFlag(ColumnProperty.PrimaryKey));
893893

894-
List<DbType> allowedIdentityDbTypes = [DbType.Int16, DbType.Int32, DbType.Int64];
894+
List<DbType> allowedIdentityDbTypes = [DbType.Int16, DbType.Int32, DbType.Int64, DbType.UInt16, DbType.UInt32, DbType.UInt64];
895895

896896
if (!allowedIdentityDbTypes.Contains(identityColumn.Type))
897897
{
898-
throw new MigrationException($"Identity columns can only be used with {nameof(DbType.Int16)}, {nameof(DbType.Int32)} and {nameof(DbType.Int64)}");
898+
var allowedIdentityDbTypesStringList = allowedIdentityDbTypes.Select(x => x.ToString()).ToList();
899+
var allowedIdentityDbTypesString = $"{string.Join(", ", allowedIdentityDbTypesStringList[..^1])} and {allowedIdentityDbTypesStringList[^1..]}";
900+
901+
throw new MigrationException($"Identity columns can only be used with {allowedIdentityDbTypesString}");
899902
}
900903

901904
var identityColumnNameQuoted = QuoteColumnNameIfRequired(identityColumn.Name);

0 commit comments

Comments
 (0)