Skip to content

Commit 4f57130

Browse files
JaBistDuNarrischJaBistDuNarrisch
authored andcommitted
Allow also unsigned data types for identity column
1 parent 7fea164 commit 4f57130

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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)